commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [Configuration] IniFile
Date Mon, 08 Mar 2004 21:07:31 GMT
The "ini" format is also used by Gnome/KDE ( and quite a few other
non-windows programs ), so I preffer the first.

Regarding key representation - why would you use [section_name]keyName ???
Never seen this pattern - in any config API I ever used.

Could you just use the same pattern ( and API ) that is used in java
util.pref ? 

BTW, IMO the correct naming would also include the file name ( minus
prefix ), since it's common practice to have multiple ini files. If the
class is initialized with a directory name, it could use this to support 
multiple ini files ( like is the case for gnome / kde ). 


Emmanuel Bourg wrote:

> 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:
For additional commands, e-mail:

View raw message