Summary
The Apache Jakarta Commons project released a new version of its Java configuration library. The Commons Configuration library abstracts out application configuration from property files, XML, and even applet parameters into a unified API.
Advertisement
Enterprise application configuration has been among the most-discussed topics in recent years. For example, many enterprise frameworks claim that simplifying configuration of objects, or an entire application, is among the framework's biggest benefits.
The Commons Configuration project takes a lower-level approach to configuration than most frameworks do, and aims to feed to an application configuration options specified via a multitude of sources, such as:
Property files
XML documents
Property list files (.plist)
JDNI
JDBC resources
System properties
Applet parameters
Servlet parameters
The Commons Configuration project's documentation states that:
Different configuration sources can be mixed using a ConfigurationFactory and a CompositeConfiguration. Additional sources of configuration parameters can be created by using custom configuration objects. This customization can be achieved by extending AbstractConfiguration or AbstractFileConfiguration.
One advantage of the Commons Configuration library is that it provides a listener mechanism to notify an application of configuration changes. The latest 1.4 release adds listeners for configuration errors, as well:
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.
Other new Commons Configuration features include alignment with the latest Commons Collections, Lang, and Digester packages, as well as a long list of bug fixes and implementation changes.
What mechanisms do you prefer when specifying configuration options for your applications?