You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Tim Bessie <tb...@meez.com> on 2011/11/16 22:24:10 UTC

[configuration] Any way to tell with CompositeConfiguration which child Config object a value is derived?

I have been trying to use commons-configuration, especially the
CompositeConfiguration object (and have looked into CombinedConfiguration),
and I have a need to be able to ask  "Which child configuration object did
a given key's value derive from?"

I had thought that CompositeConfiguration.getSource() would tell me, but if
we have:

source A:
x.prop1=hello

source B:
x.prop1=goodbye

source DEFAULT:
x.prop1=You didn't set a value

and I call getSource("x.prop1"), I'll get an IllegalArgumentException,
since x.prop1 exists in all 3 child configurations.

What I was hoping for was something that would be consistent with
getProperty("x.prop1"); since that would return the value from "source A"
(since that was where it was first found), I was hoping there'd be some
method that could tell me "in which child configuration was the value you
got found", but there doesn't seem to be any way to do this.

Why is this vital functionality missing?  Or am I missing something in the
documentation?

-- 

Tim Bessie
Meez, Inc.
tbessie@meez.com

Re: [configuration] Any way to tell with CompositeConfiguration which child Config object a value is derived?

Posted by Tim Bessie <tb...@meez.com>.
Thanks much, Ralph!

- Tim

On Thu, Nov 17, 2011 at 11:57 AM, ralph.goers @dslextreme.com <
ralph.goers@dslextreme.com> wrote:

> You should take a look at
> http://www.apache.org/foundation/getinvolved.htmlwhich references
> http://jakarta.apache.org/site/contributing.html. The first link has links
> to all the various information you will want to read. The second link
> provides a fairly good description of how people become committers on ASF
> projects.
>
> Ralph
>
> On Thu, Nov 17, 2011 at 9:32 AM, Tim Bessie <tb...@meez.com> wrote:
>
> > I'd be happy to write it myself - how does one become a committer in this
> > project?
> >
> > - Tim
> >
> > On Thu, Nov 17, 2011 at 8:55 AM, Oliver Heger
> > <ol...@oliver-heger.de>wrote:
> >
> > > Am 17.11.2011 00:34, schrieb Tim Bessie:
> > >
> > >  Thanks Oliver - unfortunately, that is not quite the same issue I'm
> > >> talking
> > >> about.
> > >> Mostly, this is because I want to use CompositeConfiguration; I don't
> > >> require structure in my configurations and don't want to have to deal
> > with
> > >> the concepts CombinedConfiguration uses (nodes, views, etc.).
> > >>
> > >> Just a simple, layered configuration concept like
> CompositeConfiguration
> > >> provides, and the ability to say "where did the value for this key
> come
> > >> from", not "what is the ONLY configuration object this key is defined
> > in".
> > >>
> > >> Perhaps we need another method - getFirstSource(String key), where the
> > >> source config returned is the one where key is first defined in the
> > child
> > >> configurations, regardless of whether that key is defined again in a
> > later
> > >> child config?
> > >>
> > >> Where would I request such a feature? Would that be hard to implement?
> > >> Seems to be a common sort of requirement.
> > >>
> > >> - Tim
> > >>
> > >
> > > Just open an enhancement ticket in Jira, our bug-tracking system [1]
> with
> > > a detailed description of what you want to achieve.
> > >
> > > From your explanation above I have the impression that this feature is
> > not
> > > too complicated to implemented. But we will see when the ticket has
> been
> > > created.
> > >
> > > Oliver
> > >
> > > [1] http://commons.apache.org/**configuration/issue-tracking.**html<
> > http://commons.apache.org/configuration/issue-tracking.html>
> > >
> > >
> > >> On Wed, Nov 16, 2011 at 1:34 PM, Oliver Heger
> > >> <ol...@oliver-heger.de>**wrote:
> > >>
> > >>  Am 16.11.2011 22:24, schrieb Tim Bessie:
> > >>>
> > >>>  I have been trying to use commons-configuration, especially the
> > >>>
> > >>>> CompositeConfiguration object (and have looked into
> > >>>> CombinedConfiguration),
> > >>>> and I have a need to be able to ask  "Which child configuration
> object
> > >>>> did
> > >>>> a given key's value derive from?"
> > >>>>
> > >>>> I had thought that CompositeConfiguration.****getSource() would tell
> > >>>> me,
> > >>>>
> > >>>> but if
> > >>>> we have:
> > >>>>
> > >>>> source A:
> > >>>> x.prop1=hello
> > >>>>
> > >>>> source B:
> > >>>> x.prop1=goodbye
> > >>>>
> > >>>> source DEFAULT:
> > >>>> x.prop1=You didn't set a value
> > >>>>
> > >>>> and I call getSource("x.prop1"), I'll get an
> IllegalArgumentException,
> > >>>> since x.prop1 exists in all 3 child configurations.
> > >>>>
> > >>>> What I was hoping for was something that would be consistent with
> > >>>> getProperty("x.prop1"); since that would return the value from
> "source
> > >>>> A"
> > >>>> (since that was where it was first found), I was hoping there'd be
> > some
> > >>>> method that could tell me "in which child configuration was the
> value
> > >>>> you
> > >>>> got found", but there doesn't seem to be any way to do this.
> > >>>>
> > >>>> Why is this vital functionality missing?  Or am I missing something
> in
> > >>>> the
> > >>>> documentation?
> > >>>>
> > >>>>
> > >>>>  There is an open bug report [1] related to this issue. Maybe the
> > >>> discussion in this ticket answers some of your questions.
> > >>>
> > >>> Oliver
> > >>>
> > >>> [1] https://issues.apache.org/****jira/browse/CONFIGURATION-443<
> > https://issues.apache.org/**jira/browse/CONFIGURATION-443>
> > >>> <**https://issues.apache.org/**jira/browse/CONFIGURATION-443<
> > https://issues.apache.org/jira/browse/CONFIGURATION-443>
> > >>> >
> > >>>
> > >>> ------------------------------****----------------------------**
> > >>> --**---------
> > >>> To unsubscribe, e-mail: user-unsubscribe@commons.**apa**che.org<
> > http://apache.org>
> > >>> <user-unsubscribe@**commons.apache.org<
> > user-unsubscribe@commons.apache.org>
> > >>> >
> > >>>
> > >>> For additional commands, e-mail: user-help@commons.apache.org
> > >>>
> > >>>
> > >>>
> > >>
> > >>
> > >
> > >
> ------------------------------**------------------------------**---------
> > > To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<
> > user-unsubscribe@commons.apache.org>
> > > For additional commands, e-mail: user-help@commons.apache.org
> > >
> > >
> >
> >
> > --
> >
> > Tim Bessie
> > Meez, Inc.
> > tbessie@meez.com
> >
>



-- 

Tim Bessie
Meez, Inc.
tbessie@meez.com

Re: [configuration] Any way to tell with CompositeConfiguration which child Config object a value is derived?

Posted by "ralph.goers @dslextreme.com" <ra...@dslextreme.com>.
You should take a look at
http://www.apache.org/foundation/getinvolved.htmlwhich references
http://jakarta.apache.org/site/contributing.html. The first link has links
to all the various information you will want to read. The second link
provides a fairly good description of how people become committers on ASF
projects.

Ralph

On Thu, Nov 17, 2011 at 9:32 AM, Tim Bessie <tb...@meez.com> wrote:

> I'd be happy to write it myself - how does one become a committer in this
> project?
>
> - Tim
>
> On Thu, Nov 17, 2011 at 8:55 AM, Oliver Heger
> <ol...@oliver-heger.de>wrote:
>
> > Am 17.11.2011 00:34, schrieb Tim Bessie:
> >
> >  Thanks Oliver - unfortunately, that is not quite the same issue I'm
> >> talking
> >> about.
> >> Mostly, this is because I want to use CompositeConfiguration; I don't
> >> require structure in my configurations and don't want to have to deal
> with
> >> the concepts CombinedConfiguration uses (nodes, views, etc.).
> >>
> >> Just a simple, layered configuration concept like CompositeConfiguration
> >> provides, and the ability to say "where did the value for this key come
> >> from", not "what is the ONLY configuration object this key is defined
> in".
> >>
> >> Perhaps we need another method - getFirstSource(String key), where the
> >> source config returned is the one where key is first defined in the
> child
> >> configurations, regardless of whether that key is defined again in a
> later
> >> child config?
> >>
> >> Where would I request such a feature? Would that be hard to implement?
> >> Seems to be a common sort of requirement.
> >>
> >> - Tim
> >>
> >
> > Just open an enhancement ticket in Jira, our bug-tracking system [1] with
> > a detailed description of what you want to achieve.
> >
> > From your explanation above I have the impression that this feature is
> not
> > too complicated to implemented. But we will see when the ticket has been
> > created.
> >
> > Oliver
> >
> > [1] http://commons.apache.org/**configuration/issue-tracking.**html<
> http://commons.apache.org/configuration/issue-tracking.html>
> >
> >
> >> On Wed, Nov 16, 2011 at 1:34 PM, Oliver Heger
> >> <ol...@oliver-heger.de>**wrote:
> >>
> >>  Am 16.11.2011 22:24, schrieb Tim Bessie:
> >>>
> >>>  I have been trying to use commons-configuration, especially the
> >>>
> >>>> CompositeConfiguration object (and have looked into
> >>>> CombinedConfiguration),
> >>>> and I have a need to be able to ask  "Which child configuration object
> >>>> did
> >>>> a given key's value derive from?"
> >>>>
> >>>> I had thought that CompositeConfiguration.****getSource() would tell
> >>>> me,
> >>>>
> >>>> but if
> >>>> we have:
> >>>>
> >>>> source A:
> >>>> x.prop1=hello
> >>>>
> >>>> source B:
> >>>> x.prop1=goodbye
> >>>>
> >>>> source DEFAULT:
> >>>> x.prop1=You didn't set a value
> >>>>
> >>>> and I call getSource("x.prop1"), I'll get an IllegalArgumentException,
> >>>> since x.prop1 exists in all 3 child configurations.
> >>>>
> >>>> What I was hoping for was something that would be consistent with
> >>>> getProperty("x.prop1"); since that would return the value from "source
> >>>> A"
> >>>> (since that was where it was first found), I was hoping there'd be
> some
> >>>> method that could tell me "in which child configuration was the value
> >>>> you
> >>>> got found", but there doesn't seem to be any way to do this.
> >>>>
> >>>> Why is this vital functionality missing?  Or am I missing something in
> >>>> the
> >>>> documentation?
> >>>>
> >>>>
> >>>>  There is an open bug report [1] related to this issue. Maybe the
> >>> discussion in this ticket answers some of your questions.
> >>>
> >>> Oliver
> >>>
> >>> [1] https://issues.apache.org/****jira/browse/CONFIGURATION-443<
> https://issues.apache.org/**jira/browse/CONFIGURATION-443>
> >>> <**https://issues.apache.org/**jira/browse/CONFIGURATION-443<
> https://issues.apache.org/jira/browse/CONFIGURATION-443>
> >>> >
> >>>
> >>> ------------------------------****----------------------------**
> >>> --**---------
> >>> To unsubscribe, e-mail: user-unsubscribe@commons.**apa**che.org<
> http://apache.org>
> >>> <user-unsubscribe@**commons.apache.org<
> user-unsubscribe@commons.apache.org>
> >>> >
> >>>
> >>> For additional commands, e-mail: user-help@commons.apache.org
> >>>
> >>>
> >>>
> >>
> >>
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<
> user-unsubscribe@commons.apache.org>
> > For additional commands, e-mail: user-help@commons.apache.org
> >
> >
>
>
> --
>
> Tim Bessie
> Meez, Inc.
> tbessie@meez.com
>

