[ANNOUNCE] Apache Commons Configuration 2.11.0

2024-06-10 Thread Gary Gregory
The Apache Commons Team is pleased to announce Commons Configuration 2.11.0.

The Commons Configuration software library provides a generic
configuration interface that enables an application to read
configuration data from a variety of sources.

Commons Configuration includes tools to assist in reading
configuration/preference files in various formats; requires Java 8.

This is a minor release with new features and updated dependencies;
requires Java 8 or above.

Historical list of changes:
https://commons.apache.org/proper/commons-configuration/changes-report.html

For complete information on Apache Commons Configuration, including
instructions on how to submit bug reports, patches, or suggestions for
improvement, see the Apache Apache Commons Configuration website:

https://commons.apache.org/proper/commons-configuration/

Download it from
https://commons.apache.org/proper/commons-configuration//download_configuration.cgi

Gary Gregory
Apache Commons Team

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [CONFIGURATION] INIConfiguration with empty section key not supported

2024-04-15 Thread Gary Gregory
Hello Thomas,

You might want to look at the unit tests to see if there are any
expectations regarding empty section names. I don't know off the top of my
head.

Gary

On Mon, Apr 15, 2024, 11:41 AM Steiner Thomas
 wrote:

> Hi,
>
> should it possible to parse an ini-File with an empty section key with
> commons-configuration2 2.10.1?
>
> Or is there any intended purpose why the following example doesn't work:
> INIConfiguration iniConfiguration = new INIConfiguration();
> try (FileReader fileReader = new FileReader(file)) {
>   iniConfiguration.read(fileReader);
> } catch (ConfigurationException | IOException e) {
>   e.printStackTrace();
> }
> SubnodeConfiguration subSection = iniConfiguration.getSection("");
> String nextKey = subSection.getKeys().next();
> assertNotNull(nextKey);
> assertEquals("property", nextKey);
> Object nextValue = subSection.getProperty(nextKey);
> assertNotNull(nextValue); // FIXME: value is null
> assertEquals("property1", nextValue);
>
> emptySection.ini:
>   []
>   property = "property1"
>
> The value is null due to the keyBuffer's length in the
> DefaultConfigurationKey is 0 and the endIndex is also 0 so the
> KeyIterator's hasNext() is false.
>
> Sections with a space (' ') are parsed as expected:
> INIConfiguration iniConfiguration = new INIConfiguration();
> try (FileReader fileReader = new FileReader(file)) {
>   iniConfiguration.read(fileReader);
> } catch (ConfigurationException | IOException e) {
>   e.printStackTrace();
> }
> SubnodeConfiguration subSection = iniConfiguration.getSection(" ");
> String nextKey = subSection.getKeys().next();
> assertNotNull(nextKey);
> assertEquals("property", nextKey);
> Object nextValue = subSection.getProperty(nextKey);
> assertNotNull(nextValue);
> assertEquals("property1", nextValue);
>
> spaceSection.ini:
>   [ ]
>   property = "property1"
>
> Best regards,
> Thomas Steiner
>
>
> 
> Please note the information on data protection at
> https://www.engelglobal.com/dataprotection.
>
>
> 
>
> Important Notice:
> This electronic transmission (including any attachments) is intended
> solely for the use and information
> of the addressee(s). It may contain confidential or legally privileged
> information. Any unauthorized use
> or disclosure of this message is strictly prohibited.If you are not the
> intended recipient, please notify
> the sender immediately and delete the message and its attachments.
> The sender does not guarantee the integrity of this transmission and shall
> therefore never be liable if
> the message is altered or falsified nor for any virus, interception or
> damage to your system.
>


[CONFIGURATION] INIConfiguration with empty section key not supported

2024-04-15 Thread Steiner Thomas
Hi,

should it possible to parse an ini-File with an empty section key with 
commons-configuration2 2.10.1?

Or is there any intended purpose why the following example doesn't work:
INIConfiguration iniConfiguration = new INIConfiguration();
try (FileReader fileReader = new FileReader(file)) {
  iniConfiguration.read(fileReader);
} catch (ConfigurationException | IOException e) {
  e.printStackTrace();
}
SubnodeConfiguration subSection = iniConfiguration.getSection("");
String nextKey = subSection.getKeys().next();
assertNotNull(nextKey);
assertEquals("property", nextKey);
Object nextValue = subSection.getProperty(nextKey);
assertNotNull(nextValue); // FIXME: value is null
assertEquals("property1", nextValue);

emptySection.ini:
  []
  property = "property1"

The value is null due to the keyBuffer's length in the DefaultConfigurationKey 
is 0 and the endIndex is also 0 so the KeyIterator's hasNext() is false.

Sections with a space (' ') are parsed as expected:
INIConfiguration iniConfiguration = new INIConfiguration();
try (FileReader fileReader = new FileReader(file)) {
  iniConfiguration.read(fileReader);
} catch (ConfigurationException | IOException e) {
  e.printStackTrace();
}
SubnodeConfiguration subSection = iniConfiguration.getSection(" ");
String nextKey = subSection.getKeys().next();
assertNotNull(nextKey);
assertEquals("property", nextKey);
Object nextValue = subSection.getProperty(nextKey);
assertNotNull(nextValue);
assertEquals("property1", nextValue);

spaceSection.ini:
  [ ]
  property = "property1"

Best regards,
Thomas Steiner


Please note the information on data protection at 
https://www.engelglobal.com/dataprotection.



Important Notice:
This electronic transmission (including any attachments) is intended solely for 
the use and information
of the addressee(s). It may contain confidential or legally privileged 
information. Any unauthorized use
or disclosure of this message is strictly prohibited.If you are not the 
intended recipient, please notify
the sender immediately and delete the message and its attachments.
The sender does not guarantee the integrity of this transmission and shall 
therefore never be liable if
the message is altered or falsified nor for any virus, interception or damage 
to your system.


CVE-2024-29131: Apache Commons Configuration: StackOverflowError adding property in AbstractListDelimiterHandler.flattenIterator()

2024-03-20 Thread Gary D. Gregory
Severity: low

Affected versions:

- Apache Commons Configuration 2.0 before 2.10.1

Description:

Out-of-bounds Write vulnerability in Apache Commons Configuration.This issue 
affects Apache Commons Configuration: from 2.0 before 2.10.1.

Users are recommended to upgrade to version 2.10.1, which fixes the issue.

This issue is being tracked as CONFIGURATION-840 

Credit:

Bob Marinier (finder)

References:

https://commons.apache.org/
https://www.cve.org/CVERecord?id=CVE-2024-29131
https://issues.apache.org/jira/browse/CONFIGURATION-840


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



CVE-2024-29133: Apache Commons Configuration: StackOverflowError calling ListDelimiterHandler.flatten(Object, int) with a cyclical object tree

2024-03-20 Thread Gary D. Gregory
Severity: low

Affected versions:

- Apache Commons Configuration 2.0 before 2.10.1

Description:

Out-of-bounds Write vulnerability in Apache Commons Configuration.This issue 
affects Apache Commons Configuration: from 2.0 before 2.10.1.

Users are recommended to upgrade to version 2.10.1, which fixes the issue.

This issue is being tracked as CONFIGURATION-841 

Credit:

Gary Gregory (finder)

References:

https://commons.apache.org/
https://www.cve.org/CVERecord?id=CVE-2024-29133
https://issues.apache.org/jira/browse/CONFIGURATION-841


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[ANNOUNCE] Apache Commons Configuration 2.10.1

2024-03-20 Thread Gary Gregory
Introducing Apache Commons Configuration 2.10.1

The Apache Commons Configuration software library provides a generic
configuration interface that enables an application to read
configuration data from a variety of sources.

Tools to assist in the reading of configuration/preferences files in
various formats; this version requires Java 8.

Minor release with new features and updated dependencies; requires
Java 8 or above.

Changes in this version include:

Fixed Bugs

* CONFIGURATION-839: java.lang.module.FindException: Module
servlet.api not found. Thanks to Bob Marinier, Gary Gregory.

* CONFIGURATION-840: StackOverflowError adding property in
AbstractListDelimiterHandler.flattenIterator(). Thanks to Bob
Marinier, Gary Gregory.

* CONFIGURATION-841: StackOverflowError calling
ListDelimiterHandler.flatten(Object, int) with a cyclical object tree.
Thanks to Gary Gregory.

Changes

* Bump jackson-databind from 2.16.1 to 2.17.0
#378. Thanks to Dependabot.
* Bump log4j.version from 2.23.0 to 2.23.1 #379.
Thanks to Dependabot.
* Bump spring.version from 5.3.32 to 5.3.33 #380.
Thanks to Dependabot, Gary Gregory.

Historical list of changes:
https://commons.apache.org/proper/commons-configuration/changes-report.html

For complete information on Apache Commons Configuration, including
instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons
Configuration website:

https://commons.apache.org/proper/commons-configuration/

Download it from
https://commons.apache.org/proper/commons-configuration//download_configuration.cgi

Gary Gregory
Apache Commons

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[ANNOUNCE] Apache Commons Configuration 2.10.0

2024-03-13 Thread Gary Gregory
The Apache Commons is pleased to announce Apache Commons Configuration 2.10.0.

The Commons Configuration software library provides a generic
configuration interface that enables an application to read
configuration data from a variety of sources and tools to assist in
the reading of configuration/preferences files in various formats

This is a minor release with new features and updated dependencies
that require Java 8.

Historical list of changes:
https://commons.apache.org/proper/commons-configuration/changes
report.html

For complete information on Apache Commons Configuration, including
instructions on how to submit bug reports, patches, or suggestions for
improvement, see the Apache Apache Commons Configuration website:

https://commons.apache.org/proper/commons-configuration/

Download it from
https://commons.apache.org/proper/commons-configuration//download_configuration.cgi

Gary Gregory
Apache Commons Team

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] Fwd: Issue with commons-configuration2 2.9.0 on Java 8

2023-10-12 Thread Poirier-Morency, Guillaume
I've originally posted this on the development mailing list but I don't think 
it was processed properly.

I'm having issue with the 2.9.0 artifact on Java 8.

-- Forwarded message --
From: "Poirier-Morency, Guillaume" 
Date: Apr 18, 2023 7:41 p.m.
Subject: Issue with commons-configuration2 2.9.0 on Java 8
To: d...@commons.apache.org
Cc:

Hello!

It appears that the latest commons-configuration2 package was built
with JDK 11 without the --release flag to target Java 8 API. This
results in incompatible code for java.nio.ByteBuffer.flip() (which does
not exist in Java 8).

We're tracking this here:

https://github.com/PavlidisLab/Gemma/issues/647

Best,
Guillaume

--
Guillaume Poirier-Morency (He, Him, His)
Bioinformatics Programmer/Analyst
Michael Smith Laboratories | Bioinformatics Unit
The University of British Columbia | Vancouver Campus | Musqueam
Traditional Territory
301-2185 East Mall | Vancouver British Columbia | V6T 1Z4 Canada
Phone 604 827 4211 | Cell 604 360 3597
poiri...@msl.ubc.ca | @arteymix
​



[ANNOUNCEMENT] Apache Commons Configuration Version 2.8.0 Released

2022-07-04 Thread Matt Juntunen
The Apache Commons Team is pleased to announce the availability of
version 2.8.0 of "Apache Commons Configuration".

Apache Commons Configuration contains tools to assist in the reading of
configuration/preferences files in various formats.

Changes in this version include:

New features:
o Implement Iterable in ImmutableNode #74. Thanks to SethiPandi.
o Add PropertiesConfigurationLayout.getBlankLinesBefore() and deprecate
  getBlancLinesBefore(). Thanks to Gary Gregory.
o Add PropertiesConfigurationLayout.setBlankLinesBefore() and deprecate
  setBlancLinesBefore(). Thanks to Gary Gregory.
o Add PropertiesConfigurationLayout.PropertyLayoutData.getBlankLines() and
  deprecate getBlancLines(). Thanks to Gary Gregory.
o Add PropertiesConfigurationLayout.PropertyLayoutData.setBlankLines() and
  deprecate setBlancLines(). Thanks to Gary Gregory.
o CONFIGURATION-789:  Add ImmutableConfiguration.getEnum() methods. Thanks to
  Gary Gregory.
o CONFIGURATION-789:  Add ImmutableConfiguration.getDuration() methods. Thanks
  to Gary Gregory.

Fixed Bugs:
o CONFIGURATION-753:  Make interpolation of collections and arrays in
  ConfigurationInterpolator consistent with behavior of
  DefaultConversionHandler. Add ConfigurationInterpolator.setStringConverter to
  allow customized string conversion behavior.
o CONFIGURATION-795:  Computation of blank lines after header comment #82.
  Thanks to dpeger.
o CONFIGURATION-801:  Remove redundant initializer #110. Thanks to
  Arturo Bernal.
o CONFIGURATION-802:  Use final #111. Thanks to Arturo Bernal.
o CONFIGURATION-803:  Java 8 lambda improvements and more #112. Thanks to
  Arturo Bernal.
o CONFIGURATION-804:  Redundant local variable #113. Thanks to Arturo Bernal.
o CONFIGURATION-805:  Use try with resource #114. Thanks to Arturo Bernal.
o CONFIGURATION-805:  [Javadoc] Specify that typed getList returns null for
  missing key #100. Thanks to Roman Zaynetdinov.
o Mention EnvironmentConfiguration in the list of configuration sources #45.
  Thanks to Oliver B. Fischer.
o CONFIGURATION-808:  DefaultListDelimiterHandler.escapeList working only for
  List>String< #137. Thanks to cigaly.
o Use final #141. Thanks to Arturo Bernal.
o Replace test asserts by simpler but equivalent calls. #139 Thanks to
  Arturo Bernal.
o CONFIGURATION-764:  Single Variable Interpolation #182. Thanks to Ning Zhang,
  Matt Juntunen, Bruno P. Kinoshita, Gary Gregory.
o Implement proper concurrency in ConstantLookup. Thanks to Gary Gregory.
o CONFIGURATION-813:  Support new namespace jakarta.mail.* used by javamail 2.0+
  (first release October 2020) #186. Thanks to Dependabot.

Changes:
o Unclosed file handle when reading config from JAR file URL. Add and use
  FileBasedBuilderProperties.setURL(URL, URLConnectionOptions). Thanks to
  Robin Jansohn, Gary Gregory, Rob Spoor.
o Make default interpolation prefix lookups configurable via system property.
  Remove dns, url, and script lookups from defaults. If these lookups are
  required for use in AbstractConfiguration subclasses, they must be enabled
  via system property. See ConfigurationInterpolator.getDefaultPrefixLookups()
  for details.
o Bump actions/cache from 2 to 3.0.4 #99, #151, #169. Thanks to Dependabot,
  Gary Gregory.
o Bump actions/checkout from 1 to 3 #47, #62, #70, #85, #150, #163. Thanks to
  Dependabot.
o Bump actions/setup-java from 1.4.0 to 3 #63, #65, #73, #174. Thanks to
  Dependabot, Gary Gregory.
o Bump codeql-action from v1 to v2. Thanks to Dependabot, Matt Juntunen.
o Bump Spring dependency versions:
org.springframework:spring-beans 4.3.26.RELEASE -> 5.3.21
org.springframework:spring-context 4.3.26.RELEASE -> 5.3.21
org.springframework:spring-core 4.3.26.RELEASE -> 5.3.21
org.springframework:spring-test 4.3.26.RELEASE -> 5.3.21
#165, #172 Thanks to Dependabot, Matt Juntunen, kinow, Gary Gregory.
o Bump commons-parent from 52 to 53. Thanks to Dependabot, Matt Juntunen.
o CONFIGURATION-787:  Bump Apache Commons Lang from 3.9 to 3.12.0. Thanks to
  Gary Gregory.
o CONFIGURATION-790:  Bump com.fasterxml.jackson.core:jackson-databind
  from 2.10.3 to 2.13.3, #60. Thanks to Gary Gregory, Dependabot.
o Bump Slf4j test dependencies:
org.slf4j:slf4j-api 1.7.26 -> 1.7.33,
org.slf4j:slf4j-ext 1.7.26 -> 1.7.33,
org.slf4j:slf4j-log4j12 1.7.26 -> 1.7.33,
org.slf4j:slf4j-nop 1.7.26 -> 1.7.33. Thanks to Gary Gregory.
o Bump commons-parent from 50 to 52. Thanks to Dependabot.
o Bump mailapi from 1.6.4 to 1.6.7 #48. Thanks to Dependabot, Gary Gregory.
o Bump spotbugs-maven-plugin from 3.1.12.2 to 4.7.0.0, #55, #75, #79, #93, #116,
  #183. Thanks to Dependabot, Gary Gregory.
o Bump hsqldb from 2.5.0 to 2.5.2 #54, #128. Thanks to Dependabot.
o Bump commons-text from 1.8 to 1.9. Thanks to Gary Gregory.
o Bump servlet-api from 2.4 to 2.5 #58. Thanks to Gary Gregory.
o Bump maven-checkstyle-plugin from 3.1.0 to 3.1.2, #57, #97. Thanks to
  Gary Gregory.
o Bump commons-pool2

Re: Commons Configuration Release Plan

2022-05-04 Thread John Patrick
Hi Shivaraj,
I've worked at companies with similar policies. For anything that is Apache
I usually respond to who is asking with something like "Apache Commons is
an active community, only release as changes are need due to being stable
and mature libraries. Release only happen if new functionality is added or
to fix bugs fixes. Excessive releases at a fixed schedule or after ever
bugfix would cause constant headache for Apache Commons maintained and us
wasting development effort testing and releases each time an update is
done.".
John

On Wed, 4 May 2022 at 16:13, Matt Juntunen 
wrote:

> Hello,
>
> I could go ahead and try to release this. It will have to be after
> this weekend, however, since I will be busy with family. (It's
> Mother's Day in the US.)
>
> Regards,
> Matt J
>
> On Wed, May 4, 2022 at 8:19 AM Gary Gregory 
> wrote:
> >
> > Different components have different levels of maturity and interest for
> > people here who are volunteering. Update frequency is not correlated to
> > quality.
> >
> > Gary
> >
> > On Wed, May 4, 2022, 07:28 Amaladhithyan Krishnamoorthy <
> > amaladhithyan.krishnamoor...@ericsson.com> wrote:
> >
> > > Hi Gary,
> > >
> > >
> > >
> > >  We are not looking for any change or feature specifically.
> > >
> > >
> > >
> > > According to an internal guideline we follow in our organization any
> FOSS
> > > that hasn’t received an update or new release in 2 years (approx.) has
> to
> > > evaluated for replacement.
> > >
> > >   Since commons-configuration last release was only in 2020, we
> wanted
> > > to know if there will any release in the future so that we can make a
> call
> > > to either go for a replacement or hold-on until an update is received.
> To
> > > make this decision we would want to know if and when there will be an
> > > update to commons-configuration.
> > >
> > >
> > >
> > >Also, we observed from the release history that
> > > common-configuration has had at least 2 updates an year until 2020. Any
> > > reason why we have not seen an update for more than 2 years?
> > >
> > >
> > >
> > >   Thanks,
> > >
> > > Amal
> > >
> > >
> > >
> > > *From:* Gary Gregory 
> > > *Sent:* Wednesday, May 4, 2022 4:21 PM
> > > *To:* Commons Users List 
> > > *Cc:* M Vasanthakumar ; Amaladhithyan
> > > Krishnamoorthy 
> > > *Subject:* Re: Commons Configuration Release Plan
> > >
> > >
> > >
> > > Hi,
> > >
> > >
> > >
> > > Are you looking for a specific change?
> > >
> > >
> > >
> > > It's on my to do list but I do not have a date. Within a couple of
> months
> > > maybe, after we release other components that have higher priority for
> me
> > > ATM.
> > >
> > >
> > >
> > > Gary
> > >
> > >
> > >
> > > On Wed, May 4, 2022, 06:46 Shivaraj Sivasankaran <
> > > shivaraj.sivasanka...@ericsson.com.invalid> wrote:
> > >
> > > +Update the Subject+++
> > > Hi,
> > >
> > > Am Shivaraj from Ericsson India Global Private Limited, we have our own
> > > software to meet the business need and we used below FOSS to achieve
> > > certain functionalities. Since we planned to upgrade the below
> component
> > > and found that the product is last released in Mar'2020 - Apache
> > > Configuration 2.7, is there any update/release planned in near future
> if so
> > > please revert on the planned release date.
> > >
> > >
> > > Vendor
> > > Software Name
> > > Version
> > > Apache
> > > Commons Configuration
> > > 1.9
> > >
> > > Regards,
> > > Shivaraj Sivasankaran.
> > >
> > >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: Commons Configuration Release Plan

2022-05-04 Thread Matt Juntunen
Hello,

I could go ahead and try to release this. It will have to be after
this weekend, however, since I will be busy with family. (It's
Mother's Day in the US.)

Regards,
Matt J

On Wed, May 4, 2022 at 8:19 AM Gary Gregory  wrote:
>
> Different components have different levels of maturity and interest for
> people here who are volunteering. Update frequency is not correlated to
> quality.
>
> Gary
>
> On Wed, May 4, 2022, 07:28 Amaladhithyan Krishnamoorthy <
> amaladhithyan.krishnamoor...@ericsson.com> wrote:
>
> > Hi Gary,
> >
> >
> >
> >  We are not looking for any change or feature specifically.
> >
> >
> >
> > According to an internal guideline we follow in our organization any FOSS
> > that hasn’t received an update or new release in 2 years (approx.) has to
> > evaluated for replacement.
> >
> >   Since commons-configuration last release was only in 2020, we wanted
> > to know if there will any release in the future so that we can make a call
> > to either go for a replacement or hold-on until an update is received. To
> > make this decision we would want to know if and when there will be an
> > update to commons-configuration.
> >
> >
> >
> >Also, we observed from the release history that
> > common-configuration has had at least 2 updates an year until 2020. Any
> > reason why we have not seen an update for more than 2 years?
> >
> >
> >
> >   Thanks,
> >
> > Amal
> >
> >
> >
> > *From:* Gary Gregory 
> > *Sent:* Wednesday, May 4, 2022 4:21 PM
> > *To:* Commons Users List 
> > *Cc:* M Vasanthakumar ; Amaladhithyan
> > Krishnamoorthy 
> > *Subject:* Re: Commons Configuration Release Plan
> >
> >
> >
> > Hi,
> >
> >
> >
> > Are you looking for a specific change?
> >
> >
> >
> > It's on my to do list but I do not have a date. Within a couple of months
> > maybe, after we release other components that have higher priority for me
> > ATM.
> >
> >
> >
> > Gary
> >
> >
> >
> > On Wed, May 4, 2022, 06:46 Shivaraj Sivasankaran <
> > shivaraj.sivasanka...@ericsson.com.invalid> wrote:
> >
> > +Update the Subject+++
> > Hi,
> >
> > Am Shivaraj from Ericsson India Global Private Limited, we have our own
> > software to meet the business need and we used below FOSS to achieve
> > certain functionalities. Since we planned to upgrade the below component
> > and found that the product is last released in Mar'2020 - Apache
> > Configuration 2.7, is there any update/release planned in near future if so
> > please revert on the planned release date.
> >
> >
> > Vendor
> > Software Name
> > Version
> > Apache
> > Commons Configuration
> > 1.9
> >
> > Regards,
> > Shivaraj Sivasankaran.
> >
> >

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



RE: Commons Configuration Release Plan

2022-05-04 Thread Amaladhithyan Krishnamoorthy
Hi Gary,

 We are not looking for any change or feature specifically.

According to an internal guideline we follow in our organization any FOSS that 
hasn’t received an update or new release in 2 years (approx.) has to evaluated 
for replacement.
  Since commons-configuration last release was only in 2020, we wanted to 
know if there will any release in the future so that we can make a call to 
either go for a replacement or hold-on until an update is received. To make 
this decision we would want to know if and when there will be an update to 
commons-configuration.

   Also, we observed from the release history that common-configuration has 
had at least 2 updates an year until 2020. Any reason why we have not seen an 
update for more than 2 years?

  Thanks,
Amal

From: Gary Gregory 
Sent: Wednesday, May 4, 2022 4:21 PM
To: Commons Users List 
Cc: M Vasanthakumar ; Amaladhithyan 
Krishnamoorthy 
Subject: Re: Commons Configuration Release Plan

Hi,

Are you looking for a specific change?

It's on my to do list but I do not have a date. Within a couple of months 
maybe, after we release other components that have higher priority for me ATM.

Gary

On Wed, May 4, 2022, 06:46 Shivaraj Sivasankaran 
mailto:shivaraj.sivasanka...@ericsson.com.invalid>>
 wrote:
+Update the Subject+++
Hi,

Am Shivaraj from Ericsson India Global Private Limited, we have our own 
software to meet the business need and we used below FOSS to achieve certain 
functionalities. Since we planned to upgrade the below component and found that 
the product is last released in Mar'2020 - Apache Configuration 2.7, is there 
any update/release planned in near future if so please revert on the planned 
release date.


Vendor
Software Name
Version
Apache
Commons Configuration
1.9

Regards,
Shivaraj Sivasankaran.


Re: Commons Configuration Release Plan

2022-05-04 Thread Gary Gregory
Different components have different levels of maturity and interest for
people here who are volunteering. Update frequency is not correlated to
quality.

Gary

On Wed, May 4, 2022, 07:28 Amaladhithyan Krishnamoorthy <
amaladhithyan.krishnamoor...@ericsson.com> wrote:

> Hi Gary,
>
>
>
>  We are not looking for any change or feature specifically.
>
>
>
> According to an internal guideline we follow in our organization any FOSS
> that hasn’t received an update or new release in 2 years (approx.) has to
> evaluated for replacement.
>
>   Since commons-configuration last release was only in 2020, we wanted
> to know if there will any release in the future so that we can make a call
> to either go for a replacement or hold-on until an update is received. To
> make this decision we would want to know if and when there will be an
> update to commons-configuration.
>
>
>
>Also, we observed from the release history that
> common-configuration has had at least 2 updates an year until 2020. Any
> reason why we have not seen an update for more than 2 years?
>
>
>
>   Thanks,
>
> Amal
>
>
>
> *From:* Gary Gregory 
> *Sent:* Wednesday, May 4, 2022 4:21 PM
> *To:* Commons Users List 
> *Cc:* M Vasanthakumar ; Amaladhithyan
> Krishnamoorthy 
> *Subject:* Re: Commons Configuration Release Plan
>
>
>
> Hi,
>
>
>
> Are you looking for a specific change?
>
>
>
> It's on my to do list but I do not have a date. Within a couple of months
> maybe, after we release other components that have higher priority for me
> ATM.
>
>
>
> Gary
>
>
>
> On Wed, May 4, 2022, 06:46 Shivaraj Sivasankaran <
> shivaraj.sivasanka...@ericsson.com.invalid> wrote:
>
> +Update the Subject+++
> Hi,
>
> Am Shivaraj from Ericsson India Global Private Limited, we have our own
> software to meet the business need and we used below FOSS to achieve
> certain functionalities. Since we planned to upgrade the below component
> and found that the product is last released in Mar'2020 - Apache
> Configuration 2.7, is there any update/release planned in near future if so
> please revert on the planned release date.
>
>
> Vendor
> Software Name
> Version
> Apache
> Commons Configuration
> 1.9
>
> Regards,
> Shivaraj Sivasankaran.
>
>


Re: Commons Configuration Release Plan

2022-05-04 Thread Gary Gregory
Hi,

Are you looking for a specific change?

It's on my to do list but I do not have a date. Within a couple of months
maybe, after we release other components that have higher priority for me
ATM.

Gary

On Wed, May 4, 2022, 06:46 Shivaraj Sivasankaran
 wrote:

> +Update the Subject+++
> Hi,
>
> Am Shivaraj from Ericsson India Global Private Limited, we have our own
> software to meet the business need and we used below FOSS to achieve
> certain functionalities. Since we planned to upgrade the below component
> and found that the product is last released in Mar'2020 - Apache
> Configuration 2.7, is there any update/release planned in near future if so
> please revert on the planned release date.
>
>
> Vendor
> Software Name
> Version
> Apache
> Commons Configuration
> 1.9
>
> Regards,
> Shivaraj Sivasankaran.
>


Commons Configuration Release Plan

2022-05-04 Thread Shivaraj Sivasankaran
+Update the Subject+++
Hi,

Am Shivaraj from Ericsson India Global Private Limited, we have our own 
software to meet the business need and we used below FOSS to achieve certain 
functionalities. Since we planned to upgrade the below component and found that 
the product is last released in Mar'2020 - Apache Configuration 2.7, is there 
any update/release planned in near future if so please revert on the planned 
release date.


Vendor
Software Name
Version
Apache
Commons Configuration
1.9

Regards,
Shivaraj Sivasankaran.


Re: [CVE-2020-1953] Uncontrolled class instantiation when loading YAML files in Apache Commons Configuration

2020-03-13 Thread Oliver Heger
The form at Mitre was just submitted, so I assume that the issue will be
visible soon.

Oliver

Am 12.03.20 um 19:18 schrieb Gary Gregory:
> Note that  https://cve.mitre.org/cgi-bin/cvename.cgi?name=2020-1953 is not
> "live" yet.
> 
> Gary
> 
> On Thu, Mar 12, 2020 at 1:53 PM Oliver Heger  wrote:
> 
>> CVE-2020-1953: Uncontrolled class instantiation when loading YAML files
>> in Apache Commons Configuration
>>
>> Severity: Moderate
>>
>> Vendor:
>> The Apache Software Foundation
>>
>> Versions Affected:
>> 2.2 to 2.6
>>
>> Description:
>> Apache Commons Configuration uses a third-party library to parse YAML
>> files which by default allows the instantiation of classes if the YAML
>> includes special statements. If a YAML file is from an untrusted source,
>> it can therefore load and execute code out of the control of the host
>> application.
>>
>> Mitigation:
>> Users should upgrade to to 2.7, which prevents class instantiation by
>> the YAML processor.
>>
>> Credit:
>> This issue was discovered by Daniel Kalinowski of ISEC.pl Research Team
>>
>> Oliver Heger
>> on behalf of the Apache Commons PMC
>>
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>> For additional commands, e-mail: dev-h...@commons.apache.org
>>
>>
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [CVE-2020-1953] Uncontrolled class instantiation when loading YAML files in Apache Commons Configuration

2020-03-12 Thread Gary Gregory
Note that  https://cve.mitre.org/cgi-bin/cvename.cgi?name=2020-1953 is not
"live" yet.

Gary

On Thu, Mar 12, 2020 at 1:53 PM Oliver Heger  wrote:

> CVE-2020-1953: Uncontrolled class instantiation when loading YAML files
> in Apache Commons Configuration
>
> Severity: Moderate
>
> Vendor:
> The Apache Software Foundation
>
> Versions Affected:
> 2.2 to 2.6
>
> Description:
> Apache Commons Configuration uses a third-party library to parse YAML
> files which by default allows the instantiation of classes if the YAML
> includes special statements. If a YAML file is from an untrusted source,
> it can therefore load and execute code out of the control of the host
> application.
>
> Mitigation:
> Users should upgrade to to 2.7, which prevents class instantiation by
> the YAML processor.
>
> Credit:
> This issue was discovered by Daniel Kalinowski of ISEC.pl Research Team
>
> Oliver Heger
> on behalf of the Apache Commons PMC
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


[CVE-2020-1953] Uncontrolled class instantiation when loading YAML files in Apache Commons Configuration

2020-03-12 Thread Oliver Heger
CVE-2020-1953: Uncontrolled class instantiation when loading YAML files
in Apache Commons Configuration

Severity: Moderate

Vendor:
The Apache Software Foundation

Versions Affected:
2.2 to 2.6

Description:
Apache Commons Configuration uses a third-party library to parse YAML
files which by default allows the instantiation of classes if the YAML
includes special statements. If a YAML file is from an untrusted source,
it can therefore load and execute code out of the control of the host
application.

Mitigation:
Users should upgrade to to 2.7, which prevents class instantiation by
the YAML processor.

Credit:
This issue was discovered by Daniel Kalinowski of ISEC.pl Research Team

Oliver Heger
on behalf of the Apache Commons PMC


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[ANNOUNCEMENT] Apache Commons Configuration Version 2.7 Released.

2020-03-11 Thread Rob Tompkins
The Apache Commons team is pleased to announce the release of Apache Commons 
Configuration Version 2.7.

Release Notes
2020-03-11

INTRODUCTION:
=

This document contains the release notes for this version of the Commons
Configuration component. It describes the changes since the previous version.
The Commons Configuration software library provides a generic configuration
interface which enables an application to read configuration data from a variety
of sources.

Tools to assist in the reading of configuration/preferences files in
various formats

Minor release with new features and updated dependencies.

Changes in this version include:

New features:
o CONFIGURATION-765:  Refactor XMLConfiguration.write(Writer) to add 
XMLConfiguration.write(Writer, Transformer). Thanks to Gary Gregory.

Fixed Bugs:
o CONFIGURATION-761:  Single argument DataConfiguration APIs always create 
empty arrays. Thanks to Gary Gregory.
o CONFIGURATION-767:  NullPointerException in 
XMLConfiguration#createTransformer() when no FileLocator is set. Thanks to Gary 
Gregory.
o CONFIGURATION-768:  XMLConfiguration#write does not indent XML elements. 
Thanks to Gary Gregory.
o CONFIGURATION-771:  Update com.fasterxml.jackson.core:jackson-databind 2.10.0 
-> 2.10.1. Thanks to Gary Gregory.
o CONFIGURATION-773:  User's Guide > Properties files > Saving - small 
documentation bugs #41. Thanks to Dan Dragut.

Changes:
o CONFIGURATION-762:  Use variable arguments. Thanks to Gary Gregory.
o Update ]com.puppycrawl.tools:checkstyle from 8.24 to  
8.25. Thanks to Gary Gregory.
o CONFIGURATION-763:  Update com.fasterxml.jackson.core:jackson-databind from 
2.9.9 to 2.10.0. Thanks to Gary Gregory.
o [test] org.easymock:easymock 4.0.2 -> 4.1. Thanks to Gary 
Gregory.
o CONFIGURATION-775:  Update Apache Commons VFS from 2.4.1 to 2.5.0. Thanks to 
Gary Gregory.
o CONFIGURATION-777:  Update Apache Commons VFS from 2.5.0 to 2.6.0. Thanks to 
Gary Gregory.
o CONFIGURATION-778:  Update optional Apache Commons Codec from 1.13 to 1.14. 
Thanks to Gary Gregory.
o Update tests from JUnit 4.12 to 4.13. Thanks to Gary 
Gregory.
o CONFIGURATION-779:  Update optional jackson-databind from 2.10.1 to 2.10.2. 
Thanks to Gary Gregory.
o CONFIGURATION-783:  Update com.fasterxml.jackson.core:jackson-databind from 
2.10.2 to 2.10.3. Thanks to Gary Gregory.
o CONFIGURATION-784:  Update org.yaml:snakeyaml from 1.25 to 1.26 and tweak 
parser configuration. Thanks to Gary Gregory.
o CONFIGURATION-785:  Update org.springframework:spring-* from 4.3.25.RELEASE 
to 4.3.26.RELEASE. Thanks to Gary Gregory.
o Update org.apache.commons:commons-parent from 48 to 50 
Thanks to Rob Tompkins.

Historical list of changes:
https://commons.apache.org/proper/commons-configuration/changes-report.html

For complete information on Apache Commons Configuration, including
instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons
Configuration website:

https://commons.apache.org/proper/commons-configuration/

Download it from
https://commons.apache.org/proper/commons-configuration/download_configuration.cgi

Best regards,
Rob Tompkins,
On behalf of the Apache Commons Team
-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[ANNOUNCEMENT] Apache Commons Configuration Version 2.6 (typo)

2019-09-19 Thread Gary Gregory
The Apache Commons team announces Apache Commons Configuration Version 2.6.
[This message fixes a typo in the download link.]

Release Notes
2019-09-13

INTRODUCTION:
=

This document contains the release notes for this version of the Commons
Configuration component. It describes the changes since the previous
version.
The Commons Configuration software library provides a generic configuration
interface which enables an application to read configuration data from a
variety
of sources.

Tools to assist in the reading of configuration/preferences files in
various formats

Minor release with new features and updated dependencies.

Changes in this version include:

New features:
o Document "includeOptional" on the site. Thanks to
Gary Gregory.
o CONFIGURATION-756:  Allow for custom behavior to handle errors loading
included properties files. Thanks to Gary Gregory.

Fixed Bugs:
o CONFIGURATION-750:  XMLPropertyListConfiguration cannot set arrays in the
correct plist form. Thanks to Jason Pickens, Gary Gregory, Emmanuel Bourg.
o Fix Javadoc for
org.apache.commons.configuration2.PropertiesConfiguration.getIncludeOptional().
Thanks to Gary Gregory.
o CONFIGURATION-760:  Properties file using cyclical includes cause a
StackOverflowError instead of detecting the misconfiguration. Thanks to
Gary Gregory.

Changes:
o CONFIGURATION-751:  Update Apache Commons Text from 1.6 to 1.7. Thanks to
Gary Gregory.
o CONFIGURATION-752:  Update Apache Commons VFS from 2.3 to 2.4.1. Thanks
to Gary Gregory.
o CONFIGURATION-754:  Update Apache Commons Text from 1.7 to 1.8. Thanks to
Gary Gregory.
o CONFIGURATION-755:  [CVE-2014-0114] Update Apache Commons BeanUtils from
1.9.3 to 1.9.4. Thanks to Gary Gregory.
o Fix syntax in user guide documentation #33. Thanks to
Kevin Wang.
o CONFIGURATION-757:  Update org.yaml:snakeyaml from 1.24 to 1.25. Thanks
to Gary Gregory.
o Update tests from org.apache.commons:commons-dbcp2
2.6.0 to 2.7.0. Thanks to Gary Gregory.
o Update tests from org.apache.commons:commons-pool2
2.6.2 to 2.7.0. Thanks to Gary Gregory.
o CONFIGURATION-758:  Update commons-codec:commons-codec from 1.12 to 1.13.
Thanks to Gary Gregory.
o Update tests from org.hsqldb:hsqldb 2.4.1 to 2.5.0.
Thanks to Gary Gregory.
o Update tests from com.sun.mail:mailapi 1.6.3 to
1.6.4. Thanks to Gary Gregory.
o CONFIGURATION-759:  Update Spring from 4.3.24.RELEASE to 4.3.25.RELEASE.
Thanks to Gary Gregory.
o Update maven-checkstyle-plugin from 3.0.0 to 3.1.0.
Thanks to Gary Gregory.
o Use current version of Checkstyle: 6.18 to 8.24.
Thanks to Gary Gregory.


Historical list of changes:
https://commons.apache.org/proper/commons-configuration/changes-report.html

For complete information on Apache Commons Configuration, including
instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons
Configuration website:

https://commons.apache.org/proper/commons-configuration/

Download it from
https://commons.apache.org/proper/commons-configuration/download_configuration.cgi

Gary Gregory,
On behalf of the Apache Commons Team


[ANNOUNCEMENT] Apache Commons Configuration Version 2.6

2019-09-18 Thread Gary Gregory
The Apache Commons team announces Apache Commons Configuration Version 2.6.

Release Notes
2019-09-13

INTRODUCTION:
=

This document contains the release notes for this version of the Commons
Configuration component. It describes the changes since the previous
version.
The Commons Configuration software library provides a generic configuration
interface which enables an application to read configuration data from a
variety
of sources.

Tools to assist in the reading of configuration/preferences files in
various formats

Minor release with new features and updated dependencies.

Changes in this version include:

New features:
o Document "includeOptional" on the site. Thanks to
Gary Gregory.
o CONFIGURATION-756:  Allow for custom behavior to handle errors loading
included properties files. Thanks to Gary Gregory.

Fixed Bugs:
o CONFIGURATION-750:  XMLPropertyListConfiguration cannot set arrays in the
correct plist form. Thanks to Jason Pickens, Gary Gregory, Emmanuel Bourg.
o Fix Javadoc for
org.apache.commons.configuration2.PropertiesConfiguration.getIncludeOptional().
Thanks to Gary Gregory.
o CONFIGURATION-760:  Properties file using cyclical includes cause a
StackOverflowError instead of detecting the misconfiguration. Thanks to
Gary Gregory.

Changes:
o CONFIGURATION-751:  Update Apache Commons Text from 1.6 to 1.7. Thanks to
Gary Gregory.
o CONFIGURATION-752:  Update Apache Commons VFS from 2.3 to 2.4.1. Thanks
to Gary Gregory.
o CONFIGURATION-754:  Update Apache Commons Text from 1.7 to 1.8. Thanks to
Gary Gregory.
o CONFIGURATION-755:  [CVE-2014-0114] Update Apache Commons BeanUtils from
1.9.3 to 1.9.4. Thanks to Gary Gregory.
o Fix syntax in user guide documentation #33. Thanks to
Kevin Wang.
o CONFIGURATION-757:  Update org.yaml:snakeyaml from 1.24 to 1.25. Thanks
to Gary Gregory.
o Update tests from org.apache.commons:commons-dbcp2
2.6.0 to 2.7.0. Thanks to Gary Gregory.
o Update tests from org.apache.commons:commons-pool2
2.6.2 to 2.7.0. Thanks to Gary Gregory.
o CONFIGURATION-758:  Update commons-codec:commons-codec from 1.12 to 1.13.
Thanks to Gary Gregory.
o Update tests from org.hsqldb:hsqldb 2.4.1 to 2.5.0.
Thanks to Gary Gregory.
o Update tests from com.sun.mail:mailapi 1.6.3 to
1.6.4. Thanks to Gary Gregory.
o CONFIGURATION-759:  Update Spring from 4.3.24.RELEASE to 4.3.25.RELEASE.
Thanks to Gary Gregory.
o Update maven-checkstyle-plugin from 3.0.0 to 3.1.0.
Thanks to Gary Gregory.
o Use current version of Checkstyle: 6.18 to 8.24.
Thanks to Gary Gregory.


Historical list of changes:
https://commons.apache.org/proper/commons-configuration/changes-report.html

For complete information on Apache Commons Configuration, including
instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons
Configuration website:

https://commons.apache.org/proper/commons-configuration/

Download it from
https://commons.apache.org/proper/commons-configuration//download_text.cgi

Gary Gregory,
On behalf of the Apache Commons Team


[ANNOUNCEMENT] Apache Commons Configuration Version 2.5

2019-05-27 Thread Gary Gregory
The Apache Commons team is pleased to announce the release of Apache
Commons Configuration Version 2.5.

The Commons Configuration software library provides a generic configuration
interface which enables an application to read configuration data from a
variety
of sources.

This is a minor release with new features and updated dependencies.

Changes in this version include:

Fixed Bugs:
o CONFIGURATION-731:  Allow user to specify the comments and separator
chars. Thanks to Shuai Zhang, Gary Gregory.

Changes:
o CONFIGURATION-738:  Update Jackson from 2.9.7 to 2.9.8. Thanks to Gary
Gregory.
o CONFIGURATION-739:  Update Apache Commons Codec from 1.11 to 1.12. Thanks
to Gary Gregory.
o CONFIGURATION-740:  Update Apache Commons VFS from 2.2 to 2.3. Thanks to
Gary Gregory.
o CONFIGURATION-741:  Update Spring from 4.3.19 to 4.3.22. Thanks to Gary
Gregory.
o CONFIGURATION-743:  Update optional library snakeyaml from 1.23 to 1.24.
Thanks to Gary Gregory.
o CONFIGURATION-747:  Update Apache Commons Lang from 3.8.1 to 3.9. Thanks
to Gary Gregory.
o CONFIGURATION-746:  Update Jackson from 2.9.8 to 2.9.9. Thanks to Gary
Gregory.
o CONFIGURATION-747:  Update Spring from 4.3.22 to 4.3.24. Thanks to Gary
Gregory.
o CONFIGURATION-745:  Add the special key "includeoptional" for properties
files. Thanks to Gary Gregory.

Historical list of changes:
http://commons.apache.org/proper/commons-configuration/changes-report.html

For complete information on Apache Commons Configuration, including
instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons
Configuration website:

http://commons.apache.org/proper/commons-configuration/

Gary Gregory,
on behalf of the Apache Commons Team


[ANNOUNCE] Commons Configuration 2.4 Released

2018-10-30 Thread Rob Tompkins
The Apache Commons Team is pleased to announce the release of
Apache Commons Configuration 2.4.

The Apache Commons Configuration open source software library 
provides a generic configuration interface which enables an application 
to read configuration data from a variety of sources.

Source and binary distributions are available for download from the Apache
Commons download site:
  
http://commons.apache.org/proper/commons-configuration/download_configuration.cgi

When downloading, please verify signatures using the KEYS file available at
the above location when downloading the release.

Alternatively the release can be pulled via maven:
  org.apache.commons
  commons-configuration2
  2.4

The release notes can be reviewed at:
  http://www.apache.org/dist/commons/configuration/RELEASE-NOTES.txt

For complete information on Commons Configuration, including instructions on 
how to
submit bug reports, patches, or suggestions for improvement, see the Apache
Commons Configuration website:

http://commons.apache.org/proper/commons-configuration/

Best regards,
Rob Tompkins
on behalf of the Apache Commons community
-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[ANNOUNCEMENT] Commons Configuration 2.3 Released

2018-08-09 Thread Oliver Heger
The Apache Commons Team is pleased to announce the availability of
Apache Commons Configuration 2.3.

The Apache Commons Configuration software library provides a generic
configuration interface which enables an application to read
configuration data from a variety of sources.

Version 2.3 is another maintenance release for the Configuration 2.x
series. It contains bug fixes and also a few new features like support
for File and Path as data types. The release is fully source and binary
compatible with version 2.2.

A full list of all changes can be found in the release notes at
  http://www.apache.org/dist/commons/configuration/RELEASE-NOTES.txt

A user's guide describing all the features of Configuration 2.x can be
found at
  http://commons.apache.org/configuration/userguide/user_guide.html

Source and binary distributions are available for download from the
Apache Commons download site:

http://commons.apache.org/proper/commons-configuration/download_configuration.cgi

Please verify signatures using the KEYS file available at the above
location when downloading the release.

For complete information on Commons Configuration, including
instructions on how to submit bug reports, patches, or suggestions for
improvement, see the Apache Commons Configuration website:

http://commons.apache.org/proper/commons-configuration/

Oliver Heger, on behalf of the Apache Commons community



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Reloading properties does not work as expected

2018-02-07 Thread Paul Wellner Bou
Hi,

Great, thanks to you!

Have a nice day,
Paul

On Tue, Feb 6, 2018 at 10:02 PM Oliver Heger 
wrote:

> Hi,
>
> the reloading examples have been fixed, and the site was redeployed.
> Thanks again.
>
> Oliver
>
>
>


Re: [configuration] Reloading properties does not work as expected

2018-02-06 Thread Oliver Heger
Hi,

the reloading examples have been fixed, and the site was redeployed.
Thanks again.

Oliver

Am 01.02.2018 um 10:26 schrieb Paul Wellner Bou:
> Hi,
> 
> thank you very much.
> 
> Yes, this helps. This is more or less what I found out as well. That's why
> I introduced the 6 seconds delay in my original example, to wait for this
> 5s timeout.
> I tried to call getProperty more than once, too, because I noticed
> debugging that the check time is only filled after the first call.
> 
> But somehow I wrote my test code in a way, that the reloading time was the
> same as the time the file changed (which may happen in unit tests, its the
> same millisecond). So the test failed again.
> 
> Now I reordered the statements a bit, and it works now. I just need to add
> a call in the very beginning of the test. The timeouts I introduced in the
> first approach are already enough.
> 
> So it works now. Thanks very much!
> https://gist.github.com/paulwellnerbou/dfed371d67e2f19a699b248ebf5c62d7
> 
>> i am trying to implement a reloadable property using commons-reloading2
>>> (2.2), without success. I tried to follow the (outdated) examples on
>>>
>> https://commons.apache.org/proper/commons-configuration/userguide/howto_reloading.html#Reloading_File-based_Configurations
>>> (both of them).
>>
>> Could you be a bit more specific about what is outdated, so that we can
>> update the examples?
>>
> 
> Sure:
> https://gist.github.com/paulwellnerbou/3e309535a8a516477dc2bede478f79f2/revisions
> Maybe you could add that commons-beanutils:1.9.3 is required to avoid the
> NoClassDefFoundException (
> https://stackoverflow.com/questions/16266047/very-simple-apache-commons-configuration-example-throws-noclassdeffounderror
> ).
> 
> Cheers,
> Paul.
> 
>>
>>> Now I created a unit test against this API which I would expect it to
>> pass,
>>> but it doesn't:
>>> https://gist.github.com/paulwellnerbou/dfed371d67e2f19a699b248ebf5c62d7
>>>
>>> Any idea what I am doing wrong?
>>
>> I had a deeper look at the test and the implementation, and here is what
>> I found out:
>>
>> The class for checking whether a reload of a file is required is
>> FileHandlerReloadingDetector. The class records the time of the last
>> check and has a refreshDelay property; it only checks again after the
>> time configured for the delay is elapsed. The default refreshDelay is 5
>> seconds. This is one reason why your test does not pass; you need to
>> decrease this delay or wait longer.
>>
>> The other reason is that there is indeed a problem in the implementation
>> that causes the first call to getConfiguration() to get missed by the
>> reload checker. The CONFIGURATION_REQUEST event is already fired before
>> the file to be loaded is properly initialized, and therefore, the
>> checker cannot set its last check time. This is initialized only at the
>> second call to getConfiguration(). So the test would only be successful
>> if getConfiguration() was called another time (taking the refresh delay
>> into account).
>>
>> This can be considered a bug, but is probably not very problematic in
>> practice when the configuration is accessed on a regular basis.
>>
>> HTH
>> Oliver
>>
>>
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Reloading properties does not work as expected

2018-02-01 Thread Paul Wellner Bou
Hi,

thank you very much.

Yes, this helps. This is more or less what I found out as well. That's why
I introduced the 6 seconds delay in my original example, to wait for this
5s timeout.
I tried to call getProperty more than once, too, because I noticed
debugging that the check time is only filled after the first call.

But somehow I wrote my test code in a way, that the reloading time was the
same as the time the file changed (which may happen in unit tests, its the
same millisecond). So the test failed again.

Now I reordered the statements a bit, and it works now. I just need to add
a call in the very beginning of the test. The timeouts I introduced in the
first approach are already enough.

So it works now. Thanks very much!
https://gist.github.com/paulwellnerbou/dfed371d67e2f19a699b248ebf5c62d7

> i am trying to implement a reloadable property using commons-reloading2
> > (2.2), without success. I tried to follow the (outdated) examples on
> >
> https://commons.apache.org/proper/commons-configuration/userguide/howto_reloading.html#Reloading_File-based_Configurations
> > (both of them).
>
> Could you be a bit more specific about what is outdated, so that we can
> update the examples?
>

Sure:
https://gist.github.com/paulwellnerbou/3e309535a8a516477dc2bede478f79f2/revisions
Maybe you could add that commons-beanutils:1.9.3 is required to avoid the
NoClassDefFoundException (
https://stackoverflow.com/questions/16266047/very-simple-apache-commons-configuration-example-throws-noclassdeffounderror
).

Cheers,
Paul.

>
> > Now I created a unit test against this API which I would expect it to
> pass,
> > but it doesn't:
> > https://gist.github.com/paulwellnerbou/dfed371d67e2f19a699b248ebf5c62d7
> >
> > Any idea what I am doing wrong?
>
> I had a deeper look at the test and the implementation, and here is what
> I found out:
>
> The class for checking whether a reload of a file is required is
> FileHandlerReloadingDetector. The class records the time of the last
> check and has a refreshDelay property; it only checks again after the
> time configured for the delay is elapsed. The default refreshDelay is 5
> seconds. This is one reason why your test does not pass; you need to
> decrease this delay or wait longer.
>
> The other reason is that there is indeed a problem in the implementation
> that causes the first call to getConfiguration() to get missed by the
> reload checker. The CONFIGURATION_REQUEST event is already fired before
> the file to be loaded is properly initialized, and therefore, the
> checker cannot set its last check time. This is initialized only at the
> second call to getConfiguration(). So the test would only be successful
> if getConfiguration() was called another time (taking the refresh delay
> into account).
>
> This can be considered a bug, but is probably not very problematic in
> practice when the configuration is accessed on a regular basis.
>
> HTH
> Oliver
>
>


Re: [configuration] Reloading properties does not work as expected

2018-01-31 Thread Oliver Heger
Hi,

Am 30.01.2018 um 10:18 schrieb Paul Wellner Bou:
> Good morning,
> 
> i am trying to implement a reloadable property using commons-reloading2
> (2.2), without success. I tried to follow the (outdated) examples on
> https://commons.apache.org/proper/commons-configuration/userguide/howto_reloading.html#Reloading_File-based_Configurations
> (both of them).

Could you be a bit more specific about what is outdated, so that we can
update the examples?

> 
> Now I created a unit test against this API which I would expect it to pass,
> but it doesn't:
> https://gist.github.com/paulwellnerbou/dfed371d67e2f19a699b248ebf5c62d7
> 
> Any idea what I am doing wrong?

I had a deeper look at the test and the implementation, and here is what
I found out:

The class for checking whether a reload of a file is required is
FileHandlerReloadingDetector. The class records the time of the last
check and has a refreshDelay property; it only checks again after the
time configured for the delay is elapsed. The default refreshDelay is 5
seconds. This is one reason why your test does not pass; you need to
decrease this delay or wait longer.

The other reason is that there is indeed a problem in the implementation
that causes the first call to getConfiguration() to get missed by the
reload checker. The CONFIGURATION_REQUEST event is already fired before
the file to be loaded is properly initialized, and therefore, the
checker cannot set its last check time. This is initialized only at the
second call to getConfiguration(). So the test would only be successful
if getConfiguration() was called another time (taking the refresh delay
into account).

This can be considered a bug, but is probably not very problematic in
practice when the configuration is accessed on a regular basis.

HTH
Oliver

> 
> Thank you and kind regards
> Paul.
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] Reloading properties does not work as expected

2018-01-30 Thread Paul Wellner Bou
Good morning,

i am trying to implement a reloadable property using commons-reloading2
(2.2), without success. I tried to follow the (outdated) examples on
https://commons.apache.org/proper/commons-configuration/userguide/howto_reloading.html#Reloading_File-based_Configurations
(both of them).

Now I created a unit test against this API which I would expect it to pass,
but it doesn't:
https://gist.github.com/paulwellnerbou/dfed371d67e2f19a699b248ebf5c62d7

Any idea what I am doing wrong?

Thank you and kind regards
Paul.


Re: [configuration] Problem Migrating from 1.x to 2.x, my XMLBeanDeclaration is key no Longer Valid

2017-10-28 Thread John Boyer
Hi Oliver:

Thank you for clarifying. Incidentally, if you go to the Commons Configuration 
home page under Documentation, click 2.1.1 > User’s Guide > Declaring and 
Creating Beans > An Example or click 
http://commons.apache.org/proper/commons-configuration/userguide/howto_beans.html#An_Example.
 The Java code example uses the dot notation:  

BeanDeclaration decl = new XMLBeanDeclaration(config, 
“gui.windowManager”);

I’d recommend adding a note to the documentation that states the default 
expression engine is being used in the example. I think I probably cut and 
paste an example that was using the XML path expression engine instead.

Thanks again,

John

> On Oct 28, 2017, at 11:57 AM, Oliver Heger <oliver.he...@oliver-heger.de> 
> wrote:
> 
> Hello,
> 
> Am 27.10.2017 um 22:26 schrieb John Boyer:
>> Hello:
>> 
>> I’m working on migrating my codebase from Commons Configuration 1.x to 2.x. 
>> However, in version 2, I receive an error indicating that the key I used in 
>> 1.x is invalid:
>> 
>>  org.apache.commons.configuration2.ex.ConfigurationRuntimeException: 
>> Passed in key must select exactly one node (found 0): ios.invitation
>> 
>> 
>> —-
>> The string dump of my XMLConfiguration appears as follows:
>> 
>> ios/invitation/@config-class=com.example.email.DefaultEventEmailFormatter
>> ios/invitation/@fileName=request-cancel
>> ios/invitation/@subject=Itty-Bitty Skedi | Invitation
>> ios/invitation/@name=Invitation
>> ios/invitation/@senderFirstName=Itty-Bitty
>> ios/invitation/@shortDescription=You have a new notification waiting for you 
>> in the Skedi app.
>> ios/invitation/@fromEmailAddress=donotre...@example.com
>> ios/invitation/@contentType=text/plain
>> ios/invitation/@senderLastName=Skedi
> 
> From this dump it looks as if the configuration is using an
> XPathExpressionEngine. Note that the slash is used as separator for
> property keys.
> 
>> 
>> 
>> —-
>> The XML file is:
>> 
>> 
>> 
>>  
>>  
>>  >  
>> config-class=“com.example.email.DefaultEventEmailFormatter”
>>  contentType="text/plain"
>>  fromEmailAddress=“donotre...@example.com”
>>  senderFirstName="Itty-Bitty"
>>  senderLastName="Skedi"
>>  subject="Itty-Bitty Skedi | Invitation"
>>  shortDescription="You have a new notification waiting 
>> for you in the Skedi app."
>>  name="Invitation"
>>  fileName="request-cancel"/>
>>  
>> 
>> 
>> —-
>> The Java code snippet:
>> 
>> XMLConfiguration xmlConfig = builder.getConfiguration();
>> log.info(ConfigurationUtils.toString(xmlConfig));
>> 
>> BeanDeclaration decl = new XMLBeanDeclaration(xmlConfig, 
>> “ios.invitation”);//where `ios.invitation` is the key
> 
> They key you pass to the bean declaration is expressed in terms of the
> default expression engine. To be compliant with the configuration, you
> should use the key "ios/invitation".
> 
> I do not know why the problem occurs after you switch to Configuration
> 2.x. But the cause seems to be that the key you use is actually wrong
> because it cannot be interpreted correctly by the expression engine.
> 
> Oliver
> 
>> 
>> —-
>> 
>> Can anyone help me to resolve this problem?
>> 
>> Thank you for your time in advance.
>> 
>> Regards,
>> 
>> John Boyer
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Problem Migrating from 1.x to 2.x, my XMLBeanDeclaration is key no Longer Valid

2017-10-28 Thread Oliver Heger
Hello,

Am 27.10.2017 um 22:26 schrieb John Boyer:
> Hello:
> 
> I’m working on migrating my codebase from Commons Configuration 1.x to 2.x. 
> However, in version 2, I receive an error indicating that the key I used in 
> 1.x is invalid:
>  
>   org.apache.commons.configuration2.ex.ConfigurationRuntimeException: 
> Passed in key must select exactly one node (found 0): ios.invitation
> 
> 
> —-
> The string dump of my XMLConfiguration appears as follows:
> 
> ios/invitation/@config-class=com.example.email.DefaultEventEmailFormatter
> ios/invitation/@fileName=request-cancel
> ios/invitation/@subject=Itty-Bitty Skedi | Invitation
> ios/invitation/@name=Invitation
> ios/invitation/@senderFirstName=Itty-Bitty
> ios/invitation/@shortDescription=You have a new notification waiting for you 
> in the Skedi app.
> ios/invitation/@fromEmailAddress=donotre...@example.com
> ios/invitation/@contentType=text/plain
> ios/invitation/@senderLastName=Skedi

>From this dump it looks as if the configuration is using an
XPathExpressionEngine. Note that the slash is used as separator for
property keys.

> 
> 
> —-
> The XML file is:
> 
> 
> 
>   
>   
>  
> config-class=“com.example.email.DefaultEventEmailFormatter”
>   contentType="text/plain"
>   fromEmailAddress=“donotre...@example.com”
>   senderFirstName="Itty-Bitty"
>   senderLastName="Skedi"
>   subject="Itty-Bitty Skedi | Invitation"
>   shortDescription="You have a new notification waiting 
> for you in the Skedi app."
>   name="Invitation"
>   fileName="request-cancel"/>
>   
> 
> 
> —-
> The Java code snippet:
> 
> XMLConfiguration xmlConfig = builder.getConfiguration();
> log.info(ConfigurationUtils.toString(xmlConfig));
> 
> BeanDeclaration decl = new XMLBeanDeclaration(xmlConfig, 
> “ios.invitation”);//where `ios.invitation` is the key

They key you pass to the bean declaration is expressed in terms of the
default expression engine. To be compliant with the configuration, you
should use the key "ios/invitation".

I do not know why the problem occurs after you switch to Configuration
2.x. But the cause seems to be that the key you use is actually wrong
because it cannot be interpreted correctly by the expression engine.

Oliver

> 
> —-
> 
> Can anyone help me to resolve this problem?
> 
> Thank you for your time in advance.
> 
> Regards,
> 
> John Boyer
> 
> 
> 
> 
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] Problem Migrating from 1.x to 2.x, my XMLBeanDeclaration is key no Longer Valid

2017-10-27 Thread John Boyer
Hello:

I’m working on migrating my codebase from Commons Configuration 1.x to 2.x. 
However, in version 2, I receive an error indicating that the key I used in 1.x 
is invalid:
 
org.apache.commons.configuration2.ex.ConfigurationRuntimeException: 
Passed in key must select exactly one node (found 0): ios.invitation


—-
The string dump of my XMLConfiguration appears as follows:

ios/invitation/@config-class=com.example.email.DefaultEventEmailFormatter
ios/invitation/@fileName=request-cancel
ios/invitation/@subject=Itty-Bitty Skedi | Invitation
ios/invitation/@name=Invitation
ios/invitation/@senderFirstName=Itty-Bitty
ios/invitation/@shortDescription=You have a new notification waiting for you in 
the Skedi app.
ios/invitation/@fromEmailAddress=donotre...@example.com
ios/invitation/@contentType=text/plain
ios/invitation/@senderLastName=Skedi


—-
The XML file is:









—-
The Java code snippet:

XMLConfiguration xmlConfig = builder.getConfiguration();
log.info(ConfigurationUtils.toString(xmlConfig));

BeanDeclaration decl = new XMLBeanDeclaration(xmlConfig, 
“ios.invitation”);//where `ios.invitation` is the key

—-

Can anyone help me to resolve this problem?

Thank you for your time in advance.

Regards,

John Boyer








-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[ANNOUNCEMENT] Commons Configuration 2.2 Released

2017-10-13 Thread Oliver Heger
The Apache Commons Team is pleased to announce the availability of
Apache Commons Configuration 2.2.

The Apache Commons Configuration software library provides a generic
configuration interface which enables an application to read
configuration data from a variety of sources.

Version 2.2 is another maintenance release for the Configuration 2.x
series. It contains a number of bug fixes and also some new features.
Among the highlights is the new support for JSON and YAML
configurations. The release is fully source and binary compatible with
version 2.1.1.

A full list of all changes can be found in the release notes at
  http://www.apache.org/dist/commons/configuration/RELEASE-NOTES.txt

A user's guide describing all the features of Configuration 2.x can be
found at
  http://commons.apache.org/configuration/userguide/user_guide.html

Source and binary distributions are available for download from the
Apache Commons download site:

http://commons.apache.org/proper/commons-configuration/download_configuration.cgi

Please verify signatures using the KEYS file available at the above
location when downloading the release.

For complete information on Commons Configuration, including
instructions on how to submit bug reports, patches, or suggestions for
improvement, see the Apache Commons Configuration website:

http://commons.apache.org/proper/commons-configuration/

Oliver Heger, on behalf of the Apache Commons community

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Release date for commons-configuration2 ?

2017-10-01 Thread Oliver Heger


Am 01.10.2017 um 14:23 schrieb Andreas Kuhtz:
> Hi Oliver,
> Thank you for the published SNAPSHOT build.
> 
> I've provided a JIRA issue and PR for the Java 9 module name:
> https://github.com/apache/commons-configuration/pull/6

Many thanks!

I will have a look (probably in a few days).

Oliver

> 
> Cheers,
> Andreas
> 
> 2017-09-28 21:48 GMT+02:00 Oliver Heger <oliver.he...@oliver-heger.de>:
> 
>>
>>
>> Am 27.09.2017 um 08:33 schrieb Andreas Kuhtz:
>>> Hi Gary,
>>>
>>> I wasn't aware that pushing a SNAPSHOT build needs the release process
>> will
>>> all preparations to be executed, but I'll wait for the next release in
>> this
>>> case.
>>> Thank you for all the good solutions that are provided by the
>> configuration
>>> team.
>>
>> For just uploading a SNAPSHOT, no release preparations should be
>> required. I have just done so, so you should now find a recent version
>> in the SNAPSHOT repository referred to by Pascal.
>>
>> Regarding a release: This is indeed on my todo list, but not with
>> highest priority. I may need some more weeks until I get to it. (If a RM
>> is available earlier, that would be great.)
>>
>> The codebase should be in a state that it can be released. There are no
>> blocking issues in Jira. We should, however, add the Java 9 module name.
>>
>> Oliver
>>
>>>
>>> Andreas
>>>
>>> 2017-09-26 22:17 GMT+02:00 Gary Gregory <garydgreg...@gmail.com>:
>>>
>>>> On Tue, Sep 26, 2017 at 2:07 PM, Andreas Kuhtz <andreas.ku...@gmail.com
>>>
>>>> wrote:
>>>>
>>>>> Thank you for the response.
>>>>> I looked at http://repository.apache.org/snapshots/ already, but there
>>>> is
>>>>> no 2.2-SNAPSHOT. If someone has permissions to publish the current
>>>>> 2.2-SNAPSHOT that would be great.
>>>>>
>>>>
>>>> Unfortunately, it's more complicated than that. We have a release
>> process
>>>> that requires a release manager from our team to volunteer and jump
>> through
>>>> a bunch of hoops.
>>>>
>>>> Gary
>>>>
>>>> <http://repository.apache.org/snapshots/>
>>>>>
>>>>> 2017-09-26 21:59 GMT+02:00 Pascal Schumacher <pascalschumac...@gmx.net
>>> :
>>>>>
>>>>>> Sorry my response was less that clear. The public maven repo address
>>>> is:
>>>>>> http://repository.apache.org/snapshots/
>>>>>>
>>>>>> See: https://www.apache.org/dev/repository-faq.html#basic
>>>>>>
>>>>>>
>>>>>> Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
>>>>>>
>>>>>>> No idea if there are concrete plans for a release date of
>>>>>>> commons-configuration 2.2 with the YAML feature.
>>>>>>>
>>>>>>> https://repository.apache.org/content/groups/snapshots/org/a
>>>>>>> pache/commons/commons-configuration2/ should have a snapshots with
>>>> the
>>>>>>> feature.
>>>>>>>
>>>>>>> Kind regards,
>>>>>>> Pascal
>>>>>>>
>>>>>>> Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:
>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> Is there a planned release date for commons-configuration2 or is a
>>>>>>>> SNAPSHOT
>>>>>>>> available in a public maven repo?
>>>>>>>>
>>>>>>>> I would like to use the YAML configuration in my project.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Andreas
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> 
>> -
>>>>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>>>>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -
>>>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>>>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Release date for commons-configuration2 ?

2017-09-28 Thread Oliver Heger


Am 27.09.2017 um 08:33 schrieb Andreas Kuhtz:
> Hi Gary,
> 
> I wasn't aware that pushing a SNAPSHOT build needs the release process will
> all preparations to be executed, but I'll wait for the next release in this
> case.
> Thank you for all the good solutions that are provided by the configuration
> team.

For just uploading a SNAPSHOT, no release preparations should be
required. I have just done so, so you should now find a recent version
in the SNAPSHOT repository referred to by Pascal.

Regarding a release: This is indeed on my todo list, but not with
highest priority. I may need some more weeks until I get to it. (If a RM
is available earlier, that would be great.)

The codebase should be in a state that it can be released. There are no
blocking issues in Jira. We should, however, add the Java 9 module name.

Oliver

> 
> Andreas
> 
> 2017-09-26 22:17 GMT+02:00 Gary Gregory <garydgreg...@gmail.com>:
> 
>> On Tue, Sep 26, 2017 at 2:07 PM, Andreas Kuhtz <andreas.ku...@gmail.com>
>> wrote:
>>
>>> Thank you for the response.
>>> I looked at http://repository.apache.org/snapshots/ already, but there
>> is
>>> no 2.2-SNAPSHOT. If someone has permissions to publish the current
>>> 2.2-SNAPSHOT that would be great.
>>>
>>
>> Unfortunately, it's more complicated than that. We have a release process
>> that requires a release manager from our team to volunteer and jump through
>> a bunch of hoops.
>>
>> Gary
>>
>> <http://repository.apache.org/snapshots/>
>>>
>>> 2017-09-26 21:59 GMT+02:00 Pascal Schumacher <pascalschumac...@gmx.net>:
>>>
>>>> Sorry my response was less that clear. The public maven repo address
>> is:
>>>> http://repository.apache.org/snapshots/
>>>>
>>>> See: https://www.apache.org/dev/repository-faq.html#basic
>>>>
>>>>
>>>> Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
>>>>
>>>>> No idea if there are concrete plans for a release date of
>>>>> commons-configuration 2.2 with the YAML feature.
>>>>>
>>>>> https://repository.apache.org/content/groups/snapshots/org/a
>>>>> pache/commons/commons-configuration2/ should have a snapshots with
>> the
>>>>> feature.
>>>>>
>>>>> Kind regards,
>>>>> Pascal
>>>>>
>>>>> Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> Is there a planned release date for commons-configuration2 or is a
>>>>>> SNAPSHOT
>>>>>> available in a public maven repo?
>>>>>>
>>>>>> I would like to use the YAML configuration in my project.
>>>>>>
>>>>>> Best regards,
>>>>>> Andreas
>>>>>>
>>>>>>
>>>>>
>>>>> -
>>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>>>
>>>>>
>>>>
>>>> -
>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>>
>>>>
>>>
>>
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re:Re: [configuration] Release date for commons-configuration2 ?

2017-09-27 Thread mingleizhang
Thanks Oliver! But I would ask, what you said "Properties.load()" ? What kind 
of Properties you mean ? If java.util.Properties ? I think NO I want it 
returns type belongs to java.util.Properties as an output. and input is a file 
name.


/Rice






At 2017-09-28 03:35:51, "Oliver Heger" <oliver.he...@oliver-heger.de> wrote:
>
>
>Am 27.09.2017 um 11:08 schrieb mingleizhang:
>> It seems I can not directly convert a file to a java Properties class in 
>> this package. I hope it like this.
>> 
>> 
>> read(fileName: String): Properties
>> 
>Wouldn't Properties.load() do the trick?
>
>Oliver
>
>> 
>> Rice.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> At 2017-09-27 14:33:01, "Andreas Kuhtz" <andreas.ku...@gmail.com> wrote:
>>> Hi Gary,
>>>
>>> I wasn't aware that pushing a SNAPSHOT build needs the release process will
>>> all preparations to be executed, but I'll wait for the next release in this
>>> case.
>>> Thank you for all the good solutions that are provided by the configuration
>>> team.
>>>
>>> Andreas
>>>
>>> 2017-09-26 22:17 GMT+02:00 Gary Gregory <garydgreg...@gmail.com>:
>>>
>>>> On Tue, Sep 26, 2017 at 2:07 PM, Andreas Kuhtz <andreas.ku...@gmail.com>
>>>> wrote:
>>>>
>>>>> Thank you for the response.
>>>>> I looked at http://repository.apache.org/snapshots/ already, but there
>>>> is
>>>>> no 2.2-SNAPSHOT. If someone has permissions to publish the current
>>>>> 2.2-SNAPSHOT that would be great.
>>>>>
>>>>
>>>> Unfortunately, it's more complicated than that. We have a release process
>>>> that requires a release manager from our team to volunteer and jump through
>>>> a bunch of hoops.
>>>>
>>>> Gary
>>>>
>>>> <http://repository.apache.org/snapshots/>
>>>>>
>>>>> 2017-09-26 21:59 GMT+02:00 Pascal Schumacher <pascalschumac...@gmx.net>:
>>>>>
>>>>>> Sorry my response was less that clear. The public maven repo address
>>>> is:
>>>>>> http://repository.apache.org/snapshots/
>>>>>>
>>>>>> See: https://www.apache.org/dev/repository-faq.html#basic
>>>>>>
>>>>>>
>>>>>> Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
>>>>>>
>>>>>>> No idea if there are concrete plans for a release date of
>>>>>>> commons-configuration 2.2 with the YAML feature.
>>>>>>>
>>>>>>> https://repository.apache.org/content/groups/snapshots/org/a
>>>>>>> pache/commons/commons-configuration2/ should have a snapshots with
>>>> the
>>>>>>> feature.
>>>>>>>
>>>>>>> Kind regards,
>>>>>>> Pascal
>>>>>>>
>>>>>>> Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:
>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> Is there a planned release date for commons-configuration2 or is a
>>>>>>>> SNAPSHOT
>>>>>>>> available in a public maven repo?
>>>>>>>>
>>>>>>>> I would like to use the YAML configuration in my project.
>>>>>>>>
>>>>>>>> Best regards,
>>>>>>>> Andreas
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> -
>>>>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>>>>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -
>>>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>>>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>
>
>-
>To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>For additional commands, e-mail: user-h...@commons.apache.org
>


Re: [configuration] Release date for commons-configuration2 ?

2017-09-27 Thread Oliver Heger


Am 27.09.2017 um 11:08 schrieb mingleizhang:
> It seems I can not directly convert a file to a java Properties class in this 
> package. I hope it like this.
> 
> 
> read(fileName: String): Properties
> 
Wouldn't Properties.load() do the trick?

Oliver

> 
> Rice.
> 
> 
> 
> 
> 
> 
> 
> At 2017-09-27 14:33:01, "Andreas Kuhtz" <andreas.ku...@gmail.com> wrote:
>> Hi Gary,
>>
>> I wasn't aware that pushing a SNAPSHOT build needs the release process will
>> all preparations to be executed, but I'll wait for the next release in this
>> case.
>> Thank you for all the good solutions that are provided by the configuration
>> team.
>>
>> Andreas
>>
>> 2017-09-26 22:17 GMT+02:00 Gary Gregory <garydgreg...@gmail.com>:
>>
>>> On Tue, Sep 26, 2017 at 2:07 PM, Andreas Kuhtz <andreas.ku...@gmail.com>
>>> wrote:
>>>
>>>> Thank you for the response.
>>>> I looked at http://repository.apache.org/snapshots/ already, but there
>>> is
>>>> no 2.2-SNAPSHOT. If someone has permissions to publish the current
>>>> 2.2-SNAPSHOT that would be great.
>>>>
>>>
>>> Unfortunately, it's more complicated than that. We have a release process
>>> that requires a release manager from our team to volunteer and jump through
>>> a bunch of hoops.
>>>
>>> Gary
>>>
>>> <http://repository.apache.org/snapshots/>
>>>>
>>>> 2017-09-26 21:59 GMT+02:00 Pascal Schumacher <pascalschumac...@gmx.net>:
>>>>
>>>>> Sorry my response was less that clear. The public maven repo address
>>> is:
>>>>> http://repository.apache.org/snapshots/
>>>>>
>>>>> See: https://www.apache.org/dev/repository-faq.html#basic
>>>>>
>>>>>
>>>>> Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
>>>>>
>>>>>> No idea if there are concrete plans for a release date of
>>>>>> commons-configuration 2.2 with the YAML feature.
>>>>>>
>>>>>> https://repository.apache.org/content/groups/snapshots/org/a
>>>>>> pache/commons/commons-configuration2/ should have a snapshots with
>>> the
>>>>>> feature.
>>>>>>
>>>>>> Kind regards,
>>>>>> Pascal
>>>>>>
>>>>>> Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> Is there a planned release date for commons-configuration2 or is a
>>>>>>> SNAPSHOT
>>>>>>> available in a public maven repo?
>>>>>>>
>>>>>>> I would like to use the YAML configuration in my project.
>>>>>>>
>>>>>>> Best regards,
>>>>>>> Andreas
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -
>>>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>>>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>>>>
>>>>>>
>>>>>
>>>>> -
>>>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>>>
>>>>>
>>>>
>>>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re:Re: [configuration] Release date for commons-configuration2 ?

2017-09-27 Thread mingleizhang
It seems I can not directly convert a file to a java Properties class in this 
package. I hope it like this.


read(fileName: String): Properties


Rice.







At 2017-09-27 14:33:01, "Andreas Kuhtz" <andreas.ku...@gmail.com> wrote:
>Hi Gary,
>
>I wasn't aware that pushing a SNAPSHOT build needs the release process will
>all preparations to be executed, but I'll wait for the next release in this
>case.
>Thank you for all the good solutions that are provided by the configuration
>team.
>
>Andreas
>
>2017-09-26 22:17 GMT+02:00 Gary Gregory <garydgreg...@gmail.com>:
>
>> On Tue, Sep 26, 2017 at 2:07 PM, Andreas Kuhtz <andreas.ku...@gmail.com>
>> wrote:
>>
>> > Thank you for the response.
>> > I looked at http://repository.apache.org/snapshots/ already, but there
>> is
>> > no 2.2-SNAPSHOT. If someone has permissions to publish the current
>> > 2.2-SNAPSHOT that would be great.
>> >
>>
>> Unfortunately, it's more complicated than that. We have a release process
>> that requires a release manager from our team to volunteer and jump through
>> a bunch of hoops.
>>
>> Gary
>>
>> <http://repository.apache.org/snapshots/>
>> >
>> > 2017-09-26 21:59 GMT+02:00 Pascal Schumacher <pascalschumac...@gmx.net>:
>> >
>> > > Sorry my response was less that clear. The public maven repo address
>> is:
>> > > http://repository.apache.org/snapshots/
>> > >
>> > > See: https://www.apache.org/dev/repository-faq.html#basic
>> > >
>> > >
>> > > Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
>> > >
>> > >> No idea if there are concrete plans for a release date of
>> > >> commons-configuration 2.2 with the YAML feature.
>> > >>
>> > >> https://repository.apache.org/content/groups/snapshots/org/a
>> > >> pache/commons/commons-configuration2/ should have a snapshots with
>> the
>> > >> feature.
>> > >>
>> > >> Kind regards,
>> > >> Pascal
>> > >>
>> > >> Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:
>> > >>
>> > >>> Hello,
>> > >>>
>> > >>> Is there a planned release date for commons-configuration2 or is a
>> > >>> SNAPSHOT
>> > >>> available in a public maven repo?
>> > >>>
>> > >>> I would like to use the YAML configuration in my project.
>> > >>>
>> > >>> Best regards,
>> > >>> Andreas
>> > >>>
>> > >>>
>> > >>
>> > >> -
>> > >> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> > >> For additional commands, e-mail: user-h...@commons.apache.org
>> > >>
>> > >>
>> > >
>> > > -
>> > > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> > > For additional commands, e-mail: user-h...@commons.apache.org
>> > >
>> > >
>> >
>>


Re: [configuration] Release date for commons-configuration2 ?

2017-09-27 Thread Andreas Kuhtz
Hi Gary,

I wasn't aware that pushing a SNAPSHOT build needs the release process will
all preparations to be executed, but I'll wait for the next release in this
case.
Thank you for all the good solutions that are provided by the configuration
team.

Andreas

2017-09-26 22:17 GMT+02:00 Gary Gregory <garydgreg...@gmail.com>:

> On Tue, Sep 26, 2017 at 2:07 PM, Andreas Kuhtz <andreas.ku...@gmail.com>
> wrote:
>
> > Thank you for the response.
> > I looked at http://repository.apache.org/snapshots/ already, but there
> is
> > no 2.2-SNAPSHOT. If someone has permissions to publish the current
> > 2.2-SNAPSHOT that would be great.
> >
>
> Unfortunately, it's more complicated than that. We have a release process
> that requires a release manager from our team to volunteer and jump through
> a bunch of hoops.
>
> Gary
>
> <http://repository.apache.org/snapshots/>
> >
> > 2017-09-26 21:59 GMT+02:00 Pascal Schumacher <pascalschumac...@gmx.net>:
> >
> > > Sorry my response was less that clear. The public maven repo address
> is:
> > > http://repository.apache.org/snapshots/
> > >
> > > See: https://www.apache.org/dev/repository-faq.html#basic
> > >
> > >
> > > Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
> > >
> > >> No idea if there are concrete plans for a release date of
> > >> commons-configuration 2.2 with the YAML feature.
> > >>
> > >> https://repository.apache.org/content/groups/snapshots/org/a
> > >> pache/commons/commons-configuration2/ should have a snapshots with
> the
> > >> feature.
> > >>
> > >> Kind regards,
> > >> Pascal
> > >>
> > >> Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:
> > >>
> > >>> Hello,
> > >>>
> > >>> Is there a planned release date for commons-configuration2 or is a
> > >>> SNAPSHOT
> > >>> available in a public maven repo?
> > >>>
> > >>> I would like to use the YAML configuration in my project.
> > >>>
> > >>> Best regards,
> > >>> Andreas
> > >>>
> > >>>
> > >>
> > >> -
> > >> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > >> For additional commands, e-mail: user-h...@commons.apache.org
> > >>
> > >>
> > >
> > > -
> > > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > > For additional commands, e-mail: user-h...@commons.apache.org
> > >
> > >
> >
>


Re: [configuration] Release date for commons-configuration2 ?

2017-09-26 Thread Gary Gregory
On Tue, Sep 26, 2017 at 2:07 PM, Andreas Kuhtz <andreas.ku...@gmail.com>
wrote:

> Thank you for the response.
> I looked at http://repository.apache.org/snapshots/ already, but there is
> no 2.2-SNAPSHOT. If someone has permissions to publish the current
> 2.2-SNAPSHOT that would be great.
>

Unfortunately, it's more complicated than that. We have a release process
that requires a release manager from our team to volunteer and jump through
a bunch of hoops.

Gary

<http://repository.apache.org/snapshots/>
>
> 2017-09-26 21:59 GMT+02:00 Pascal Schumacher <pascalschumac...@gmx.net>:
>
> > Sorry my response was less that clear. The public maven repo address is:
> > http://repository.apache.org/snapshots/
> >
> > See: https://www.apache.org/dev/repository-faq.html#basic
> >
> >
> > Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
> >
> >> No idea if there are concrete plans for a release date of
> >> commons-configuration 2.2 with the YAML feature.
> >>
> >> https://repository.apache.org/content/groups/snapshots/org/a
> >> pache/commons/commons-configuration2/ should have a snapshots with the
> >> feature.
> >>
> >> Kind regards,
> >> Pascal
> >>
> >> Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:
> >>
> >>> Hello,
> >>>
> >>> Is there a planned release date for commons-configuration2 or is a
> >>> SNAPSHOT
> >>> available in a public maven repo?
> >>>
> >>> I would like to use the YAML configuration in my project.
> >>>
> >>> Best regards,
> >>> Andreas
> >>>
> >>>
> >>
> >> -
> >> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> >> For additional commands, e-mail: user-h...@commons.apache.org
> >>
> >>
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> > For additional commands, e-mail: user-h...@commons.apache.org
> >
> >
>


Re: [configuration] Release date for commons-configuration2 ?

2017-09-26 Thread Andreas Kuhtz
Thank you for the response.
I looked at http://repository.apache.org/snapshots/ already, but there is
no 2.2-SNAPSHOT. If someone has permissions to publish the current
2.2-SNAPSHOT that would be great.
<http://repository.apache.org/snapshots/>

2017-09-26 21:59 GMT+02:00 Pascal Schumacher <pascalschumac...@gmx.net>:

> Sorry my response was less that clear. The public maven repo address is:
> http://repository.apache.org/snapshots/
>
> See: https://www.apache.org/dev/repository-faq.html#basic
>
>
> Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
>
>> No idea if there are concrete plans for a release date of
>> commons-configuration 2.2 with the YAML feature.
>>
>> https://repository.apache.org/content/groups/snapshots/org/a
>> pache/commons/commons-configuration2/ should have a snapshots with the
>> feature.
>>
>> Kind regards,
>> Pascal
>>
>> Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:
>>
>>> Hello,
>>>
>>> Is there a planned release date for commons-configuration2 or is a
>>> SNAPSHOT
>>> available in a public maven repo?
>>>
>>> I would like to use the YAML configuration in my project.
>>>
>>> Best regards,
>>> Andreas
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [configuration] Release date for commons-configuration2 ?

2017-09-26 Thread Pascal Schumacher
Sorry my response was less that clear. The public maven repo address is: 
http://repository.apache.org/snapshots/


See: https://www.apache.org/dev/repository-faq.html#basic

Am 26.09.2017 um 21:56 schrieb Pascal Schumacher:
No idea if there are concrete plans for a release date of 
commons-configuration 2.2 with the YAML feature.


https://repository.apache.org/content/groups/snapshots/org/apache/commons/commons-configuration2/ 
should have a snapshots with the feature.


Kind regards,
Pascal

Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:

Hello,

Is there a planned release date for commons-configuration2 or is a 
SNAPSHOT

available in a public maven repo?

I would like to use the YAML configuration in my project.

Best regards,
Andreas




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Release date for commons-configuration2 ?

2017-09-26 Thread Pascal Schumacher
No idea if there are concrete plans for a release date of 
commons-configuration 2.2 with the YAML feature.


https://repository.apache.org/content/groups/snapshots/org/apache/commons/commons-configuration2/ 
should have a snapshots with the feature.


Kind regards,
Pascal

Am 26.09.2017 um 21:43 schrieb Andreas Kuhtz:

Hello,

Is there a planned release date for commons-configuration2 or is a SNAPSHOT
available in a public maven repo?

I would like to use the YAML configuration in my project.

Best regards,
Andreas




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] Release date for commons-configuration2 ?

2017-09-26 Thread Andreas Kuhtz
Hello,

Is there a planned release date for commons-configuration2 or is a SNAPSHOT
available in a public maven repo?

I would like to use the YAML configuration in my project.

Best regards,
Andreas


Re: [configuration] Creating a properties file

2017-08-31 Thread Thomas Mortagne
Of course I looked everywhere except the constructor...

Thanks a lot and sorry for the noise !

On Thu, Aug 31, 2017 at 4:43 PM, Oliver Heger
<oliver.he...@oliver-heger.de> wrote:
>
>
> Am 31.08.2017 um 08:12 schrieb Thomas Mortagne:
>> OK but my use case is that the file may or may not already exist and
>> if it already exist I need to modify it, not overwrite it.
>
> I see. Then there is a constructor of FileBasedConfigurationBuilder that
> accepts a boolean allowFailOnInit flag. Setting this flag to true will
> cause the behavior you are probably after: If the file does not exist,
> an empty configuration is created. Otherwise, it is loaded from the file.
>
> Oliver
>
>>
>> My point is that I did not really needed to care about that in 1.x.
>>
>> On Wed, Aug 30, 2017 at 5:49 PM, Oliver Heger
>> <oliver.he...@oliver-heger.de> wrote:
>>> Hi Thomas,
>>>
>>> Am 30.08.2017 um 10:56 schrieb Thomas Mortagne:
>>>> Here is what I currently do:
>>>>
>>>> PropertiesBuilderParameters parameters = new
>>>> Parameters().properties();
>>>> if (file.exists()) {
>>>> new Parameters().properties().setFile(file);
>>>> }
>>>>
>>>> FileBasedConfigurationBuilder builder 
>>>> =
>>>> new
>>>> FileBasedConfigurationBuilder(PropertiesConfiguration.class)
>>>> .configure(parameters);
>>>> PropertiesConfiguration properties = 
>>>> builder.getConfiguration();
>>>>
>>>> properties.setProperty("property", "value");
>>>>
>>>> builder.getFileHandler().save(file);
>>>>
>>>> but I find it more complex than it should.
>>>
>>> one option would be to create the PropertiesConfiguration directly,
>>> populate it, and then save it using a FileHandler. This would roughly
>>> look something like the following:
>>>
>>> PropertiesConfiguration config = new PropertiesConfiguration();
>>> config.addProperty(...);
>>>
>>> FileHandler handler = new FileHandler(config);
>>> File out = new File("union.properties");
>>> handler.save(out);
>>>
>>> More information can be found in the user's guide in the section about
>>> file-based configurations [1].
>>>
>>> HTH
>>> Oliver
>>>
>>> [1]
>>> http://commons.apache.org/proper/commons-configuration/userguide/howto_filebased.html#File_Operations_on_Configurations
>>>
>>>>
>>>> IMO the file handler should not care if the file exist or not by
>>>> default (empty PropertiesConfiguration as in 1.x if it does not exist)
>>>> and only fail if asked to in the parameters of the builder. At the
>>>> very least it should be possible to have some way to tell the builder
>>>> to not care about not existing file.
>>>>
>>>> On Wed, Aug 30, 2017 at 10:37 AM, Thomas Mortagne
>>>> <thomas.morta...@gmail.com> wrote:
>>>>> Hi,
>>>>>
>>>>> I trying to move from Commons Configuration 1.x to 2.1.1 and I cannot
>>>>> figure out how to do something that used to be obvious: creating a
>>>>> properties file that does not yet exist on the file system.
>>>>>
>>>>> In 1.x all I had to do is create a PropertiesConfiguration with a
>>>>> File, set a few properties and then save.
>>>>>
>>>>> In 2.1.1 I cannot find how to configure the build for it to accept a
>>>>> path to a file that does not exist, I always end up with:
>>>>>
>>>>> org.apache.commons.configuration2.ex.ConfigurationException: Could not
>>>>> locate: 
>>>>> org.apache.commons.configuration2.io.FileLocator@28d79cba[fileName=store.properties,basePath=/media/data/projets/xwiki/src/git/xwiki-commons/xwiki-commons-core/xwiki-commons-job/target/test/jobs/status,sourceURL=,encoding=ISO-8859-1,fileSystem=,locationStrategy=]
>>>>> at 
>>>>> org.apache.commons.configuration2.io.FileLocatorUtils.locateOrThrow(FileLocatorUtils.java:346)
>>>>> at 
>>>>> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:972)
>>>>> at 
>>>>> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:702)
>>>>>
>>>>> and from what I see in FileHandler sources it not really configurable.
>>>>>
>>>>> So did I missed something or am I really supposed to create an empty
>>>>> file before using the builder ?
>>>>>
>>>>> Thanks,
>>>>> --
>>>>> Thomas
>>>>
>>>>
>>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>
>>
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>



-- 
Thomas

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Creating a properties file

2017-08-31 Thread Oliver Heger


Am 31.08.2017 um 08:12 schrieb Thomas Mortagne:
> OK but my use case is that the file may or may not already exist and
> if it already exist I need to modify it, not overwrite it.

I see. Then there is a constructor of FileBasedConfigurationBuilder that
accepts a boolean allowFailOnInit flag. Setting this flag to true will
cause the behavior you are probably after: If the file does not exist,
an empty configuration is created. Otherwise, it is loaded from the file.

Oliver

> 
> My point is that I did not really needed to care about that in 1.x.
> 
> On Wed, Aug 30, 2017 at 5:49 PM, Oliver Heger
> <oliver.he...@oliver-heger.de> wrote:
>> Hi Thomas,
>>
>> Am 30.08.2017 um 10:56 schrieb Thomas Mortagne:
>>> Here is what I currently do:
>>>
>>> PropertiesBuilderParameters parameters = new
>>> Parameters().properties();
>>> if (file.exists()) {
>>> new Parameters().properties().setFile(file);
>>> }
>>>
>>> FileBasedConfigurationBuilder builder =
>>> new
>>> FileBasedConfigurationBuilder(PropertiesConfiguration.class)
>>> .configure(parameters);
>>> PropertiesConfiguration properties = builder.getConfiguration();
>>>
>>> properties.setProperty("property", "value");
>>>
>>> builder.getFileHandler().save(file);
>>>
>>> but I find it more complex than it should.
>>
>> one option would be to create the PropertiesConfiguration directly,
>> populate it, and then save it using a FileHandler. This would roughly
>> look something like the following:
>>
>> PropertiesConfiguration config = new PropertiesConfiguration();
>> config.addProperty(...);
>>
>> FileHandler handler = new FileHandler(config);
>> File out = new File("union.properties");
>> handler.save(out);
>>
>> More information can be found in the user's guide in the section about
>> file-based configurations [1].
>>
>> HTH
>> Oliver
>>
>> [1]
>> http://commons.apache.org/proper/commons-configuration/userguide/howto_filebased.html#File_Operations_on_Configurations
>>
>>>
>>> IMO the file handler should not care if the file exist or not by
>>> default (empty PropertiesConfiguration as in 1.x if it does not exist)
>>> and only fail if asked to in the parameters of the builder. At the
>>> very least it should be possible to have some way to tell the builder
>>> to not care about not existing file.
>>>
>>> On Wed, Aug 30, 2017 at 10:37 AM, Thomas Mortagne
>>> <thomas.morta...@gmail.com> wrote:
>>>> Hi,
>>>>
>>>> I trying to move from Commons Configuration 1.x to 2.1.1 and I cannot
>>>> figure out how to do something that used to be obvious: creating a
>>>> properties file that does not yet exist on the file system.
>>>>
>>>> In 1.x all I had to do is create a PropertiesConfiguration with a
>>>> File, set a few properties and then save.
>>>>
>>>> In 2.1.1 I cannot find how to configure the build for it to accept a
>>>> path to a file that does not exist, I always end up with:
>>>>
>>>> org.apache.commons.configuration2.ex.ConfigurationException: Could not
>>>> locate: 
>>>> org.apache.commons.configuration2.io.FileLocator@28d79cba[fileName=store.properties,basePath=/media/data/projets/xwiki/src/git/xwiki-commons/xwiki-commons-core/xwiki-commons-job/target/test/jobs/status,sourceURL=,encoding=ISO-8859-1,fileSystem=,locationStrategy=]
>>>> at 
>>>> org.apache.commons.configuration2.io.FileLocatorUtils.locateOrThrow(FileLocatorUtils.java:346)
>>>> at 
>>>> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:972)
>>>> at 
>>>> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:702)
>>>>
>>>> and from what I see in FileHandler sources it not really configurable.
>>>>
>>>> So did I missed something or am I really supposed to create an empty
>>>> file before using the builder ?
>>>>
>>>> Thanks,
>>>> --
>>>> Thomas
>>>
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
> 
> 
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Creating a properties file

2017-08-31 Thread Thomas Mortagne
OK but my use case is that the file may or may not already exist and
if it already exist I need to modify it, not overwrite it.

My point is that I did not really needed to care about that in 1.x.

On Wed, Aug 30, 2017 at 5:49 PM, Oliver Heger
<oliver.he...@oliver-heger.de> wrote:
> Hi Thomas,
>
> Am 30.08.2017 um 10:56 schrieb Thomas Mortagne:
>> Here is what I currently do:
>>
>> PropertiesBuilderParameters parameters = new
>> Parameters().properties();
>> if (file.exists()) {
>> new Parameters().properties().setFile(file);
>> }
>>
>> FileBasedConfigurationBuilder builder =
>> new
>> FileBasedConfigurationBuilder(PropertiesConfiguration.class)
>> .configure(parameters);
>> PropertiesConfiguration properties = builder.getConfiguration();
>>
>> properties.setProperty("property", "value");
>>
>> builder.getFileHandler().save(file);
>>
>> but I find it more complex than it should.
>
> one option would be to create the PropertiesConfiguration directly,
> populate it, and then save it using a FileHandler. This would roughly
> look something like the following:
>
> PropertiesConfiguration config = new PropertiesConfiguration();
> config.addProperty(...);
>
> FileHandler handler = new FileHandler(config);
> File out = new File("union.properties");
> handler.save(out);
>
> More information can be found in the user's guide in the section about
> file-based configurations [1].
>
> HTH
> Oliver
>
> [1]
> http://commons.apache.org/proper/commons-configuration/userguide/howto_filebased.html#File_Operations_on_Configurations
>
>>
>> IMO the file handler should not care if the file exist or not by
>> default (empty PropertiesConfiguration as in 1.x if it does not exist)
>> and only fail if asked to in the parameters of the builder. At the
>> very least it should be possible to have some way to tell the builder
>> to not care about not existing file.
>>
>> On Wed, Aug 30, 2017 at 10:37 AM, Thomas Mortagne
>> <thomas.morta...@gmail.com> wrote:
>>> Hi,
>>>
>>> I trying to move from Commons Configuration 1.x to 2.1.1 and I cannot
>>> figure out how to do something that used to be obvious: creating a
>>> properties file that does not yet exist on the file system.
>>>
>>> In 1.x all I had to do is create a PropertiesConfiguration with a
>>> File, set a few properties and then save.
>>>
>>> In 2.1.1 I cannot find how to configure the build for it to accept a
>>> path to a file that does not exist, I always end up with:
>>>
>>> org.apache.commons.configuration2.ex.ConfigurationException: Could not
>>> locate: 
>>> org.apache.commons.configuration2.io.FileLocator@28d79cba[fileName=store.properties,basePath=/media/data/projets/xwiki/src/git/xwiki-commons/xwiki-commons-core/xwiki-commons-job/target/test/jobs/status,sourceURL=,encoding=ISO-8859-1,fileSystem=,locationStrategy=]
>>> at 
>>> org.apache.commons.configuration2.io.FileLocatorUtils.locateOrThrow(FileLocatorUtils.java:346)
>>> at 
>>> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:972)
>>> at 
>>> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:702)
>>>
>>> and from what I see in FileHandler sources it not really configurable.
>>>
>>> So did I missed something or am I really supposed to create an empty
>>> file before using the builder ?
>>>
>>> Thanks,
>>> --
>>> Thomas
>>
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>



-- 
Thomas

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Creating a properties file

2017-08-30 Thread Oliver Heger
Hi Thomas,

Am 30.08.2017 um 10:56 schrieb Thomas Mortagne:
> Here is what I currently do:
> 
> PropertiesBuilderParameters parameters = new
> Parameters().properties();
> if (file.exists()) {
> new Parameters().properties().setFile(file);
> }
> 
> FileBasedConfigurationBuilder builder =
> new
> FileBasedConfigurationBuilder(PropertiesConfiguration.class)
> .configure(parameters);
> PropertiesConfiguration properties = builder.getConfiguration();
> 
> properties.setProperty("property", "value");
> 
> builder.getFileHandler().save(file);
> 
> but I find it more complex than it should.

one option would be to create the PropertiesConfiguration directly,
populate it, and then save it using a FileHandler. This would roughly
look something like the following:

PropertiesConfiguration config = new PropertiesConfiguration();
config.addProperty(...);

FileHandler handler = new FileHandler(config);
File out = new File("union.properties");
handler.save(out);

More information can be found in the user's guide in the section about
file-based configurations [1].

HTH
Oliver

[1]
http://commons.apache.org/proper/commons-configuration/userguide/howto_filebased.html#File_Operations_on_Configurations

> 
> IMO the file handler should not care if the file exist or not by
> default (empty PropertiesConfiguration as in 1.x if it does not exist)
> and only fail if asked to in the parameters of the builder. At the
> very least it should be possible to have some way to tell the builder
> to not care about not existing file.
> 
> On Wed, Aug 30, 2017 at 10:37 AM, Thomas Mortagne
> <thomas.morta...@gmail.com> wrote:
>> Hi,
>>
>> I trying to move from Commons Configuration 1.x to 2.1.1 and I cannot
>> figure out how to do something that used to be obvious: creating a
>> properties file that does not yet exist on the file system.
>>
>> In 1.x all I had to do is create a PropertiesConfiguration with a
>> File, set a few properties and then save.
>>
>> In 2.1.1 I cannot find how to configure the build for it to accept a
>> path to a file that does not exist, I always end up with:
>>
>> org.apache.commons.configuration2.ex.ConfigurationException: Could not
>> locate: 
>> org.apache.commons.configuration2.io.FileLocator@28d79cba[fileName=store.properties,basePath=/media/data/projets/xwiki/src/git/xwiki-commons/xwiki-commons-core/xwiki-commons-job/target/test/jobs/status,sourceURL=,encoding=ISO-8859-1,fileSystem=,locationStrategy=]
>> at 
>> org.apache.commons.configuration2.io.FileLocatorUtils.locateOrThrow(FileLocatorUtils.java:346)
>> at 
>> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:972)
>> at 
>> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:702)
>>
>> and from what I see in FileHandler sources it not really configurable.
>>
>> So did I missed something or am I really supposed to create an empty
>> file before using the builder ?
>>
>> Thanks,
>> --
>> Thomas
> 
> 
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Creating a properties file

2017-08-30 Thread Thomas Mortagne
Here is what I currently do:

PropertiesBuilderParameters parameters = new
Parameters().properties();
if (file.exists()) {
new Parameters().properties().setFile(file);
}

FileBasedConfigurationBuilder builder =
new
FileBasedConfigurationBuilder(PropertiesConfiguration.class)
.configure(parameters);
PropertiesConfiguration properties = builder.getConfiguration();

properties.setProperty("property", "value");

builder.getFileHandler().save(file);

but I find it more complex than it should.

IMO the file handler should not care if the file exist or not by
default (empty PropertiesConfiguration as in 1.x if it does not exist)
and only fail if asked to in the parameters of the builder. At the
very least it should be possible to have some way to tell the builder
to not care about not existing file.

On Wed, Aug 30, 2017 at 10:37 AM, Thomas Mortagne
<thomas.morta...@gmail.com> wrote:
> Hi,
>
> I trying to move from Commons Configuration 1.x to 2.1.1 and I cannot
> figure out how to do something that used to be obvious: creating a
> properties file that does not yet exist on the file system.
>
> In 1.x all I had to do is create a PropertiesConfiguration with a
> File, set a few properties and then save.
>
> In 2.1.1 I cannot find how to configure the build for it to accept a
> path to a file that does not exist, I always end up with:
>
> org.apache.commons.configuration2.ex.ConfigurationException: Could not
> locate: 
> org.apache.commons.configuration2.io.FileLocator@28d79cba[fileName=store.properties,basePath=/media/data/projets/xwiki/src/git/xwiki-commons/xwiki-commons-core/xwiki-commons-job/target/test/jobs/status,sourceURL=,encoding=ISO-8859-1,fileSystem=,locationStrategy=]
> at 
> org.apache.commons.configuration2.io.FileLocatorUtils.locateOrThrow(FileLocatorUtils.java:346)
> at 
> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:972)
> at 
> org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:702)
>
> and from what I see in FileHandler sources it not really configurable.
>
> So did I missed something or am I really supposed to create an empty
> file before using the builder ?
>
> Thanks,
> --
> Thomas



-- 
Thomas

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] Creating a properties file

2017-08-30 Thread Thomas Mortagne
Hi,

I trying to move from Commons Configuration 1.x to 2.1.1 and I cannot
figure out how to do something that used to be obvious: creating a
properties file that does not yet exist on the file system.

In 1.x all I had to do is create a PropertiesConfiguration with a
File, set a few properties and then save.

In 2.1.1 I cannot find how to configure the build for it to accept a
path to a file that does not exist, I always end up with:

org.apache.commons.configuration2.ex.ConfigurationException: Could not
locate: 
org.apache.commons.configuration2.io.FileLocator@28d79cba[fileName=store.properties,basePath=/media/data/projets/xwiki/src/git/xwiki-commons/xwiki-commons-core/xwiki-commons-job/target/test/jobs/status,sourceURL=,encoding=ISO-8859-1,fileSystem=,locationStrategy=]
at 
org.apache.commons.configuration2.io.FileLocatorUtils.locateOrThrow(FileLocatorUtils.java:346)
at 
org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:972)
at 
org.apache.commons.configuration2.io.FileHandler.load(FileHandler.java:702)

and from what I see in FileHandler sources it not really configurable.

So did I missed something or am I really supposed to create an empty
file before using the builder ?

Thanks,
-- 
Thomas

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[ANNOUNCE] Apache Commons Configuration 2.1.1 released!

2017-02-09 Thread Benedikt Ritter
The Apache Commons team is happy to announce the release of Commons 
Configuration 2.1.1!

The Commons Configuration software library provides a generic configuration 
interface which enables a Java application to read configuration data from a 
variety of sources. Commons Configuration provides typed access to single, and 
multi-valued configuration parameters.

