Java Code Examples for org.apache.commons.digester.Digester#addSetProperties()
The following examples show how to use
org.apache.commons.digester.Digester#addSetProperties() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DigesterUtil.java From sakai with Educational Community License v2.0 | 6 votes |
public static Digester configurePrefsDigester(Digester digester) { // prefs root digester.addObjectCreate("prefs", PrefsData.class ); digester.addSetProperties("prefs" ); digester.addBeanPropertySetter("prefs/listToolEventsOnlyAvailableInSite", "setListToolEventsOnlyAvailableInSite" ); digester.addBeanPropertySetter("prefs/showOwnStatisticsToStudents", "setShowOwnStatisticsToStudents" ); 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; }
Example 2
Source File: ComponentsXmlDigesterConfigurer.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
@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()); }
Example 3
Source File: ComponentsXmlDigesterConfigurer.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
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"); // rule to set the context dataset name digester.addRule(listContentsPattern, new DatasetRunReportContextRule<>(ListComponent.class)); }
Example 4
Source File: SortComponentDigester.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
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); }
Example 5
Source File: DigesterUtil.java From sakai with Educational Community License v2.0 | 6 votes |
public static Digester configurePrefsDigester(Digester digester) { // prefs root digester.addObjectCreate("prefs", PrefsData.class ); digester.addSetProperties("prefs" ); digester.addBeanPropertySetter("prefs/listToolEventsOnlyAvailableInSite", "setListToolEventsOnlyAvailableInSite" ); digester.addBeanPropertySetter("prefs/showOwnStatisticsToStudents", "setShowOwnStatisticsToStudents" ); 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; }
Example 6
Source File: CVDigester.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected static void addEvaluationPropertiesRules(Digester digester, String pattern) { digester.addSetProperties( pattern, // properties to be ignored by this rule new String[] { JRXmlConstants.ATTRIBUTE_evaluationTime, CVXmlFactory.ATTRIBUTE_onErrorType }, new String[0] ); digester.addRule(pattern, new XmlConstantPropertyRule(JRXmlConstants.ATTRIBUTE_evaluationTime, "evaluationTimeValue", EvaluationTimeEnum.values())); digester.addRule(pattern, new XmlConstantPropertyRule(CVXmlFactory.ATTRIBUTE_onErrorType, OnErrorTypeEnum.values())); }
Example 7
Source File: ComponentsXmlDigesterConfigurer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") protected void addTableRowRules(Digester digester, String pattern, String setNextMethod) { digester.addObjectCreate(pattern, StandardRow.class); digester.addSetProperties(pattern); digester.addSetNext(pattern, setNextMethod); addExpressionRules(digester, pattern + "/printWhenExpression", JRExpressionFactory.BooleanExpressionFactory.class, "setPrintWhenExpression", true); }
Example 8
Source File: ComponentsXmlDigesterConfigurer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void addTableGroupCellRules(Digester digester, String pattern, String setNextMethod) { digester.addObjectCreate(pattern, StandardGroupCell.class); digester.addSetProperties(pattern); addTableCellRules(digester, pattern + "/cell", "setCell"); digester.addSetNext(pattern, setNextMethod); }
Example 9
Source File: ComponentsXmlDigesterConfigurer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void addTableBaseCellRules(Digester digester, String pattern, String setNextMethod) { digester.addObjectCreate(pattern, DesignBaseCell.class); digester.addSetNext(pattern, setNextMethod); // rule to set the context dataset name digester.addRule(pattern, new DatasetRunReportContextRule<>(TableComponent.class)); digester.addSetProperties(pattern, new String[]{JRXmlConstants.ATTRIBUTE_style}, new String[0]); digester.addRule(pattern, new StyleContainerRule()); }
Example 10
Source File: ComponentsXmlDigesterConfigurer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") protected void addBarbecueRules(Digester digester) { String barcodePattern = "*/componentElement/barbecue"; digester.addObjectCreate(barcodePattern, StandardBarbecueComponent.class); digester.addSetProperties(barcodePattern, //properties to be ignored by this rule new String[]{JRXmlConstants.ATTRIBUTE_evaluationTime, StandardBarbecueComponent.PROPERTY_ROTATION}, new String[0]); digester.addRule(barcodePattern, new XmlConstantPropertyRule( JRXmlConstants.ATTRIBUTE_evaluationTime, "evaluationTimeValue", EvaluationTimeEnum.values())); digester.addRule(barcodePattern, new XmlConstantPropertyRule( StandardBarbecueComponent.PROPERTY_ROTATION, RotationEnum.values())); String barcodeExpressionPattern = barcodePattern + "/codeExpression"; digester.addFactoryCreate(barcodeExpressionPattern, JRExpressionFactory.StringExpressionFactory.class.getName()); digester.addCallMethod(barcodeExpressionPattern, "setText", 0); digester.addSetNext(barcodeExpressionPattern, "setCodeExpression", JRExpression.class.getName()); String applicationIdentifierExpressionPattern = barcodePattern + "/applicationIdentifierExpression"; digester.addFactoryCreate(applicationIdentifierExpressionPattern, JRExpressionFactory.StringExpressionFactory.class.getName()); digester.addCallMethod(applicationIdentifierExpressionPattern, "setText", 0); digester.addSetNext(applicationIdentifierExpressionPattern, "setApplicationIdentifierExpression", JRExpression.class.getName()); }
Example 11
Source File: StatisticsParser.java From iaf with Apache License 2.0 | 5 votes |
public void digestStatistics(Reader reader, String sysid) throws ConfigurationException { Reader fileReader = new EncapsulatingReader(reader, "<"+ROOT_ELEM_NAME+">", "</"+ROOT_ELEM_NAME+">", false); Digester digester = new Digester(); digester.setUseContextClassLoader(true); // push config on the stack digester.push(this); try { // String prefix="/"+ROOT_ELEM_NAME+"/"; String prefix="*/"; digester.addSetProperties(prefix+"statisticsCollection"); // timestamp info digester.addSetProperties(prefix+"statisticsCollection/statgroup"); // instance info digester.addObjectCreate (prefix+"statisticsCollection/statgroup/statgroup",SummaryRecord.class); // adapterinfo digester.addSetProperties(prefix+"statisticsCollection/statgroup/statgroup"); digester.addSetNext (prefix+"statisticsCollection/statgroup/statgroup","registerRecord"); digester.addObjectCreate (prefix+"statisticsCollection/statgroup/statgroup/stat/interval/item",Item.class); // adapterinfo digester.addSetProperties(prefix+"statisticsCollection/statgroup/statgroup/stat/interval/item"); digester.addSetNext (prefix+"statisticsCollection/statgroup/statgroup/stat/interval/item","registerItem"); InputSource is= new InputSource(fileReader); digester.parse(is); } catch (Exception e) { // wrap exception to be sure it gets rendered via the IbisException-renderer throw new ConfigurationException("error during parsing of file ["+sysid +"]", e); } }
Example 12
Source File: PartComponentsXmlDigesterConfigurer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
protected void addSubreportRules(Digester digester) { String subreportPattern = "*/part/subreportPart"; digester.addObjectCreate(subreportPattern, StandardSubreportPartComponent.class); digester.addSetProperties(subreportPattern); String partNamespace = digester.getRuleNamespaceURI(); String jrNamespace = JRXmlConstants.JASPERREPORTS_NAMESPACE; digester.setRuleNamespaceURI(jrNamespace); String paramMapExpressionPattern = subreportPattern + "/parametersMapExpression"; digester.addFactoryCreate(paramMapExpressionPattern, JRExpressionFactory.class.getName()); digester.addCallMethod(paramMapExpressionPattern, "setText", 0); digester.addSetNext(paramMapExpressionPattern, "setParametersMapExpression", JRExpression.class.getName()); /* */ digester.addFactoryCreate("*/subreportPart/subreportParameter", JRSubreportParameterFactory.class.getName()); digester.addSetNext("*/subreportPart/subreportParameter", "addParameter", JRSubreportParameter.class.getName()); /* */ digester.addFactoryCreate("*/subreportPart/subreportParameter/subreportParameterExpression", JRExpressionFactory.class.getName()); digester.addSetNext("*/subreportPart/subreportParameter/subreportParameterExpression", "setExpression", JRExpression.class.getName()); digester.addCallMethod("*/subreportPart/subreportParameter/subreportParameterExpression", "setText", 0); /* */ digester.addFactoryCreate("*/subreportPart/returnValue", JRSubreportReturnValueFactory.class.getName()); digester.addSetNext("*/subreportPart/returnValue", "addReturnValue", JRSubreportReturnValue.class.getName()); String subreportExpressionPattern = subreportPattern + "/subreportExpression"; digester.addFactoryCreate(subreportExpressionPattern, JRExpressionFactory.class.getName()); digester.addCallMethod(subreportExpressionPattern, "setText", 0); digester.addSetNext(subreportExpressionPattern, "setExpression", JRExpression.class.getName()); digester.setRuleNamespaceURI(partNamespace); }
Example 13
Source File: HtmlComponentDigester.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("deprecation") protected void setHtmlComponentRules(Digester digester) { String htmlComponentPattern = "*/componentElement/html"; digester.addObjectCreate(htmlComponentPattern, HtmlComponent.class.getName()); digester.addSetProperties(htmlComponentPattern, new String[] { HtmlComponent.PROPERTY_SCALE_TYPE, HtmlComponent.PROPERTY_HORIZONTAL_ALIGN, HtmlComponent.PROPERTY_VERTICAL_ALIGN, HtmlComponent.PROPERTY_EVALUATION_TIME }, new String[0]); digester.addRule(htmlComponentPattern, new XmlConstantPropertyRule( HtmlComponent.PROPERTY_SCALE_TYPE, ScaleImageEnum.values())); digester.addRule(htmlComponentPattern, new XmlConstantPropertyRule( HtmlComponent.PROPERTY_HORIZONTAL_ALIGN, "horizontalImageAlign", HorizontalImageAlignEnum.values())); digester.addRule(htmlComponentPattern, new XmlConstantPropertyRule( HtmlComponent.PROPERTY_VERTICAL_ALIGN, "verticalImageAlign", VerticalImageAlignEnum.values())); digester.addRule(htmlComponentPattern, new XmlConstantPropertyRule( HtmlComponent.PROPERTY_EVALUATION_TIME, EvaluationTimeEnum.values())); String htmlContentPattern = htmlComponentPattern + "/htmlContentExpression"; digester.addFactoryCreate(htmlContentPattern, JRExpressionFactory.StringExpressionFactory.class.getName()); digester.addCallMethod(htmlContentPattern, "setText", 0); digester.addSetNext(htmlContentPattern, "setHtmlContentExpression", JRExpression.class.getName()); }
Example 14
Source File: LoaderSetProperties.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Just add a SetPropertiesRule at the specified path. */ @Override public void addRules(Digester digester, String path) { Log log = digester.getLogger(); boolean debug = log.isDebugEnabled(); if (debug) { log.debug( "LoaderSetProperties loading rules for plugin at path [" + path + "]"); } digester.addSetProperties(path); }
Example 15
Source File: JRXmlDigesterFactory.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
private static void addMultiAxisDataRules(Digester digester) { String dataPattern = "*/" + JRXmlConstants.ELEMENT_multiAxisData; digester.addObjectCreate(dataPattern, DesignMultiAxisData.class); digester.addSetNext(dataPattern, "setMultiAxisData");// TODO lucianc move to containing element String datasetPattern = dataPattern + "/" + JRXmlConstants.ELEMENT_multiAxisDataset; digester.addObjectCreate(datasetPattern, DesignMultiAxisDataset.class); digester.addSetNext(datasetPattern, "setDataset"); String dataAxisPattern = dataPattern + "/" + JRXmlConstants.ELEMENT_dataAxis; digester.addObjectCreate(dataAxisPattern, DesignDataAxis.class); digester.addRule(dataAxisPattern, new XmlConstantPropertyRule(JRXmlConstants.ATTRIBUTE_axis, Axis.values())); digester.addSetNext(dataAxisPattern, "addDataAxis"); String axisLevelPattern = dataAxisPattern + "/" + JRXmlConstants.ELEMENT_axisLevel; digester.addObjectCreate(axisLevelPattern, DesignDataAxisLevel.class); digester.addSetProperties(axisLevelPattern); digester.addSetNext(axisLevelPattern, "addLevel"); addExpressionRules(digester, axisLevelPattern + "/" + JRXmlConstants.ELEMENT_labelExpression, "setLabelExpression"); String bucketPattern = axisLevelPattern + "/" + JRXmlConstants.ELEMENT_axisLevelBucket; digester.addObjectCreate(bucketPattern, DesignDataLevelBucket.class); digester.addSetProperties(bucketPattern, new String[]{JRXmlConstants.ATTRIBUTE_class, JRXmlConstants.ATTRIBUTE_order}, new String[]{"valueClassName"}); digester.addRule(bucketPattern, new XmlConstantPropertyRule(JRXmlConstants.ATTRIBUTE_order, BucketOrder.values())); digester.addSetNext(bucketPattern, "setBucket"); addExpressionRules(digester, bucketPattern + "/" + JRCrosstabBucketFactory.ELEMENT_bucketExpression, "setExpression"); addExpressionRules(digester, bucketPattern + "/" + JRXmlConstants.ELEMENT_MULTI_AXIS_BUCKET_LABEL_EXPRESSION, "setLabelExpression"); addExpressionRules(digester, bucketPattern + "/" + JRCrosstabBucketFactory.ELEMENT_comparatorExpression, "setComparatorExpression"); String bucketExpressionPattern = bucketPattern + "/" + JRXmlConstants.ELEMENT_bucketProperty; digester.addObjectCreate(bucketExpressionPattern, DesignDataLevelBucketProperty.class); digester.addSetProperties(bucketExpressionPattern); digester.addSetNext(bucketExpressionPattern, "addBucketProperty"); addExpressionRules(digester, bucketExpressionPattern, "setExpression"); String measurePattern = dataPattern + "/" + JRXmlConstants.ELEMENT_multiAxisMeasure; digester.addObjectCreate(measurePattern, DesignDataMeasure.class); digester.addSetNext(measurePattern, "addMeasure"); digester.addSetProperties(measurePattern, new String[]{JRXmlConstants.ATTRIBUTE_class, JRXmlConstants.ATTRIBUTE_incrementerFactoryClass, JRXmlConstants.ATTRIBUTE_calculation}, new String[]{"valueClassName", "incrementerFactoryClassName"}); digester.addRule(measurePattern, new XmlConstantPropertyRule( JRXmlConstants.ATTRIBUTE_calculation, CalculationEnum.values())); addExpressionRules(digester, measurePattern + "/" + JRXmlConstants.ELEMENT_labelExpression, "setLabelExpression"); addExpressionRules(digester, measurePattern + "/" + JRXmlConstants.ELEMENT_valueExpression, "setValueExpression"); }
Example 16
Source File: ConfigParser.java From development with Apache License 2.0 | 4 votes |
/** * Creates the rules. * * @return The rules all put into a rule chain */ private LinkedList createServerList(File data) throws Exception { Digester digester = new Digester(); digester.setUseContextClassLoader(true); // Construct server list digester.addObjectCreate("config", LinkedList.class); // Create servers digester.addObjectCreate("config/server", null, "className"); digester.addSetProperties("config/server"); // Create rule digester.addObjectCreate("config/server/rule", null, "className"); digester.addSetProperties("config/server/rule"); digester.addSetNext("config/server/rule", "setRule"); // Create composite rule digester.addObjectCreate("config/server/composite-rule", null, "className"); digester.addSetProperties("config/server/composite-rule"); digester.addObjectCreate("config/server/composite-rule/rule", null, "className"); digester.addSetProperties("config/server/composite-rule/rule"); digester.addSetNext("config/server/composite-rule/rule", "addRule"); digester.addSetNext("config/server/composite-rule", "setRule"); // Add server to list digester.addSetNext("config/server", "add"); // Create cluster servers digester.addObjectCreate("config/cluster-server", null, "className"); digester.addSetProperties("config/cluster-server"); // Create the servers in this cluster digester.addCallMethod("config/cluster-server/server", "addServer", 2); digester.addCallParam("config/cluster-server/server", 0, "domainName"); digester.addCallParam("config/cluster-server/server", 1, "path"); // Create rule digester.addObjectCreate("config/cluster-server/rule", null, "className"); digester.addSetProperties("config/cluster-server/rule"); digester.addSetNext("config/cluster-server/rule", "setRule"); // Create composite rule digester.addObjectCreate("config/cluster-server/composite-rule", null, "className"); digester.addSetProperties("config/cluster-server/composite-rule"); digester.addObjectCreate("config/cluster-server/composite-rule/rule", null, "className"); digester.addSetProperties("config/cluster-server/composite-rule/rule"); digester.addSetNext("config/cluster-server/composite-rule/rule", "addRule"); digester.addSetNext("config/cluster-server/composite-rule", "setRule"); // Add server to list digester.addSetNext("config/cluster-server", "add"); return (LinkedList) digester.parse(data); }
Example 17
Source File: ComponentsXmlDigesterConfigurer.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@SuppressWarnings("deprecation") protected void addTableRules(Digester digester) { String tablePattern = "*/componentElement/table"; //digester.addObjectCreate(tablePattern, StandardTable.class); digester.addFactoryCreate(tablePattern, StandardTableFactory.class.getName()); String columnPattern = "*/column"; digester.addObjectCreate(columnPattern, StandardColumn.class); digester.addSetNext(columnPattern, "addColumn"); digester.addSetProperties(columnPattern, //properties to be ignored by this rule new String[]{"uuid"}, new String[0]); digester.addRule(columnPattern, new UuidPropertyRule("uuid", "UUID")); addExpressionRules(digester, columnPattern + "/printWhenExpression", JRExpressionFactory.BooleanExpressionFactory.class, "setPrintWhenExpression", true); addTableCellRules(digester, columnPattern + "/tableHeader", "setTableHeader"); addTableCellRules(digester, columnPattern + "/tableFooter", "setTableFooter"); addTableGroupCellRules(digester, columnPattern + "/groupHeader", "addGroupHeader"); addTableGroupCellRules(digester, columnPattern + "/groupFooter", "addGroupFooter"); addTableCellRules(digester, columnPattern + "/columnHeader", "setColumnHeader"); addTableCellRules(digester, columnPattern + "/columnFooter", "setColumnFooter"); addTableCellRules(digester, columnPattern + "/detailCell", "setDetailCell"); String columnGroupPattern = "*/columnGroup"; digester.addObjectCreate(columnGroupPattern, StandardColumnGroup.class); digester.addSetNext(columnGroupPattern, "addColumn"); digester.addSetProperties(columnGroupPattern, //properties to be ignored by this rule new String[]{"uuid"}, new String[0]); digester.addRule(columnGroupPattern, new UuidPropertyRule("uuid", "UUID")); addExpressionRules(digester, columnGroupPattern + "/printWhenExpression", JRExpressionFactory.BooleanExpressionFactory.class, "setPrintWhenExpression", true); addTableCellRules(digester, columnGroupPattern + "/tableHeader", "setTableHeader"); addTableCellRules(digester, columnGroupPattern + "/tableFooter", "setTableFooter"); addTableGroupCellRules(digester, columnGroupPattern + "/groupHeader", "addGroupHeader"); addTableGroupCellRules(digester, columnGroupPattern + "/groupFooter", "addGroupFooter"); addTableCellRules(digester, columnGroupPattern + "/columnHeader", "setColumnHeader"); addTableCellRules(digester, columnGroupPattern + "/columnFooter", "setColumnFooter"); addTableRowRules(digester, tablePattern + "/tableHeader", "setTableHeader"); addTableRowRules(digester, tablePattern + "/tableFooter", "setTableFooter"); addTableGroupRowRules(digester, tablePattern + "/groupHeader", "addGroupHeader"); addTableGroupRowRules(digester, tablePattern + "/groupFooter", "addGroupFooter"); addTableRowRules(digester, tablePattern + "/columnHeader", "setColumnHeader"); addTableRowRules(digester, tablePattern + "/columnFooter", "setColumnFooter"); addTableRowRules(digester, tablePattern + "/detail", "setDetail"); addTableBaseCellRules(digester, tablePattern + "/noData", "setNoData"); }
Example 18
Source File: MonitorManager.java From iaf with Apache License 2.0 | 4 votes |
public void setDigesterRules(Digester d) { Rule attributeChecker=new AttributeCheckingRule(); d.addFactoryCreate("*/monitoring",new CreationFactory()); d.addSetProperties("*/monitoring"); d.addSetTop("*/monitoring","register"); d.addRule("*/monitoring", attributeChecker); d.addRule("*/monitoring/destinations",new DestinationCleanup()); d.addObjectCreate("*/destination","className",IMonitorAdapter.class); d.addSetProperties("*/destination"); d.addSetTop("*/destination","register"); d.addRule("*/destination", attributeChecker); d.addObjectCreate("*/destination/sender","className",ISender.class); d.addSetProperties("*/destination/sender"); d.addSetNext("*/destination/sender","setSender"); d.addRule("*/destination/sender", attributeChecker); d.addObjectCreate("*/monitor",Monitor.class); d.addSetProperties("*/monitor"); d.addSetTop("*/monitor","register"); d.addRule("*/monitor", attributeChecker); d.addObjectCreate("*/alarm",Trigger.class); d.addSetProperties("*/alarm"); d.addSetNext("*/alarm","registerAlarm"); d.addRule("*/alarm", attributeChecker); d.addCallMethod("*/alarm/events/event", "addEventCode", 0); d.addObjectCreate("*/clearing",Trigger.class); d.addSetProperties("*/clearing"); d.addSetNext("*/clearing","registerClearing"); d.addRule("*/clearing", attributeChecker); d.addCallMethod("*/clearing/events/event", "addEventCode", 0); d.addObjectCreate("*/trigger",Trigger.class); d.addSetProperties("*/trigger"); d.addSetNext("*/trigger","registerTrigger"); d.addRule("*/trigger", attributeChecker); d.addCallMethod("*/trigger/events/event", "addEventCode", 0); d.addObjectCreate("*/adapterfilter",AdapterFilter.class); d.addSetProperties("*/adapterfilter"); d.addSetNext("*/adapterfilter","registerAdapterFilter"); d.addRule("*/adapterfilter", attributeChecker); d.addSetNext("*/adapterfilter/sources","setFilteringToLowerLevelObjects"); d.addCallMethod("*/adapterfilter/sources/source", "registerSubOject", 0); }
Example 19
Source File: XChartDigester.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void configureDigester(Digester digester) { String componentNamespace = digester.getRuleNamespaceURI(); String jrNamespace = JRXmlConstants.JASPERREPORTS_NAMESPACE; String xyChartPattern = "*/componentElement/XYChart"; digester.addFactoryCreate(xyChartPattern, XYChartXmlFactory.class.getName()); String xyDatasetPattern = xyChartPattern + "/XYDataset"; digester.addFactoryCreate(xyDatasetPattern, XYDatasetXmlFactory.class.getName()); digester.addSetNext(xyDatasetPattern, "setDataset", XYDataset.class.getName()); digester.setRuleNamespaceURI(jrNamespace); String datasetPattern = xyDatasetPattern + "/dataset"; digester.addFactoryCreate(datasetPattern, JRElementDatasetFactory.class.getName()); String datasetIncrementWhenExpressionPath = datasetPattern + JRXmlConstants.ELEMENT_incrementWhenExpression; digester.addFactoryCreate(datasetIncrementWhenExpressionPath, JRExpressionFactory.class.getName()); digester.addSetNext(datasetIncrementWhenExpressionPath, "setIncrementWhenExpression", JRExpression.class.getName()); digester.addCallMethod(datasetIncrementWhenExpressionPath, "setText", 0); String datasetRunPattern = datasetPattern +"/" + JRXmlConstants.ELEMENT_datasetRun; digester.addFactoryCreate(datasetRunPattern, JRDatasetRunFactory.class.getName()); digester.addSetNext(datasetRunPattern, "setDatasetRun", JRDatasetRun.class.getName()); String datasetParamPattern = datasetRunPattern + "/" + JRXmlConstants.ELEMENT_datasetParameter; digester.addFactoryCreate(datasetParamPattern, JRDatasetRunParameterFactory.class.getName()); digester.addSetNext(datasetParamPattern, "addParameter", JRDatasetParameter.class.getName()); String datasetParamExprPattern = datasetParamPattern + "/" + JRXmlConstants.ELEMENT_datasetParameterExpression; digester.addFactoryCreate(datasetParamExprPattern, JRExpressionFactory.class.getName()); digester.addSetNext(datasetParamExprPattern, "setExpression", JRExpression.class.getName()); digester.addCallMethod(datasetParamExprPattern, "setText", 0); String returnValuePattern = datasetRunPattern + "/" + JRXmlConstants.ELEMENT_returnValue; digester.addObjectCreate(returnValuePattern, DesignReturnValue.class.getName()); digester.addSetProperties(returnValuePattern, new String[]{JRXmlConstants.ATTRIBUTE_incrementerFactoryClass, JRXmlConstants.ATTRIBUTE_calculation}, new String[]{"incrementerFactoryClassName"}); digester.addRule(returnValuePattern, new XmlConstantPropertyRule( JRXmlConstants.ATTRIBUTE_calculation, CalculationEnum.values())); digester.addSetNext(returnValuePattern, "addReturnValue"); digester.setRuleNamespaceURI(componentNamespace); String seriesPattern = xyDatasetPattern + "/XYSeries"; digester.addFactoryCreate(seriesPattern, XYSeriesFactory.class.getName()); digester.addSetNext(seriesPattern, "addXYSeries", DesignXYSeries.class.getName()); digester.setRuleNamespaceURI(jrNamespace); digester.addFactoryCreate(seriesPattern + "/seriesExpression", JRExpressionFactory.class.getName()); digester.addSetNext(seriesPattern + "/seriesExpression", "setSeriesExpression", JRDesignExpression.class.getName()); digester.addCallMethod(seriesPattern + "/seriesExpression", "setText", 0); digester.addFactoryCreate(seriesPattern + "/xValueExpression", JRExpressionFactory.class.getName()); digester.addSetNext(seriesPattern + "/xValueExpression", "setXValueExpression", JRDesignExpression.class.getName()); digester.addCallMethod(seriesPattern + "/xValueExpression", "setText", 0); digester.addFactoryCreate(seriesPattern + "/yValueExpression", JRExpressionFactory.class.getName()); digester.addSetNext(seriesPattern + "/yValueExpression", "setYValueExpression", JRDesignExpression.class.getName()); digester.addCallMethod(seriesPattern + "/yValueExpression", "setText", 0); digester.setRuleNamespaceURI(componentNamespace); digester.addFactoryCreate(seriesPattern + "/colorExpression", JRExpressionFactory.class.getName()); digester.addSetNext(seriesPattern + "/colorExpression", "setColorExpression", JRDesignExpression.class.getName()); digester.addCallMethod(seriesPattern + "/colorExpression", "setText", 0); String chartTitleExpressionPattern = xyChartPattern + "/chartTitleExpression"; digester.addFactoryCreate(chartTitleExpressionPattern, JRExpressionFactory.class.getName()); digester.addCallMethod(chartTitleExpressionPattern, "setText", 0); digester.addSetNext(chartTitleExpressionPattern, "setChartTitleExpression", JRExpression.class.getName()); String xAxisTitleExpressionPattern = xyChartPattern + "/xAxisTitleExpression"; digester.addFactoryCreate(xAxisTitleExpressionPattern, JRExpressionFactory.class.getName()); digester.addCallMethod(xAxisTitleExpressionPattern, "setText", 0); digester.addSetNext(xAxisTitleExpressionPattern, "setXAxisTitleExpression", JRExpression.class.getName()); String yAxisTitleExpressionPattern = xyChartPattern + "/yAxisTitleExpression"; digester.addFactoryCreate(yAxisTitleExpressionPattern, JRExpressionFactory.class.getName()); digester.addCallMethod(yAxisTitleExpressionPattern, "setText", 0); digester.addSetNext(yAxisTitleExpressionPattern, "setYAxisTitleExpression", JRExpression.class.getName()); }
Example 20
Source File: NavDigester.java From spacewalk with GNU General Public License v2.0 | 4 votes |
/** * buildTree, method to take a url and parse the contents * into a NavTree * @param url the file to parse * @return NavTree the tree represented by the file * @throws Exception if something breaks. XXX: fix to be tighter */ public static NavTree buildTree(URL url) throws Exception { if (url == null) { throw new IllegalArgumentException("URL is null, your definition tag " + "probably points to a non existing file."); } Digester digester = new Digester(); digester.setValidating(false); digester.addObjectCreate("rhn-navi-tree", NavTree.class); digester.addSetProperties("rhn-navi-tree"); digester.addSetProperties("rhn-navi-tree", "acl_mixins", "aclMixins"); digester.addObjectCreate("*/rhn-tab", NavNode.class); digester.addSetProperties("*/rhn-tab", "active-image", "activeImage"); digester.addSetProperties("*/rhn-tab", "inactive-image", "inactiveImage"); digester.addSetProperties("*/rhn-tab", "target", "target"); digester.addCallMethod("*/rhn-tab", "addPrimaryURL", 1); digester.addCallParam("*/rhn-tab", 0, "url"); digester.addCallMethod("*/rhn-tab/rhn-tab-url", "addURL", 0); digester.addCallMethod("*/rhn-tab/rhn-tab-directory", "addDirectory", 0); digester.addSetNext("*/rhn-tab", "addNode"); return (NavTree)digester.parse(url.openStream()); }