Hi all,
The scenario is you have a large set of application configuration
settings comming from: ldap, property files etc.
The problem is many sections of your application depend on many
different configuration settings. I am bored of seeing a big fat and
evil global class having the indecent exposure smell that is used from
every point of the application and the "reading configuration
parameters" concern scattered all over.
Any ideas or approaches to address this very problem?
Given that configuration management is more close to a "non-funtional
concern" would it make sense using AspectJ and take the concern out of
the first OO dimension? examples? also would it bring in this case
another problem that configuration management needs another
"non-funtional concern" logging ...
Thanks in advance,
Best Regards,
Giovanni
Rastislav Komara - 09 Mar 2006 15:28 GMT
Hello,
There are several ways. One of them is use special Class for
Configuration. Its implementation will be responsible for reading and
possibly writing configuration values dependent on key. This
Configuration will use SPI approach to provide variable implementations
of ConfigurationDataSources. This Configuration can be singleton
initialy configured e.g. from xml file where is stored information
about list of providers, strategy for using these providers,
availability of cache etc... The configuration will use special Key
object to identify the value. This key can also identify a primary
resource or hold key tipe information to help make strategic decisions
about source of value.
If U want to use already created solution try
java.util.prefs.Preferences