Commons Configuration 2.1.1 ist a bugfix release with no API changes. It 
requires at least Java 1.6. Users of the 2.x line should upgrade to the new 
release. Users of the 1.x line should inspect the migration guide on the 
project’s website 
(http://commons.apache.org/proper/commons-configuration/userguide/upgradeto2_0.html)

Source and binary distributions are available for download from the Apache 
Commons download site:
  http://commons.apache.org/proper/commons-configuration/download_text.cgi

When downloading, please verify signatures using the KEYS file available at the 
above location when downloading the release.

Alternatively the release can be pulled via Maven:


  org.apache.commons
  commons-configuration2
  2.1.1


Full details of all the changes in 2.1.1 can be found in the changelog:
  http://commons.apache.org/proper/commons-configuration/changes-report.html

The release notes can be reviewed at:
  http://www.apache.org/dist/commons/configuration/RELEASE-NOTES.txt

For complete information on Commons Configuration, including instructions on 
how to submit bug reports, patches, or suggestions for improvement, see the 
Apache Commons Configuration website:

http://commons.apache.org/proper/commons-configuration/

Have fun!
Benedikt,
on behalf of the Apache Commons Community


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



AW: [configuration] save xml list element

2017-01-11 Thread Tobias.Wolf
No I`m just doing a change somewhere else, but not in that particular node, but 
it is splitted up in separate nodes anyway. I understand that you have to 
create an internal node for each comma separated value, but why you can`t store 
it back as comma separated value?

mit freundlichen Grüßen
Tobias Wolf

T-Systems International GmbH
Systems Integration
Horizontal Solutions
Tobias Wolf
Software Architekt
Project Center ECM & ECM Strategy & Architecture Consulting
Dachauer Str. 651, D-80995 München
+49 89 54550 - 2479 (Tel.)
+49 151 168 80 221 (Mobil)
E-Mail: tobias.w...@t-systems.com 
Internet: http://www.t-systems.com

T-Systems International GmbH
Supervisory Board: Thomas Dannenfeldt (Chairman)
Board of Management: Reinhard Clemens (Chairman), Dr. Ferri Abolhassan, Dr. 
Markus Müller, Georg Pepping, Hagen Rickmann, Klaus Werner 
Commercial register: Amtsgericht Frankfurt am Main HRB 55933
Registered office: Frankfurt am Main

 

Notice: This transmittal and/or attachments may be privileged or confidential. 
It is intended solely for the addressee named above. Any review, dissemination, 
or copying is strictly prohibited. If you received this transmittal in error, 
please notify us immediately by reply and immediately delete this message and 
all its attachments. Thank you.

 

Big changes start small - conserve resources by not printing every e-mail.


-Ursprüngliche Nachricht-
Von: Oliver Heger [mailto:oliver.he...@oliver-heger.de] 
Gesendet: Mittwoch, 11. Januar 2017 18:04
An: Commons Users List
Betreff: Re: [configuration] save xml list element

Hi,

Am 11.01.2017 um 10:04 schrieb tobias.w...@t-systems.com:
> I`m reading a xml configuration object with a xml element containing a comma 
> separated string:
> 
> TLSv1.1,TLSv1.2
> 
> I archive this by setting explicitly a ListDelimiterHandler
> 
> this.xmlConfigBuilder = new 
> FileBasedConfigurationBuilder(ExtendedXMLConfiguration.class)
> 
> .configure(params.xml().setFile(configFile).setExpressionEngine(new 
> XPathExpressionEngine())
> 
> .setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
> 
> 
> and the reading is fine, but when I write this out I got separate xml 
> elements for each value instead of the same comma separated value element.
> 
> this.xmlConfigBuilder.save();
> 
> TLSv1.1
> TLSv1.2
> 

the current implementation of XMLConfiguration internally always splits strings 
containing the delimiter character on reading and creates multiple internal 
node objects for the single values. This is required to handle queries 
correctly that operate on the internal node model. So when writing out such a 
configuration the original format is lost and multiple list nodes are created.

I would, however, assume that a change in the format only occurs if there is a 
change in the value of the property or if the content of a configuration is 
copied into another one. When loading an XML file the configuration stores the 
original DOM and applies changes on it as necessary. That way the original 
format should be kept as close as possible. Are there such changes in your use 
case?

Oliver

> 
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] save xml list element

2017-01-11 Thread Oliver Heger
Hi,

Am 11.01.2017 um 10:04 schrieb tobias.w...@t-systems.com:
> I`m reading a xml configuration object with a xml element containing a comma 
> separated string:
> 
> TLSv1.1,TLSv1.2
> 
> I archive this by setting explicitly a ListDelimiterHandler
> 
> this.xmlConfigBuilder = new 
> FileBasedConfigurationBuilder(ExtendedXMLConfiguration.class)
> 
> .configure(params.xml().setFile(configFile).setExpressionEngine(new 
> XPathExpressionEngine())
> 
> .setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
> 
> 
> and the reading is fine, but when I write this out I got separate xml 
> elements for each value instead of the same comma separated value element.
> 
> this.xmlConfigBuilder.save();
> 
> TLSv1.1
> TLSv1.2
> 

the current implementation of XMLConfiguration internally always splits
strings containing the delimiter character on reading and creates
multiple internal node objects for the single values. This is required
to handle queries correctly that operate on the internal node model. So
when writing out such a configuration the original format is lost and
multiple list nodes are created.

I would, however, assume that a change in the format only occurs if
there is a change in the value of the property or if the content of a
configuration is copied into another one. When loading an XML file the
configuration stores the original DOM and applies changes on it as
necessary. That way the original format should be kept as close as
possible. Are there such changes in your use case?

Oliver

> 
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] save xml list element

2017-01-11 Thread Tobias.Wolf
I`m reading a xml configuration object with a xml element containing a comma 
separated string:

TLSv1.1,TLSv1.2

I archive this by setting explicitly a ListDelimiterHandler

this.xmlConfigBuilder = new 
FileBasedConfigurationBuilder(ExtendedXMLConfiguration.class)

.configure(params.xml().setFile(configFile).setExpressionEngine(new 
XPathExpressionEngine())

.setListDelimiterHandler(new DefaultListDelimiterHandler(',')));


and the reading is fine, but when I write this out I got separate xml elements 
for each value instead of the same comma separated value element.

this.xmlConfigBuilder.save();

TLSv1.1
TLSv1.2




Re: [configuration] tension between auto-loading and synchronization

2016-11-28 Thread Oliver Heger


Am 27.11.2016 um 18:14 schrieb Garret Wilson:
> Thanks for clearing this up, Oliver!
> 
> I was going straight from the documentation. On the page
> https://commons.apache.org/proper/commons-configuration/userguide/howto_concurrency.html
> I can't find anything about setting up the builder parameters.
> 
> So I'm extremely happy to learn that you can configure the builder with
> a synchronizer. So I guess the "tension" now is that part of the
> documentation says, "it's better to use a builder than the configuration
> itself, especially if you want auto-loading", and then the part that
> actually talks about synchronization seems to favor working with the
> configuration and doesn't even mention that I can set the synchronizer
> on the builder.
> 
> At the very least
> https://commons.apache.org/proper/commons-configuration/userguide/howto_concurrency.html
> should mention the configuration params.

I will try to make it clearer.

Oliver

> 
> Cheers,
> 
> Garret
> 
> 
> On 11/27/2016 8:58 AM, Gary Gregory wrote:
>>
>> Do we need better Javadocs to make this obvious?
>>
>> Gary
>>
>>
>> On Nov 27, 2016 7:02 AM, "Oliver Heger" <oliver.he...@oliver-heger.de
>> <mailto:oliver.he...@oliver-heger.de>> wrote:
>>
>> Hi,
>>
>> Am 25.11.2016 um 22:55 schrieb Garret Wilson:
>>
>> I'm reading the documentation for the new
>> commons-configuration 2.x. I
>> have a simple need: load a configuration file from a
>> properties file,
>> reload it when the file changes, and make the configuration
>> thread-safe
>> for reading.
>>
>> From the documentation I understand that I shouldn't keep the
>> Configuration object around, because it may be reloaded if the
>> file
>> changes. Instead I should keep a ConfigurationBuilder around.
>> So my
>> application's getConfiguration() would look like this:
>>
>> public Configuration getConfiguration() {
>>   return configurationBuilder.getConfiguration();
>> }
>>
>> But I need it to be thread-safe. So I do this:
>>
>> public Configuration getConfiguration() {
>>   Configuration
>> configuration=configurationBuilder.getConfiguration();
>>   configuration.setSynchronizer(new ReadWriteSynchronizer());
>>   return configuration;
>> }
>>
>> Oops! It turns out that we don't know if the builder returns
>> the same
>> configuration or a new configuration, so we could be swapping
>> out the
>> synchronizer on the same configuration. That introduces a race
>>     condition
>> and defeats the thread safety!
>>
>> So are we expected to keep a separate synchronizer around and
>> make sure
>> the new/existing configuration uses it?
>>
>> private final Synchronizer synchronizer = new
>> ReadWriteSynchronizer();
>>
>>     public Configuration getConfiguration() {
>>   Configuration
>> configuration=configurationBuilder.getConfiguration();
>>   configuration.setSynchronizer(synchronizer);
>>   return configuration;
>> }
>>
>> Wow, that's getting complicated. The problem is that Apache
>> Commons
>> Configuration2 recommends that the builder be the ultimate
>> source of the
>> configuration, yet it associates the syncrhonizer with the actual
>> configuration instance. Shouldn't we set the synchronizer on
>> the builder
>> and let it manage the synchronizer of the new configurations?
>> Or do you
>> want each configuration to potentially have different
>> synchronizers? But
>> is that realistic---would synchronized and unsynchronized
>> configurations
>> play well together if they are backed by the same builder? I'm
>> trying to
>> understand what the expected usage is.
>>
>>
>> you configure the builder to set the correct synchronizer on newly
>> created Configuration objects. To achieve this, call the builder's
>> configure() method with a parameters object. Focused on the
>> synchronizer, this looks as follows:
>>
>> Synchronizer sync = ...;
>> Parameters params = new Parameters();
>

Re: [configuration] tension between auto-loading and synchronization

2016-11-27 Thread Gary Gregory
Do we need better Javadocs to make this obvious?

Gary

On Nov 27, 2016 7:02 AM, "Oliver Heger" <oliver.he...@oliver-heger.de>
wrote:

> Hi,
>
> Am 25.11.2016 um 22:55 schrieb Garret Wilson:
>
>> I'm reading the documentation for the new commons-configuration 2.x. I
>> have a simple need: load a configuration file from a properties file,
>> reload it when the file changes, and make the configuration thread-safe
>> for reading.
>>
>> From the documentation I understand that I shouldn't keep the
>> Configuration object around, because it may be reloaded if the file
>> changes. Instead I should keep a ConfigurationBuilder around. So my
>> application's getConfiguration() would look like this:
>>
>> public Configuration getConfiguration() {
>>   return configurationBuilder.getConfiguration();
>> }
>>
>> But I need it to be thread-safe. So I do this:
>>
>> public Configuration getConfiguration() {
>>   Configuration configuration=configurationBuilder.getConfiguration();
>>   configuration.setSynchronizer(new ReadWriteSynchronizer());
>>   return configuration;
>> }
>>
>> Oops! It turns out that we don't know if the builder returns the same
>> configuration or a new configuration, so we could be swapping out the
>> synchronizer on the same configuration. That introduces a race condition
>> and defeats the thread safety!
>>
>> So are we expected to keep a separate synchronizer around and make sure
>> the new/existing configuration uses it?
>>
>> private final Synchronizer synchronizer = new ReadWriteSynchronizer();
>>
>> public Configuration getConfiguration() {
>>   Configuration configuration=configurationBuilder.getConfiguration();
>>   configuration.setSynchronizer(synchronizer);
>>   return configuration;
>> }
>>
>> Wow, that's getting complicated. The problem is that Apache Commons
>> Configuration2 recommends that the builder be the ultimate source of the
>> configuration, yet it associates the syncrhonizer with the actual
>> configuration instance. Shouldn't we set the synchronizer on the builder
>> and let it manage the synchronizer of the new configurations? Or do you
>> want each configuration to potentially have different synchronizers? But
>> is that realistic---would synchronized and unsynchronized configurations
>> play well together if they are backed by the same builder? I'm trying to
>> understand what the expected usage is.
>>
>
> you configure the builder to set the correct synchronizer on newly created
> Configuration objects. To achieve this, call the builder's configure()
> method with a parameters object. Focused on the synchronizer, this looks as
> follows:
>
> Synchronizer sync = ...;
> Parameters params = new Parameters();
> BasicConfigurationBuilder builder =
> new BasicConfigurationBuilder(
> PropertiesConfiguration.class)
> .configure(params.basic()
> .setSynchronizer(sync));
>
> Just insert your type parameters for the configuration type. All
> properties configured this way are automatically set on the Configuration
> each time a new instance is created.
>
> Oliver
>
>
>> Garret
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [configuration] tension between auto-loading and synchronization

2016-11-27 Thread Oliver Heger

Hi,

Am 25.11.2016 um 22:55 schrieb Garret Wilson:

I'm reading the documentation for the new commons-configuration 2.x. I
have a simple need: load a configuration file from a properties file,
reload it when the file changes, and make the configuration thread-safe
for reading.

From the documentation I understand that I shouldn't keep the
Configuration object around, because it may be reloaded if the file
changes. Instead I should keep a ConfigurationBuilder around. So my
application's getConfiguration() would look like this:

public Configuration getConfiguration() {
  return configurationBuilder.getConfiguration();
}

But I need it to be thread-safe. So I do this:

public Configuration getConfiguration() {
  Configuration configuration=configurationBuilder.getConfiguration();
  configuration.setSynchronizer(new ReadWriteSynchronizer());
  return configuration;
}

Oops! It turns out that we don't know if the builder returns the same
configuration or a new configuration, so we could be swapping out the
synchronizer on the same configuration. That introduces a race condition
and defeats the thread safety!

So are we expected to keep a separate synchronizer around and make sure
the new/existing configuration uses it?

private final Synchronizer synchronizer = new ReadWriteSynchronizer();

public Configuration getConfiguration() {
  Configuration configuration=configurationBuilder.getConfiguration();
  configuration.setSynchronizer(synchronizer);
  return configuration;
}

Wow, that's getting complicated. The problem is that Apache Commons
Configuration2 recommends that the builder be the ultimate source of the
configuration, yet it associates the syncrhonizer with the actual
configuration instance. Shouldn't we set the synchronizer on the builder
and let it manage the synchronizer of the new configurations? Or do you
want each configuration to potentially have different synchronizers? But
is that realistic---would synchronized and unsynchronized configurations
play well together if they are backed by the same builder? I'm trying to
understand what the expected usage is.


you configure the builder to set the correct synchronizer on newly 
created Configuration objects. To achieve this, call the builder's 
configure() method with a parameters object. Focused on the 
synchronizer, this looks as follows:


Synchronizer sync = ...;
Parameters params = new Parameters();
BasicConfigurationBuilder builder =
new BasicConfigurationBuilder(
PropertiesConfiguration.class)
.configure(params.basic()
.setSynchronizer(sync));

Just insert your type parameters for the configuration type. All 
properties configured this way are automatically set on the 
Configuration each time a new instance is created.


Oliver



Garret

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] tension between auto-loading and synchronization

2016-11-25 Thread Garret Wilson
I'm reading the documentation for the new commons-configuration 2.x. I 
have a simple need: load a configuration file from a properties file, 
reload it when the file changes, and make the configuration thread-safe 
for reading.


From the documentation I understand that I shouldn't keep the 
Configuration object around, because it may be reloaded if the file 
changes. Instead I should keep a ConfigurationBuilder around. So my 
application's getConfiguration() would look like this:


public Configuration getConfiguration() {
  return configurationBuilder.getConfiguration();
}

But I need it to be thread-safe. So I do this:

public Configuration getConfiguration() {
  Configuration configuration=configurationBuilder.getConfiguration();
  configuration.setSynchronizer(new ReadWriteSynchronizer());
  return configuration;
}

Oops! It turns out that we don't know if the builder returns the same 
configuration or a new configuration, so we could be swapping out the 
synchronizer on the same configuration. That introduces a race condition 
and defeats the thread safety!


So are we expected to keep a separate synchronizer around and make sure 
the new/existing configuration uses it?


private final Synchronizer synchronizer = new ReadWriteSynchronizer();

public Configuration getConfiguration() {
  Configuration configuration=configurationBuilder.getConfiguration();
  configuration.setSynchronizer(synchronizer);
  return configuration;
}

Wow, that's getting complicated. The problem is that Apache Commons 
Configuration2 recommends that the builder be the ultimate source of the 
configuration, yet it associates the syncrhonizer with the actual 
configuration instance. Shouldn't we set the synchronizer on the builder 
and let it manage the synchronizer of the new configurations? Or do you 
want each configuration to potentially have different synchronizers? But 
is that realistic---would synchronized and unsynchronized configurations 
play well together if they are backed by the same builder? I'm trying to 
understand what the expected usage is.


Garret

P.S. Please reply-all, as I'm not yet subscribed to the list.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] tension between auto-loading and synchronization

2016-11-25 Thread Garret Wilson
I'm reading the documentation for the new commons-configuration 2.x. I 
have a simple need: load a configuration file from a properties file, 
reload it when the file changes, and make the configuration thread-safe 
for reading.


From the documentation I understand that I shouldn't keep the 
Configuration object around, because it may be reloaded if the file 
changes. Instead I should keep a ConfigurationBuilder around. So my 
application's getConfiguration() would look like this:


public Configuration getConfiguration() {
  return configurationBuilder.getConfiguration();
}

But I need it to be thread-safe. So I do this:

public Configuration getConfiguration() {
  Configuration configuration=configurationBuilder.getConfiguration();
  configuration.setSynchronizer(new ReadWriteSynchronizer());
  return configuration;
}

Oops! It turns out that we don't know if the builder returns the same 
configuration or a new configuration, so we could be swapping out the 
synchronizer on the same configuration. That introduces a race condition 
and defeats the thread safety!


So are we expected to keep a separate synchronizer around and make sure 
the new/existing configuration uses it?


private final Synchronizer synchronizer = new ReadWriteSynchronizer();

public Configuration getConfiguration() {
  Configuration configuration=configurationBuilder.getConfiguration();
  configuration.setSynchronizer(synchronizer);
  return configuration;
}

Wow, that's getting complicated. The problem is that Apache Commons 
Configuration2 recommends that the builder be the ultimate source of the 
configuration, yet it associates the syncrhonizer with the actual 
configuration instance. Shouldn't we set the synchronizer on the builder 
and let it manage the synchronizer of the new configurations? Or do you 
want each configuration to potentially have different synchronizers? But 
is that realistic---would synchronized and unsynchronized configurations 
play well together if they are backed by the same builder? I'm trying to 
understand what the expected usage is.


Garret

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Custom variable interpolation

2016-11-23 Thread Oliver Heger
Hi Greg,

Am 23.11.2016 um 00:50 schrieb Greg Torrance:
> Hi all,
> 
> I would like to implement a custom variable interpolator that is
> specific to a Configuration object, but that also supports the standard
> prefixes (sys, const, env).
> 
> What I mean by "specific to a Configuration object" is that the custom
> interpolator needs to know the Configuration to which it is associated
> in order to produce a valid result for a variable.
> 
> Say I want to associate a variable "rootDir" with the custom prefix
> "myPrefix". To use this variable I would specify ${myPrefix:rootDir} in
> my configuration file. At the code level, though, if I create a
> Configuration config1, I want "rootDir" for that Configuration to
> evaluate to "/abc/def". But for Configuration config2, "rootDir" should
> evaluate to "/ghi/jkl". I assume I will need to have a specific Lookup
> instance per Configuration, right?
> 
> I have tried to understand how to do this based on this page
> (https://commons.apache.org/proper/commons-configuration/userguide/howto_basicfeatures.html#Customizing_interpolation),
> but the information seems to be a bit inaccurate based on v2.1. (For
> example, it refers to calling the static registerGlobalLookup() method
> on ConfigurationInterpolator, but this method does not appear to exist.)

Could you please open a ticket in our bugtracking system [1] when you
notice inconsistencies in the documentation, so that they can be fixed?
Thanks in advance!

[1]
https://commons.apache.org/proper/commons-configuration/issue-tracking.html

> 
> Also, I'm not clear if I should be extending StrLookup, or implementing
> Lookup. (I was initially using StrLookup, but the
> ConfigurationInterpolator registerLookup() method requires a Lookup
> instance.)

StrLookup is from [lang], to avoid a direct dependency, [configuration]
uses its own abstraction. But the Lookup interface is so simple that it
can be easily implemented.

> 
> If I do the following, it seems to allow me create a working custom
> interpolator. But when I do this, the standard prefixes (sys, const,
> env) no longer work:
> 
> ConfigurationInterpolator ci = new ConfigurationInterpolator();
> ci.registerLookup("myPrefix", new MyLookup()); // implementation of
> Lookup interface
> config1.setInterpolator(ci);

You can try the following:
config1.getInterpolator().registerLookup( ... );

This should add the new lookup to the existing ones.

Oliver

> 
> Any thoughts on how to implement this using Commons Configuration best
> practices?
> 
> Thanks in advance,
> Greg
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] Custom variable interpolation

2016-11-22 Thread Greg Torrance

Hi all,

I would like to implement a custom variable interpolator that is 
specific to a Configuration object, but that also supports the standard 
prefixes (sys, const, env).


What I mean by "specific to a Configuration object" is that the custom 
interpolator needs to know the Configuration to which it is associated 
in order to produce a valid result for a variable.


Say I want to associate a variable "rootDir" with the custom prefix 
"myPrefix". To use this variable I would specify ${myPrefix:rootDir} in 
my configuration file. At the code level, though, if I create a 
Configuration config1, I want "rootDir" for that Configuration to 
evaluate to "/abc/def". But for Configuration config2, "rootDir" should 
evaluate to "/ghi/jkl". I assume I will need to have a specific Lookup 
instance per Configuration, right?


I have tried to understand how to do this based on this page 
(https://commons.apache.org/proper/commons-configuration/userguide/howto_basicfeatures.html#Customizing_interpolation), 
but the information seems to be a bit inaccurate based on v2.1. (For 
example, it refers to calling the static registerGlobalLookup() method 
on ConfigurationInterpolator, but this method does not appear to exist.)


Also, I'm not clear if I should be extending StrLookup, or implementing 
Lookup. (I was initially using StrLookup, but the 
ConfigurationInterpolator registerLookup() method requires a Lookup 
instance.)


If I do the following, it seems to allow me create a working custom 
interpolator. But when I do this, the standard prefixes (sys, const, 
env) no longer work:


ConfigurationInterpolator ci = new ConfigurationInterpolator();
ci.registerLookup("myPrefix", new MyLookup()); // implementation of 
Lookup interface

config1.setInterpolator(ci);

Any thoughts on how to implement this using Commons Configuration best 
practices?


Thanks in advance,
Greg

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [jira] [Commented] (CONFIGURATION-641) XMLConfiguration.load may throw NPE

2016-11-21 Thread Claude Warren
(posted to user@commons.apache.org)  For background see:
https://issues.apache.org/jira/browse/CONFIGURATION-641?
page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&
focusedCommentId=15681474#comment-15681474

Perhaps there is a bigger problem with the semantics of the classes.  I
come late to this project having used version 1.x and not participated or
followed any of the development discussion for 2.x versions.  So from a
pseudo-noob point of view perhaps the Configuration objects should not have
a read/write method that does not take a FileHandler object.

I think this makes sense in that you can create a configuration and do a
lot with it without reading or writeing it.  The read/write issues arise
because of resolution issues in reading/writing (e.g. resolving include
statements).

Perhaps in version 2.2 the read/write methods could be deprecated in favor
of _read() and _write() (renaming the methods in FileBased) and FileHandler
could be renamed to IOHandler.  So reading from a stream, file, ByteBuffer,
etc would be handled by the IOHandler.  It seem counter inturitive that a
FileHandler would be needed to read/write a configuration to a Stream.

Just thoughts.  Any comments?

Claude

On Sun, Nov 20, 2016 at 5:07 PM, Oliver Heger (JIRA) <j...@apache.org>
wrote:

>
> [ https://issues.apache.org/jira/browse/CONFIGURATION-641?
> page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&
> focusedCommentId=15681474#comment-15681474 ]
>
> Oliver Heger commented on CONFIGURATION-641:
> 
>
> Agreed that it is not a good style to throw a NPE here. However, the
> underlying problem here is that the read() method should not be called
> directly, but a {{FileHandler}} object should be used to load or save a
> configuration as described at
> http://commons.apache.org/proper/commons-configuration/
> userguide/howto_filebased.html#File_Operations_on_Configurations
>
> The documentation of read() and write() methods should be improved to
> state this.
>
> > XMLConfiguration.load may throw NPE
> > ---
> >
> >     Key: CONFIGURATION-641
> > URL: https://issues.apache.org/
> jira/browse/CONFIGURATION-641
> > Project: Commons Configuration
> >  Issue Type: Bug
> >Affects Versions: 2.1
> > Environment: Java 8 / Linux
> >Reporter: Claude Warren
> >   Original Estimate: 1h
> >  Remaining Estimate: 1h
> >
> > I expect that
> > {noformat}
> > URL url = Test.class.getResource( "/Test.xml");
> > XMLConfiguration config = new XMLConfiguration();
> > config.read( url.openStream());
> > {noformat}
> > Would read the XML file.  However it will throw a NPE at line 967
> > {noformat}
> >  private void load(InputSource source) throws ConfigurationException
> > {
> > try
> > {
> > URL sourceURL = locator.getSourceURL(); // <- NPE here
> > if (sourceURL != null)
> > {
> > source.setSystemId(sourceURL.toString());
> > }
> > {noformat}
> > I believe that testing for locator == null first will solve the problem
> as the rest of the code in the method does not appear to use it.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.4#6332)
>



-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren


Re: [configuration] Character position of key in file

2016-11-15 Thread Greg Torrance
Thanks for the detailed suggestions, Oliver. I appreciate it. I'll dig 
around a bit and give it some thought; you've given me a good head start.


All the best,
Greg

On 11/15/2016 03:35 PM, Oliver Heger wrote:

Hi Greg,

Am 14.11.2016 um 22:34 schrieb Greg Torrance:

Thanks Oliver.

Regarding the Configuration API, is it possible to replace not just
values but keys, too? For example, could I replace



with



   Some Value



If so, can you suggest what class to look at first (for accomplishing
this)?

This is indeed a tough one. There are multiple options, but I am not
sure whether they fully cover your use case; you will certainly need
some experiments:

- With the high-level API (offered by Configuration) you can delete the
key to be replaced and then use the addNodes() method to insert a nodes
structure as replacement. The tricky part is to get the key for
addNodes() right, so the replacement goes to the desired position. The
configuration's expression engine may help you here. It has methods to
query for keys (and receive matching node objects) and to obtain a
canonical key for a given node.

- You may also operate on the hierarchical configuration's node
structure directly. The root node can be queried via the node model
getNodeModel()). As this structure is immutable, you cannot directly
change it, but you have to create a copy which might not be that efficient.

- Unfortunately, XMLConfiguration has no direct hooks to manipulate the
node creation process. There are some helper methods, but these are private.

The use case is interesting. It would be good to offer some generic
support for configuration pre-processing, independent on a concrete
implementation. However, this is probably not easy to implement, and it
may still be insufficient for specific use cases.

Oliver


Thanks,
Greg

On 11/14/2016 04:27 PM, Oliver Heger wrote:

Hi Greg,

Am 14.11.2016 um 19:01 schrieb Greg Torrance:

I hope I'm not asking too many questions...

I wonder if it is possible to determine the character/byte position
of a particular key in a configuration file?

No, the original position from where data is read is not stored in the
resulting configuration.


My intent is to do a pre-pass of an XML configuration file in which
certain configuration keys/values are replaced by other keys/values.
Once that is done the file will be reloaded. I realize this is
possible outside of Commons Configuration, but I was wondering if
there is a "hook" in the tool that might help simplify the process.


But wouldn't it be easier to do this with the Configuration API? Load
the configuration, iterate over its keys, replace data as appropriate
and save the result?

Oliver


Thanks,
Greg


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org





-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Character position of key in file

2016-11-15 Thread Oliver Heger
Hi Greg,

Am 14.11.2016 um 22:34 schrieb Greg Torrance:
> Thanks Oliver.
> 
> Regarding the Configuration API, is it possible to replace not just
> values but keys, too? For example, could I replace
> 
> 
> 
> with
> 
> 
>
>   Some Value
>
> 
> 
> If so, can you suggest what class to look at first (for accomplishing
> this)?

This is indeed a tough one. There are multiple options, but I am not
sure whether they fully cover your use case; you will certainly need
some experiments:

- With the high-level API (offered by Configuration) you can delete the
key to be replaced and then use the addNodes() method to insert a nodes
structure as replacement. The tricky part is to get the key for
addNodes() right, so the replacement goes to the desired position. The
configuration's expression engine may help you here. It has methods to
query for keys (and receive matching node objects) and to obtain a
canonical key for a given node.

- You may also operate on the hierarchical configuration's node
structure directly. The root node can be queried via the node model
getNodeModel()). As this structure is immutable, you cannot directly
change it, but you have to create a copy which might not be that efficient.

- Unfortunately, XMLConfiguration has no direct hooks to manipulate the
node creation process. There are some helper methods, but these are private.

The use case is interesting. It would be good to offer some generic
support for configuration pre-processing, independent on a concrete
implementation. However, this is probably not easy to implement, and it
may still be insufficient for specific use cases.

Oliver

> 
> Thanks,
> Greg
> 
> On 11/14/2016 04:27 PM, Oliver Heger wrote:
>> Hi Greg,
>>
>> Am 14.11.2016 um 19:01 schrieb Greg Torrance:
>>> I hope I'm not asking too many questions...
>>>
>>> I wonder if it is possible to determine the character/byte position
>>> of a particular key in a configuration file?
>> No, the original position from where data is read is not stored in the
>> resulting configuration.
>>
>>> My intent is to do a pre-pass of an XML configuration file in which
>>> certain configuration keys/values are replaced by other keys/values.
>>> Once that is done the file will be reloaded. I realize this is
>>> possible outside of Commons Configuration, but I was wondering if
>>> there is a "hook" in the tool that might help simplify the process.
>>>
>> But wouldn't it be easier to do this with the Configuration API? Load
>> the configuration, iterate over its keys, replace data as appropriate
>> and save the result?
>>
>> Oliver
>>
>>> Thanks,
>>> Greg
>>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] reading full text of PropertiesConfiguration file in 2.0

2016-11-14 Thread Robert V Sasseen
Didn't subscribe to list, found Oliver's kind reply on the archive site, don't 
know how to reply to that directly, so I'm replying to my original message. 
Oliver's suggestion worked fine, 2.0 code is:


FileBasedConfigurationBuilder builder 
= new Configurations.propertiesBuilder("my.properties");
PropertiesConfiguration propertiesConfiguration = 
builder.getConfiguration();
FileHandler fileHandler = builder.getFileHandler();
URL url = fileHandler.getURL();
String cont = IOUtils.toString((InputStream) 
url.openConnection().getContent(), StandardCharsets.UTF_8);


From: Robert V Sasseen <rvsass...@hotmail.com>
Sent: Friday, November 11, 2016 6:47 PM
To: user@commons.apache.org
Subject: [configuration] reading full text of PropertiesConfiguration file in 
2.0


Is there a straightforward way to get the full text of the properties file from 
a PropertiesConfiguration object in 2.0? In 1.x I could do


PropertiesConfiguration propertiesConfiguration = new 
PropertiesConfiguration("my.properties");

URL url = propertiesConfiguration.getURL();
String cont = IOUtils.toString((InputStream) 
url.openConnection().getContent(), StandardCharsets.UTF_8);


This worked for both properties file in my jar and in the filesystem on the 
classpath. But in 2.0 PropertiesConfiguration does not have a method getURL().


Since PropertiesConfiguration has a (somewhat) complicated algorithm for 
finding properties in the classpath and filesystem, I want to let it carry out 
its algorithm, then ask it where it found the file, rather than having to try 
to understand and replicate the algorithm.


If you're wondering why I want the text, I want to be able to show my user 
exactly what the file looks like, even if it's hidden away in a jar file. I 
know (a little) about PropertiesConfigurationLayout, but I'd prefer to just get 
the file text rather than reconstruct an approximation of it using that.


Re: [configuration] Combined Configuration examples

2016-11-14 Thread Aaron Gadberry
Thanks Oliver!

On Mon, Nov 14, 2016 at 3:24 PM, Oliver Heger <oliver.he...@oliver-heger.de>
wrote:

> Hi Aaron,
>
> Am 14.11.2016 um 18:38 schrieb Aaron Gadberry:
> > Hi All,
> >
> > A follow up question.  Is there a way to view the combined XML?  I am
> > constantly missing elements not knowing if it is my paths or my original
> > files or the combiner.
>
> what you could do is to copy the combined configuration into a
> XMLConfiguration and save this to a file. XMLConfiguration has a
> constructor that accepts a hierarchical configuration; so you pass in
> the combined configuration. Then the configuration can be saved to file
> or dumped to an output stream:
>
> XMLConfiguration copy = new XMLConfiguration(combined);
> FileHandler handler = new FileHandler(copy);
> handler.save(new File("target.xml"));
>
> Oliver
>
> >
> > Thanks,
> >
> >
> >
> > On Sun, Nov 13, 2016 at 2:54 PM, Greg Torrance <greg.torra...@pobox.com>
> > wrote:
> >
> >> Thanks Oliver.
> >>
> >> I think I understand what you're saying about why Channel 4 would not be
> >> included with the OverrideCombiner (if it doesn't exist in
> testfile1.xml).
> >> I am sorry to hear, though, that attributes are not used at all for
> >> matching with OverrideCombiner. If I'm understanding it correctly, that
> >> means it can't really be used for overriding just specific list items,
> as
> >> the entire list would have to be represented, in the same order, in both
> >> primary and overriding files, or the wrong list item might be
> overridden.
> >> (For example, if the primary list had Channels 1, 2, and 3, and the
> >> override list had only Channel 2, then it would attempt to override
> Channel
> >> 1 with the info from Channel 2.) Is my understanding correct?
> >>
> >> Anyway, I'm going to experiment a bit and try to make sure I have a good
> >> understanding of how this works.
> >>
> >> Thanks again for the help.
> >>
> >> Greg
> >>
> >>
> >> On 11/13/2016 01:51 PM, Oliver Heger wrote:
> >>
> >>> Hi Greg,
> >>>
> >>> Am 13.11.2016 um 18:41 schrieb Greg Torrance:
> >>>
> >>>> Hi Oliver,
> >>>>
> >>>> Thanks for the reply. That is helpful!
> >>>>
> >>>> Hm, it looks as if the examples are partly incorrect. I assume that
> >>>>>
> >>>> the channel with id="4" should not be part of testfile1.xml, but only
> be
> >>>> contained in the second file. It should appear in the results of union
> >>>> and  merge combiner. Does that make sense?
> >>>>
> >>>> I'm not clear why -- if the channel with id="4" is not contained in
> >>>> testfile1.xml -- why it will not end up in the results from all three
> >>>> combiners. Why just union and merge and not override, too?
> >>>>
> >>> On a higher level, OverrideCombiner detects that both files have a list
> >>> of channels. Therefore, it copies the first list and ignores the second
> >>> one. So the channels element in the first file overrides the one in the
> >>> second file.
> >>>
> >>> As for the attributes, do I understand correctly that the attribute
> >>>> values for elements are used, essentially, as "key" values to
> >>>> distinguish the various elements for combining purposes? And if the
> >>>> values of any attributes of two elements differ, then the elements
> would
> >>>> be considered different elements for combining purposes? (Said another
> >>>> way, if two elements have a set of attributes in common, if the values
> >>>> for those common attributes are the same, the elements will be
> >>>> considered to match.) Does that make sense? Is that correct?
> >>>>
> >>> This is true only for MergeCombiner. The other combiners do not try to
> >>> match nodes in both configurations based on their attribute values;
> they
> >>> take two source nodes at the same position in the hierarchy and produce
> >>> a result node that has all the attributes of the two source nodes.
> >>>
> >>> Oliver
> >>>
> >>> Thanks again for the reply.
> >>>>
> >>>> Greg
> >>>>
> >>>> On 11/13/2016 12:05 PM, Oliver Heger wrote:
>

Re: [configuration] Character position of key in file

2016-11-14 Thread Greg Torrance

Thanks Oliver.

Regarding the Configuration API, is it possible to replace not just 
values but keys, too? For example, could I replace




with


   
  Some Value
   


If so, can you suggest what class to look at first (for accomplishing 
this)?


Thanks,
Greg

On 11/14/2016 04:27 PM, Oliver Heger wrote:

Hi Greg,

Am 14.11.2016 um 19:01 schrieb Greg Torrance:

I hope I'm not asking too many questions...

I wonder if it is possible to determine the character/byte position of a 
particular key in a configuration file?

No, the original position from where data is read is not stored in the
resulting configuration.


My intent is to do a pre-pass of an XML configuration file in which certain configuration 
keys/values are replaced by other keys/values. Once that is done the file will be 
reloaded. I realize this is possible outside of Commons Configuration, but I was 
wondering if there is a "hook" in the tool that might help simplify the process.


But wouldn't it be easier to do this with the Configuration API? Load
the configuration, iterate over its keys, replace data as appropriate
and save the result?

Oliver


Thanks,
Greg


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org





-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Character position of key in file

2016-11-14 Thread Oliver Heger
Hi Greg,

Am 14.11.2016 um 19:01 schrieb Greg Torrance:
> I hope I'm not asking too many questions...
> 
> I wonder if it is possible to determine the character/byte position of a 
> particular key in a configuration file?
No, the original position from where data is read is not stored in the
resulting configuration.

> 
> My intent is to do a pre-pass of an XML configuration file in which certain 
> configuration keys/values are replaced by other keys/values. Once that is 
> done the file will be reloaded. I realize this is possible outside of Commons 
> Configuration, but I was wondering if there is a "hook" in the tool that 
> might help simplify the process.
> 
But wouldn't it be easier to do this with the Configuration API? Load
the configuration, iterate over its keys, replace data as appropriate
and save the result?

Oliver

> Thanks,
> Greg
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Combined Configuration examples

2016-11-14 Thread Oliver Heger
Hi Aaron,

Am 14.11.2016 um 18:38 schrieb Aaron Gadberry:
> Hi All,
> 
> A follow up question.  Is there a way to view the combined XML?  I am
> constantly missing elements not knowing if it is my paths or my original
> files or the combiner.

what you could do is to copy the combined configuration into a
XMLConfiguration and save this to a file. XMLConfiguration has a
constructor that accepts a hierarchical configuration; so you pass in
the combined configuration. Then the configuration can be saved to file
or dumped to an output stream:

XMLConfiguration copy = new XMLConfiguration(combined);
FileHandler handler = new FileHandler(copy);
handler.save(new File("target.xml"));

Oliver

> 
> Thanks,
> 
> 
> 
> On Sun, Nov 13, 2016 at 2:54 PM, Greg Torrance <greg.torra...@pobox.com>
> wrote:
> 
>> Thanks Oliver.
>>
>> I think I understand what you're saying about why Channel 4 would not be
>> included with the OverrideCombiner (if it doesn't exist in testfile1.xml).
>> I am sorry to hear, though, that attributes are not used at all for
>> matching with OverrideCombiner. If I'm understanding it correctly, that
>> means it can't really be used for overriding just specific list items, as
>> the entire list would have to be represented, in the same order, in both
>> primary and overriding files, or the wrong list item might be overridden.
>> (For example, if the primary list had Channels 1, 2, and 3, and the
>> override list had only Channel 2, then it would attempt to override Channel
>> 1 with the info from Channel 2.) Is my understanding correct?
>>
>> Anyway, I'm going to experiment a bit and try to make sure I have a good
>> understanding of how this works.
>>
>> Thanks again for the help.
>>
>> Greg
>>
>>
>> On 11/13/2016 01:51 PM, Oliver Heger wrote:
>>
>>> Hi Greg,
>>>
>>> Am 13.11.2016 um 18:41 schrieb Greg Torrance:
>>>
>>>> Hi Oliver,
>>>>
>>>> Thanks for the reply. That is helpful!
>>>>
>>>> Hm, it looks as if the examples are partly incorrect. I assume that
>>>>>
>>>> the channel with id="4" should not be part of testfile1.xml, but only be
>>>> contained in the second file. It should appear in the results of union
>>>> and  merge combiner. Does that make sense?
>>>>
>>>> I'm not clear why -- if the channel with id="4" is not contained in
>>>> testfile1.xml -- why it will not end up in the results from all three
>>>> combiners. Why just union and merge and not override, too?
>>>>
>>> On a higher level, OverrideCombiner detects that both files have a list
>>> of channels. Therefore, it copies the first list and ignores the second
>>> one. So the channels element in the first file overrides the one in the
>>> second file.
>>>
>>> As for the attributes, do I understand correctly that the attribute
>>>> values for elements are used, essentially, as "key" values to
>>>> distinguish the various elements for combining purposes? And if the
>>>> values of any attributes of two elements differ, then the elements would
>>>> be considered different elements for combining purposes? (Said another
>>>> way, if two elements have a set of attributes in common, if the values
>>>> for those common attributes are the same, the elements will be
>>>> considered to match.) Does that make sense? Is that correct?
>>>>
>>> This is true only for MergeCombiner. The other combiners do not try to
>>> match nodes in both configurations based on their attribute values; they
>>> take two source nodes at the same position in the hierarchy and produce
>>> a result node that has all the attributes of the two source nodes.
>>>
>>> Oliver
>>>
>>> Thanks again for the reply.
>>>>
>>>> Greg
>>>>
>>>> On 11/13/2016 12:05 PM, Oliver Heger wrote:
>>>>
>>>>> Hi Greg,
>>>>>
>>>>> Am 13.11.2016 um 15:07 schrieb Greg Torrance:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I am trying to work out the precise differences between
>>>>>> OverrideCombiner, UnionCombiner, and MergeCombiner. However, the
>>>>>> examples on this page
>>>>>> (https://commons.apache.org/proper/commons-configuration/use
>>>>>> rguide/howto_combinedconfiguration.html)
>>>>>>

[configuration] Character position of key in file

2016-11-14 Thread Greg Torrance
I hope I'm not asking too many questions...

I wonder if it is possible to determine the character/byte position of a 
particular key in a configuration file?

My intent is to do a pre-pass of an XML configuration file in which certain 
configuration keys/values are replaced by other keys/values. Once that is done 
the file will be reloaded. I realize this is possible outside of Commons 
Configuration, but I was wondering if there is a "hook" in the tool that might 
help simplify the process.

Thanks,
Greg

Re: [configuration] reading full text of PropertiesConfiguration file in 2.0

2016-11-14 Thread Oliver Heger
Hi Robert,

Am 12.11.2016 um 03:47 schrieb Robert V Sasseen:
> Is there a straightforward way to get the full text of the properties file 
> from a PropertiesConfiguration object in 2.0? In 1.x I could do
> 
> 
> PropertiesConfiguration propertiesConfiguration = new 
> PropertiesConfiguration("my.properties");
> 
> URL url = propertiesConfiguration.getURL();
> String cont = IOUtils.toString((InputStream) 
> url.openConnection().getContent(), StandardCharsets.UTF_8);
> 
> 
> This worked for both properties file in my jar and in the filesystem on the 
> classpath. But in 2.0 PropertiesConfiguration does not have a method getURL().
> 
> 
> Since PropertiesConfiguration has a (somewhat) complicated algorithm for 
> finding properties in the classpath and filesystem, I want to let it carry 
> out its algorithm, then ask it where it found the file, rather than having to 
> try to understand and replicate the algorithm.
> 
> 
> If you're wondering why I want the text, I want to be able to show my user 
> exactly what the file looks like, even if it's hidden away in a jar file. I 
> know (a little) about PropertiesConfigurationLayout, but I'd prefer to just 
> get the file text rather than reconstruct an approximation of it using that.
> 
If you use a FileBasedConfigurationBuilder to create the
PropertiesConfiguration, you should be able to use the builder's
getFileHandler() method to obtain a FileHandler object. This object has
methods that allow you to retrieve the underlying file or URL.

Oliver

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] reading full text of PropertiesConfiguration file in 2.0

2016-11-14 Thread Robert V Sasseen
Is there a straightforward way to get the full text of the properties file from 
a PropertiesConfiguration object in 2.0? In 1.x I could do


PropertiesConfiguration propertiesConfiguration = new 
PropertiesConfiguration("my.properties");

URL url = propertiesConfiguration.getURL();
String cont = IOUtils.toString((InputStream) 
url.openConnection().getContent(), StandardCharsets.UTF_8);


This worked for both properties file in my jar and in the filesystem on the 
classpath. But in 2.0 PropertiesConfiguration does not have a method getURL().


Since PropertiesConfiguration has a (somewhat) complicated algorithm for 
finding properties in the classpath and filesystem, I want to let it carry out 
its algorithm, then ask it where it found the file, rather than having to try 
to understand and replicate the algorithm.


If you're wondering why I want the text, I want to be able to show my user 
exactly what the file looks like, even if it's hidden away in a jar file. I 
know (a little) about PropertiesConfigurationLayout, but I'd prefer to just get 
the file text rather than reconstruct an approximation of it using that.


Re: [configuration] Combined Configuration examples

2016-11-13 Thread Greg Torrance

Thanks Oliver.

I think I understand what you're saying about why Channel 4 would not be 
included with the OverrideCombiner (if it doesn't exist in 
testfile1.xml). I am sorry to hear, though, that attributes are not used 
at all for matching with OverrideCombiner. If I'm understanding it 
correctly, that means it can't really be used for overriding just 
specific list items, as the entire list would have to be represented, in 
the same order, in both primary and overriding files, or the wrong list 
item might be overridden. (For example, if the primary list had Channels 
1, 2, and 3, and the override list had only Channel 2, then it would 
attempt to override Channel 1 with the info from Channel 2.) Is my 
understanding correct?


Anyway, I'm going to experiment a bit and try to make sure I have a good 
understanding of how this works.


Thanks again for the help.

Greg

On 11/13/2016 01:51 PM, Oliver Heger wrote:

Hi Greg,

Am 13.11.2016 um 18:41 schrieb Greg Torrance:

Hi Oliver,

Thanks for the reply. That is helpful!


Hm, it looks as if the examples are partly incorrect. I assume that

the channel with id="4" should not be part of testfile1.xml, but only be
contained in the second file. It should appear in the results of union
and  merge combiner. Does that make sense?

I'm not clear why -- if the channel with id="4" is not contained in
testfile1.xml -- why it will not end up in the results from all three
combiners. Why just union and merge and not override, too?

On a higher level, OverrideCombiner detects that both files have a list
of channels. Therefore, it copies the first list and ignores the second
one. So the channels element in the first file overrides the one in the
second file.


As for the attributes, do I understand correctly that the attribute
values for elements are used, essentially, as "key" values to
distinguish the various elements for combining purposes? And if the
values of any attributes of two elements differ, then the elements would
be considered different elements for combining purposes? (Said another
way, if two elements have a set of attributes in common, if the values
for those common attributes are the same, the elements will be
considered to match.) Does that make sense? Is that correct?

This is true only for MergeCombiner. The other combiners do not try to
match nodes in both configurations based on their attribute values; they
take two source nodes at the same position in the hierarchy and produce
a result node that has all the attributes of the two source nodes.

Oliver


Thanks again for the reply.

Greg

On 11/13/2016 12:05 PM, Oliver Heger wrote:

Hi Greg,

Am 13.11.2016 um 15:07 schrieb Greg Torrance:

Hi all,

I am trying to work out the precise differences between
OverrideCombiner, UnionCombiner, and MergeCombiner. However, the
examples on this page
(https://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html)

are confusing to me.

testfile1.xml and testfile2.xml both contain Channels with id="4",
however none of the Combiner Results shows any Channels with id="4".
And the Notes on the right-hand side of the page contain no mention of
Channel 4.

Am I missing something? Are the examples correct?

Hm, it looks as if the examples are partly incorrect. I assume that the
channel with id="4" should not be part of testfile1.xml, but only be
contained in the second file. It should appear in the results of union
and merge combiner. Does that make sense?


What I'm really trying to understand is the impact of attributes in the
way the various combiners choose to combine elements. (Any pointers to
further documentation on this would be appreciated.)

Some more information can be found in the Javadocs of the combiner
classes:
- UnionCombiner states: "Another limitation is the handling of
attributes: Attributes can only have a single value. So if two nodes are
to be combined which both have an attribute with the same name, it is
not possible to construct a proper union attribute. In this case, the
attribute value from the first node is used."

- OverrideCombiner has an addAttributes() method with the following
documentation: "Handles the attributes during a combination process.
First all attributes of the first node are added to the result. Then all
attributes of the second node, which are not contained in the first
node, are also added."

- The merging behavior of MergeCombiner is also described in its class
documentation.

Does this help?
Oliver


Thoughts?

Thanks,
Greg


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@

Re: [configuration] Combined Configuration examples

2016-11-13 Thread Oliver Heger
Hi Greg,

Am 13.11.2016 um 18:41 schrieb Greg Torrance:
> Hi Oliver,
> 
> Thanks for the reply. That is helpful!
> 
>> Hm, it looks as if the examples are partly incorrect. I assume that
> the channel with id="4" should not be part of testfile1.xml, but only be
> contained in the second file. It should appear in the results of union
> and  merge combiner. Does that make sense?
> 
> I'm not clear why -- if the channel with id="4" is not contained in
> testfile1.xml -- why it will not end up in the results from all three
> combiners. Why just union and merge and not override, too?
On a higher level, OverrideCombiner detects that both files have a list
of channels. Therefore, it copies the first list and ignores the second
one. So the channels element in the first file overrides the one in the
second file.

> 
> As for the attributes, do I understand correctly that the attribute
> values for elements are used, essentially, as "key" values to
> distinguish the various elements for combining purposes? And if the
> values of any attributes of two elements differ, then the elements would
> be considered different elements for combining purposes? (Said another
> way, if two elements have a set of attributes in common, if the values
> for those common attributes are the same, the elements will be
> considered to match.) Does that make sense? Is that correct?
This is true only for MergeCombiner. The other combiners do not try to
match nodes in both configurations based on their attribute values; they
take two source nodes at the same position in the hierarchy and produce
a result node that has all the attributes of the two source nodes.

Oliver

> 
> Thanks again for the reply.
> 
> Greg
> 
> On 11/13/2016 12:05 PM, Oliver Heger wrote:
>> Hi Greg,
>>
>> Am 13.11.2016 um 15:07 schrieb Greg Torrance:
>>> Hi all,
>>>
>>> I am trying to work out the precise differences between
>>> OverrideCombiner, UnionCombiner, and MergeCombiner. However, the
>>> examples on this page
>>> (https://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html)
>>>
>>> are confusing to me.
>>>
>>> testfile1.xml and testfile2.xml both contain Channels with id="4",
>>> however none of the Combiner Results shows any Channels with id="4".
>>> And the Notes on the right-hand side of the page contain no mention of
>>> Channel 4.
>>>
>>> Am I missing something? Are the examples correct?
>> Hm, it looks as if the examples are partly incorrect. I assume that the
>> channel with id="4" should not be part of testfile1.xml, but only be
>> contained in the second file. It should appear in the results of union
>> and merge combiner. Does that make sense?
>>
>>> What I'm really trying to understand is the impact of attributes in the
>>> way the various combiners choose to combine elements. (Any pointers to
>>> further documentation on this would be appreciated.)
>> Some more information can be found in the Javadocs of the combiner
>> classes:
>> - UnionCombiner states: "Another limitation is the handling of
>> attributes: Attributes can only have a single value. So if two nodes are
>> to be combined which both have an attribute with the same name, it is
>> not possible to construct a proper union attribute. In this case, the
>> attribute value from the first node is used."
>>
>> - OverrideCombiner has an addAttributes() method with the following
>> documentation: "Handles the attributes during a combination process.
>> First all attributes of the first node are added to the result. Then all
>> attributes of the second node, which are not contained in the first
>> node, are also added."
>>
>> - The merging behavior of MergeCombiner is also described in its class
>> documentation.
>>
>> Does this help?
>> Oliver
>>
>>> Thoughts?
>>>
>>> Thanks,
>>> Greg
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Combined Configuration examples

2016-11-13 Thread Greg Torrance

Hi Oliver,

Thanks for the reply. That is helpful!

> Hm, it looks as if the examples are partly incorrect. I assume that 
the channel with id="4" should not be part of testfile1.xml, but only be 
contained in the second file. It should appear in the results of union 
and  merge combiner. Does that make sense?


I'm not clear why -- if the channel with id="4" is not contained in 
testfile1.xml -- why it will not end up in the results from all three 
combiners. Why just union and merge and not override, too?


As for the attributes, do I understand correctly that the attribute 
values for elements are used, essentially, as "key" values to 
distinguish the various elements for combining purposes? And if the 
values of any attributes of two elements differ, then the elements would 
be considered different elements for combining purposes? (Said another 
way, if two elements have a set of attributes in common, if the values 
for those common attributes are the same, the elements will be 
considered to match.) Does that make sense? Is that correct?


Thanks again for the reply.

Greg

On 11/13/2016 12:05 PM, Oliver Heger wrote:

Hi Greg,

Am 13.11.2016 um 15:07 schrieb Greg Torrance:

Hi all,

I am trying to work out the precise differences between
OverrideCombiner, UnionCombiner, and MergeCombiner. However, the
examples on this page
(https://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html)
are confusing to me.

testfile1.xml and testfile2.xml both contain Channels with id="4",
however none of the Combiner Results shows any Channels with id="4".
And the Notes on the right-hand side of the page contain no mention of
Channel 4.

Am I missing something? Are the examples correct?

Hm, it looks as if the examples are partly incorrect. I assume that the
channel with id="4" should not be part of testfile1.xml, but only be
contained in the second file. It should appear in the results of union
and merge combiner. Does that make sense?


What I'm really trying to understand is the impact of attributes in the
way the various combiners choose to combine elements. (Any pointers to
further documentation on this would be appreciated.)

Some more information can be found in the Javadocs of the combiner classes:
- UnionCombiner states: "Another limitation is the handling of
attributes: Attributes can only have a single value. So if two nodes are
to be combined which both have an attribute with the same name, it is
not possible to construct a proper union attribute. In this case, the
attribute value from the first node is used."

- OverrideCombiner has an addAttributes() method with the following
documentation: "Handles the attributes during a combination process.
First all attributes of the first node are added to the result. Then all
attributes of the second node, which are not contained in the first
node, are also added."

- The merging behavior of MergeCombiner is also described in its class
documentation.

Does this help?
Oliver


Thoughts?

Thanks,
Greg


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org





-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Combined Configuration examples

2016-11-13 Thread Oliver Heger
Hi Greg,

Am 13.11.2016 um 15:07 schrieb Greg Torrance:
> Hi all,
> 
> I am trying to work out the precise differences between
> OverrideCombiner, UnionCombiner, and MergeCombiner. However, the
> examples on this page
> (https://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html)
> are confusing to me.
> 
> testfile1.xml and testfile2.xml both contain Channels with id="4",
> however none of the Combiner Results shows any Channels with id="4". 
> And the Notes on the right-hand side of the page contain no mention of
> Channel 4.
> 
> Am I missing something? Are the examples correct?
Hm, it looks as if the examples are partly incorrect. I assume that the
channel with id="4" should not be part of testfile1.xml, but only be
contained in the second file. It should appear in the results of union
and merge combiner. Does that make sense?

> 
> What I'm really trying to understand is the impact of attributes in the
> way the various combiners choose to combine elements. (Any pointers to
> further documentation on this would be appreciated.)
Some more information can be found in the Javadocs of the combiner classes:
- UnionCombiner states: "Another limitation is the handling of
attributes: Attributes can only have a single value. So if two nodes are
to be combined which both have an attribute with the same name, it is
not possible to construct a proper union attribute. In this case, the
attribute value from the first node is used."

- OverrideCombiner has an addAttributes() method with the following
documentation: "Handles the attributes during a combination process.
First all attributes of the first node are added to the result. Then all
attributes of the second node, which are not contained in the first
node, are also added."

- The merging behavior of MergeCombiner is also described in its class
documentation.

Does this help?
Oliver

> 
> Thoughts?
> 
> Thanks,
> Greg
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] Combined Configuration examples

2016-11-13 Thread Greg Torrance

Hi all,

I am trying to work out the precise differences between 
OverrideCombiner, UnionCombiner, and MergeCombiner. However, the 
examples on this page 
(https://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html) 
are confusing to me.


testfile1.xml and testfile2.xml both contain Channels with id="4", 
however none of the Combiner Results shows any Channels with id="4".  
And the Notes on the right-hand side of the page contain no mention of 
Channel 4.


Am I missing something? Are the examples correct?

What I'm really trying to understand is the impact of attributes in the 
way the various combiners choose to combine elements. (Any pointers to 
further documentation on this would be appreciated.)


Thoughts?

Thanks,
Greg


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [Configuration]

2016-08-24 Thread Oliver Heger
Hi,

Am 24.08.2016 um 21:31 schrieb Michael Fortin:
> Hi, I’m trying to combine two child lists in two configurations and was 
> expecting them to be combined into one longer list, but one seems to be 
> taking precedence over the other.  Is there a way to merge child lists?

Don't use CompositeConfiguration, but CombinedConfiguration. Please
refer to the user guide [1] and make sure you read the chapter about
node combiners.

HTH
Oliver

[1]
http://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html#Combined_Configuration

> 
> Here’s the unit test:
> https://github.com/m410/commons-configuration-yaml/blob/master/src/test/java/org/m410/config/YamlCompositeConfigurationTest.java
>  
> <https://github.com/m410/commons-configuration-yaml/blob/master/src/test/java/org/m410/config/YamlCompositeConfigurationTest.java>
> line 48 fails
> 
> here’s the two configurations:
> https://github.com/m410/commons-configuration-yaml/tree/master/src/test/resource
>  
> <https://github.com/m410/commons-configuration-yaml/tree/master/src/test/resource>
> 
> thx
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[Configuration]

2016-08-24 Thread Michael Fortin
Hi, I’m trying to combine two child lists in two configurations and was 
expecting them to be combined into one longer list, but one seems to be taking 
precedence over the other.  Is there a way to merge child lists?

Here’s the unit test:
https://github.com/m410/commons-configuration-yaml/blob/master/src/test/java/org/m410/config/YamlCompositeConfigurationTest.java
 
<https://github.com/m410/commons-configuration-yaml/blob/master/src/test/java/org/m410/config/YamlCompositeConfigurationTest.java>
line 48 fails

here’s the two configurations:
https://github.com/m410/commons-configuration-yaml/tree/master/src/test/resource
 
<https://github.com/m410/commons-configuration-yaml/tree/master/src/test/resource>

thx

[ANNOUNCEMENT] Commons Configuration 2.1 Released

2016-08-21 Thread Oliver Heger
The Apache Commons Team is pleased to announce the availability of
Apache Commons Configuration 2.1.

The Commons Configuration software library provides a generic
configuration interface which enables an application to read
configuration data from a variety of sources.

This is the first maintenance release for Apache Commons Configuration
2.x. It contains some bug fixes and also adds a few new features like a
better integration into Spring. A full list of all changes can be found
in the release notes at
  http://www.apache.org/dist/commons/configuration/RELEASE-NOTES.txt

Version 2.1 is fully source and binary compatible with the previous 2.0
version.

Source and binary distributions are available for download from the
Apache Commons download site:

http://commons.apache.org/proper/commons-configuration/download_configuration.cgi

Please verify signatures using the KEYS file available at the above
location when downloading the release.

For complete information on Commons Configuration, including
instructions on how to submit bug reports, patches, or suggestions for
improvement, see the Apache Commons Configuration website:

http://commons.apache.org/proper/commons-configuration/

Oliver Heger, on behalf of the Apache Commons community

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] YAML configuration

2016-07-28 Thread Michael Fortin
Hi, I nearly have the library working with a few small caveats.  I’m not sure 
if this is a bug, I setup something wrong, or the expected behavior.  

This is the unit test, line 60 fails:
https://github.com/m410/commons-configuration-yaml/blob/master/src/test/java/org/m410/config/YamlConfigurationTest.java
 
<https://github.com/m410/commons-configuration-yaml/blob/master/src/test/java/org/m410/config/YamlConfigurationTest.java>

but the collection is there, the preceding 4 lines pass without issue.  Any 
advice would be much appreciated.

thx.


> On Jul 15, 2016, at 3:20 AM, Dennis Kieselhorst <d...@apache.org> wrote:
> 
> Hi Michael,
> 
> your toNodeMap method has a bug. In line 54 you're adding the child node
> but you're not using the node that is returned.
> 
> Regards
> Dennis
> 
> Am 13.07.2016 um 20:43 schrieb Michael Fortin:
>> Hi, I was trying to setup commons configuration to use YAML as it’s 
>> configuration file format.  
>> 
>> I found this example using commons 1.*:
>> https://github.com/PEXPlugins/PermissionsEx/blob/5da1c1410f134e2c8e39fbc93dc1c7d5e3456335/src/main/java/ru/tehkode/utils/config/YamlFileConfiguration.java
>>  
>> <https://github.com/PEXPlugins/PermissionsEx/blob/5da1c1410f134e2c8e39fbc93dc1c7d5e3456335/src/main/java/ru/tehkode/utils/config/YamlFileConfiguration.java>
>> 
>> And I was also looking at source of the XMLConfiguration as a guide:
>> https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/XMLConfiguration.html
>>  
>> <https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/XMLConfiguration.html>
>> 
>> This is what I have so far:
>> https://github.com/m410/commons-configuration-yaml/blob/master/src/main/java/org/m410/config/YamlConfiguration.java
>>  
>> <https://github.com/m410/commons-configuration-yaml/blob/master/src/main/java/org/m410/config/YamlConfiguration.java>
>> 
>> The test runs but doesn’t pass.  Could someone give me some guidance as to 
>> what I’m doing wrong?  
>> 
>> thanks much,
>> Michael
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 



Re: [configuration] YAML configuration

2016-07-19 Thread Michael Fortin
Hi Dennis, that’s just the nudge in the right direction I needed. thank you

> On Jul 15, 2016, at 3:20 AM, Dennis Kieselhorst <d...@apache.org> wrote:
> 
> Hi Michael,
> 
> your toNodeMap method has a bug. In line 54 you're adding the child node
> but you're not using the node that is returned.
> 
> Regards
> Dennis
> 
> Am 13.07.2016 um 20:43 schrieb Michael Fortin:
>> Hi, I was trying to setup commons configuration to use YAML as it’s 
>> configuration file format.  
>> 
>> I found this example using commons 1.*:
>> https://github.com/PEXPlugins/PermissionsEx/blob/5da1c1410f134e2c8e39fbc93dc1c7d5e3456335/src/main/java/ru/tehkode/utils/config/YamlFileConfiguration.java
>>  
>> <https://github.com/PEXPlugins/PermissionsEx/blob/5da1c1410f134e2c8e39fbc93dc1c7d5e3456335/src/main/java/ru/tehkode/utils/config/YamlFileConfiguration.java>
>> 
>> And I was also looking at source of the XMLConfiguration as a guide:
>> https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/XMLConfiguration.html
>>  
>> <https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/XMLConfiguration.html>
>> 
>> This is what I have so far:
>> https://github.com/m410/commons-configuration-yaml/blob/master/src/main/java/org/m410/config/YamlConfiguration.java
>>  
>> <https://github.com/m410/commons-configuration-yaml/blob/master/src/main/java/org/m410/config/YamlConfiguration.java>
>> 
>> The test runs but doesn’t pass.  Could someone give me some guidance as to 
>> what I’m doing wrong?  
>> 
>> thanks much,
>> Michael
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] YAML configuration

2016-07-15 Thread Dennis Kieselhorst
Hi Michael,

your toNodeMap method has a bug. In line 54 you're adding the child node
but you're not using the node that is returned.

Regards
Dennis

Am 13.07.2016 um 20:43 schrieb Michael Fortin:
> Hi, I was trying to setup commons configuration to use YAML as it’s 
> configuration file format.  
>
> I found this example using commons 1.*:
> https://github.com/PEXPlugins/PermissionsEx/blob/5da1c1410f134e2c8e39fbc93dc1c7d5e3456335/src/main/java/ru/tehkode/utils/config/YamlFileConfiguration.java
>  
> <https://github.com/PEXPlugins/PermissionsEx/blob/5da1c1410f134e2c8e39fbc93dc1c7d5e3456335/src/main/java/ru/tehkode/utils/config/YamlFileConfiguration.java>
>
> And I was also looking at source of the XMLConfiguration as a guide:
> https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/XMLConfiguration.html
>  
> <https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/XMLConfiguration.html>
>
> This is what I have so far:
> https://github.com/m410/commons-configuration-yaml/blob/master/src/main/java/org/m410/config/YamlConfiguration.java
>  
> <https://github.com/m410/commons-configuration-yaml/blob/master/src/main/java/org/m410/config/YamlConfiguration.java>
>
> The test runs but doesn’t pass.  Could someone give me some guidance as to 
> what I’m doing wrong?  
>
> thanks much,
> Michael


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] YAML configuration

2016-07-13 Thread Michael Fortin
Hi, I was trying to setup commons configuration to use YAML as it’s 
configuration file format.  

I found this example using commons 1.*:
https://github.com/PEXPlugins/PermissionsEx/blob/5da1c1410f134e2c8e39fbc93dc1c7d5e3456335/src/main/java/ru/tehkode/utils/config/YamlFileConfiguration.java
 
<https://github.com/PEXPlugins/PermissionsEx/blob/5da1c1410f134e2c8e39fbc93dc1c7d5e3456335/src/main/java/ru/tehkode/utils/config/YamlFileConfiguration.java>

And I was also looking at source of the XMLConfiguration as a guide:
https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/XMLConfiguration.html
 
<https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/XMLConfiguration.html>

This is what I have so far:
https://github.com/m410/commons-configuration-yaml/blob/master/src/main/java/org/m410/config/YamlConfiguration.java
 
<https://github.com/m410/commons-configuration-yaml/blob/master/src/main/java/org/m410/config/YamlConfiguration.java>

The test runs but doesn’t pass.  Could someone give me some guidance as to what 
I’m doing wrong?  

thanks much,
Michael

RE: [configuration] Monitoring configs

2016-05-02 Thread Ahmad, Zeba
Hi Oliver, 

Thank you for the reply. I actually wanted the configurations to surface up as 
JMX beans by registering in the MBean server at the time of creating the 
Configuration object itself. 

For now we have decided to go with option (1) where user does this at their 
side by calling MBean register after creating Configuration, but also use your 
suggestion of event mechanism to reload the JMX bean in case the file changes. 

Regards,
Zeba
-Original Message-
From: Oliver Heger [mailto:oliver.he...@oliver-heger.de] 
Sent: Tuesday, April 26, 2016 1:10 AM
To: Commons Users List <user@commons.apache.org>
Subject: Re: [configuration] Monitoring configs



Am 25.04.2016 um 09:45 schrieb Ahmad, Zeba:
> Hi,
> 
> I'm looking at providing a platform for users to monitor their 
> configurations either via JMX or some other means. Some ways I can 
> think of doing this
> 
> 1)  Let users register their chosen configurations as MBeans. 
> Here's<https://github.com/Netflix/archaius/blob/master/archaius-core/src/main/java/com/netflix/config/jmx/ConfigJMXManager.java>
>  a similar approach by Netflix. Here however, platform cannot mandate all 
> configurations to get surfaced for monitoring.
> 
> 2)  Read all config files present for the given application in config 
> directory, use Apache Modeler or some other to dynamically generate bean 
> descriptors and JMX MBeans for monitoring. But here I'm duplicating the 
> reading of the configs and the memory structures.
> 
> 3)  Have instrumentation within apache-commons-config  for such 
> monitoring by JMX or any other means.
> 
> Reg. #3, is there any recommendation on how users can efficiently 
> monitor/view/modify their configurations dynamically (without delivering an 
> updated file)?

Not sure what you want to achieve exactly. Could the event mechanism [1] be of 
some help?

Oliver

[1]
http://commons.apache.org/proper/commons-configuration/userguide/howto_events.html#Events

> 
> Regards,
> Zeba
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] Monitoring configs

2016-04-25 Thread Oliver Heger


Am 25.04.2016 um 09:45 schrieb Ahmad, Zeba:
> Hi,
> 
> I'm looking at providing a platform for users to monitor their configurations 
> either via JMX or some other means. Some ways I can think of doing this
> 
> 1)  Let users register their chosen configurations as MBeans. 
> Here's<https://github.com/Netflix/archaius/blob/master/archaius-core/src/main/java/com/netflix/config/jmx/ConfigJMXManager.java>
>  a similar approach by Netflix. Here however, platform cannot mandate all 
> configurations to get surfaced for monitoring.
> 
> 2)  Read all config files present for the given application in config 
> directory, use Apache Modeler or some other to dynamically generate bean 
> descriptors and JMX MBeans for monitoring. But here I'm duplicating the 
> reading of the configs and the memory structures.
> 
> 3)  Have instrumentation within apache-commons-config  for such 
> monitoring by JMX or any other means.
> 
> Reg. #3, is there any recommendation on how users can efficiently 
> monitor/view/modify their configurations dynamically (without delivering an 
> updated file)?

Not sure what you want to achieve exactly. Could the event mechanism [1]
be of some help?

Oliver

[1]
http://commons.apache.org/proper/commons-configuration/userguide/howto_events.html#Events

> 
> Regards,
> Zeba
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] Monitoring configs

2016-04-25 Thread Ahmad, Zeba
Hi,

I'm looking at providing a platform for users to monitor their configurations 
either via JMX or some other means. Some ways I can think of doing this

1)  Let users register their chosen configurations as MBeans. 
Here's
 a similar approach by Netflix. Here however, platform cannot mandate all 
configurations to get surfaced for monitoring.

2)  Read all config files present for the given application in config 
directory, use Apache Modeler or some other to dynamically generate bean 
descriptors and JMX MBeans for monitoring. But here I'm duplicating the reading 
of the configs and the memory structures.

3)  Have instrumentation within apache-commons-config  for such monitoring 
by JMX or any other means.

Reg. #3, is there any recommendation on how users can efficiently 
monitor/view/modify their configurations dynamically (without delivering an 
updated file)?

Regards,
Zeba


Re: [configuration] use commons configuration 2 as PropertySource in Spring

2016-04-20 Thread Oliver Heger
Hi Dennis,

Am 19.04.2016 um 22:05 schrieb Dennis Kieselhorst:
> Hi Gary,
> 
> I'm Apache committer and like to contribute but do you think it makes
> sense to have a Spring dependency in Commons Configuration? Maybe as
> optional?

obviously, there is no better active project where this Spring-related
code could live. So I guess, an optional dependency would probably be okay.

On the dependencies page all optional dependencies are listed and also
for which use cases they are required. So this information would need to
be updated, too.

Thanks
Oliver

> 
> Regards
> Dennis
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Composite Configuration with ReloadingFileBasedConfiguration

2016-04-20 Thread Oliver Heger
Hi Avin,

the reloading is only performed by the configuration builder. After you
have obtained a configuration from the builder, it will not change
automatically due to a reload operation. Citing from the user's guide [1]:

"One important point to keep in mind when using this approach to
reloading is that reloads are only functional if the builder is used as
central component for accessing configuration data. The configuration
instance obtained from the builder will not change automagically! So if
an application fetches a configuration object from the builder at
startup and then uses it throughout its life time, changes on the
external configuration file become never visible. The correct approach
is to keep a reference to the builder centrally and obtain the
configuration from there every time configuration data is needed."

This section of the user's guide also contains a working example. If you
want to combine multiple configuration sources with reloading support,
use CombinedConfiguration rather than CompositeConfiguration. How this
is done is described at [2].

HTH
Oliver

[1]
http://commons.apache.org/proper/commons-configuration/userguide/howto_reloading.html#Reloading_File-based_Configurations
[2]
http://commons.apache.org/proper/commons-configuration/userguide/howto_combinedbuilder.html#Reloading_Support

Am 20.04.2016 um 05:10 schrieb Avin:
> I am trying to implement the Apache Configuration 2 in my codebaseimport 
> java.io.File;
> import java.util.concurrent.TimeUnit;
> 
> import org.apache.commons.configuration2.PropertiesConfiguration;
> import org.apache.commons.configuration2.builder.ConfigurationBuilderEvent;
> import 
> org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder;
> import org.apache.commons.configuration2.builder.fluent.Parameters;
> import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
> import org.apache.commons.configuration2.event.EventListener;
> import org.apache.commons.configuration2.ex.ConfigurationException;
> import org.apache.commons.configuration2.reloading.PeriodicReloadingTrigger;
> 
> import org.apache.commons.configuration2.CompositeConfiguration;
> 
> public class Test {
> 
> private static final long DELAY_MILLIS = 10 * 60 * 5;
> 
> 
> public static void main(String[] args) {
> // TODO Auto-generated method stub
> CompositeConfiguration compositeConfiguration = new 
> CompositeConfiguration();
> PropertiesConfiguration props = null;
> try {
> props = initPropertiesConfiguration(new 
> File("/tmp/DEV.properties"));
> } catch (ConfigurationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> compositeConfiguration.addConfiguration( props );
> compositeConfiguration.addEventListener(ConfigurationBuilderEvent.ANY,
> new EventListener()
> {
> @Override
> public void onEvent(ConfigurationBuilderEvent event)
> {
> System.out.println("Event:" + event);
> 
> }
> });
> 
> System.out.println(compositeConfiguration.getString("property1"));
> 
> try {
> Thread.sleep(14*1000);
> } catch (InterruptedException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> 
> // Have a script which changes the value of property1 in 
> DEV.properties
> System.out.println(compositeConfiguration.getString("property1"));
> }
> 
> protected static PropertiesConfiguration initPropertiesConfiguration(File 
> propsFile) throws ConfigurationException { 
> 
> if(propsFile.exists()) {
> 
> final 
> ReloadingFileBasedConfigurationBuilder builder =
> new 
> ReloadingFileBasedConfigurationBuilder(PropertiesConfiguration.class)
> .configure(new Parameters().fileBased()
> .setFile(propsFile)
> .setReloadingRefreshDelay(DELAY_MILLIS)
> .setThrowExceptionOnMissing(false)
> .setListDelimiterHandler(new 
> DefaultListDelimiterHandler(';')));
> final PropertiesConfiguration propsConfiguration = 
> builder.getConfiguration();
> PeriodicReloadingTrigger trigger = new 
> PeriodicReloadingTrigger(builder.getReloadingController(),
> null, 1, TimeUnit.SECONDS);
> trigger.start();
> 
>     return propsConfiguration;
> } else {
> retur

Composite Configuration with ReloadingFileBasedConfiguration

2016-04-19 Thread Avin
I am trying to implement the Apache Configuration 2 in my codebaseimport 
java.io.File;
import java.util.concurrent.TimeUnit;

import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.builder.ConfigurationBuilderEvent;
import 
org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder;
import org.apache.commons.configuration2.builder.fluent.Parameters;
import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
import org.apache.commons.configuration2.event.EventListener;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.reloading.PeriodicReloadingTrigger;

import org.apache.commons.configuration2.CompositeConfiguration;

public class Test {

private static final long DELAY_MILLIS = 10 * 60 * 5;


public static void main(String[] args) {
// TODO Auto-generated method stub
CompositeConfiguration compositeConfiguration = new 
CompositeConfiguration();
PropertiesConfiguration props = null;
try {
props = initPropertiesConfiguration(new 
File("/tmp/DEV.properties"));
} catch (ConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
compositeConfiguration.addConfiguration( props );
compositeConfiguration.addEventListener(ConfigurationBuilderEvent.ANY,
new EventListener()
{
@Override
public void onEvent(ConfigurationBuilderEvent event)
{
System.out.println("Event:" + event);

}
});

System.out.println(compositeConfiguration.getString("property1"));

try {
Thread.sleep(14*1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

// Have a script which changes the value of property1 in DEV.properties
System.out.println(compositeConfiguration.getString("property1"));
}

protected static PropertiesConfiguration initPropertiesConfiguration(File 
propsFile) throws ConfigurationException { 

if(propsFile.exists()) {

final 
ReloadingFileBasedConfigurationBuilder builder =
new 
ReloadingFileBasedConfigurationBuilder(PropertiesConfiguration.class)
.configure(new Parameters().fileBased()
.setFile(propsFile)
.setReloadingRefreshDelay(DELAY_MILLIS)
.setThrowExceptionOnMissing(false)
.setListDelimiterHandler(new 
DefaultListDelimiterHandler(';')));
final PropertiesConfiguration propsConfiguration = 
builder.getConfiguration();
PeriodicReloadingTrigger trigger = new 
PeriodicReloadingTrigger(builder.getReloadingController(),
null, 1, TimeUnit.SECONDS);
trigger.start();

return propsConfiguration;
} else {
return new PropertiesConfiguration();
}

}
}
Here is a sample code that I using to check whether the Automatic Reloading 
works or not. However when the underlying property file is updated, the 
configuration doesn't reflect it.Once the DEV.properties is updated, it doesn't 
get reflected when the compositeConfiguration.getString("property1") is called 
again. 


Re: [configuration] use commons configuration 2 as PropertySource in Spring

2016-04-19 Thread Dennis Kieselhorst
Hi Gary,

I'm Apache committer and like to contribute but do you think it makes
sense to have a Spring dependency in Commons Configuration? Maybe as
optional?

Regards
Dennis

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] use commons configuration 2 as PropertySource in Spring

2016-04-19 Thread Gary Gregory
Hi Dennis,

Patches welcome, or at least our own JIRA ticket.

Actually, if you are already an Apache committer, you can commit to Apache
Commons.

Gary

On Tue, Apr 19, 2016 at 5:24 AM, Dennis Kieselhorst  wrote:

> Hi Ron!
>
> > We are just now starting to assess Config 2, but I would assume these
> approaches would still work.
>
> You are right, just replace the imports and it works. Thanks for the
> hint. Btw the code would be simpler if this issue is fixed:
> https://jira.spring.io/browse/SPR-9631
>
> Cheers
> Dennis
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition

JUnit in Action, Second Edition 
Spring Batch in Action 
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory


Re: [configuration] use commons configuration 2 as PropertySource in Spring

2016-04-19 Thread Dennis Kieselhorst
Hi Ron!

> We are just now starting to assess Config 2, but I would assume these
approaches would still work.

You are right, just replace the imports and it works. Thanks for the
hint. Btw the code would be simpler if this issue is fixed:
https://jira.spring.io/browse/SPR-9631

Cheers
Dennis

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] read only configuration with combined configurations

2016-04-14 Thread Oliver Heger


Am 14.04.2016 um 04:46 schrieb Mansour Al Akeel:
> Oliver,
> thank you a lot for the detailed response.
> What I concluded that I need a wrapper. We need to have a repository
> of configurations for a unit testing framework (think JUnit).
> We have a setup method, then test cases. So here's what we need:
> 
> 1- A section of the configurations (read-only), holds process wide
> configurations, and loaded on start up.
> 2- A section for setup (read-only) config, loaded from files
> 3- A section for setup method (read/write), that turns becomes
> read-only after the setup method exits. For example store a login
> token, or similar properties.
> 4- A section for data provided by files for each test case. This is
> read only. This is erased after each test method.
> 5- A section for read-write test data, that gets erased after each test 
> method.
> 
> Immutable configurations here will complicate things for me. I think
> it's better to stay with CombinedConfigurations, and write a
> wrapper/proxy that will control access, and manage the repository.
Yes, this sounds reasonable. Good luck!

Oliver

> 
> Thank you a lot for your help.
> 
> 
> On Tue, Apr 12, 2016 at 3:28 PM, Oliver Heger
> <oliver.he...@oliver-heger.de> wrote:
>> Hi Mansour,
>>
>> Am 12.04.2016 um 05:39 schrieb Mansour Al Akeel:
>>> Hello,
>>>
>>> I am looking to create a configuration repository, with multiple part,
>>> some for read-only, other for read. I found combined configuration
>>> suitable for my other requirements, but I was not able to add this mix
>>> of read-only and read/write configurations.
>>
>> I am not sure how exactly your configuration repository looks like and
>> which API it provides.
>>
>> I would recommend the following approach: Use a CombinedConfiguration to
>> manage all your configuration settings. This configuration should be
>> treated as immutable, e.g. convert it using
>> ConfigurationUtils.unmodifiableConfiguration() when exposing it to
>> clients. Although CombinedConfiguration has methods for updating
>> properties, these capabilities are limited (see [1]).
>>
>> Your repository component should offer means for querying or updating
>> the configurations that can be modified. When adding configurations to
>> the combined configuration you can specify names under which these child
>> configurations can be accessed; you can use this mechanism to obtain
>> references to specific child configurations that can then be updated.
>> When a child configuration is manipulated, the combined configuration is
>> automatically updated accordingly.
>>
>> Would this work for you?
>>
>> Oliver
>>
>> [1]
>> http://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html#Dealing_with_changes
>>
>>>
>>> Any hint ?
>>>
>>> Thank you.
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] read only configuration with combined configurations

2016-04-13 Thread Mansour Al Akeel
Oliver,
thank you a lot for the detailed response.
What I concluded that I need a wrapper. We need to have a repository
of configurations for a unit testing framework (think JUnit).
We have a setup method, then test cases. So here's what we need:

1- A section of the configurations (read-only), holds process wide
configurations, and loaded on start up.
2- A section for setup (read-only) config, loaded from files
3- A section for setup method (read/write), that turns becomes
read-only after the setup method exits. For example store a login
token, or similar properties.
4- A section for data provided by files for each test case. This is
read only. This is erased after each test method.
5- A section for read-write test data, that gets erased after each test method.

Immutable configurations here will complicate things for me. I think
it's better to stay with CombinedConfigurations, and write a
wrapper/proxy that will control access, and manage the repository.

Thank you a lot for your help.


On Tue, Apr 12, 2016 at 3:28 PM, Oliver Heger
<oliver.he...@oliver-heger.de> wrote:
> Hi Mansour,
>
> Am 12.04.2016 um 05:39 schrieb Mansour Al Akeel:
>> Hello,
>>
>> I am looking to create a configuration repository, with multiple part,
>> some for read-only, other for read. I found combined configuration
>> suitable for my other requirements, but I was not able to add this mix
>> of read-only and read/write configurations.
>
> I am not sure how exactly your configuration repository looks like and
> which API it provides.
>
> I would recommend the following approach: Use a CombinedConfiguration to
> manage all your configuration settings. This configuration should be
> treated as immutable, e.g. convert it using
> ConfigurationUtils.unmodifiableConfiguration() when exposing it to
> clients. Although CombinedConfiguration has methods for updating
> properties, these capabilities are limited (see [1]).
>
> Your repository component should offer means for querying or updating
> the configurations that can be modified. When adding configurations to
> the combined configuration you can specify names under which these child
> configurations can be accessed; you can use this mechanism to obtain
> references to specific child configurations that can then be updated.
> When a child configuration is manipulated, the combined configuration is
> automatically updated accordingly.
>
> Would this work for you?
>
> Oliver
>
> [1]
> http://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html#Dealing_with_changes
>
>>
>> Any hint ?
>>
>> Thank you.
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [configuration] read only configuration with combined configurations

2016-04-12 Thread Oliver Heger
Hi Mansour,

Am 12.04.2016 um 05:39 schrieb Mansour Al Akeel:
> Hello,
> 
> I am looking to create a configuration repository, with multiple part,
> some for read-only, other for read. I found combined configuration
> suitable for my other requirements, but I was not able to add this mix
> of read-only and read/write configurations.

I am not sure how exactly your configuration repository looks like and
which API it provides.

I would recommend the following approach: Use a CombinedConfiguration to
manage all your configuration settings. This configuration should be
treated as immutable, e.g. convert it using
ConfigurationUtils.unmodifiableConfiguration() when exposing it to
clients. Although CombinedConfiguration has methods for updating
properties, these capabilities are limited (see [1]).

Your repository component should offer means for querying or updating
the configurations that can be modified. When adding configurations to
the combined configuration you can specify names under which these child
configurations can be accessed; you can use this mechanism to obtain
references to specific child configurations that can then be updated.
When a child configuration is manipulated, the combined configuration is
automatically updated accordingly.

Would this work for you?

Oliver

[1]
http://commons.apache.org/proper/commons-configuration/userguide/howto_combinedconfiguration.html#Dealing_with_changes

> 
> Any hint ?
> 
> Thank you.
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



[configuration] read only configuration with combined configurations

2016-04-11 Thread Mansour Al Akeel
Hello,

I am looking to create a configuration repository, with multiple part,
some for read-only, other for read. I found combined configuration
suitable for my other requirements, but I was not able to add this mix
of read-only and read/write configurations.

Any hint ?

Thank you.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Prefix for combined configuration

2016-04-09 Thread Mansour Al Akeel
Oliver,
In fact , this is exactly what I ended up doing, implementing
ExpressionEngine and I think in fact this is the proper way to do it.
However, I am facing some issues, doing it cleanly, because I am
extending DefaultConfigurationKey. Unfortunately, the keyBuffer
(StringBuilder) is private, and can not access it from the child
class. The only way is to copy/paste everything in
DefaultConfigurationKey.

After all, I think I am on the right track.
Thank you a lot.


On Sat, Apr 9, 2016 at 2:45 PM, Oliver Heger
<oliver.he...@oliver-heger.de> wrote:
> Hi Mansour,
>
> Am 09.04.2016 um 06:07 schrieb Mansour Al Akeel:
>> Hello,
>>
>> I am trying to load multiple sources into a CombinedConfiguration
>> object. However, I need to access each property using a prefix.
>> For example, a property that resides in "global.xml" needs to be
>> accessed with a unique prefix:
>>
>> glob:this.is.a.global.property.
>>
>> And a property that is loaded from "case.properties", needs to be
>> accessed with the prefix:
>>
>> case:another.case.specific.property
>>
>> I can extend CombinedConfiguration and override the getters, or create
>> a map. But if it's possible out of the box, it will save me sometime.
>> So here's my sample code:
>>
>> Parameters params = new Parameters();
>>
>> URL url =
>> ConfigurationManager.class.getClassLoader().getResource("META-INF/global.xml");
>> URL url2 =
>> ConfigurationManager.class.getClassLoader().getResource("META-INF/case.properties");
>>
>> FileBasedConfigurationBuilder globBuilder =
>> new FileBasedConfigurationBuilder(XMLConfiguration.class);
>> globBuilder = globBuilder.configure(params.xml().setURL(url));
>>
>> FileBasedConfigurationBuilder
>> testBuilder = new
>> FileBasedConfigurationBuilder(PropertiesConfiguration.class);
>> testBuilder.configure(params.properties().setURL(url2));
>>
>> CombinedConfiguration cc = new CombinedConfiguration();
>>
>> // cc.setExpressionEngine(new XPathExpressionEngine());
>>
>> cc.addConfiguration(globBuilder.getConfiguration(), null, "global:");
>> cc.addConfiguration(testBuilder.getConfiguration(), null, "case:");
>>
>> config = ConfigurationUtils.unmodifiableConfiguration(cc);
>>
>>
>> This is working great so far, as I can do:
>>
>> global:.this.is.a.global
>>
>> Please note the dot in the dotted notation, between the prefix and the
>> property name. It will be nice if I there is an easy way to remove it,
>> so that I can do "global:this.is.a.global.property".
>
> When a prefix is provided when adding a configuration to a
> CombinedConfiguration, internal node structures are created that
> correspond to this prefix. Resolving of such keys therefore requires a
> dot (or separator) behind the prefix because the nodes with
> configuration data are actually child nodes of the prefix node. This is
> how it works internally.
>
> Maybe the following trick could be an option: You could create your own
> ExpressionEngine implementation that delegates to another
> ExpressionEngine instance. In the implementation of the query() method
> you modify the passed in key by replacing the first ":" by ":." and then
> invoke the wrapped engine. I guess this should achieve what you want and
> is pretty straight-forward.
>
> Oliver
>
>>
>> Any advice ?
>>
>>
>> Thank you.
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: Prefix for combined configuration

2016-04-09 Thread Oliver Heger
Hi Mansour,

Am 09.04.2016 um 06:07 schrieb Mansour Al Akeel:
> Hello,
> 
> I am trying to load multiple sources into a CombinedConfiguration
> object. However, I need to access each property using a prefix.
> For example, a property that resides in "global.xml" needs to be
> accessed with a unique prefix:
> 
> glob:this.is.a.global.property.
> 
> And a property that is loaded from "case.properties", needs to be
> accessed with the prefix:
> 
> case:another.case.specific.property
> 
> I can extend CombinedConfiguration and override the getters, or create
> a map. But if it's possible out of the box, it will save me sometime.
> So here's my sample code:
> 
> Parameters params = new Parameters();
> 
> URL url =
> ConfigurationManager.class.getClassLoader().getResource("META-INF/global.xml");
> URL url2 =
> ConfigurationManager.class.getClassLoader().getResource("META-INF/case.properties");
> 
> FileBasedConfigurationBuilder globBuilder =
> new FileBasedConfigurationBuilder(XMLConfiguration.class);
> globBuilder = globBuilder.configure(params.xml().setURL(url));
> 
> FileBasedConfigurationBuilder
> testBuilder = new
> FileBasedConfigurationBuilder(PropertiesConfiguration.class);
> testBuilder.configure(params.properties().setURL(url2));
> 
> CombinedConfiguration cc = new CombinedConfiguration();
> 
> // cc.setExpressionEngine(new XPathExpressionEngine());
> 
> cc.addConfiguration(globBuilder.getConfiguration(), null, "global:");
> cc.addConfiguration(testBuilder.getConfiguration(), null, "case:");
> 
> config = ConfigurationUtils.unmodifiableConfiguration(cc);
> 
> 
> This is working great so far, as I can do:
> 
> global:.this.is.a.global
> 
> Please note the dot in the dotted notation, between the prefix and the
> property name. It will be nice if I there is an easy way to remove it,
> so that I can do "global:this.is.a.global.property".

When a prefix is provided when adding a configuration to a
CombinedConfiguration, internal node structures are created that
correspond to this prefix. Resolving of such keys therefore requires a
dot (or separator) behind the prefix because the nodes with
configuration data are actually child nodes of the prefix node. This is
how it works internally.

Maybe the following trick could be an option: You could create your own
ExpressionEngine implementation that delegates to another
ExpressionEngine instance. In the implementation of the query() method
you modify the passed in key by replacing the first ":" by ":." and then
invoke the wrapped engine. I guess this should achieve what you want and
is pretty straight-forward.

Oliver

> 
> Any advice ?
> 
> 
> Thank you.
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
> 

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Prefix for combined configuration

2016-04-08 Thread Mansour Al Akeel
Hello,

I am trying to load multiple sources into a CombinedConfiguration
object. However, I need to access each property using a prefix.
For example, a property that resides in "global.xml" needs to be
accessed with a unique prefix:

glob:this.is.a.global.property.

And a property that is loaded from "case.properties", needs to be
accessed with the prefix:

case:another.case.specific.property

I can extend CombinedConfiguration and override the getters, or create
a map. But if it's possible out of the box, it will save me sometime.
So here's my sample code:

Parameters params = new Parameters();

URL url =
ConfigurationManager.class.getClassLoader().getResource("META-INF/global.xml");
URL url2 =
ConfigurationManager.class.getClassLoader().getResource("META-INF/case.properties");

FileBasedConfigurationBuilder globBuilder =
new FileBasedConfigurationBuilder(XMLConfiguration.class);
globBuilder = globBuilder.configure(params.xml().setURL(url));

FileBasedConfigurationBuilder
testBuilder = new
FileBasedConfigurationBuilder(PropertiesConfiguration.class);
testBuilder.configure(params.properties().setURL(url2));

CombinedConfiguration cc = new CombinedConfiguration();

// cc.setExpressionEngine(new XPathExpressionEngine());

cc.addConfiguration(globBuilder.getConfiguration(), null, "global:");
cc.addConfiguration(testBuilder.getConfiguration(), null, "case:");

config = ConfigurationUtils.unmodifiableConfiguration(cc);


This is working great so far, as I can do:

global:.this.is.a.global

Please note the dot in the dotted notation, between the prefix and the
property name. It will be nice if I there is an easy way to remove it,
so that I can do "global:this.is.a.global.property".

Any advice ?


Thank you.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



  1   2   3   4   5   6   >