• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DigesterLoader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.digester.xmlrules.DigesterLoader的典型用法代码示例。如果您正苦于以下问题:Java DigesterLoader类的具体用法?Java DigesterLoader怎么用?Java DigesterLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DigesterLoader类属于org.apache.commons.digester.xmlrules包,在下文中一共展示了DigesterLoader类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadDigesterRules

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
private void loadDigesterRules(String rulesfileName)
{
   if (rulesfileName == null)
   {
      logger.error("No rules file configured");
      return;
   }
   logger.info("loading rulesfile " + rulesfileName);
   URL rulesURL = ClassLoader.getSystemResource(rulesfileName);
   if (rulesURL == null)
   {
      logger.error("Unable to find rules file " + rulesfileName);
      throw new IllegalStateException("Unable to find rules file " + rulesfileName);
   }

   digester = DigesterLoader.createDigester(rulesURL);
}
 
开发者ID:dheraclio,项目名称:dependometer,代码行数:18,代码来源:TypeDefinitionProviderXML.java


示例2: doPipe

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
@Override
   public PipeRunResult doPipe(Object input, IPipeLineSession session)
	throws PipeRunException {

	//Multi threading: instantiate digester for each request as the digester is NOT thread-safe.
	//TODO: make a pool of digesters
	Digester digester = DigesterLoader.createDigester(rulesURL);

	try {
		ByteArrayInputStream xmlInputStream =
			new ByteArrayInputStream(input.toString().getBytes());

		return new PipeRunResult(getForward(), digester.parse(xmlInputStream));

	} catch (Exception e) {
		throw new PipeRunException(this, getLogPrefix(session)+"exception in digesting", e);
	}
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:19,代码来源:DigesterPipe.java


示例3: S2ValidatorResources

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的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


示例4: digesterFromXml

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
/**
 * <p>Instantiate a Digester from an XML input stream using the Commons
 * <code>DigesterLoader</code>.</p>
 * @param path the path to the digester rules XML to be found using <code>source</code>
 * @param source a string indicating the lookup method to be used with <code>path</code>
 * @return a configured Digester
 * @throws FileNotFoundException
 * @throws MalformedURLException
 * @see #getConfigURL(String, String)
 */
protected Digester digesterFromXml(String path, String source)
    throws IOException {

    URL configURL = this.getConfigURL(path, source);
    if (configURL == null)
    {
        throw new NullPointerException("No resource '" + path + "' found in '" + source + "'");
    }
    return DigesterLoader.createDigester(configURL);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:DigestingPlugIn.java


示例5: loadRules

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
/**
 * @return Rules loaded from the appropriate XML file
 */
protected Rules loadRules(String digestorRulesFileName) {
    // locate Digester rules
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    URL rulesUrl = classLoader.getResource(digestorRulesFileName);
    if (rulesUrl == null) {
        throw new RuntimeException("unable to locate digester rules file " + digestorRulesFileName);
    }

    // create and init digester
    Digester digester = DigesterLoader.createDigester(rulesUrl);

    return digester.getRules();
}
 
开发者ID:VU-libtech,项目名称:OLE-INST,代码行数:17,代码来源:XmlBatchInputFileTypeBase.java


示例6: loadRules

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
/**
 * @return Rules loaded from the appropriate XML file
 */
private Rules loadRules(String digestorRulesFileName) {
    // locate Digester rules
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    URL rulesUrl = classLoader.getResource(digestorRulesFileName);
    if (rulesUrl == null) {
        throw new RuntimeException("unable to locate digester rules file " + digestorRulesFileName);
    }

    // create and init digester
    Digester digester = DigesterLoader.createDigester(rulesUrl);

    return digester.getRules();
}
 
开发者ID:kuali,项目名称:kfs,代码行数:17,代码来源:CustomerInvoiceWriteoffBatchDigesterTest.java


示例7: load

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
/**
 * Loads the configuration parameters by delegating to commons digester.
 */
public Collection<T> load() throws KettleConfigException
{
	ClassLoader loader = Thread.currentThread().getContextClassLoader();

	Digester digester = DigesterLoader.createDigester(loader.getResource(rulesURL));

	final Set<T> configObjs = new LinkedHashSet<T>();

	digester.addRule(setNext, new SetNextRule("")
	{
		@SuppressWarnings("unchecked")
		public void end(String nameSpace, String name) throws Exception
		{
			configObjs.add((T) digester.peek());
		}
	});

	try
	{
		digester.parse(loader.getResource(configURL));
	} catch (Exception e)
	{
		throw new KettleConfigException(e);
	}

	return configObjs;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:31,代码来源:DigesterConfigManager.java


示例8: initDigester

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
/**
 *  Initialize the digester.
 */
private Digester initDigester() {
    URL rulesUrl = this.getClass().getResource(VALIDATOR_RULES);
    if (rulesUrl == null) {
        // Fix for Issue# VALIDATOR-195
        rulesUrl = ValidatorResources.class.getResource(VALIDATOR_RULES);
    }
    if (getLog().isDebugEnabled()) {
        getLog().debug("Loading rules from '" + rulesUrl + "'");
    }
    Digester digester = DigesterLoader.createDigester(rulesUrl);
    digester.setNamespaceAware(true);
    digester.setValidating(true);
    digester.setUseContextClassLoader(true);

    // Add rules for arg0-arg3 elements
    addOldArgRules(digester);

    // register DTDs
    for (int i = 0; i < REGISTRATIONS.length; i += 2) {
        URL url = this.getClass().getResource(REGISTRATIONS[i + 1]);
        if (url != null) {
            digester.register(REGISTRATIONS[i], url.toString());
        }
    }
    return digester;
}
 
开发者ID:ManfredTremmel,项目名称:gwt-commons-validator,代码行数:30,代码来源:ValidatorResources.java


示例9: configure

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
@Override
   public void configure() throws ConfigurationException {
	super.configure();

	try {
    		 rulesURL = ClassUtils.getResourceURL(classLoader, digesterRulesFile);
			 DigesterLoader.createDigester(rulesURL); // load rules to check if they can be loaded when needed
	} catch (Exception e) {
		throw new ConfigurationException(getLogPrefix(null)+"Digester rules file ["+digesterRulesFile+"] not found", e);
	}
	log.debug(getLogPrefix(null)+"End of configuration");
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:13,代码来源:DigesterPipe.java


示例10: unmarshal

import org.apache.commons.digester.xmlrules.DigesterLoader; //导入依赖的package包/类
/**
 * Parses and validates the XML input data.
 */
public void unmarshal(String objects) throws TaskException {
    try {
        // get the configuration filename
        String configFilename = PARAM_CONFIG_FILENAME_DEFAULT;
        if (parameters.get(PARAM_CONFIG_FILENAME.getName()) != null) {
            configFilename = (String) parameters.get(PARAM_CONFIG_FILENAME.getName());
        }

        // if the filename is relative, prepend default directory
        configFilename = getAbsolutePath(configFilename);
        LOG.debug("Config filename: " + configFilename);

        // load the parsing rules
        Digester digester = DigesterLoader.createDigester(new URL("file:///" + configFilename));
        digester.setUseContextClassLoader(true);

        // parse the input string
        //digester.setValidating(true);
        data = digester.parse(new StringReader(objects));
    } catch (IOException ioe) {
        LOG.error("Error parsing XML file: " + ioe.toString());
        throw new TaskException(ioe);
    } catch (SAXException saxe) {
        LOG.error("Error parsing XML file: " + saxe.toString());
        throw new TaskException(saxe);
    }
}
 
开发者ID:maxdelo77,项目名称:replyit-master-3.2-final,代码行数:31,代码来源:AbstractGeneratorTask.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReactiveMongoOperations类代码示例发布时间:2022-05-22
下一篇:
Java MapReducePolicyProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap