当前位置: 首页>>代码示例>>Java>>正文


Java Digester.push方法代码示例

本文整理汇总了Java中org.apache.commons.digester.Digester.push方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.push方法的具体用法?Java Digester.push怎么用?Java Digester.push使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.digester.Digester的用法示例。


在下文中一共展示了Digester.push方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseConfig

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private void parseConfig(String publicId, String entityURL,
    String strutsConfig) {
    // Prepare a Digester for parsing a struts-config.xml file
    Digester digester = new Digester();

    digester.push(config);
    digester.setNamespaceAware(true);
    digester.setValidating(true);
    digester.addRuleSet(new ConfigRuleSet());
    digester.register(publicId,
        this.getClass().getResource(entityURL).toString());

    // Parse the test struts-config.xml file
    try {
        InputStream input =
            this.getClass().getResourceAsStream(strutsConfig);

        assertNotNull("Got an input stream for " + strutsConfig, input);
        digester.parse(input);
        input.close();
    } catch (Throwable t) {
        t.printStackTrace(System.out);
        fail("Parsing threw exception:  " + t);
    }
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:26,代码来源:TestModuleConfig.java

示例2: ValidatorResources

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
 * Create a ValidatorResources object from an InputStream.
 *
 * @param streams An array of InputStreams to several validation.xml
 * configuration files that will be read in order and merged into this object.
 * It's the client's responsibility to close these streams.
 * @throws SAXException if the validation XML files are not valid or well
 * formed.
 * @throws IOException if an I/O error occurs processing the XML files
 * @since Validator 1.1
 */
public ValidatorResources(InputStream[] streams)
        throws IOException, SAXException {

    super();

    Digester digester = initDigester();
    for (int i = 0; i < streams.length; i++) {
        if (streams[i] == null) {
            throw new IllegalArgumentException("Stream[" + i + "] is null");
        }
        digester.push(this);
        digester.parse(streams[i]);
    }

    this.process();
}
 
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:28,代码来源:ValidatorResources.java

示例3: parseURL

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private void parseURL(URL u) {
    Digester d = new Digester();
    d.setValidating(false);

    d.push(this);
    d.addObjectCreate("factory/template", HashMap.class);
    d.addRule("factory/template", new AttributeCopyRule());
    d.addSetNext("factory/template", "addFactoryTemplate");

    try {
        d.parse(u.openStream());
    }
    catch (Exception e) {
        throw new ManifestFactoryParseException("Unable to parse " +
                                                builder.getManifestFilename(), e);
    }
}
 
开发者ID:spacewalkproject,项目名称:spacewalk,代码行数:18,代码来源:ManifestFactory.java

示例4: load

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
 * Load the contents of our configuration file.
 */
protected void load() {

    // Validate the existence of our configuration file
    File file = new File(pathname);
    if (!file.isAbsolute())
        file = new File(System.getProperty("catalina.base"), pathname);
    if (!file.exists() || !file.canRead()) {
        log("Cannot load configuration file " + file.getAbsolutePath());
        return;
    }

    // Load the contents of our configuration file
    Digester digester = new Digester();
    digester.setValidating(false);
    digester.addRuleSet(new MemoryRuleSet());
    try {
        digester.push(this);
        digester.parse(file);
    } catch (Exception e) {
        log("Error processing configuration file " +
            file.getAbsolutePath(), e);
        return;
    }

}
 
开发者ID:eclipsky,项目名称:HowTomcatWorks,代码行数:29,代码来源:JAASMemoryLoginModule.java

示例5: parseXML

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static GoPluginDescriptor parseXML(InputStream pluginXML, String pluginJarFileLocation, File pluginBundleLocation, boolean isBundledPlugin) throws IOException, SAXException {
    Digester digester = initDigester();
    GoPluginDescriptorParser parserForThisXML = new GoPluginDescriptorParser(pluginJarFileLocation, pluginBundleLocation, isBundledPlugin);
    digester.push(parserForThisXML);

    digester.addCallMethod("go-plugin", "createPlugin", 2);
    digester.addCallParam("go-plugin", 0, "id");
    digester.addCallParam("go-plugin", 1, "version");

    digester.addCallMethod("go-plugin/about", "createAbout", 4);
    digester.addCallParam("go-plugin/about/name", 0);
    digester.addCallParam("go-plugin/about/version", 1);
    digester.addCallParam("go-plugin/about/target-go-version", 2);
    digester.addCallParam("go-plugin/about/description", 3);

    digester.addCallMethod("go-plugin/about/vendor", "createVendor", 2);
    digester.addCallParam("go-plugin/about/vendor/name", 0);
    digester.addCallParam("go-plugin/about/vendor/url", 1);

    digester.addCallMethod("go-plugin/about/target-os/value", "addTargetOS", 1);
    digester.addCallParam("go-plugin/about/target-os/value", 0);

    digester.parse(pluginXML);

    return parserForThisXML.descriptor;
}
 
开发者ID:gocd,项目名称:gocd,代码行数:27,代码来源:GoPluginDescriptorParser.java

示例6: xml2Object

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void xml2Object()  throws SAXException
   {
       Digester digester = new Digester();
       digester.push(this);        
       digester.addCallMethod("datasources/datasource", "addDataSource", 5 );
       digester.addCallParam("datasources/datasource/name", 0);
       digester.addCallParam("datasources/datasource/driver", 1);
       digester.addCallParam("datasources/datasource/url", 2);
       digester.addCallParam("datasources/datasource/username", 3);
       digester.addCallParam("datasources/datasource/password", 4);
try{	
           //java.io.InputStream xmlFile =  getClass().getResourceAsStream("xml/datasource.xml");
           java.io.InputStream xmlFile 
           =  new java.io.FileInputStream(gafetes.util.VariablesAmbiente.getArchivoDBConfiguracion());        
           digester.parse(xmlFile);
       }catch( java.io.IOException ioex ){
           System.out.println();
       }
       
   }
 
开发者ID:developercancun,项目名称:credenjava,代码行数:21,代码来源:SampleDigester.java

示例7: xmlConfiguration2Object

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void xmlConfiguration2Object()  throws SAXException
   {
       Digester digester = new Digester();
       digester.push(this);        
       digester.addCallMethod("datasources/datasource", "addDataConfigurationSource", 4 );
       digester.addCallParam("datasources/datasource/rutaFotos", 0);
       digester.addCallParam("datasources/datasource/rutaCarpetaFotos", 1);
       digester.addCallParam("datasources/datasource/rutaFotoNoExiste", 2);        
       digester.addCallParam("datasources/datasource/passPhrase", 3); 
try{	
           //java.io.InputStream xmlFile =  getClass().getResourceAsStream("xml/datasource.xml");
           java.io.InputStream xmlFile 
           =  new java.io.FileInputStream(gafetes.util.VariablesAmbiente.getArchivoConfiguracion());        
           digester.parse(xmlFile);
       }catch( java.io.IOException ioex ){
           System.out.println();
       }        
   }
 
开发者ID:developercancun,项目名称:credenjava,代码行数:19,代码来源:SampleDigester.java

示例8: createObject

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public Object createObject(
  Attributes attributes) throws Exception
{
  String href = attributes.getValue("href");
  if (href == null)
    throw new IllegalStateException("Missing href attribute");

  URL master = (URL)digester.getRoot();
  URL included = new URL(master, href);

  Digester includedDigester = createEmptyDigester();
  addDigesterRules(includedDigester);
  includedDigester.push(included);
  includedDigester.push(digester.peek());

  URLConnection conn = included.openConnection();
  InputStream is = conn.getInputStream();
  includedDigester.parse(is);
  is.close();

  // We don't really want the included object - but return it anyway
  return included;
}
 
开发者ID:alessandroleite,项目名称:maven-jdev-plugin,代码行数:24,代码来源:FacesConfigParser.java

示例9: S2ValidatorResources

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
 * インスタンスを構築します。
 * 
 * @param streams
 *            入力ストリームの配列
 * @throws IOException
 *             IO例外が発生した場合。
 * @throws SAXException
 *             SAX例外が発生した場合。
 */
public S2ValidatorResources(InputStream[] streams) throws IOException,
        SAXException {
    URL rulesUrl = ValidatorResources.class
            .getResource("digester-rules.xml");
    Digester digester = DigesterLoader.createDigester(rulesUrl);
    digester.setNamespaceAware(true);
    digester.setValidating(true);
    digester.setUseContextClassLoader(true);
    for (int i = 0; i < REGISTRATIONS.length; i += 2) {
        URL url = ValidatorResources.class
                .getResource(REGISTRATIONS[i + 1]);
        if (url != null) {
            digester.register(REGISTRATIONS[i], url.toString());
        }
    }
    for (int i = 0; i < streams.length; i++) {
        digester.push(this);
        digester.parse(streams[i]);
    }
    initialize();
}
 
开发者ID:seasarorg,项目名称:sa-struts,代码行数:32,代码来源:S2ValidatorResources.java

示例10: parseXML

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static void parseXML() {
  Digester digester = new Digester();
  digester.push(_instance); // Push controller servlet onto the stack
  digester.setValidating(false);

  digester.addObjectCreate("eformap-config/databaseap",DatabaseAP.class);
  //digester.addSetProperties("eformap-config/databaseap");
  digester.addBeanPropertySetter("eformap-config/databaseap/ap-name","apName");
  digester.addBeanPropertySetter("eformap-config/databaseap/ap-sql","apSQL");
  digester.addBeanPropertySetter("eformap-config/databaseap/ap-output","apOutput");
  digester.addBeanPropertySetter("eformap-config/databaseap/ap-insql", "apInSQL");
  digester.addBeanPropertySetter("eformap-config/databaseap/archive", "archive");
  digester.addBeanPropertySetter("eformap-config/databaseap/ap-json-output", "apJsonOutput");
  digester.addSetNext("eformap-config/databaseap","addDatabaseAP");
  try {
      Properties op = oscar.OscarProperties.getInstance();
      String configpath = op.getProperty("eform_databaseap_config");
      InputStream fs = null;
      if (configpath == null) {
         EFormLoader eLoader = new EFormLoader();
         ClassLoader loader = eLoader.getClass().getClassLoader();
         fs = loader.getResourceAsStream("/oscar/eform/apconfig.xml");
      }else{
         fs = new FileInputStream(configpath);
      }
      digester.parse(fs);
      fs.close();
  } catch (Exception e) { MiscUtils.getLogger().error("Error", e); }
}
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:30,代码来源:EFormLoader.java

示例11: initModuleConfig

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
 * <p>Initialize the module configuration information for the specified
 * module.</p>
 *
 * @param prefix Module prefix for this module
 * @param paths  Comma-separated list of context-relative resource path(s)
 *               for this modules's configuration resource(s)
 * @return The new module configuration instance.
 * @throws ServletException if initialization cannot be performed
 * @since Struts 1.1
 */
protected ModuleConfig initModuleConfig(String prefix, String paths)
    throws ServletException {
    if (log.isDebugEnabled()) {
        log.debug("Initializing module path '" + prefix
            + "' configuration from '" + paths + "'");
    }

    // Parse the configuration for this module
    ModuleConfigFactory factoryObject = ModuleConfigFactory.createFactory();
    ModuleConfig config = factoryObject.createModuleConfig(prefix);

    // Configure the Digester instance we will use
    Digester digester = initConfigDigester();

    List urls = splitAndResolvePaths(paths);
    URL url;

    for (Iterator i = urls.iterator(); i.hasNext();) {
        url = (URL) i.next();
        digester.push(config);
        this.parseModuleConfigFile(digester, url);
    }

    getServletContext().setAttribute(Globals.MODULE_KEY
        + config.getPrefix(), config);

    return config;
}
 
开发者ID:SonarSource,项目名称:sonar-scanner-maven,代码行数:40,代码来源:ActionServlet.java

示例12: processStandardFacesConfig

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private static void processStandardFacesConfig(
		DesignerProject designerProject, Digester digester,
		FacesConfigBean fcb) {

	IFile config = designerProject.getProject().getFile(FACESCONFIG_PATH);

	if (!config.exists()) {
		if (logger.isInfoEnabled()) {
			logger.info("faces-config.xml not found for project {0}",
					designerProject.getProject().getName());
		}
		return;
	}

	digester.clear();
	digester.push(fcb);

	try {

		digester.parse(config.getContents(false));

	} catch (Exception e) {

		if (logger.isErrorEnabled()) {
			logger.error(e,
					"Error Parsing Standard faces config for project {0}",
					designerProject.getProject().getName());
		}

	}

}
 
开发者ID:camac,项目名称:Barista,代码行数:33,代码来源:BaristaUtil.java

示例13: StemmerFactory

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private StemmerFactory() {
    initParams = new Properties();

    try {
        Digester digester = new Digester();
        digester.push(this);

        digester.addCallMethod("jsre-config/stemmer-list/stemmer",
                "addStemmer", 2);
        digester.addCallParam(
                "jsre-config/stemmer-list/stemmer/stemmer-name", 0);
        digester.addCallParam(
                "jsre-config/stemmer-list/stemmer/stemmer-class", 1);

        String configFile = System.getProperty("config.file");
        if (configFile == null) {
            logger.debug("StemmerFactory uses the default config file: jsre-config.xml");
            checkFileExists(JSRE_HOME + RESOURCES_PATH + "jsre-config.xml");
            digester.parse(JSRE_HOME + RESOURCES_PATH + "jsre-config.xml");
        } else {
            logger.debug("StemmerFactory uses the config file: "
                    + configFile);
            digester.parse(configFile);
        }
    } catch (Exception e) {
        logger.error("", e);
    }

}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:30,代码来源:StemmerFactory.java

示例14: start

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
 * Prepare for active use of the public methods of this Component.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents it from being started
 */
public synchronized void start() throws LifecycleException {

    // Validate the existence of our database file
    File file = new File(pathname);
    if (!file.isAbsolute())
        file = new File(System.getProperty("catalina.base"), pathname);
    if (!file.exists() || !file.canRead())
        throw new LifecycleException
            (sm.getString("memoryRealm.loadExist",
                          file.getAbsolutePath()));

    // Load the contents of the database file
    if (debug >= 1)
        log(sm.getString("memoryRealm.loadPath",
                         file.getAbsolutePath()));
    Digester digester = getDigester();
    try {
        synchronized (digester) {
            digester.push(this);
            digester.parse(file);
        }
    } catch (Exception e) {
        throw new LifecycleException("memoryRealm.readXml", e);
    }

    // Perform normal superclass initialization
    super.start();

}
 
开发者ID:eclipsky,项目名称:HowTomcatWorks,代码行数:36,代码来源:MemoryRealm.java

示例15: read

import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
synchronized Map<String, IAdapter> read(URL url) throws IOException, SAXException, InterruptedException {
    try {
        AdapterService catcher = new AdapterServiceImpl();
        Configuration configuration = new Configuration(catcher);
        ConfigurationDigester configurationDigester = new ConfigurationDigester();
        Digester digester = configurationDigester.getDigester(configuration);
        digester.push(catcher);
        digester.parse(url.openStream());
        // Does'nt work. I probably don't know how it is supposed to work.
        return catcher.getAdapters();
    } catch (Throwable t) {
        LOG.error("For " + url + ": " + t.getMessage(), t);
        return null;
    }
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:16,代码来源:DirectoryScanningAdapterServiceImpl.java


注:本文中的org.apache.commons.digester.Digester.push方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。