Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Oliver Heger
Alec Swan schrieb: Thanks, this approach worked. One minor problem I ran into was that the merged configuration always has a new line at the end even if the default configuration does not have a new line at the end of the file. Is there a way to control if the new line should be added or not? T

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Alec Swan
Thanks, this approach worked. One minor problem I ran into was that the merged configuration always has a new line at the end even if the default configuration does not have a new line at the end of the file. Is there a way to control if the new line should be added or not? Thanks. On Wed, Jun 1

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Oliver Heger
Alec Swan schrieb: Can the following be done with Commons Configurations? 1. Load defaults into a PropertyConfiguration object. 2. Load overrides into a Java Properties object. (Note that I do not need to preserve the formatting of overrides.) 3. Iterate over the overrides properties and set val

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Oliver Heger
Alec Swan schrieb: This is really unfortunate. The merged configuration is required to preserve comments from defaults, but not necessarily overrides. Are there any plans to add this functionality in the near future? Thanks. This is a new feature that was not considered before. I think, it i

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Alec Swan
Can the following be done with Commons Configurations? 1. Load defaults into a PropertyConfiguration object. 2. Load overrides into a Java Properties object. (Note that I do not need to preserve the formatting of overrides.) 3. Iterate over the overrides properties and set values on corresponding

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Alec Swan
This is really unfortunate. The merged configuration is required to preserve comments from defaults, but not necessarily overrides. Are there any plans to add this functionality in the near future? Thanks. On Wed, Jun 17, 2009 at 1:54 PM, Oliver Heger wrote: > Alec Swan schrieb: > >> I wrote th

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Oliver Heger
Alec Swan schrieb: I wrote the code following the example on http://commons.apache.org/configuration/userguide-1.2/howto_compositeconfiguration.html There is no save() method in CompositeConfiguration. How can I save it? Thanks. The merged configuration produced by CompositeConfiguration is o

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Alec Swan
I wrote the code following the example on http://commons.apache.org/configuration/userguide-1.2/howto_compositeconfiguration.html There is no save() method in CompositeConfiguration. How can I save it? Thanks. On Wed, Jun 17, 2009 at 11:23 AM, Jörg Schaible wrote: > Alec Swan wrote at Mittwoch

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Jörg Schaible
Alec Swan wrote at Mittwoch, 17. Juni 2009 18:39: > Thank you for updating the subject, Jörg. > > I changed the order in which I add defaults and overrides. The following > is the new code: > > // merge overrides with defaults > CompositeConfiguration comp

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Alec Swan
Thank you for updating the subject, Jörg. I changed the order in which I add defaults and overrides. The following is the new code: // merge overrides with defaults CompositeConfiguration compositeConfig = new CompositeConfiguration(overridingConfig);

Re: [configuration] Merging overrides with defaults

2009-06-17 Thread Jörg Schaible
Hi Alec, as commons contains quite a lot of components, it is best practice to include the component's name iln the subject to give a reader the context of your question. Alec Swan wrote at Mittwoch, 17. Juni 2009 00:00: > I have a property file containing default configurations in a key=value >