Package org.apache.commons.configuration
Class ConfigurationFactory
java.lang.Object
org.apache.commons.configuration.ConfigurationFactory
Deprecated.
Factory class to create a CompositeConfiguration from a .xml file using Digester. By default it can handle the Configurations from commons- configuration. If you need to add your own, then you can pass in your own digester rules to use. It is also namespace aware, by providing a digesterRuleNamespaceURI.
Note: Almost all of the features provided by this class and many
more are also available for the DefaultConfigurationBuilder
class. DefaultConfigurationBuilder
also has a more robust
merge algorithm for constructing combined configurations. So it is
recommended to use this class instead of ConfigurationFactory
.
- Version:
- $Id: ConfigurationFactory.java 1209685 2011-12-02 20:47:44Z oheger $
- Author:
- Eric Pugh, Henning P. Schmiedehausen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Deprecated.A simple data class that holds all information about a configuration from the<additional>
section.static class
Deprecated.An internally used helper class for constructing the composite configuration object.class
Deprecated.A base class for digester factory classes.class
Deprecated.A tiny inner class that allows the Configuration Factory to let the digester construct FileConfiguration objects that already have the correct base Path set.class
Deprecated.A factory that returns an XMLPropertiesConfiguration for .xml files and a PropertiesConfiguration for the others.class
Deprecated.A factory that returns an XMLPropertyListConfiguration for .xml files and a PropertyListConfiguration for the others. -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.ConstructorConfigurationFactory
(String configurationFileName) Deprecated.Constructor with ConfigurationFile Name passed -
Method Summary
Modifier and TypeMethodDescriptionprotected void
enableDigesterSubstitutor
(org.apache.commons.digester.Digester digester) Deprecated.Adds a substitutor to interpolate system propertiesDeprecated.Returns the Base path from which this Configuration Factory operates.Deprecated.Return the configuration provided by this factory.Deprecated.Returns the configurationFile.Deprecated.Returns the URL of the configuration file to be loaded.Deprecated.Returns the digesterRuleNamespaceURI.Deprecated.Returns the digesterRules.protected void
initDefaultDigesterRules
(org.apache.commons.digester.Digester digester) Deprecated.Initializes the parsing rules for the default digester This allows the Configuration Factory to understand the default types: Properties, XML and JNDI.protected void
initDigesterSectionRules
(org.apache.commons.digester.Digester digester, String matchString, boolean additional) Deprecated.Sets up digester rules for a specified section of the configuration info file.void
setBasePath
(String basePath) Deprecated.Sets the basePath for all file references from this Configuration Factory.void
setConfigurationFileName
(String configurationFileName) Deprecated.Sets the configurationFile.void
setConfigurationURL
(URL url) Deprecated.Sets the URL of the configuration to load.void
setDigesterRuleNamespaceURI
(String digesterRuleNamespaceURI) Deprecated.Sets the digesterRuleNamespaceURI.void
setDigesterRules
(URL digesterRules) Deprecated.Sets the digesterRules.protected void
setupDigesterInstance
(org.apache.commons.digester.Digester digester, String matchString, org.apache.commons.digester.ObjectCreationFactory factory, String method, boolean additional) Deprecated.Sets up digester rules for a configuration to be loaded.protected void
setupUnionRules
(org.apache.commons.digester.Digester digester, String matchString) Deprecated.Sets up rules for configurations in the additional section.
-
Constructor Details
-
ConfigurationFactory
public ConfigurationFactory()Deprecated.Constructor -
ConfigurationFactory
Deprecated.Constructor with ConfigurationFile Name passed- Parameters:
configurationFileName
- The path to the configuration file
-
-
Method Details
-
getConfiguration
Deprecated.Return the configuration provided by this factory. It loads the configuration file which is a XML description of the actual configurations to load. It can contain various different types of configuration, e.g. Properties, XML and JNDI.- Returns:
- A Configuration object
- Throws:
ConfigurationException
- A generic exception that we had trouble during the loading of the configuration data.
-
getConfigurationFileName
Deprecated.Returns the configurationFile.- Returns:
- The name of the configuration file. Can be null.
-
setConfigurationFileName
Deprecated.Sets the configurationFile.- Parameters:
configurationFileName
- The name of the configurationFile to use.
-
getConfigurationURL
Deprecated.Returns the URL of the configuration file to be loaded.- Returns:
- the URL of the configuration to load
-
setConfigurationURL
Deprecated.Sets the URL of the configuration to load. This configuration can be either specified by a file name or by a URL.- Parameters:
url
- the URL of the configuration to load
-
getDigesterRules
Deprecated.Returns the digesterRules.- Returns:
- URL
-
setDigesterRules
Deprecated.Sets the digesterRules.- Parameters:
digesterRules
- The digesterRules to set
-
enableDigesterSubstitutor
Deprecated.Adds a substitutor to interpolate system properties- Parameters:
digester
- The digester to which we add the substitutor
-
initDefaultDigesterRules
Deprecated.Initializes the parsing rules for the default digester This allows the Configuration Factory to understand the default types: Properties, XML and JNDI. Two special sections are introduced:<override>
and<additional>
.- Parameters:
digester
- The digester to configure
-
initDigesterSectionRules
protected void initDigesterSectionRules(org.apache.commons.digester.Digester digester, String matchString, boolean additional) Deprecated.Sets up digester rules for a specified section of the configuration info file.- Parameters:
digester
- the current digester instancematchString
- specifies the sectionadditional
- a flag if rules for the additional section are to be added
-
setupDigesterInstance
protected void setupDigesterInstance(org.apache.commons.digester.Digester digester, String matchString, org.apache.commons.digester.ObjectCreationFactory factory, String method, boolean additional) Deprecated.Sets up digester rules for a configuration to be loaded.- Parameters:
digester
- the current digestermatchString
- the pattern to match with this rulefactory
- an ObjectCreationFactory instance to use for creating new objectsmethod
- the name of a method to be called or null for noneadditional
- a flag if rules for the additional section are to be added
-
setupUnionRules
Deprecated.Sets up rules for configurations in the additional section.- Parameters:
digester
- the current digestermatchString
- the pattern to match with this rule
-
getDigesterRuleNamespaceURI
Deprecated.Returns the digesterRuleNamespaceURI.- Returns:
- A String with the digesterRuleNamespaceURI.
-
setDigesterRuleNamespaceURI
Deprecated.Sets the digesterRuleNamespaceURI.- Parameters:
digesterRuleNamespaceURI
- The new digesterRuleNamespaceURI to use
-
getBasePath
Deprecated.Returns the Base path from which this Configuration Factory operates. This is never null. If you set the BasePath to null, then a base path according to the configuration to load is returned.- Returns:
- The base Path of this configuration factory.
-
setBasePath
Deprecated.Sets the basePath for all file references from this Configuration Factory. Normally a base path need not to be set because it is determined by the location of the configuration file to load. All relative pathes in this file are resolved relative to this file. Setting a base path makes sense if such relative pathes should be otherwise resolved, e.g. if the configuration file is loaded from the class path and all sub configurations it refers to are stored in a special config directory.- Parameters:
basePath
- The new basePath to set.
-
DefaultConfigurationBuilder
instead; this class provides the same features as ConfigurationFactory plus some more; it can also process the same configuration definition files.