views:

302

answers:

4

Hi,

I need to decide which configuration framework to use. At the moment I am thinking between using properties files and XML files. My configuration needs to have some primitive grouping, e.g. in XML format would be something like:

<configuration>
    <group name="abc">
        <param1>value1</param1>
        <param2>value2</param2>
    </group>
    <group name="def">
        <param3>value3</param3>
        <param4>value4</param4>
    </group>
</configuration>

or a properties file (something similar to log4j.properties):

group.abc.param1 = value1 
group.abc.param2 = value2

group.def.param3 = value3
group.def.param4 = value4

I need bi-directional (read and write) configuration library/framework. Nice feature would be - that I could read out somehow different configuration groups as different objects, so I could later pass them to different places, e.g. - reading everything what belongs to group "abc" as one object and "def" as another. If that is not possible I can always split single configuration object into smaller ones myself in the application initialization part of course.

Which framework would best fit for me?

+6  A: 

Since you are saying that it is possible to also store objects in the config, I would suggest this:

http://commons.apache.org/configuration/

dimitko
A: 

I've suggested an approach here which fits perfectly to your requirements, assuming your applications use some kind of database.

Tomislav Nakic-Alfirevic
+2  A: 

The simplest way to do this would be to use Simple XML. It can bind XML to Java POJOs in a very simple manner. Also, it is much faster than other such XML binding frameworks.

http://simple.sourceforge.net

Only 270K with no dependencies.

ng
A: 

Please take a look at this URL: http://issues.apache.org/jira/browse/CONFIGURATION-394

The Configuration framework which we're looking for it is something on top of Apache Commons Configuration and must support Concurrency Issues, JMX issues and most of stores(e.g .properties file, .xml files or PreferencesAPI).

What weblogic team provides on 'Administration Console' is intersting which through it you can have transactional(atomic) updates on configurations so that are registered listeners be notified.

The Apache guys insist that this project is out of scopes of Commons Configuration, maybe!

I've attached a simple configuration framework, take look please

john smith