You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Inger, Matthew" <In...@Synygy.com> on 2004/07/24 00:02:33 UTC

[Configuration]IniFileConfiguration

Barring any objections, I'd like to commit the IniFileConfiguration
classes (and test code and data) to CVS.  Here's a basic summary of
how it would be used:

        IniFileConfiguration conf = new IniFileConfiguration(filePath);

        IniSectionConfiguration section1 = conf.getSection("Section 1");
	  String key_a = section1.getString("key_a");

        String key_b =
conf.getString(IniFileConfiguration.createKey("Section 1",
 
"key_b"));

        conf.save(newFilePath);

Basically, it behaves like a configuration object, exception that the keys
are a special format containing the section name and key name: [section]key
and there are special methods for retrieving specific sections.

Any dissention?

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


Re: [Configuration]IniFileConfiguration

Posted by Emmanuel Bourg <sm...@lfjr.net>.
Hi Matthew, could you hold on your code until [configuration] 1.0 is 
released please ? I'd like to keep the focus on fixing the bugs for our 
first release and include the enhancements in the  1.1 release. Thanks :)

Emmanuel Bourg


Inger, Matthew wrote:
> Barring any objections, I'd like to commit the IniFileConfiguration
> classes (and test code and data) to CVS.  Here's a basic summary of
> how it would be used:
> 
>         IniFileConfiguration conf = new IniFileConfiguration(filePath);
> 
>         IniSectionConfiguration section1 = conf.getSection("Section 1");
> 	  String key_a = section1.getString("key_a");
> 
>         String key_b =
> conf.getString(IniFileConfiguration.createKey("Section 1",
>  
> "key_b"));
> 
>         conf.save(newFilePath);
> 
> Basically, it behaves like a configuration object, exception that the keys
> are a special format containing the section name and key name: [section]key
> and there are special methods for retrieving specific sections.
> 
> Any dissention?
> 
> ---------------------------------------------------------------------
> 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


RE: [Configuration]IniFileConfiguration

Posted by Eric Pugh <ep...@upstate.com>.
I think the only dissention that I would have is the conf.getSection...   I
think that one of the key points of Configuration is that the implementors
all work via the Configuration interface..   A user of IniFileConfiguration
is going to expect to do something like getString("Section 1.key_a") or
something along that means..

It seems like how you would do it is
IniFileConfiguration conf = new IniFileConfiguration(filePath);

        Configuration section1 = conf.subset("Section 1");
	  String key_a = section1.getString("key_a");

conf.setProperty("Section 1.key_b","key_b_value");

        String key_b = conf.getSTring("Section 1.key_b");


I think that you have to implement this to support working with
CompositeConfiguration, SubsetConfiguration.

Now, if beyond the Configuration interface you had a couple helper methods
specific to IniFileConfiguration, then that would be okay I think...   But,
I think it really has to implement Configuration.

Eric



> -----Original Message-----
> From: Inger, Matthew [mailto:Inger@Synygy.com]
> Sent: Saturday, July 24, 2004 12:03 AM
> To: 'Jakarta Commons Developers List'
> Subject: [Configuration]IniFileConfiguration
>
>
> Barring any objections, I'd like to commit the IniFileConfiguration
> classes (and test code and data) to CVS.  Here's a basic summary of
> how it would be used:
>
>         IniFileConfiguration conf = new IniFileConfiguration(filePath);
>
>         IniSectionConfiguration section1 = conf.getSection("Section 1");
> 	  String key_a = section1.getString("key_a");
>
>         String key_b =
> conf.getString(IniFileConfiguration.createKey("Section 1",
>
> "key_b"));
>
>         conf.save(newFilePath);
>
> Basically, it behaves like a configuration object, exception that the keys
> are a special format containing the section name and key name:
> [section]key
> and there are special methods for retrieving specific sections.
>
> Any dissention?
>
> ---------------------------------------------------------------------
> 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