Class PropertiesFactoryConfiguration

  • All Implemented Interfaces:
    java.lang.Comparable<Configuration>

    public class PropertiesFactoryConfiguration
    extends FileFactoryConfiguration

    This reads in configuration info formatted as a property file using ExtendedProperties from Commons-Collections.

    Example usage:

     FactoryConfiguration cfg = new PropertiesFactoryConfiguration();
     cfg.read("my.properties");
     ToolboxFactory factory = cfg.createFactory();
     

    This reads in a configuration such as:

     tools.toolbox = request,application
     tools.property.locale = en_us
     tools.property.locale.class = java.util.Locale
     tools.property.locale.converter = org.apache.velocity.tools.config.LocaleConverter
     tools.request.property.xhtml = true
     tools.request.render = org.apache.velocity.tools.view.ViewRenderTool
     tools.request.render.parseDepth = 5
     tools.request.search = com.foo.tools.MySearchTool
     tools.request.search.itemsPerPage = 10
     tools.application.math = org.apache.velocity.tools.generic.MathTool
     tools.data.foo = bar
     tools.data.foo.class = java.lang.String
     tools.data.foo.converter = org.apache.commons.beanutils.converter.StringConverter
     tools.data.version = 1.0
     tools.data.version.type = number
     tools.data.debug = false
     tools.data.debug.type = boolean
     
    NOTE: "property", "data", and "toolbox" are reserved words do not use them as tool keys or toolbox scopes.

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

      • PropertiesFactoryConfiguration

        public PropertiesFactoryConfiguration()
      • PropertiesFactoryConfiguration

        public PropertiesFactoryConfiguration​(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

      • read

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

        Reads an properties file 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
      • read

        public void read​(ExtendedProperties factory)
        Description copied from class: FileFactoryConfiguration

        Reads an configuration from an InputStream.

        Specified by:
        read in class FileFactoryConfiguration
        Parameters:
        factory - the InputStream to read from
      • readProperties

        protected void readProperties​(ExtendedProperties configProps,
                                      Configuration config)
      • readToolboxes

        protected void readToolboxes​(ExtendedProperties factory)
      • readData

        protected void readData​(ExtendedProperties dataset)
      • setProperties

        protected void setProperties​(ExtendedProperties props,
                                     Data data)