EasyConf aims to be as easy to use as possible. If all you want is to make configurable a constant or a set of constants a single line of code for each is needed. But it is not much harder when your necessities grow and you want to use complex XML configuration.
This guide provides full documentation of all of EasyConf's features and points to documentation of the libraries it depends for further information.
EasyConf was born from necessity because none of the existing libraries had all the needed functionality. But it is not our intent to reimplement what does exist so whenever possible we'll base its functionality in existing free software libraries.
EasyConf organizes the configuration it reads in components. Each component has its own name and is composed of two parts:
A component can have only properties, only a configuration object or have both.
Let's start with the examples. To obtain the configuration of an application named my-app you have to write the following code:
ComponentConfiguration conf = EasyConf.getConfiguration("my-app");
ComponentConfiguration is the class which holds the configuration of my-app. To retrieve the properties all you have to do is:
ComponentProperties props = conf.getProperties();
ComponentProperties contains methods to retrieve properties of any of the supported types. The properties of the example component will be read from a file called my-app.properties. Later will see that properties can also be read from other complementary sources.
The configuration object can be read using another method of the conf object:
Object confObj = conf.getConfigurationObject();
The configuration object contains a representation of an XML file. The XML file can have any user defined vocabulary, but it must be given the name of the component with xml as the extension. In our example it must be called my-app.xml. This file will be read and converted to user defined classes. The conversion is configured in a mapping file which must have digesterRules.xml as its extensions. In our example it should be called my-app.digesterRules.xml
Now you that you have the big picture, the next sections will give more details and examples of the features of EasyConf
This manual is a work in progress. Here is the expected table of contents:
Specific use cases (TBD)
The progress of this manual can be followed viewing the latest CVS files