Re: [configuration] Any way to tell with CompositeConfiguration which child Config object a value is derived?

Posted by Tim Bessie <tb...@meez.com>.
I'd be happy to write it myself - how does one become a committer in this
project?

- Tim

On Thu, Nov 17, 2011 at 8:55 AM, Oliver Heger
<ol...@oliver-heger.de>wrote:

> Am 17.11.2011 00:34, schrieb Tim Bessie:
>
>  Thanks Oliver - unfortunately, that is not quite the same issue I'm
>> talking
>> about.
>> Mostly, this is because I want to use CompositeConfiguration; I don't
>> require structure in my configurations and don't want to have to deal with
>> the concepts CombinedConfiguration uses (nodes, views, etc.).
>>
>> Just a simple, layered configuration concept like CompositeConfiguration
>> provides, and the ability to say "where did the value for this key come
>> from", not "what is the ONLY configuration object this key is defined in".
>>
>> Perhaps we need another method - getFirstSource(String key), where the
>> source config returned is the one where key is first defined in the child
>> configurations, regardless of whether that key is defined again in a later
>> child config?
>>
>> Where would I request such a feature? Would that be hard to implement?
>> Seems to be a common sort of requirement.
>>
>> - Tim
>>
>
> Just open an enhancement ticket in Jira, our bug-tracking system [1] with
> a detailed description of what you want to achieve.
>
> From your explanation above I have the impression that this feature is not
> too complicated to implemented. But we will see when the ticket has been
> created.
>
> Oliver
>
> [1] http://commons.apache.org/**configuration/issue-tracking.**html<http://commons.apache.org/configuration/issue-tracking.html>
>
>
>> On Wed, Nov 16, 2011 at 1:34 PM, Oliver Heger
>> <ol...@oliver-heger.de>**wrote:
>>
>>  Am 16.11.2011 22:24, schrieb Tim Bessie:
>>>
>>>  I have been trying to use commons-configuration, especially the
>>>
>>>> CompositeConfiguration object (and have looked into
>>>> CombinedConfiguration),
>>>> and I have a need to be able to ask  "Which child configuration object
>>>> did
>>>> a given key's value derive from?"
>>>>
>>>> I had thought that CompositeConfiguration.****getSource() would tell
>>>> me,
>>>>
>>>> but if
>>>> we have:
>>>>
>>>> source A:
>>>> x.prop1=hello
>>>>
>>>> source B:
>>>> x.prop1=goodbye
>>>>
>>>> source DEFAULT:
>>>> x.prop1=You didn't set a value
>>>>
>>>> and I call getSource("x.prop1"), I'll get an IllegalArgumentException,
>>>> since x.prop1 exists in all 3 child configurations.
>>>>
>>>> What I was hoping for was something that would be consistent with
>>>> getProperty("x.prop1"); since that would return the value from "source
>>>> A"
>>>> (since that was where it was first found), I was hoping there'd be some
>>>> method that could tell me "in which child configuration was the value
>>>> you
>>>> got found", but there doesn't seem to be any way to do this.
>>>>
>>>> Why is this vital functionality missing?  Or am I missing something in
>>>> the
>>>> documentation?
>>>>
>>>>
>>>>  There is an open bug report [1] related to this issue. Maybe the
>>> discussion in this ticket answers some of your questions.
>>>
>>> Oliver
>>>
>>> [1] https://issues.apache.org/****jira/browse/CONFIGURATION-443<https://issues.apache.org/**jira/browse/CONFIGURATION-443>
>>> <**https://issues.apache.org/**jira/browse/CONFIGURATION-443<https://issues.apache.org/jira/browse/CONFIGURATION-443>
>>> >
>>>
>>> ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: user-unsubscribe@commons.**apa**che.org<http://apache.org>
>>> <us...@commons.apache.org>
>>> >
>>>
>>> For additional commands, e-mail: user-help@commons.apache.org
>>>
>>>
>>>
>>
>>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<us...@commons.apache.org>
> For additional commands, e-mail: user-help@commons.apache.org
>
>


