commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Inger, Matthew" <In...@Synygy.com>
Subject RE: [Configuration] IniFile
Date Thu, 04 Mar 2004 21:46:41 GMT
Because IniFiles are not hierarchal.  There is only one
level of sections as far as i know.  If i'm wrong, someone
correct me.


-----Original Message-----
From: Emmanuel Bourg [mailto:ebourg@micropole-univers.com]
Sent: Thursday, March 04, 2004 12:12 PM
To: Jakarta Commons Developers List
Subject: Re: [Configuration] IniFile


What about a single class instead, IniConfiguration or 
WindowsConfiguration (I tend to prefer the later) extending 
BasePathConfiguration with new methods:

void load();
void save();
List getSections();
Configuration getSection(String name); // delegating to subset
void setProperty(String section, String key, Object value);
void getProperty(String section, String key);

Emmanuel Bourg


Inger, Matthew wrote:

> I think what i'm planning on is the following:
> 
> IniSectionConfiguration -
>  extends BaseConfiguration, and doesn't really do much else
>  except add a name attribute with a getter, and a save method
>  to write the section to an output stream
> 
> IniFileConfiguration - 
>   extends BaseConfiguration.  It contains a map, whose
>   key is section name, and value is an IniSectionConfiguration
>   object.  There will be getSection(String name) method which returns
>   an IniSectionConfiguration.  The existing "subset" method will delegate
>   to the getSection method.
> 
>   From the perspective of IniFileConfiguration keys are represented as:
> 
>        [section_name]keyName
> 
>   All of the get,add,clear, etc... methods will parse the key above and
>   find the correct section, and delegate the call to that section.
> 
> I think this is the cleanest solution.  Thoughts?



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org

---------------------------------------------------------------------
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