public class XmlFactoryConfiguration extends FileFactoryConfiguration
This reads in configuration info formatted as an XML file
using Commons-Digester
. This uses
XmlFactoryConfigurationRuleSet
as the default set of rules
for processing the XML. However, you may always change this by
passing a new RuleSet
to the setRuleSet(org.apache.commons.digester.RuleSet)
method.
See the configuration documentation on the main web site for
instructions on the XML format supported by the default rules.
Example usage:
FactoryConfiguration cfg = new XmlFactoryConfiguration("Dev Tools"); cfg.read("devtools.xml"); ToolboxFactory factory = cfg.createFactory();
Constructor and Description |
---|
XmlFactoryConfiguration() |
XmlFactoryConfiguration(boolean supportOldConfig) |
XmlFactoryConfiguration(boolean supportOldConfig,
String id)
Creates an instance using the specified string
as an identifier to distinguish this instance when debugging
and using the specified setting for supporting the old toolbox.xml
format from VelocityTools 1.x.
|
XmlFactoryConfiguration(String id)
Creates an instance using the specified string
as an identifier to distinguish this instance when debugging.
|
Modifier and Type | Method and Description |
---|---|
org.apache.commons.digester.RuleSet |
getRuleSet()
Retrieves the rule set Digester should use to parse and load
the toolbox for this manager.
|
void |
read(InputStream input)
Reads an XML document from an
InputStream
and uses it to configure this FactoryConfiguration . |
void |
setRuleSet(org.apache.commons.digester.RuleSet rules)
Sets the
RuleSet this loader will use to
digest the xml toolbox. |
findURL, read, read, read, read, read, read, read
addConfiguration, addData, addSource, addToolbox, createFactory, equals, getData, getData, getData, getSource, getSources, getToolbox, getToolboxes, hasData, hashCode, removeData, removeToolbox, setData, setSource, setToolboxes, toString, toString, validate
addChild, addConfiguration, appendChildren, getChild, getChildren, hasChildren, removeChild, setChildren
addConfiguration, addProperty, appendProperties, compareTo, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap
public XmlFactoryConfiguration()
public XmlFactoryConfiguration(boolean supportOldConfig)
public XmlFactoryConfiguration(String id)
id
- the name of the "source" of this instanceFactoryConfiguration.setSource(String)
public XmlFactoryConfiguration(boolean supportOldConfig, String id)
supportOldConfig
- whether the old toolbox.xml format should be supportedid
- the name of the "source" of this instanceFactoryConfiguration.setSource(String)
public void setRuleSet(org.apache.commons.digester.RuleSet rules)
RuleSet
this loader will use to
digest the xml toolbox.public org.apache.commons.digester.RuleSet getRuleSet()
Retrieves the rule set Digester should use to parse and load the toolbox for this manager.
public void read(InputStream input) throws IOException
Reads an XML document from an InputStream
and uses it to configure this FactoryConfiguration
.
read
in class FileFactoryConfiguration
input
- the InputStream to read fromIOException
Copyright © 2002–2021 Apache Software Foundation. All rights reserved.