commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörg Schaible <>
Subject [configuration] Local lookup fix & enhancement
Date Fri, 06 Mar 2009 20:59:08 GMT
Hi folks,

it has been a while since I committed last time something to configuration.
It has been improved a lot since then and one of the newer features are the
user defined StrLookup support. However, nothing is perfect and I'd like to
work somewhat on it. My proposed

1/ While it is quite easy to register a global StrLookup, it is not so easy
to work with the local ones. Especially since those are no longer available
for a SubsetConfiguration:


assertEquals("bar", config.getString("moduleA.value"));
assertEquals("bar", config.subset("moduleA").getString("value"));

The second assert fails. I've prepared patches to support this scenario.

2/ In my use case I have a big "unified" configuration, actually based on a
CompositeConfiguration with an overloaded createInterpolator method. The
configuration itself combines system properties, an individual
configuration for a module and a default configuration file. Each module
will use then its own subset (so it can be used or tested individually),
but the scenario allows me to override every configuration value from
command line or use a default value in the standard file. However,
sometimes the individual modules share some settings and therefore I
invented auto-lookups based on a local StrLookup. These auto-lookup are
defined automatically using the keys in the configuration itself, i.e.

- "auto.lookup" defines the root node for the automatically registered local
lookups (the name of this root can be set individually for a configuration)
- the next node defines the namespace of the lookup
- all nodes below "auto.lookup.XXX" are part of the local lookup
- even for subsets of the individual modules these local auto-lookups work:

As said I've implemented this currently in a derived class of
CompositeConfiguration, but it might be added to AbstractConfiguration. The
name of the auto-lookup root is provided as ctor param. The local StrLookup
itself is again based on a Configuration (actually a subset of the name
giving node).


- Jörg

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message