Class 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 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(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
    • Field Detail

      • ruleSet

        private RuleSet ruleSet
      • supportOldXml

        private boolean supportOldXml
    • Constructor Detail

      • XmlFactoryConfiguration

        public XmlFactoryConfiguration()
      • XmlFactoryConfiguration

        public XmlFactoryConfiguration​(boolean supportOldConfig)
      • 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)
      • XmlFactoryConfiguration

        public XmlFactoryConfiguration​(boolean supportOldConfig,
                                       java.lang.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.
        Parameters:
        supportOldConfig - whether the old toolbox.xml format should be supported
        id - the name of the "source" of this instance
        See Also:
        FactoryConfiguration.setSource(String)
    • Method Detail

      • setRuleSet

        public void setRuleSet​(RuleSet rules)
        Sets the RuleSet this loader will use to digest the xml toolbox.
      • getRuleSet

        public RuleSet getRuleSet()

        Retrieves the rule set Digester should use to parse and load the toolbox for this manager.

      • read

        public void read​(java.io.InputStream input)
                  throws java.io.IOException

        Reads an XML document from an InputStream and uses it to configure this FactoryConfiguration.

        Specified by:
        read in class FileFactoryConfiguration
        Parameters:
        input - the InputStream to read from
        Throws:
        java.io.IOException