Changes
Eric Pugh
MapConfiguration now directly uses a Properties object passed to its
constructor as data store rather than copying it. This allows
SystemConfiguration to be connected to system properties; i.e.
changing a property through SystemConfiguration immediately affects
the corresponding system property.
The deprectated INIConfiguration class was removed.
HierarchicalINIConfiguration was renamed to INIConfiguration.
The deprectated ConfigurationFactory class was removed.
File-based configurations are now implemented in a different way.
The interfaces FileConfiguration and ReloadingStrategy have been
removed, also the base classes AbstractFileConfiguration and
AbstractHierarchicalFileConfiguration. They are replaced by the
FileBased interface and the FileHandler class which implements
central I/O functionality. Reloading is now in the responsibility of
configuration builders.
DatabaseConfiguration now provides get methods for querying its
properties defining the underlying database structures.
The includesAllowed property of PropertyConfiguration is now independent
from the existence of a base path.
DatabaseConfiguration now automatically converts CLOBs to strings if
they appear in property values.
AbstractConfiguration.clearPropertyDirect() is now abstract.
XMLPropertiesConfiguration now supports loading from and saving to DOM
nodes.
PropertiesConfiguration now keeps a comment at the bottom of a
properties file. A new footer property was added for reading and
writing this footer comment.
Interpolation now works correctly after a configuration was cloned.
The ConfigurationInterpolator instance is now cloned, too.
ConfigurationUtils.fileFromUrl() now correctly handles URL containing
encoded percent characters.
Classes and interfaces related to interpolation have been slightly
reworked. ConfigurationInterpolator is now thread-safe. There are
multiple ways to define the ConfigurationInterpolator object to be
used by an AbstractConfiguration instance.
Hierarchical configurations now provide methods to obtain sub
configurations for all child elements of a given key.
PropertiesConfiguration no longer escapes double quotes on saving.
The visibility of some internal methods of PropertiesConfiguration.PropertiesWriter
has been increased to protected. This simplifies the implementation of
a custom escaping strategy.
Bean declarations now support constructor invocations.
HierarchicalConfiguration is now an interface. The base implementation
class is named BaseHierarchicalConfiguration.
It is now possible to obtain an immutable view on a Configuration or
HierarchicalConfiguration object. New interfaces,
ImmutableConfiguration, and ImmutableHierarchicalConfiguration have
been introduced.
Removed obsolete nested classes Node and NodeVisitor of
HierarchicalConfiguration. The related deprecated class
ConfigurationKey was removed, too.
XMLConfiguration no longer supports attributes with multiple values or
list delimiter parsing in attributes. This feature was complex and
error prone and brought little value to the user.
SubnodeConfiguration now provides a new method for clearing it and
removing its root node from the parent configuration. The method
HierarchicalConfiguration.configurationsAt() now returns a list
of SubnodeConfiguration so that it is easier to make direct use of
this feature.
XMLConfiguration now adds attributes of elements defining a list to
all list nodes.
EventSource is now an interface. With BaseEventSource there is a
default implementation.
Small changes in user guide documentation.
Improvements of basic features and AbstractConfiguration documentation.
XMLPropertyListConfiguration no longer swallows exception caused by
invalid date properties. Now a warning message is logged.
List properties can now be set correctly on a HierarchicalConfiguration
if delimiter parsing is disabled.
Made static DateFormat fields in XMLPropertyListConfiguration.PListNode
final and added a note about proper synchronization.
DataConfiguration.get() now also works with String properties and if no
data type conversion is required.
DatabaseConfiguration now always closes the result set.
The Import-Package section in the OSGi manifest now uses the
resolution:=optional directive for optional dependencies.
Variable substitution in configuration sources declared in a definition
file for DefaultConfigurationBuilder now works across multiple sources.
PropertyListConfiguration now can deal with C-style comments in plist
configuration files. Both block and single-line comments are supported.
Fixed possible ClassCastExceptions in CompositeConfiguration related to
special in-memory configurations.
Class ConfigurationKey was deprecated in favor of DefaultConfigurationKey.
Implemented delimiter parsing in HierarchicalINIConfiguration to be
consistent with other Configuration implementations. Note that this can
impact existing code. To switch back to the old behavior, call
setDelimiterParsingDisabled(true) before loading the configuration.
CompositeConfiguration now provides better support for child
configurations that are used as in-memory configuration.
Classes generated by JavaCC are now created dynamically during the
build process.
Commons Configuration now requires Java 5 or later.
Binary literals are now supported (i.e Ob11010001).
Updated the dependency to Commons Jexl to version 2.1.1. This version
provides correct OSGi manifest headers.
Improved documentation of AbstractFileConfiguration related to load()
methods and their impact on the base path.
The project now uses standard Maven directory layout.
Reloading now also works for configuration sources declared in the
additional section of a configuration definition file for
DefaultConfigurationBuilder.
ConfigurationFactory has been deprecated. The user guide was updated to
no more mention this class.
HierarchicalConfiguration now provides a specific implementation of the
clear() method. This is more efficient and also solves some other
problems related to clearing a SubnodeConfiguration.
Improved Javadocs of getKeys(String) method for some configuration
classes.
HierarchicalINIConfiguration.getSection() now creates a section if it
does not exist. The SubnodeConfiguration returned by this method is now
always connected to the parent ini configuration.
XPathExpressionEngine now provides better support for the setProperty()
method.
The parsing of ini files has been improved for property definitions
containing multiple separator characters.
DefaultConfigurationBuilder now supports including environment properties
using the "env" tag.
XMLConfiguration now handles attributes correctly whose value is an
empty string.
Transforming a CombinedConfiguration with ViewNodes to an
XMLConfiguration could cause problems with attributes. This has been
fixed.
Child configuration builders created for a <configuration> element
in a configuration definition file now inherit the configuration and
error listeners from the original DefaultConfigurationBuilder. This
makes it possible to suppress log output created for optional
configurations.
JNDIConfiguration.getKeys() no more logs an exception if the prefix does
not exist.
Child configuration builders created for a <configuration> element
in a configuration definition file now inherit some of their properties
from the builder object which processed the file.
The optional dependency to Apache Ant has been changed to the new
groupId org.apache.ant. The version was updated to the most recent
version 1.8.2 (older versions should still work).
HierarchicalINIConfiguration now recognizes comment characters in
property definitions only if they are preceded by whitespace. Thus
comment characters can now be part of the property value. This is for
instance required for the definition of file paths which use the
semicolon as path separator.
Minor improvements of the support for indexed properties in
ConfigurationDynaBean.
The methods getList() and getStringArray() of AbstractConfiguration can
now handle single-valued properties of primitive types.
XMLConfiguration no longer escapes backslashs in the values of
XML elements.
HierarchicalINIConfiguration now works correctly with configurations
that contain only properties in the global section.
testFromClassPath() can fail when it should not because of inconsistent escaping of output from
PropertiesConfiguration.getURL() and FileChangedReloadingStrategy.getFile().toURL().
A bug related to the interpretation of escape sequences for backslashes
has been fixed. The user guide has also been improved in this area.
Files with a plus character in their names are now handled correctly.
SubsetConfiguration now produces correct events.
DatabaseConfiguration can now be instructed to perform a commit after an
update of the managed database table. This makes it usable in
environments where the connections do not use auto-commit mode.
Added a refresh() method to AbstractFileConfiguration and
AbstractHierarchicalFileConfiguration.
HierarchicalINIConfiguration now correctly saves sections whose name
contains delimiter characters.
PropertiesConfiguration.save() escaped slashes in properties values.
This was caused by a bug in commons-lang 2.4. Updating to the new
version commons-lang 2.5 fixed this problem.
Fixed a potential IllegalStateException in HierarchicalINIConfiguration
that can be thrown when the global section is requested concurrently.
XMLPropertyListConfiguration no longer throws a ConfigurationException
if the file to be loaded does not have an outer dict element.
The default expression engine used by hierarchical configurations used to
throw a NumberFormatException if invalid indices were used in property
keys. This has been fixed. As a side effect brackets can now be used in
property keys.
When an empty XMLConfiguration was saved and reloaded the root element
was assigned an empty text value. Because of this isEmpty() returned
false for this configuration. This has been fixed.
Default variable interpolation now supports the env: prefix for
referencing environment variables.
Schema violation exceptions are now propagated back to the caller.
XMLConfiguration and CombinedConfiguraton are now synchronized to fix problems
caused by reloading in a multithreaded environment.
HierarchicalConfiguration.NodeVisitor is now passed the correct key to
its visitAfterChildren() method.
BaseConfiguration.clone() now also clones collections stored in the
internal map. This causes list properties to be handled correctly.
DefaultConfigurationBuilder now supports defining ini files in its
configuration definition file.
Attribute or element values will not be escaped when attribute or element splitting are disabled.
When using Commons Lang 2.6 or higher as dependency nested interpolation
in variable names is supported.
Empty dictionaries in a PropertyList configuration are now preserved when the configuration is saved.
DatabaseConfiguration now generates correct events for the clear() and
clearProperty() methods.
Add ExprLookup to allow expressions to be evaluated in configurations. When
used, this requires that Apache Commons Jexl be added as a dependency to
projects using Commons Configuration.
MapConfiguration now provides a way of controlling the trimming
behavior.
Added MergeCombiner to allow elements in two configurations to be merged when the
element and attributes in the first file match those in the second file.
File system access has been abstracted to a FileSystem interface. Two implementations
are provided, DefaultFileSystem that behaves in a backward compatible manner and
VFSFileSystem which uses Commons VFS to retreive and store files.
PropertiesConfigurationLayout now allows setting the line separator to
be used when writing the properties file.
PropertiesConfigurationLayout now also stores the property separators used for
the single properties. It is also possible to change them for specific
properties or set a global properties separator. In earlier versions
the separator was hard-coded to " = ".
PropertiesConfiguration now defines a nested interface IOFactory. Using
this interface it is possible to inject custom PropertiesReader and
PropertiesWriter implementations.
SubnodeConfiguration now fires an event of type EVENT_SUBNODE_CHANGED
if a structural change of the parent configuration was detected. If the
SubnodeConfiguration is contained in a CombinedConfiguration, the
CombinedConfiguration receives this event and can update itself.
MultiFileHierarchicalConfiguration was not using basepath to
construct the file url. It also threw an exception if the
file pattern resolved to a non-existent file. This is now
configurable.
Align interpolation functionality of SubnodeConfiguration and
SubsetConfiguration. SubsetConfiguration will now also interpolate
keys of the parent configuration or use the local lookups of its
parent. SubnodeConfiguration is in turn now able to lookup local
keys as well.
Align interpolation functionality of SubnodeConfiguration and
SubsetConfiguration.
Align interpolation functionality of SubnodeConfiguration and
SubsetConfiguration.
SubsetConfiguration did not use locally registered lookups of its
interpolator.
Fixed broken links to the API documentation in the user's guide.
Improvements of the user's guide for hierarchical configurations.
The message of the ConversionException thrown by
AbstractConfiguration.getBigInteger() is now correct.
Added getConfigurations and getConfigurationNameList.
Allow configurations to be validated using XML Schemas.
Allow configurations to be validated using XML Schemas.
Some dependencies to other Commons components have been updated to the
recent versions. Affected are Commons Lang, Commons Collections,
Commons Logging, Commons BeanUtils, and Commons JXPath. The older
versions should still work.
Allow system properties to be set from a configuration file.
Allow variable resolvers to be defined configured in
DefaultConfigurationBuilder.
Added MultiFileHierarchicalConfiguration, DynamicCombinedConfiguration
and PatternSubtreeConfigurationWrapper.
The visibility of DefaultConfigurationBuilder.XMLConfigurationProvider
was changed from package local to public. This makes it easier to
implement providers that create configuration classes derived from
XMLConfiguration.
AbstractHierarchicalFileConfiguration.getKeys() now also checks whether
a reload is required.
AbstractFileConfiguration.getKeys() now returns an iterator that points
to a snapshot of the keys of the configuration. This prevents
ConcurrentModificationExceptions during iteration when a reload is
performed.
ConfigurationUtils.convertToHierarchical() now creates multiple
configuration nodes for properties with multiple values. This
improves compatibility with queries.
PropertiesConfiguration now per default uses the encoding "ISO-8859-1"
for loading properties files.
CombinedConfiguration could cause a deadlock when it was accessed while
concurrently a reload of one of its child configuration happened. This
was fixed by reducing synchronization where it is not strictly
necessary.
The "force reload check" mechanism of CombinedConfiguration now also
works with sub configurations created by configurationAt().
When performing interpolation the methods getList() and getStringArray()
of CompositeConfiguration did not take the order of child configurations
into account. This could lead to wrong interpolated values when the key
was contained in multiple child configuration. Interpolation is now
always done in the correct order.
PropertiesConfiguration now also performs interpolation when searching
for include files. This means that the name of a file to include can be
determined by another property.
DefaultConfigurationBuilder now supports defining new configuration
providers in the configuration definition file.
When converting a flat configuration to a hierarchical one it is now
possible to specify the expression engine to be used for this purpose.
This may be necessary if the flat configuration contains keys with
special characters interpreted by the expression engine.
CombinedConfiguration defines the new setConversionExpressionEngine()
method. The expression engine passed to this method will be used when
converting flat child configurations to hierarchical ones.
XMLConfiguration now allows disabling the attribute splitting mechanism
introduced in the 1.5 release (as part of the fix for CONFIGURATION-268).
This may be necessary for correctly processing attributes containing
both the list delimiter and the attribute delimiter character. The new
property "disableAttributeSplitting" was added for this
purpose.
Made handling of parent nodes more consistent when setRoot() or
setRootNode() of HierarchicalConfiguration are involved.
Properties written through a DataConfiguration to a wrapped
PropertiesConfiguration got lost when the PropertiesConfiguration was
saved. This has been fixed.
XMLBeanDeclaration now defines a factory method createBeanDeclaration()
for creating the declarations for complex nested properties. This
method can be overridden by derived classes for injecting custom
BeanDeclaration implementations.
A bug in XMLConfiguration.addNodes() made it impossible to add
attribute nodes using this method. This has been fixed.
INIConfiguration misinterpreted variables in the global section with
a dot in their name as section names. HierarchicalINIConfiguration fixes
this problem.
INIConfiguration does not support obtaining a subset for the global
section. HierarchicalINIConfiguration provides the getSection() method
that returns the content of the global section if null is passed in as
section name.
INIConfiguration does not return the global section in its getSections()
method. HierarchicalINIConfiguration fixes this problem.
HierarchicalINIConfiguration adds support for line continuation.
INIConfiguration has been deprecated. Its functionality is now available
through the new HierarchicalINIConfiguration class.
With HierarchicalINIConfiguration a complete new Configuration
implementation for parsing Windows INI files is available. This new
class is a full replacement of INIConfiguration and addresses some of its
shortcomings. Being derived from HierarchicalConfiguration it offers
the enhanced functionality of hierarchical configurations.
ConfigurationDynaBean now works properly with indexed properties
stored internally in the underlying configuration as arrays.
The iterator returned by HierarchicalConfiguration.getKeys(String prefix)
now also contains the prefix if this key is contained in the
configuration.
XMLPropertyListConfiguration is no longer limited to 32 bits integers.
When an XMLConfiguration is created using the copy constructor, the name
of the root element is now preserved.
Changing the text of the root element of an XMLConfiguration had no
effect when the configuration was saved. This has been fixed.
CombinedConfiguration used to send two EVENT_COMBINED_INVALIDATE events
for each modified child configuration. Now this event is sent only
once after the affected child configuration was updated.
XMLConfiguration now supports the xml:space attribute. This attribute
can be used to preserve whitespace in the content of XML elements.
INIConfiguration now preserves whitespace in quoted values.
If a change has been detected by FileChangedReloadingStrategy, the
reloadingRequired() method will now return true until
reloadingPerformed() has been called.
Fixed a NullPointerException that could be thrown under certain
circumstances when saving an XMLConfiguration that was created using
the constructor that takes a HierarchicalConfiguration.
Instantiating an XMLPropertyListConfiguration no longer fails
if the DTD is missing from the classpath.
It's now possible to read a configuration file containing
a '#' in its name (requires Java 1.4 or above).
Fixed the date format for XMLPropertyListConfiguration.
Some of the dependencies in the m2 pom have been updated to be more
consistent.
The dependency to commons-logging was updated to the current version
1.1. Older versions of commons-logging will still work.
A new method interpolatedConfiguration() was added to AbstractConfiguration.
This method returns a configuration with the same type and
content as the original configuration, however all variables have been
resolved.
Resolving of variables with the prefix const (constant fields) caused
a ClassCastException under certain circumstances if non-String fields
were involved. This has been fixed.
The dependencies to commons-codec and commons-jxpath have been marked
as optional. They are not required by the core classes.
There is a new configuration implementation EnvironmentConfiguration,
which provides access to (OS) environment variables. On Java >= 1.5
this class can be directly used; on earlier versions a dependency to ant
is required.
A bug in XMLConfiguration caused that attributes of the root element
could not be changed. This has been fixed.
A new method registerEntityId() was added to XMLConfiguration, which
allows to register URLs for entities. A new default implementation of
the EntityResolver interface handles these entities automatically.
The subset() method of HierarchicalConfiguration now takes the value of
the subset's root node into account if it is not ambigous.
Nodes added to a XMLConfiguration using the addNodes() method could
lose their value when the configuration was saved. This is now fixed.
New copy() and append() methods have been added to AbstractConfiguration.
They replace the methods with the same names in ConfigurationUtils,
which do not handle all features of AbstractConfiguration properly (e.g.
list delimiters in property values are incorrectly treated). To avoid
such problems, the new methods should be used.
The addNodes() method of hierarchical file-based configurations now
correctly triggers an auto save.
HierarchicalConfiguration.addNodes() now resets the reference property
of all nodes to be added. This fixes a problem with XMLConfiguration,
which now detects the added nodes as new and treats them correctly when
the configuration is saved.
DefaultConfigurationBuilder will now notify registered error listeners
about optional configuration sources that could not be created. Before
exceptions thrown by optional configurations were swallowed
ConfigurationUtils.convertToHierarchical() now correctly deals with
property values containing escaped list delimiters. This also affects
CombinedConfiguration when sub configurations with such property values
are contained.
AbstractConfiguration.addProperty() now correctly deals with list and
array properties if delimiter parsing is disabled.
The default expression engine used by HierarchicalConfiguration
instances is now lazily initialized. This avoids NullPointerExceptions
in certain server environments after a redeploy.
Cycles in the JNDI tree no longer cause a stack overflow in
JNDIConfiguration.
The base implementation of clear() in AbstractConfiguration now checks
for a potential UnsupportedOperationException when iterating over the
existing properties.
Using file-based configurations in auto-save mode together with a
reloading strategy could cause data loss. This has been fixed.
A PropertiesConfiguration that was created from a non existing file
lost its content when it was saved. This problem has been solved.
A new getSource() method was added to CompositeConfiguration and
CombinedConfiguration, which returns the child configuration, in which
a given property is defined.
PropertiesConfiguration now supports escaping the escape character for
list delimiters.
PropertiesConfiguration no longer escapes the list delimiter on saving
if the list delimiter has been disabled.
List properties and properties containing interpolated variables
are now properly saved by INIConfiguration.
When delimiter parsing was disabled for XMLConfiguration, saving and
loading the configuration accidently added escape characters to properties
containing the list delimiter character. This has been fixed. It is now
also possible to escape the escape character itself.
The return value of FileConfiguration.getFile() is now always
consistent with the result of getURL().
INIConfiguration uses the platform's specific line separator instead
of the Windows line separator.
INIConfiguration flushes the output at the end of a save operation.
For hierarchical file-based configurations the auto-save mechanism is
now also triggered if a subnode configuration is changed. In such a case
the new event type EVENT_SUBNODE_CHANGED will be sent to registered
listeners.
ConfigurationInterpolator now also invokes the default lookup object for
variables with a prefix that could not be resolved by their associated
lookup object.
A SubnodeConfiguration per default does not see certain changes of its
parent configuration (e.g. reloads). With a new boolean parameter of
HierarchicalConfiguration's configurationAt() method a mode can be
enabled, in which the subnode configuration checks for such changes and
reconstructs itself if necessary.
byte[] properties are properly saved as data fields in the plist
configurations (PropertyListConfiguration and XMLPropertyListConfiguration).
DataConfiguration now supports java.net.InetAddress,
javax.mail.internet.InternetAddress, and Java 5 enumeration types.
Properties are converted to these types using the new generic getters.
The object getters in DataConfiguration with no default value
(i.e getURL(key)) now throw a NoSuchElementException if the flag
throwExceptionOnMissing is set.
Generic get methods have been added to DataConfiguration (get(),
getArray() and getList())
XMLConfiguration used to drop attributes when an element's value was a
list. This has been fixed.
File configurations can now be saved to FTP URLs, or any other URL
protocol supporting data output.
Fixed a potential issue in DatabaseConfiguration where an error on
closing a statement would prevent the connection from being closed.
Date objects are now supported in ASCII plist files.
XMLPropertyListConfiguration no longer requires commons-digester and
commons-beanutils to work.
Fixed INIConfiguration to handle the quoted values and the lines
containing a value and a comment.
MapConfiguration and the web-based configurations now treat strings
that contain an escaped list delimiter correctly: The escape character
will be removed, so that for instance "foo\,bar" becomes "foo,bar".
DatabaseConfiguration now handles list delimiters in property values
correctly.
After cloning a XMLConfiguration there was still a connection to the
original configuration. So when the clone was modified and then saved
the content of the original configuration was written. This has now
been fixed.
Class loading in BeanHelper is now done using ClassUtils of Commons
Lang.
With ManagedReloadingStrategy a new reloading strategy for file-based
configurations was added that can be triggered through JMX.
The dependencies to Commons Lang, Commons Collections, and Commons Digester
are updated to use the recent available version. However older versions
will still work.
A pom for maven 2 was added.
ConfigurationUtils.getFile() now always checks first whether the passed
in file name is absolute. If it is, this file will be returned. This
prevents that on Unix under certain circumstances absolute file names
are interpreted as relative ones.
The dependency to xml-apis was changed to the version 1.0.b2. The so
far used version 2.0.2 is reported to be bogus.
In addition to configuration event listeners now so-called configuration
error listeners are supported. These listeners are notified about
internal errors that had been logged and swallowed by privious versions.
The new enableRuntimeExceptions() method of ConfigurationUtils
registers a special error listener at the passed in configuration that
generates a runtime exception when an error event is received.
AbstractConfiguration now allows to set an instance specific logger
using the setLogger() method. This gives clients more control over a
configuration's logging behavior.
SubsetConfiguration and CompositeConfiguration were updated to fully
support an instance specific list delimiter. Concerning splitting of
string properties that contain a list delimiter character, these
classes now behave like a "normal" configuration.
Variable interpolation features have been improved. A variable can now
have the form ${prefix:variableName} where the prefix
defines the type of the variable. The standard types sys for
system properties and const for constants are supported.
Variables without a prefix are treated as references to other
configuration properties (which is compatible to earlier versions).
Commons Configuration now depends on Commons Lang 2.2. Some features
of Lang's new text package are used.
The number of dependencies needed for DefaultConfigurationBuilder was
reduced by letting some of the default configuration providers resolve
their classes per reflection.
File-based configurations with a reloading strategy did not work well
together with CombinedConfiguration because the reloading strategy is
only checked when its associated configuration is accessed (which does
not happen when only the combined configuration is queried).
As a workaround CombinedConfiguration now provides the boolean
forceReloadCheck property. If this is set to true, all contained
configurations will be triggered when a property is queried. This will
cause a reload if necessary.
Configuration declarations in the configuration definition file for
DefaultConfigurationBuilder that are marked as optional now support a
new attribute config-forceCreate. If this attribute is set
to true and the initialization of the configuration fails,
DefaultConfigurationBuilder tries to add an empty configuration of the
correct type to the resulting combined configuration. Before this
change optional configurations that caused errors were never added to
the combined configuration.
CompositeConfiguration.clearProperty() now generates the correct
update events.
The configuration returned by HierarchicalConfiguration.subset()
performed variable interpolation only in the keys that belong to the
subset. Now the parent configuration is searched, too, to resolve the
value of the referenced property. This is consistent with the way
SubnodeConfiguration works.
DefaultConfigurationBuilder now internally uses the standard expression
engine for hierarchical configurations. So the dependency to Commons
JXPath is no more needed when this class is used. Note that this change
has some impact on existing code that manually sets properties before
the combined configuration is created; this code must now be adapted to
the changed syntax of property keys.
HierarchicalConfiguration and some of its sub classes now define a
copy constructor.
A new configuration class for windows ini files was added.
For file-based configurations loaded by ConfigurationFactory the load()
method was called before all of the properties specified by attributes
of the XML element have been initialized. Now load() is called after
property initialization.
Interpolation of non string values did not work when SubsetConfiguration
was involved. This has now been fixed.
The compatibility of ConfigurationDynaBean with other configuration types
than those that inherit from BaseConfiguration was improved.
The getList() method of CompositeConfiguration does now fully support
variable interpolation. So it is possible to refer to a variable in
one (sub) configuration that is defined in another configuration.
XPathExpressionEngine used to create wrong keys for attribute nodes.
This caused some operations on XMLConfiguration to fail when such an
expression engine was set (e.g. reloading). Now correct keys for
attributes are constructed.
Some of the methods of file-based hierarchical configurations (e.g.
subset() or configurationAt()) did not take an eventually set reloading
strategy into account. This is now fixed by overriding the internal
fetchNodeList() method in AbstractHierarchicalFileConfiguration and
letting it always check for a reload.
AbstractFileConfiguration now overrides addProperty() and setProperty()
instead of addPropertyDirect() to implement the auto save feature.
This was necessary to properly integrate PropertiesConfigurationLayout.
It has also the advantage that an auto save is triggered only once if
multi-valued properties are involved (before a save operation was
performed for each property value).
The new PropertiesConfigurationLayout class broke the save() operation
of PropertiesConfiguration when an instance was newly created and
populated in memory. This is fixed now by ensuring that a layout object
is immediately created and registered as event listener at the
configuration.
ConfigurationFactory now supports variables in its configuration
definition files. These variables are resolved using system properties
and have the typical ${} syntax.
There were still some problems with resolving relative paths when
configuration files are loaded from classpath. This fix addresses these
issues.
DataConfiguration.getDateArray() used to ignore the format argument.
This was fixed.
PropertiesConfiguration now defines its own clone() method to handle
the associated PropertiesConfigurationLayout object correctly.
The dependency to servletapi was updated from version 2.3 to version
2.4, but version 2.3 will still work.
A new class PropertiesConfigurationLayout was introduced whose task is
to preserve the structure (e.g. comments, blanc lines) of a file
loaded by PropertiesConfiguration. Each PropertiesConfiguration
object is now associated with such a layout object. A saved properties
file will look very similar to its original.
clone() methods have been added to BaseConfiguration, AbstractFileConfiguration,
MapConfiguration, CompositeConfiguration, and CombinedConfiguration.
So the most important Configuration implementations now support
cloning. To ConfigurationUtils an utility method cloneConfiguration()
was added that allows to conveniently clone a configuration.
If a configuration file was to be loaded from classpath, the
constructor of AbstractFileConfiguration dropped the file's path. The
path is now taken into account.
The getter methods for numeric data types in AbstractConfiguration now
support conversions between different Number types, e.g. you can now
call getLong(key) when key points to an Integer value.
The new class DefaultConfigurationBuilder was added as an alternative to
ConfigurationFactory. It provides some more features and creates a
CombinedConfiguration object
The new class CombinedConfiguration was added as a hierarchical
alternative to CompositeConfiguration.
Support for low-level configuration events was added to all classes
derived from AbstractConfiguration. The major part of this is handled
by the new super class EventSource of AbstractConfiguration.
A new method convertToHierarchical() was added to ConfigurationUtils,
which is able to convert an arbitrary configuration object into a
hierarchical configuration.
Loading of file-based configurations no longer throws a NullPointerException
in setups where the thread context class loader is not set.
The dependency to dom4j was removed; it was only used by two test classes,
which have been re-written.
XMLConfiguration used to drop the DOCTYPE declaration when saving the
configuration. It is now able to extract the DTD's public and system ID
and write them back (more complex DOCTYPE declarations are still not supported).
With the new methods setSystemID() and setPublicID(), the DOCTYPE
declaration can be configured.
Added two new constructors in CompositeConfiguration accepting a
collection of configurations as a parameter.
(Basic) Support for declaring beans in configuration files was added.
Some new classes in the beanutils package allow to create instances from
these declarations.
The implementation of the interpolation features have been extracted out
off AbstractConfiguration and moved to PropertyConverter. The
interpolateHelper() method of AbstractConfiguration is now deprectated
and will not be called any more during interpolation.
A new method configurationsAt() was added to HierarchicalConfiguration
that provides a convenient way of iterating over complex list-like
structures without the need of manually constructing configuration keys
with indices.
A new class SubnodeConfiguration was introduced that wraps a configuration
node of a HierarchicalConfiguration. All operations performed on this
configuration use this wrapped node as root. The new configurationAt()
method of HierarchicalConfiguration returns such a SubnodeConfiguration
for a specified sub node.
With XPathExpressionEngine an expression engine for hierarchical
configurations is now available that can evaluate XPATH expressions in
property keys. This expression engine implementation is based on
Commons JXPath, which is now declared as a new dependency (but at
runtime it is only needed if the XPathExpressionEngine class is used).
The code for interpreting property keys was refactored out off
HierarchicalConfiguration. Instead this class now supports pluggable
expression engines (using the setExpressionEngine() method). So it is
possible to plug in different expression languages. A default expression
engine is provided that understands the native expression language used
by hierarchical configurations in older versions. During the process of
this refactoring some methods of HierarchicalConfiguration have been
deprecated; they will not be called any more when searching or adding
properties. These are the following: createAddPath(), fetchAddNode(),
findLastPathNode(), findPropertyNodes().
A larger refactoring was performed on the inner Node class of
HierarchicalConfiguration: A ConfigurationNode interface was extracted
for which a default implementation (DefaultConfigurationNode) is
provided. HierarchicalConfiguration.Node now extends this default
implementation. The new ConfigurationNode interface defines some more
methods than the Node class did originally for conveniently dealing with
sub nodes and attributes. HierarchicalConfiguration now uses the new
type ConfigurationNode whereever possible. Some methods dealing with
Node objects have been deprecated and replaced by versions operating on
ConfigurationNode objects instead.
All configuration classes derived from AbstractConfiguration now allow
to set an instance specific list delimiter. This can be done through
the new method setListDelimiter(). As before it is possible to define
a default list delimiter, which will be used if no instance specific
delimiter is set. This can be done using the new setDefaultListDelimiter()
method (the methods get/setDelimiter() have been deprecated). With the
new setDelimiterParsingDisabled() method parsing of lists can be
disabled at all.
Commons Configuration now declares a dependency to Xalan. As with
Xerces this dependency is only needed for JDK 1.3. It was introduced
in a process of making Configuration buildable on a JDK 1.3. Documentation
about the build process was also added.
The dependency to Commons Beanutils Collections was unnecessary and
thus removed.
Commons Configuration now depends on Commons Digester 1.6 instead of 1.5.
(This was done only to pick up the latest available release of digester.)
ConfigurationDynaBean now implements the java.util.Map interface (as
was stated in the javadocs). This was done by deriving the class from
ConfigurationMap.
The reload() method in AbstractFileConfiguration was updated to prevent
reentrant invocation, which may be caused by some methods when they
are called during a reloading operation.
AbstractHierarchicalFileConfiguration, a new base class for file based
hierarchical configurations, was introduced. XMLConfiguration now
extends this class.
XMLConfiguration now prints the used encoding in the xml declaration of
generated files. In earlier versions always the default encoding was
written. PropertiesConfiguration now always uses the platform specific
line separator when saving files.
PropertiesConfiguration now translates properly the escaped unicode
characters (like \u1234) used in the property keys. This complies with
the specification of java.util.Properties.
ConfigurationConverter.getProperties() now uses the delimiter of the
specified configuration to convert the list properties into strings.
The interpolation of variables (${foo}) is now performed in all property
getters of AbstractConfiguration and DataConfiguration. As a side effect
the Properties object returned by ConfigurationConverter.getProperties()
contains only interpolated values.
PropertiesConfiguration now uses the ISO-8859-1 encoding by default
instead of the system encoding to comply with the specification of
java.util.Properties.
JNDIConfiguration no longer logs an error when attempting to get
a property that doesn't exist in the configuration.
Attempting to load a configuration from a directory instead of a file
will now throw a ConfigurationException.
If a multi-valued property was involved in an interpolation operation,
AbstractConfiguration created a string representation of the list of all
values. This was changed to only use the first value, which makes more
sense in this context and is consistent with other getters for single
valued properties.
If an include file with a relative path cannot be found in the base
path, PropertiesConfiguration now also tries to resolve it based on its
own location.
Fixed MapConfiguration to store the list of values added under a same
key instead of the last value added.
Fixed a bug in the handling of relative file names in ConfigurationFactory:
In most cases relative file names were not resolved relative to the
location of the configuration definition file as stated in the documentation.
This behavior was now changed to always be in sync with the documentation.
This may have an impact on existing code which uses workarounds for
the erroneous resolving mechanism.
Empty elements or elements whose content consists only of comments or
whitespace are now taken into account by XMLConfiguration. They are
added to the configuration; their value is an empty string.
XMLConfiguration now sets a valid system id in the InputSource used for
loading files. This enables XML parsers to correctly resolve relative
files, e.g. DTDs.
getKeys() in HierarchicalConfiguration now returns the keys in the same order the properties were inserted.
Commons Configuration now depends on Commons Collections 3.1 instead of 3.0
New configurations implementing the "property list" format used in
NeXT/OpenStep and its XML variant used in Mac OS X.
(PropertyListConfiguration and XMLPropertyListConfiguration)
Resolved some issues with XMLConfiguration and properties containing
the delimiter character. These properties are now correctly treated,
escaping the delimiter will work, too.
Added support for XMLPropertiesConfiguration in ConfigurationFactory.
A <properties> element will generate a XMLPropertiesConfiguration
if the filename ends with ".xml".
PropertiesConfiguration now supports escaped key/value separators in the keys
(i.e foo\:key = bar).
PropertiesConfiguration now supports all key/value separators supported by java.util.Properties
('=', ':' and white space characters).
Commons Configuration now depends on Commons Lang 2.1 instead of 2.0
Comment lines for PropertiesConfiguration can start with the '!' char (compatibility with java.util.Properties).
Because ConfigurationUtils.copy() does not fully support hierarchical
configurations a clone() method was added to HierarchicalConfiguration
that can be used instead.
XMLConfiguration now provides some support for validating XML
documents. With the setValidating() method DTD validation can be
enabled. It is also possible to set a custom DocumentBuilder allowing
a caller to perform enhanced configuration of the XML loading process.
AbstractFileConfiguration now always sets a valid base path if the
configuration file could be located. This allows PropertiesConfiguration
to resolve include files even when loaded from class path.
Updated XMLConfiguration to correctly deal with properties containing
dots in their names. Such properties could not be accessed before.
PropertiesConfiguration's handling of backslash characters at the end
of line was incorrect when there was an even number of trailing
backslashes. This is now fixed.
Fixed a problem related to file based configurations that are loaded
from a URL which is application/x-www-form-urlencoded: the save() method
would store such files at a wrong location.
Updated FileChangedReloadingStrategy to use the file based configuration's
source URL to find the file to watch. Before that it was possible that
the strategy checked the wrong file. For configuration files loaded
from a jar FileChangedReloadingStrategy now checks the jar file itself
for changes. Finally a bug was fixed which caused the strategy to
check the watched file's last change date on every invocation of its
reloadingRequired() method ignoring its refresh delay. Thanks to Jorge
Ferrer.
Fixed a bug in the collaboration between XMLConfiguration and its
reloading strategy: The configuration did not check its reloading
strategy, so no reload was performed.
Disabled auto save mode during PropertiesConfiguration.load(). Prior
it was possible that the properties file to be loaded was immideately
overwritten.
Under certain circumstances it was possible that a reloading strategy
set for PropertiesConfiguration interferred with the save() method causing
the configuration file to be erased. This has now been fixed.
AbstractFileConfiguration now stores the URL of the config file in the
load() methods. This URL is reused by the save() method to ensure that
the same file is written.
XMLPropertiesConfiguration no longer depends on Digester to parse the
configuration file, it's now implemented with a pure SAX parser.
Fixed a bug which causes XMLConfiguration.save to lose attribute values
under some circumstances. The clear() method now also ensures that the
associated DOM document is always cleared.
XMLConfiguration now parse the configuration using the encoding
declared in the XML header instead of the OS default encoding.
XMLConfiguration now uses the delimiter set by setDelimiter(char).
Fixed a ConcurrentModificationException thrown when calling clear()
on a SubsetConfiguration applied to a BaseConfiguration.
The resolveContainerStore() method in AbstractConfiguration now works
properly with arrays of objects and arrays of primitives. This means
it is possible to store an array of value in the configuration and
retrieve the first element with the getString(), getInt()... methods.
Updated documentation for FileConfiguration's load() methods. Fixed a
problem in XMLConfiguration with the output of the save() method when
multiple files were loaded.
Fixed a bug in FileChangedReloadingStrategy preventing the detection
of a file change in some cases.
Changed getXXXArray() and getXXXList() in DataConfiguration to return
an empty array/list for empty values.
Fixed getLongArray(), getFloatArray() and getDoubleArray() in DataConfiguration,
the values were cast into integers.
ConfigurationFactory now always configures digester to use the context
classloader. This avoids problems in application server environments,
which use their own version of digester. Thanks to Mike Colbert for the
patch!
Added a new configuration, XMLPropertiesConfiguration, supporting the
new XML format for java.util.Properties introduced in Java 1.5.
A 1.5 runtime is not required to use this class.
Added a comment header to PropertiesConfiguration. The header is not
parsed when the file is loaded yet.
Added the setEncoding(String) and the getEncoding() methods to the
FileConfiguration interface to control the encoding of the
configuration file.
Access to the top level element of the XML document is now provided. For
newly created configurations this element can be changed before the
document is written.
Merged the two XML related configuration classes into one new class
XMLConfiguration. This new class should provide the best of its
ancestors.
Replaced the PropertyTokenizer inner class in AbstractConfiguration
with the split method in PropertyConverter. Also moved the method
building an iterator on the elements of a composite value in
PropertyConverter as toIterator().
Some cleanup of the handling of the base path in file based configurations.
The base path is now always taken into account.
Calling getProperties on a JNDIConfiguration no longer throws an
UnsupportedOperationException.
Removed the getPropertyDirect method from AbstractConfiguration,
concrete configurations now implement directly the getProperty method
from the Configuration interface.
Added implementation of a save() method for HierarchicalXMLConfiguration.
Constructing a file based configuration with a File no longer throws
an exception when the file doesn't exist.
Saving a configuration now creates the path to the file if it doesn't exist.
AbstractFileConfiguration.save(File) no longer fails silently when
an error occurs, a ConfigurationException is thrown instead.
ConfigurationUtils.locate() now checks if the URL based resources exist.
This fixes a bug preventing configuration files from being found if
the configuration descriptor is in a JAR file (reported by Grant Ingersoll).
Fixed NPE that were caused in the constructors of file based
configurations if an invalid file name was specified.
Added support for optional configuration sources in definition files for
ConfigurationFactory. A new optional attribute allows to specify whether a
configuration source is mandatory or optional.
JNDIConfiguration.getKeys() now returns an empty iterator instead of
throwing a ConfigurationRuntimeException when a NamingException occurs.
The NamingExceptions are now logged.
DatabaseConfiguration.isEmpty() now returns true if an SQLException occurs.
Added two methods copy(Configuration, Configuration) and
append(Configuration, Configuration) in ConfigurationUtils to copy
properties between configurations.
Moved the constructors implementations from PropertiesConfiguration and
XMLConfiguration to AbstractFileConfiguration.
Remove deprecated getVector() implementations.
File based configurations can now be automatically reloaded when the
underlying file is modified.
Added a clear() method to the Configuration interface to remove
all properties.
Added a SystemConfiguration wrapping the system properties.
ConfigurationFactory recognizes the corresponding <system/>
element.
Added a MapConfiguration to turn any Map into a Configuration. The
getConfiguration() methods in ConfigurationConverter now use
MapConfiguration, as a result the Configuration returned is always
synchronized with the underlying Properties or ExtendedProperties,
changes made to the Configuration are available in the Properties,
and reciprocally.
The "autoSave" feature of XMLConfiguration has been generalized
to all file based configurations.
Numeric properties can now be specified in hexadecimal format,
for example "number = 0xC5F0".
Fixed HierarchicalConfiguration.getKeys(String), it returned an empty
iterator if the prefix string contained indices.
Added a DataConfiguration decorator providing getters for all useful
types found in a configuration (URL, Locale, Date, Calendar, Color,
lists and arrays)
Added 5 new configurations to be used in a web environment:
AppletConfiguration, ServletConfiguration, ServletContextConfiguration,
ServletRequestConfiguration, ServletFilterConfiguration.
The getStringArray() method in CompositeConfiguration now interpolates
the strings.
SubsetConfiguration now shares the "throwExceptionOnMissing" property
with its parent.
Removed "file:" at the beginning of the base path when calling
setFile() on a FileConfiguration. This prevented auto saving an
XMLConfiguration loaded from a File (issue reported by Mark Roth).
All NamingEnumerations in JNDIConfiguraiton are now properly closed (Suggested
by Eric Jung).
Properties added to an XMLConfiguration are no longer duplicated in the
resulting XML file.
Unified the mechanisms for loading and saving file based configurations.
PropertiesConfiguration, XMLConfiguration and HierarchicalXMLConfiguration
now implement the same FileConfiguration interface. BasePathLoader,
BasePathConfiguration, ClassPropertiesConfiguration and
BasePropertiesConfiguration have been removed.
Replaced the calls to Boolean.booleanValue(boolean) in
AbstractConfiguration and ConfigurationDynaBean to be Java 1.3
compatible.
Changing the prefix of a JNDIConfiguration will now reset the base context used.
The context used by JNDIConfiguration can be specified in its
constructor or through the setContext() method. The context can be
accessed with the getContext() method which is now public.
Make the behaviour on missing properties for the get methods that
return objects configurable. A property throwExceptionOnMissing
can be set and then the getters throw an NoSuchElementException.
The old default behaviour of returning a null value has
been restored.
Allow configurations extending AbstractConfiguration to change the
delimiter used from "," to something else.
PropertiesConfiguration.save() method has issues with preserving the filename
Test cases for HierarchicalConfigurationXMLReader stores comments as text nodes.
Clarify for ConfigurationDynaBean that the get method should throw an
illegalArgumentException if there is no property specified.
Fixed a ClassCastException when adding a non String property to an XMLConfiguration.
Fixed the handling of attribute properties by HierarchicalConfigurationConverter.
Fixed a ClassCastException thrown on adding a non string property
in a DatabaseConfiguration.
Bring back the getVector() methods in the Configuration interface.
These methods are needed for "drop-on" replacement of the
various pre-1.0 commons-configuration snapshots and are already
deprecated. These methods will be removed for 1.1.
HierarchicalConfigurationXMLReader stores comments as text nodes.
project.xml contains bad dependencies.
clearXmlProperty doesn't remove list properties completely.
new ConfigurationDynaBean.
new ConfigurationMap and ConfigurationSet.
Problem adding property XMLConfiguration.
ConfigurationXMLDocument removed until post 1.0.
DatabaseConfiguration doesn't support List properties.
Fixed a bug related to XMLConfiguration. Can't add a new property as an
attribute in XMLConfiguration.
Fixed a bug related to XMLConfiguration. XMLConfiguration doesn't
support attribute names with a dot.
Fixed a bug related to XMLConfiguration. XMLConfiguration doesn't ignore
comments.
Fixed a bug related to XMLConfiguration. XMLConfiguration.save() doesn't
escape reserved characters.
Added save methods in XMLConfiguration similar to PropertiesConfiguration
to save the configuration to another file.
Removed the DOM4J implementations in favor of the DOM ones.
DOMConfiguration has been renamed to XMLConfiguration, and
HierarchicalDOMConfiguration to HierarchicalXMLConfiguration. The
elements parsed by the ConfigurationFactory have been changed
accordingly.
Added a save() method to PropertiesConfiguration and save(Writer out),
save(OutputStream out), save(OutputStream out, String encoding) to
BasePropertiesConfiguration.
List values are now properly stored as comma separated values in the
Properties object returned by ConfigurationConverter.getProperties()
Introduced a ConversionException thrown when the value of a property is
not compatible the type requested. It replaces the ClassCastException
and the NumberFormatException thrown previously.
Tokens like ${ref} in a PropertyConfiguration are now properly saved.
The getList() method of a CompositeConfiguration now returns the list
composed of the elements in the first matching configuration and the
additional elements found in the in memory configuration.
SubsetConfiguration returns a List on getList(). AbstractConfiguration
wouldn't properly deal with a List, only with a Container for getList()!
Thanks to jschaible for the unit test.
Direct support of XML via DOM. New classes DOMConfiguration and HierarchicalDOMConfiguration.
Update build to not include test configuration files in resulting jar.
Refactored JNDIConfiguration to use AbstractConfiguration.
Fixed invalid subsets by refactoring out the subset logic into a SubsetConfiguration.
Reapply the ConfigurationXMLDocument that went missing during migration out of sandbox.
Apply ASL 2.0 license. Thanks to Jeff Painter for scripting the conversion!
Changed CompositeConfiguration to extend from AbstractConfiuration. This means that the behavior of
CompositeConfiguration is much similar to others like PropertiesConfiguration in handling of missing
keys, interpolation, etc.. Previously CompositeConfiguration had quite a few differences.
Removed "defaults" from BaseConfiguration. Defaults are now done via using a CompositeConfiguration, either
directly or via a ConfigurationFactory. if you want to save changes made to a Configuration, then you use
a CompositeConfiguration and get back the inMemoryConfiguration that has the delta of changes. Added a
bit of documentation on this.
Enhancement: Configuration Comparator.
BaseConfiguration: containsKey ignores default properties.
I have changed it so that now the defaults are paid attention to.
The Configuration interface now supports BigDecimal and BigInteger numbers.
ConfigurationException is now thrown by public methods instead of Exception or
IOException or whatnot.
For configuration based on properties files, allow characters like \n etc
to be escaped and unescaped.
New DatabaseConfiguration that uses a database to store the properties.
It supports 2 table structures: one table per configuration (2 colums
key/value), one table for multiple configurations (2 columns key/value +
1 column for the name of the configuration).
ConfigurationFactory now supports the hierarchicalDom4j element in configuration
definition file
Change all Vector objects to List objects.
ConfigurationFactory now supports two types of properties files, additional and
override. Additional properties add each other together. Override override each
other. This allows you to have a single property that is either aggregated from a
number of sources, or have a property that is overridden according to a specific
order of sources.
AbstractConfiguration addProperty now delegates to an abstract addPropertyDirect
implemented by BaseConfiguration.
Changed getString() method to throw a NoSuchElementException instead of "" if the
configuration property doesn't exist.
Added AbstractConfiguration to make it easier to create subclasses by only
having to implement the methods required.
ClassPropertiesConfiguration Additions:
Use the classloader of class that is provided by the constructor.
Add a constructor that indicates whether to use relative or absolute.
Change getPropertyStream to utilize the relative or absolute flag.
Add a test case that checks that absolute paths work.
JNDIConfiguration.getKeys() Addition:
The JNDIConfiguration.getKeys() method was returning an unsupported
operation error. However, this is an important method to have
supported.
CompositeConfiguration.getKeys() Fix
The CompositeConfiguration.getKeys() method was returning an
unordered list of configuration values. However, many apps
expect the order that keys are returned to be the order they
are added into the properties file.