commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver.He...@t-online.de (Oliver Heger)
Subject Re: [configuration] File locator
Date Tue, 07 Dec 2004 18:09:13 GMT
If we have Loccators,  IMO there is no need to keep the base path and 
file name stuff in file based configurations. These are things a 
concrete Locator has to deal with, and the information needed by a 
Locator may vary. So I suggest the following simple method signature:

    URL locate();  // eventuelly throws ConfigurationException?

Concrete Locators should have getter and setter methods for the 
properties they need, e.g. the ClasspathLocator a resource name, the 
URLLocator a URL etc. That way a Locator could be created by Digester 
and initialized with a SetPropertiesRule, which comes in handy when used 
with ConfigurationFactory.

Usage of a Locator would then look like:
Locator locator = new MyConcreteLocator();
// init locator as necessary
Configuration conf = new PropertiesConfiguration(locator);

in contrast to
Locator locator = new MyConcreteLocator();
Configuration conf = new PropertiesConfiguration();
conf.setBasePath(...);
conf.setFileName(...);
conf.load(locator);

Oliver


Emmanuel Bourg wrote:

> Here is a quick attempt at implementing the Locator strategy discussed 
> earlier. Feel free to comment :)
>
> 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