commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <ebo...@apache.org>
Subject Re: Configuration Cache
Date Fri, 07 Apr 2006 13:48:42 GMT
Marcus Malcom a écrit :

> My use case is to make sure that a configuration file is only loaded
> once per class loader space. I didn't see anything in the configuration
> API that accomplishes this (please let me know if I missed something).
> The call would look something like this:
> 
>  cache.getConfiguration("someFile")
> 
> Naturally, this can be done with any Configuration, but I'm looking
> mainly at the file configurations at the moment. The API would look
> something like this:
> 
>  Configuration getConfiguration(String fileName)
>  Configuration getConfiguration(URL url)
>  Configuration getConfiguration(File file)
> 
> Again, the point is that the cache object (singleton/multiton) would
> cache the configuration file so that subsequent calls to
> getConfiguration(...) would return the same object. I do have some
> example code that I put together yesterday, should I send them to the
> group?

I had a similar need on a project, I wrote a ConfigurationManager class 
caching the configurations and performing an application specific lookup 
to locate the configuration file. I'm not sure if such a singleton 
should be introduced in the API though, such a caching looks a bit out 
of scope to me. Developers will adopt very different approaches to this 
issue depending on their architecture or personal taste (singleton, 
dependency injection, existing cache API...) We can't really impose one 
way of doing it. However this might be a good addition to our Wiki. We 
already have a Spring example there.

     http://wiki.apache.org/jakarta-commons/Configuration

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