Package org.apache.velocity.tools.config
Class XmlFactoryConfiguration
- java.lang.Object
-
- org.apache.velocity.tools.config.Configuration
-
- org.apache.velocity.tools.config.CompoundConfiguration<ToolboxConfiguration>
-
- org.apache.velocity.tools.config.FactoryConfiguration
-
- org.apache.velocity.tools.config.FileFactoryConfiguration
-
- org.apache.velocity.tools.config.XmlFactoryConfiguration
-
- All Implemented Interfaces:
java.lang.Comparable<Configuration>
public class XmlFactoryConfiguration extends FileFactoryConfiguration
This reads in configuration info formatted as an XML file using Commons-
Digester. This usesXmlFactoryConfigurationRuleSetas the default set of rules for processing the XML. However, you may always change this by passing a newRuleSetto thesetRuleSet(org.apache.commons.digester3.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();- Version:
- $Id: XmlFactoryConfiguration.java 511959 2007-02-26 19:24:39Z nbubna $
- Author:
- Nathan Bubna
-
-
Constructor Summary
Constructors Constructor Description XmlFactoryConfiguration()Creates an instanceXmlFactoryConfiguration(java.lang.String id)Creates an instance using the specified string as an identifier to distinguish this instance when debugging
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.commons.digester3.RuleSetgetRuleSet()Retrieves the rule set Digester should use to parse and load the toolbox for this manager.protected voidreadImpl(java.net.URL url)Reads an XML document from anURLand uses it to configure thisFactoryConfiguration.voidsetRuleSet(org.apache.commons.digester3.RuleSet rules)Sets theRuleSetthis loader will use to digest the xml toolbox.-
Methods inherited from class org.apache.velocity.tools.config.FileFactoryConfiguration
findURL, read, read, read, read, read, read
-
Methods inherited from class org.apache.velocity.tools.config.FactoryConfiguration
addConfiguration, addData, addSource, addToolbox, createFactory, equals, getData, getData, getData, getSource, getSources, getToolbox, getToolboxes, hasData, hashCode, removeData, removeToolbox, setData, setSource, setToolboxes, toString, toString, validate
-
Methods inherited from class org.apache.velocity.tools.config.CompoundConfiguration
addChild, addChildren, addConfiguration, appendChildren, getChild, getChildren, hasChildren, removeChild, setChildren
-
Methods inherited from class org.apache.velocity.tools.config.Configuration
addConfiguration, addProperty, appendProperties, compareTo, getProperties, getProperty, getPropertyMap, hasProperties, removeProperty, removeProperty, setProperties, setProperty, setPropertyMap
-
-
-
-
Constructor Detail
-
XmlFactoryConfiguration
public XmlFactoryConfiguration()
Creates an instance- See Also:
FactoryConfiguration.setSource(String)
-
XmlFactoryConfiguration
public XmlFactoryConfiguration(java.lang.String id)
Creates an instance using the specified string as an identifier to distinguish this instance when debugging- Parameters:
id- the name of the "source" of this instance- See Also:
FactoryConfiguration.setSource(String)
-
-
Method Detail
-
setRuleSet
public void setRuleSet(org.apache.commons.digester3.RuleSet rules)
Sets theRuleSetthis loader will use to digest the xml toolbox.- Parameters:
rules- rules set
-
getRuleSet
public org.apache.commons.digester3.RuleSet getRuleSet()
Retrieves the rule set Digester should use to parse and load the toolbox for this manager.
- Returns:
- rules set
-
readImpl
protected void readImpl(java.net.URL url) throws java.io.IOExceptionReads an XML document from an
URLand uses it to configure thisFactoryConfiguration.- Specified by:
readImplin classFileFactoryConfiguration- Parameters:
url- the URL to read from- Throws:
java.io.IOException- if a problem occurs
-
-