commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <ebo...@micropole-univers.com>
Subject Re: [configuration] SubsetConfiguration
Date Fri, 05 Mar 2004 11:17:10 GMT
I tried to push the reasoning a bit further yesterday and observed that 
if there is a SubsetConfiguration shifting the parent keys to the left, 
we might imagine a SupersetConfiguration shifting the keys to the right 
by adding a prefix. Both classes could even be merged into a 
TranslatedConfiguration. But what use case could require the addition of 
a prefix to all the keys of a configuration ? I identified 2 use cases:

- ini files, a section is basically a configuration translated to the 
right by the section name.

- configuration "mounting" in a CompositeConfiguration, to mix 
heterogeneous configurations with identical keys into a unique 
configuration. For example, given 2 configurations:

mail.properties:
server=smtp.xyz.com

database.properties:
server=db.xyz.com

One would mount the configuration into a CompositeConfiguration to avoid 
conflicts:

composite.addConfiguration(new TranslatedConfiguration(mail, "mail"));
composite.addConfiguration(new TranslatedConfiguration(database, 
"database"));

composite.getString("mail.server");
composite.getString("database.server");


Emmanuel Bourg

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


Mime
View raw message