-- 

Tim Bessie
Meez, Inc.
tbessie@meez.com

Re: [configuration] Any way to tell with CompositeConfiguration which child Config object a value is derived?

Posted by Oliver Heger <ol...@oliver-heger.de>.
Am 17.11.2011 00:34, schrieb Tim Bessie:
> Thanks Oliver - unfortunately, that is not quite the same issue I'm talking
> about.
> Mostly, this is because I want to use CompositeConfiguration; I don't
> require structure in my configurations and don't want to have to deal with
> the concepts CombinedConfiguration uses (nodes, views, etc.).
>
> Just a simple, layered configuration concept like CompositeConfiguration
> provides, and the ability to say "where did the value for this key come
> from", not "what is the ONLY configuration object this key is defined in".
>
> Perhaps we need another method - getFirstSource(String key), where the
> source config returned is the one where key is first defined in the child
> configurations, regardless of whether that key is defined again in a later
> child config?
>
> Where would I request such a feature? Would that be hard to implement?
> Seems to be a common sort of requirement.
>
> - Tim

Just open an enhancement ticket in Jira, our bug-tracking system [1] 
with a detailed description of what you want to achieve.

 From your explanation above I have the impression that this feature is 
not too complicated to implemented. But we will see when the ticket has 
been created.

Oliver

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

>
> On Wed, Nov 16, 2011 at 1:34 PM, Oliver Heger
> <ol...@oliver-heger.de>wrote:
>
>> Am 16.11.2011 22:24, schrieb Tim Bessie:
>>
>>   I have been trying to use commons-configuration, especially the
>>> CompositeConfiguration object (and have looked into
>>> CombinedConfiguration),
>>> and I have a need to be able to ask  "Which child configuration object did
>>> a given key's value derive from?"
>>>
>>> I had thought that CompositeConfiguration.**getSource() would tell me,
>>> but if
>>> we have:
>>>
>>> source A:
>>> x.prop1=hello
>>>
>>> source B:
>>> x.prop1=goodbye
>>>
>>> source DEFAULT:
>>> x.prop1=You didn't set a value
>>>
>>> and I call getSource("x.prop1"), I'll get an IllegalArgumentException,
>>> since x.prop1 exists in all 3 child configurations.
>>>
>>> What I was hoping for was something that would be consistent with
>>> getProperty("x.prop1"); since that would return the value from "source A"
>>> (since that was where it was first found), I was hoping there'd be some
>>> method that could tell me "in which child configuration was the value you
>>> got found", but there doesn't seem to be any way to do this.
>>>
>>> Why is this vital functionality missing?  Or am I missing something in the
>>> documentation?
>>>
>>>
>> There is an open bug report [1] related to this issue. Maybe the
>> discussion in this ticket answers some of your questions.
>>
>> Oliver
>>
>> [1] https://issues.apache.org/**jira/browse/CONFIGURATION-443<https://issues.apache.org/jira/browse/CONFIGURATION-443>
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<us...@commons.apache.org>
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
>
>


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


