AJCT – Another Java Configuration Tool
AJCT is -as the name indicates- another java configuration tool. It enables java application developers to easy configure their applications, whither running standalone or inside a J2EE server. It is set up as an extendible framework, providing some default configuration sources:
From AJCT v0.2 on:
And some default 'targets', enabling basic integration with other components:
From AJCT v0.1 on:
From AJCT v0.1 on:
The following sources/targets are in the pipeline:
v0.3 - XML dump: export one or more sections to an XML file (AJCT compatible format).
v0.3 - LDAP Query: import configuration data from an LDAP query.
JBoss cache: import/export configuration data from JBoss' cache.
XML template: export using an XML file as template.
Text template: export using a text file as template.
Why or when to use AJCT?
AJCT is useful in the following situation:
When using different environments (development, test, production, etc.). Every environment has the same core configuration, but eg different user name/passwords or web service endpoints. AJCT enables you to create a hierarchy of configuration files (e.g.: one common for all environment and one with specifics for a given environment overwriting or extending the common configuration)
When having several configuration sources: your application has its own configuration, but you also need to retrieve configuration data from e.g. a central store.
When running the same application across multiple JVM's, AJCT can be used to access the same common configuration (and optionally some specifics for the given JVM).
Reusing the same value in different configuration values (eg: host name of a server is used in several web service endpoints or JNDI addresses). AJCT allows for substitution: configure the host name once, and use the substitution to use it where needed.
Default set-up for most applications. The default set-up looks for a file called '<hostname>.config.xml' in the classpath.
Extensible: if you have a configuration source not yet provided, you can extend AJCT.
Support for 'namespacing'. When running multiple applications inside one J2EE, this allows for each application to use its own configuration namespace (or all use the same if wanted).
Automatically reload of configuration at the given interval (interval can be a configuration parameter).
Configuration file is processed in the order of appearance.
The initial hit against AJCT costs the most: it will read the configuration in the calling thread. Subsequent automatic reloads are performed in a background thread having little impact on the system.
Memory wise, it is good to know that all configuration data is read into memory. This should not be an issue for most application (reading a couple of hounderd string into memory).
AJCT is threadsafe: reloading the data is done in a new configuration object. Only when the complete set is reloaded into memory and processed, the current configuration data is replaced with the new data (synchronized).