Return-Path:
Configuration definition files are XML documents telling
- DefaultConfigurationBuilder
which configuration sources to
+ CombinedConfigurationBuilder
which configuration sources to
load and how to process them in order to create the resulting combined
configuration.
- A configuration definition file for DefaultConfigurationBuilder
+ A configuration definition file for CombinedConfigurationBuilder
can contain three sections, all of which are optional. A skeleton looks as
follows:
The override
and additional
sections have already
- been introduced when the basics of DefaultConfigurationBuilder
+ been introduced when the basics of CombinedConfigurationBuilder
were discussed. They contain declarations for the configuration sources to be
embedded. For convenience reasons it is also possible to declare
configuration sources outside these sections; they are then treated as if
@@ -518,7 +518,7 @@ CombinedConfiguration config = builder.g
element whose name determines the type of the configuration source.
Attributes or nested elements can be used to provide additional
configuration options for the sources to be included (e.g. a name of a
- file to be loaded or a reloading strategy). Below is a list of all
+ file to be loaded or further flags). Below is a list of all
tags which can be used out of the box:
@@ -528,50 +528,72 @@ CombinedConfiguration config = builder.g
the file to load is specified using the fileName
attribute. Which configuration class is created by this tag
depends on the extension of the file to load: If the extension
- is ".xml", a XMLPropertiesConfiguration
object is
+ is ".xml", a
+
+ XMLPropertiesConfiguration
object is
created, which is able to process the XML properties format
- introduced in Java 5.0. Otherwise a PropertiesConfiguration
- object is created, the default reader for properties files.
+ introduced in Java 5.0. Otherwise a
+
+ PropertiesConfiguration
object is created, the default reader
+ for properties files.
xml
element can be used to load XML configuration
files. It also uses the fileName
attribute to
determine the name of the file to load and creates an instance
- of XMLConfiguration
.
+ XMLConfiguration
.
JNDIConfiguration
- class. The prefix
attribute can be used to
- select a subset of the JNDI tree.
+ JndiConfiguration
class. The prefix
attribute
+ can be used to select a subset of the JNDI tree.
plist
element allows to embedd configuration
+ plist
element allows embedding configuration
files in the NeXT / OpenStep or Mac OS X format. Again the
name of the file to load is specified through the
fileName
attribute. If a XML file is specified,
- a XMLPropertyListConfiguration
object is created
- to process the file. Otherwise this task is delegated to a
- PropertyListConfiguration
instance.
+ XMLPropertyListConfiguration
object is created
+ to process the file. Otherwise, this task is delegated to a
+
+ PropertyListConfiguration
instance.SystemConfiguration
- is added to the resulting configuration allowing access to
- system properties. Note: Using this element system properties
- are directly made available. Alternatively the
- interpolation features introduced in version 1.4 (see
-
+
+ SystemConfiguration
is added to the resulting configuration
+ allowing access to system properties. Note: Using this element
+ system properties are directly made available. Alternatively the
+ interpolation features (see
Variable Interpolation for more details) can be used for referencing
system properties.
+ INIConfiguration
is used to load the ini file.<system>
tag for
+ Java system properties.configuration
tag allows other configuration
definition files to be included. This makes it possible to nest these
definition files up to an arbitrary depth. In fact, this tag will
- create another DefaultConfigurationBuilder
object,
+ create another CombinedConfigurationBuilder
object,
initialize it, and obtain the CombinedConfiguation
from it.
This combined configuration will then be added to the resulting
combined configuration. Like all file-based configurations the
fileName
attribute can be used to specify the configuration
definition file to be loaded. This file must be an XML document that
conforms to the format described here. Some of the most important
- settings are copied from the original DefaultConfigurationBuilder
+ settings are copied from the original CombinedConfigurationBuilder
object to the newly created builder:
- HierarchicalINIConfiguration
is used to load the ini file.<system>
tag for
- Java system properties.In the declaration of a configuration source it is possible to set properties on the corresponding configuration objects. Configuration declarations are indeed - Bean - declarations. That means they can have attributes matching simple + Bean declarations. That means they can have attributes matching simple properties of the configuration object to create, and sub elements matching complex properties. The following example fragment shows how complex initialization can be performed in a configuration declaration:
@@ -617,19 +628,26 @@ CombinedConfiguration config = builder.g
an XML document are defined. For the properties source the
throwExceptionOnMissing
property is set to true,
which means that it should throw an exception if a requested property is
- not found. In addition it is assigned a reloading strategy, which is
+ not found. In addition, it is assigned a custom reloading detector, which is
declared and configured in a sub element. The XML configuration source is
initialized in a similar way: a simple property is set, and an expression
- engine is assigned. More information about the format for declaring objects
- and initializing their properties can be found in the section about
- bean
- declarations.
+ engine is assigned. In fact, the properties defined in these declarations
+ are not directly set on configuration instances, but on
+ initialization
+ parameters objects for configuration builders. These builders are
+ created for the declared configuration sources and configured with the
+ defined properties. Then their managed configurations are obtained and
+ combined into the resulting configuration. Nevertheless, the declarations
+ share the same syntax as other bean declarations supported by
+ Commons Configuration. More information about the format for
+ declaring beans and initializing their properties can be found in the
+ section about bean declarations.
In addition to the attributes that correspond to properties of the
- configuration object to be created, a configuration declaration can have a
+ configuration sources to be created, a configuration declaration can have a
set of special attributes that are evaluated by
- DefaultConfigurationBuilder
when it creates the objects.
+ CombinedConfigurationBuilder
when it creates the objects.
These attributes are listed in the following table:
@@ -665,7 +683,7 @@ CombinedConfiguration config = builder.g
config-forceCreate
This example differs from the previous one by the systemProperties
- attribute added to the root element. It causes the specified to be read
+ attribute added to the root element. It causes the specified properties file to be read
and all properties defined therein to be added to the system properties.
So properties like CONFIG_FILE can be defined in a properties
file and are then treated as if they were system properties.
@@ -742,13 +760,13 @@ CombinedConfiguration config = builder.g
object can be set. The main part of this section is a bean declaration
that is used for creating the resulting configuration object. Other
elements can be used for customizing the
- Node combiners
+ Node combiners
used by the override and the union combined configuration. The following
- example shows a header section that uses all supported properties:
+ example shows a header section that uses some of the supported properties: