commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom <t...@tbee.org>
Subject [Commons Configuration] idea
Date Thu, 08 Jun 2006 09:29:13 GMT
I have no idea if CC support this, but it's an FYI: I use a home made 
configuration class. The idea behind it is that some configuration items 
are relevant in a machine context (DB hostname?), others only for a user 
(GUI settings?), other in the combination of machine and user (home 
dir?), so this class automatically collects configuration based on the 
context it is running in. The context is determined by attributes, these 
attributes can be provided manually after instantiation, and some are 
set automatically. The class then tries to find configuration files in 
the classpath that match the current attributes.

Say you have a machine name "compA", a user "userB", it searches for:

configuration.properties
configuration#system=compA#.properties
configuration#user=userB#.properties
configuration#system=compA#user=userB#.properties

Of course the default prefix "configuration" can be altered to, for 
example, the application name.

The biggest advantage is that it is possible to check the configuration 
files into the repository. When checking it out on another system, it 
automatically uses other configuration files, so there is no 
"configuration war". Naturally it has a monitoring thread to detect 
changes, allows chaining to make configuration even more flexible, etc.

Just a FYI.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message