using a "." as the separator is not the ideal thing to do, as there may be a "." in the section name. I'm not sure what you mean by the API used in util.pref
Secondly, reading in all the ini files should be the job of the application, not the IniFile class. If you want multiple files, you should construct an instance for each of them (I'm pretty confident that this is what is done for Gnome/KDE) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, March 08, 2004 4:08 PM To: Jakarta Commons Developers List Subject: Re: [Configuration] IniFile 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 ). Costin 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
