當前位置: 首頁>>代碼示例>>Java>>正文


Java Digester.addObjectCreate方法代碼示例

本文整理匯總了Java中org.apache.commons.digester.Digester.addObjectCreate方法的典型用法代碼示例。如果您正苦於以下問題:Java Digester.addObjectCreate方法的具體用法?Java Digester.addObjectCreate怎麽用?Java Digester.addObjectCreate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.digester.Digester的用法示例。


在下文中一共展示了Digester.addObjectCreate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createStopDigester

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
 * Create and configure the Digester we will be using for shutdown.
 */
protected Digester createStopDigester() {

    // Initialize the digester
    Digester digester = new Digester();
    if (debug)
        digester.setDebug(999);

    // Configure the rules we need for shutting down
    digester.addObjectCreate("Server",
                             "org.apache.catalina.core.StandardServer",
                             "className");
    digester.addSetProperties("Server");
    digester.addSetNext("Server",
                        "setServer",
                        "org.apache.catalina.Server");

    return (digester);

}
 
開發者ID:c-rainstorm,項目名稱:jerrydog,代碼行數:23,代碼來源:Catalina.java

示例2: setPieChartRules

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
protected void setPieChartRules(Digester digester)
{
	String pieChartPattern = "*/componentElement/pieChart";
	digester.addFactoryCreate(pieChartPattern, PieChartXmlFactory.class.getName());
	
	String pieDatasetPattern = pieChartPattern + "/pieDataset";
	digester.addObjectCreate(pieDatasetPattern, DesignPieDataset.class.getName());
	digester.addSetNext(pieDatasetPattern, "setDataset", PieDataset.class.getName());

	String keyExpressionPattern = pieDatasetPattern + "/keyExpression";
	digester.addFactoryCreate(keyExpressionPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
	digester.addCallMethod(keyExpressionPattern, "setText", 0);
	digester.addSetNext(keyExpressionPattern, "setKeyExpression", JRExpression.class.getName());

	String valueExpressionPattern = pieDatasetPattern + "/valueExpression";
	digester.addFactoryCreate(valueExpressionPattern, JRExpressionFactory.NumberExpressionFactory.class.getName());
	digester.addCallMethod(valueExpressionPattern, "setText", 0);
	digester.addSetNext(valueExpressionPattern, "setValueExpression", JRExpression.class.getName());

	String titleExpressionPattern = pieChartPattern + "/titleExpression";
	digester.addFactoryCreate(titleExpressionPattern, JRExpressionFactory.StringExpressionFactory.class.getName());
	digester.addCallMethod(titleExpressionPattern, "setText", 0);
	digester.addSetNext(titleExpressionPattern, "setTitleExpression", JRExpression.class.getName());
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:26,代碼來源:ChartsDigester.java

示例3: addSortComponentRules

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public static void addSortComponentRules(Digester digester)
{
	String componentNamespace = digester.getRuleNamespaceURI();
	
	String sortComponentPattern = "*/componentElement/sort";
	digester.addObjectCreate(sortComponentPattern, SortComponent.class.getName());
	
	digester.addSetProperties(sortComponentPattern, new String[] {
			SortComponent.PROPERTY_EVALUATION_TIME,
			}, 
			new String[0]);
	
	digester.addRule(sortComponentPattern, 
			new XmlConstantPropertyRule(
					SortComponent.PROPERTY_EVALUATION_TIME,
					EvaluationTimeEnum.values()));

	digester.addFactoryCreate(sortComponentPattern + "/symbol", SortComponentSymbolFactory.class.getName());
	
	digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE);

	digester.addFactoryCreate(sortComponentPattern + "/symbol/font", SortComponentSymbolFontFactory.class.getName());
	digester.addSetNext(sortComponentPattern + "/symbol/font", "setSymbolFont", JRFont.class.getName());

	digester.setRuleNamespaceURI(componentNamespace);
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:27,代碼來源:SortComponentDigester.java

示例4: addListRules

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
protected void addListRules(Digester digester)
{
	String listPattern = "*/componentElement/list";
	digester.addObjectCreate(listPattern, StandardListComponent.class);
	digester.addSetProperties(listPattern,
			//properties to be ignored by this rule
			new String[]{"printOrder"}, 
			new String[0]);
	digester.addRule(listPattern, new XmlConstantPropertyRule(
			"printOrder", "printOrderValue", PrintOrderEnum.values()));
	
	String listContentsPattern = listPattern + "/listContents";
	digester.addObjectCreate(listContentsPattern, DesignListContents.class);
	digester.addSetProperties(listContentsPattern);
	digester.addSetNext(listContentsPattern, "setContents");
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:17,代碼來源:ComponentsXmlDigesterConfigurer.java

示例5: addBarcodeRules

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
protected <T> void addBarcodeRules(Digester digester, 
		String barcodePattern, Class<T> barcodeComponentClass,
		String[] ignoredProperties)
{
	digester.addObjectCreate(barcodePattern, barcodeComponentClass);
	digester.addSetProperties(barcodePattern,
			//properties to be ignored by this rule
			ignoredProperties, 
			new String[0]);
	//rule to set evaluation time
	digester.addRule(barcodePattern, 
			new XmlConstantPropertyRule(
					JRXmlConstants.ATTRIBUTE_evaluationTime, "evaluationTimeValue",
					EvaluationTimeEnum.values()));
	
	String codeExpressionPattern = barcodePattern + "/codeExpression";
	digester.addFactoryCreate(codeExpressionPattern, 
			JRExpressionFactory.StringExpressionFactory.class.getName());
	digester.addCallMethod(codeExpressionPattern, "setText", 0);
	digester.addSetNext(codeExpressionPattern, "setCodeExpression", 
			JRExpression.class.getName());
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:24,代碼來源:ComponentsXmlDigesterConfigurer.java

示例6: getWebworkPackages

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
 * Parse file to webwork configuration
 *
 * @param webworkConfigurationFile Webwork configuration file
 * @return Webwork configuration package list
 * @throws IOException IOException
 * @throws SAXException SAXException
 */
@SuppressWarnings("unchecked")
public List<WebworkPackage> getWebworkPackages(File webworkConfigurationFile) throws IOException, SAXException {
	final Digester digester = new Digester();
	digester.addObjectCreate("xwork", ArrayList.class);
	digester.addObjectCreate("xwork/package", WebworkPackage.class);
	digester.addSetProperties("xwork/package", "name", "name");
	digester.addSetProperties("xwork/package", "namespace", "namespace");
	digester.addObjectCreate("xwork/package/action", WebworkAction.class);
	digester.addSetProperties("xwork/package/action", "name", "name");
	digester.addSetProperties("xwork/package/action", "class", "className");
	digester.addSetNext("xwork/package/action", "addAction");
	digester.addSetNext("xwork/package", "add");

	return (List<WebworkPackage>)digester.parse(webworkConfigurationFile);
}
 
開發者ID:unchai,項目名稱:maven-precheck-plugin,代碼行數:24,代碼來源:WebworkConfigurationParser.java

示例7: processSources

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
 * <p>Read xml configuration for source directories into SourceDirectory instances.</p>
 * <p/>
 * <p>package scope so that it could be individually tested</p>
 *
 * @param xml String xml to parse
 * @throws IOException  when an input/output error occurs
 * @throws SAXException when given xml can not be parsed
 */
void processSources(final String xml)
        throws IOException, SAXException {

    final Digester digester = getDigester();

    digester.addObjectCreate(XmlConfiguration.sources, ArrayList.class);
    digester.addObjectCreate(XmlConfiguration.source, SourceDirectory.class);
    digester.addCallMethod(XmlConfiguration.source, "setPath", 0);
    digester.addSetProperties(XmlConfiguration.source, "not-found", "notFound");
    digester.addSetNext(XmlConfiguration.source, "add");

    final StringReader reader = new StringReader(xml);
    Object o = digester.parse(reader);

    if ((o != null) && o instanceof List) {

        final List<SourceDirectory> parsedSources = (ArrayList<SourceDirectory>) o;

        for (final SourceDirectory sourceDirectory : parsedSources) {

            getSources().add(sourceDirectory);
        }
    }
}
 
開發者ID:AndyScherzinger,項目名稱:architecturerules,代碼行數:34,代碼來源:DigesterConfigurationFactory.java

示例8: processRules

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
 * <p>Process XML configuration to read rules elements into <code>Rules</code></p>
 * <p/>
 * <p>package scope so that it could be individually tested</p>
 *
 * @param xml String xml to parse
 * @throws IOException  when an input/output error occurs
 * @throws SAXException when given xml can not be parsed
 */
void processRules(final String xml)
        throws IOException, SAXException {

    final Digester digester = getDigester();

    digester.addObjectCreate(XmlConfiguration.rules, ArrayList.class);
    digester.addObjectCreate(XmlConfiguration.rule, Rule.class);
    digester.addSetProperties(XmlConfiguration.rule, "id", "idString");
    digester.addCallMethod(XmlConfiguration.ruleComment, "setComment", 0);
    digester.addCallMethod(XmlConfiguration.rulePackage, "addPackage", 0);
    digester.addCallMethod(XmlConfiguration.ruleViolation, "addViolation", 0);
    digester.addSetNext(XmlConfiguration.rule, "add");

    final StringReader reader = new StringReader(xml);

    Object o = digester.parse(reader);

    if (o != null) {

        final List<Rule> parsedRules = (ArrayList<Rule>) o;
        getRules().addAll(parsedRules);
    }
}
 
開發者ID:AndyScherzinger,項目名稱:architecturerules,代碼行數:33,代碼來源:DigesterConfigurationFactory.java

示例9: configureToolEventsDefDigester

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public static Digester configureToolEventsDefDigester(String prefix, Digester digester) {        
    // root
    digester.addObjectCreate(prefix + "toolEventsDef", ArrayList.class );

    // tool tag
    ToolFactoryImpl toolFactory = new ToolFactoryImpl();
    digester.addFactoryCreate(prefix + "toolEventsDef/tool", toolFactory);
    digester.addBeanPropertySetter(prefix + "toolEventsDef/tool/toolId", "toolId" );
    digester.addBeanPropertySetter(prefix + "toolEventsDef/tool/additionalToolIds", "additionalToolIdsStr" );
    digester.addBeanPropertySetter(prefix + "toolEventsDef/tool/selected", "selected" );
    digester.addSetNext(prefix + "toolEventsDef/tool", "add" );

    // event tag
    EventFactoryImpl eventFactoryImpl = new EventFactoryImpl();
    digester.addFactoryCreate(prefix + "toolEventsDef/tool/event", eventFactoryImpl);
    digester.addBeanPropertySetter(prefix + "toolEventsDef/tool/event/eventId", "eventId" );
    digester.addBeanPropertySetter(prefix + "toolEventsDef/tool/event/selected", "selected" );
    digester.addBeanPropertySetter(prefix + "toolEventsDef/tool/event/anonymous", "anonymous" );
    digester.addSetNext(prefix + "toolEventsDef/tool/event", "addEvent" );
    
    return digester;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:23,代碼來源:DigesterUtil.java

示例10: configurePrefsDigester

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public static Digester configurePrefsDigester(Digester digester) {        
    // prefs root
    digester.addObjectCreate("prefs", PrefsData.class );
    digester.addSetProperties("prefs" );
    digester.addBeanPropertySetter("prefs/listToolEventsOnlyAvailableInSite", "setListToolEventsOnlyAvailableInSite" );
    digester.addBeanPropertySetter("prefs/chartIn3D", "setChartIn3D" );
    digester.addBeanPropertySetter("prefs/chartTransparency", "setChartTransparency" );
    digester.addBeanPropertySetter("prefs/itemLabelsVisible", "setItemLabelsVisible" );
    digester.addBeanPropertySetter("prefs/useAllTools", "setUseAllTools" );
    
    // toolEventsDef
    digester = configureToolEventsDefDigester("prefs/", digester);
    digester.addSetNext("prefs/toolEventsDef", "setToolEventsDef" );
    
    
    return digester;
}
 
開發者ID:sakaiproject,項目名稱:sakai,代碼行數:18,代碼來源:DigesterUtil.java

示例11: createDigester

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private static Digester createDigester() {
    Digester d = new Digester();
    d.setValidating(false);

    d.addObjectCreate("hyracks-cluster", HyracksCluster.class);
    d.addSetProperties("hyracks-cluster");

    d.addObjectCreate("hyracks-cluster/cluster-controller", ClusterController.class);
    d.addSetProperties("hyracks-cluster/cluster-controller");
    d.addSetNext("hyracks-cluster/cluster-controller", "setClusterController");

    d.addObjectCreate("hyracks-cluster/node-controllers/node-controller", NodeController.class);
    d.addSetProperties("hyracks-cluster/node-controllers/node-controller");
    d.addSetNext("hyracks-cluster/node-controllers/node-controller", "addNodeController");

    d.addObjectCreate("*/container-specification", ContainerSpecification.class);
    d.addSetProperties("*/container-specification");
    d.addSetNext("*/container-specification", "setContainerSpecification");
    return d;
}
 
開發者ID:apache,項目名稱:incubator-asterixdb-hyracks,代碼行數:21,代碼來源:ManifestParser.java

示例12: configureDigester

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
private static void configureDigester(Digester digester) {
    digester.setValidating(false);

    digester.addObjectCreate("params", ClientCertificate.class);
    digester.addObjectCreate("*/param/value/struct/member/", Member.class);
    digester.addCallMethod("*/param/value/struct/member/name",
            "setName", 0);
    digester.addCallMethod("*/param/value/struct/member/value/string",
            "addValue", 0);
    digester.addObjectCreate("*/param/value/struct/member/value/array",
            ArrayList.class);
    digester.addCallMethod(
            "*/param/value/struct/member/value/array/data/value/string",
            "add", 0);
    digester.addSetNext("*/param/value/struct/member/value/array",
            "setValues");
    digester.addSetNext("*/param/value/struct/member", "addMember");
}
 
開發者ID:spacewalkproject,項目名稱:spacewalk,代碼行數:19,代碼來源:ClientCertificateDigester.java

示例13: 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

示例14: main

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
public static void main(String[] args) {
  String path = System.getProperty("user.dir") + File.separator  + "etc";
  File file = new File(path, "employee1.xml");
  Digester digester = new Digester();
  // add rules
  digester.addObjectCreate("employee", "ex15.pyrmont.digestertest.Employee");
  digester.addSetProperties("employee");    
  digester.addCallMethod("employee", "printName");

  try {
    Employee employee = (Employee) digester.parse(file);
    System.out.println("First name : " + employee.getFirstName());
    System.out.println("Last name : " + employee.getLastName());
  }
  catch(Exception e) {
    e.printStackTrace();
  }
}
 
開發者ID:eclipsky,項目名稱:HowTomcatWorks,代碼行數:19,代碼來源:Test01.java

示例15: get

import org.apache.commons.digester.Digester; //導入方法依賴的package包/類
/**
 * Reading the checksum file (xml) from an InputSream and put it in a Map.
 * 
 * @param in
 * @return A Map with the file name as key and the checksum as value.
 */
public static Map<String, String> get(final InputStream in) {
	Digester digester = new Digester();
	digester.setValidating(false);
	digester.addObjectCreate("checksums", HashMap.class);
	digester.addCallMethod("checksums/file", "put", 2);
	digester.addCallParam("checksums/file/name", 0);
	digester.addCallParam("checksums/file/checksum", 1);
	try {
		@SuppressWarnings("unchecked")
		Map<String, String> checksums = (Map<String, String>) digester.parse(in);
		return checksums;
	} catch (Exception e) {
		throw new FatalException("Error while parsing checksums: " + e.getMessage(), e);
	}
}
 
開發者ID:th-schwarz,項目名稱:pmcms,代碼行數:22,代碼來源:ChecksumTool.java


注:本文中的org.apache.commons.digester.Digester.addObjectCreate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。