Class FactoryConfiguration

  • All Implemented Interfaces:
    Comparable<Configuration>
    Direct Known Subclasses:
    EasyFactoryConfiguration, FileFactoryConfiguration

    public class FactoryConfiguration
    extends CompoundConfiguration<ToolboxConfiguration>

    This class serves to define configuration info for a ToolboxFactory. It contains the ToolboxConfigurations for the factory as well as any Data which is to be made available in the application scope by the factory and any Propertys which you intend to be available to all tools managed by the factory, regardless of toolbox or scope.

    Most users will not find themselves directly using the API of this class, as its subclasses generally provide much simpler means of inputting the actual configuration info whether from XML, Java or a Properties files.

    When combining any Configurations via the various addConfiguration(org.apache.velocity.tools.config.FactoryConfiguration) methods in each class, it is essential to remember that subsequent configurations always override previous ones. This is a "last entry wins" approach to configuration!

    For debugging, this class tracks its "sources", keeping a chronological list of all sources for configuration data. When you add configuration info to this class via addConfiguration(org.apache.velocity.tools.config.FactoryConfiguration), the source lists from those FactoryConfigurations is appended to this instance's list. The initial item in this list will typically be the name of the FactoryConfiguration class (or subclass) along with a caller-provided string identifying where this instance was created. This aids greatly in debugging combined, complex configurations. You may add further sources at any time via addSource(java.lang.String).

    The toString() method of this class provides a complete and well-formatted listing of the configuration info contained within this instance and is also very useful for debugging.

    Version:
    $Id: FactoryConfiguration.java 511959 2007-02-26 19:24:39Z nbubna $
    Author:
    Nathan Bubna
    • Constructor Detail

      • FactoryConfiguration

        public FactoryConfiguration()
      • FactoryConfiguration

        public FactoryConfiguration​(String source)
        Creates a new instance with the specified source name combined with this class's name as the initial source.
      • FactoryConfiguration

        protected FactoryConfiguration​(Class clazz,
                                       String source)
        Allows subclasses to construct an instance that uses their classname.