commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <sma...@lfjr.net>
Subject Re: [CONFIGURATION] ClassPropertiesConfiguration
Date Tue, 07 Dec 2004 12:53:09 GMT
Henning P. Schmiedehausen wrote:

> Yep. However, we could simply say, that for using this, you have to
> have an URL. One can always fake up a Locator that loads the file from
> the input stream, saves it to a temp file and returns this URL.

Yes that's a solution, alternatively the user can still call the 
load(InputStream) method.


>>new PropertiesConfiguration(locator.locate("config.properties));
> 
> I don't like that much. Once the locator has run, it has run. Passing
> the locator object allows the implementor to catch all the calls to
> locate() and maybe react differently.

I'm not sure to see the need, do you have a real use case in mind ?


> How about wrapping the name of the configuration file / the
> configuration parameters into the locator object:
> 
> config = new PropertiesConfiguration (new FileLocator("config.properties"));
> config = new PropertiesConfiguration (new ClassPathLocator("config.properties"));
> 
> config.load(new FileLocator("config.properties"));

Hmm no because a locator is a strategy to find a resource, it doesn't 
define a resource, this is the role of the URL.


> This would simplify the method signatures. We might even be able to
> decouple things like JDBC and JNDI:
> 
> config = new PropertiesConfiguration(new JDBCLocator(... jdbc params...));

Is this really simpler than instanciating DatabaseConfiguration and 
JNDIConfiguration ? :)

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