Re: [configuration] Any way to tell with CompositeConfiguration which child Config object a value is derived?

Posted by Tim Bessie <tb...@meez.com>.
Thanks Oliver - unfortunately, that is not quite the same issue I'm talking
about.
Mostly, this is because I want to use CompositeConfiguration; I don't
require structure in my configurations and don't want to have to deal with
the concepts CombinedConfiguration uses (nodes, views, etc.).

Just a simple, layered configuration concept like CompositeConfiguration
provides, and the ability to say "where did the value for this key come
from", not "what is the ONLY configuration object this key is defined in".

Perhaps we need another method - getFirstSource(String key), where the
source config returned is the one where key is first defined in the child
configurations, regardless of whether that key is defined again in a later
child config?

Where would I request such a feature? Would that be hard to implement?
Seems to be a common sort of requirement.

- Tim

On Wed, Nov 16, 2011 at 1:34 PM, Oliver Heger
<ol...@oliver-heger.de>wrote:

> Am 16.11.2011 22:24, schrieb Tim Bessie:
>
>  I have been trying to use commons-configuration, especially the
>> CompositeConfiguration object (and have looked into
>> CombinedConfiguration),
>> and I have a need to be able to ask  "Which child configuration object did
>> a given key's value derive from?"
>>
>> I had thought that CompositeConfiguration.**getSource() would tell me,
>> but if
>> we have:
>>
>> source A:
>> x.prop1=hello
>>
>> source B:
>> x.prop1=goodbye
>>
>> source DEFAULT:
>> x.prop1=You didn't set a value
>>
>> and I call getSource("x.prop1"), I'll get an IllegalArgumentException,
>> since x.prop1 exists in all 3 child configurations.
>>
>> What I was hoping for was something that would be consistent with
>> getProperty("x.prop1"); since that would return the value from "source A"
>> (since that was where it was first found), I was hoping there'd be some
>> method that could tell me "in which child configuration was the value you
>> got found", but there doesn't seem to be any way to do this.
>>
>> Why is this vital functionality missing?  Or am I missing something in the
>> documentation?
>>
>>
> There is an open bug report [1] related to this issue. Maybe the
> discussion in this ticket answers some of your questions.
>
> Oliver
>
> [1] https://issues.apache.org/**jira/browse/CONFIGURATION-443<https://issues.apache.org/jira/browse/CONFIGURATION-443>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@commons.**apache.org<us...@commons.apache.org>
> For additional commands, e-mail: user-help@commons.apache.org
>
>


-- 

Tim Bessie
Meez, Inc.
tbessie@meez.com

Re: [configuration] Any way to tell with CompositeConfiguration which child Config object a value is derived?

Posted by Oliver Heger <ol...@oliver-heger.de>.
Am 16.11.2011 22:24, schrieb Tim Bessie:
> I have been trying to use commons-configuration, especially the
> CompositeConfiguration object (and have looked into CombinedConfiguration),
> and I have a need to be able to ask  "Which child configuration object did
> a given key's value derive from?"
>
> I had thought that CompositeConfiguration.getSource() would tell me, but if
> we have:
>
> source A:
> x.prop1=hello
>
> source B:
> x.prop1=goodbye
>
> source DEFAULT:
> x.prop1=You didn't set a value
>
> and I call getSource("x.prop1"), I'll get an IllegalArgumentException,
> since x.prop1 exists in all 3 child configurations.
>
> What I was hoping for was something that would be consistent with
> getProperty("x.prop1"); since that would return the value from "source A"
> (since that was where it was first found), I was hoping there'd be some
> method that could tell me "in which child configuration was the value you
> got found", but there doesn't seem to be any way to do this.
>
> Why is this vital functionality missing?  Or am I missing something in the
> documentation?
>

There is an open bug report [1] related to this issue. Maybe the 
discussion in this ticket answers some of your questions.

Oliver

[1] https://issues.apache.org/jira/browse/CONFIGURATION-443

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