You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Ralph Goers <ra...@dslextreme.com> on 2009/09/16 15:22:42 UTC

Re: [CONFIGURATION] Help with optional XML file in override section of configuration builder.

On Sep 16, 2009, at 4:37 AM, Martin Ritchie wrote:

>
> Oliver,
> Thanks for the pointer to use DefaultConfigurationBuilder.
>
> Whilst this now does not need to have the test.config property defined
> or the file existing it does behave differently to the older
> ConfigurationFactory.
>
> With the configuration as shown in the pastie
> (http://pastie.org/617143) the ConfigurationFactory builds a single
> configuration tree where later elements are overwritten by newer
> values.
> So given the configuration values shown here: http://pastie.org/618625
> The value of tests.store.class in config.xml (MemoryMessageStore) is
> overwritten with (SlowMessageStore) from the test.config. The
> additional values in the test.config are also propgated in to the
> final configuraiton.
>
> When I changed to use the DefaultConfigurationBuilder the entire
> virtualhosts section was overwritten as a result the other virtualhost
> sections in config.xml were lost.
>
> Is there a way I can get the behaviour as seen with the
> ConfigurationFactory but have the file parsing/loading of the
> DefaultConfigurationBuilder?
>
What you are experiencing is probably a result of the NodeCombiner  
being used. In trunk you will find a "MergeCombiner" that may behave  
the way you want it to. If you build trunk you should look at the  
updated documentation as it provides some documentation on how the 3  
combiners work and what results they will produce in various situations.

Ralph


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


Re: [CONFIGURATION] Help with optional XML file in override section of configuration builder.

Posted by Martin Ritchie <ri...@apache.org>.
2009/9/16 Oliver Heger <ol...@oliver-heger.de>:
> Ralph Goers schrieb:
>>
>> On Sep 16, 2009, at 4:37 AM, Martin Ritchie wrote:
>>
>>>
>>> Oliver,
>>> Thanks for the pointer to use DefaultConfigurationBuilder.
>>>
>>> Whilst this now does not need to have the test.config property defined
>>> or the file existing it does behave differently to the older
>>> ConfigurationFactory.
>>>
>>> With the configuration as shown in the pastie
>>> (http://pastie.org/617143) the ConfigurationFactory builds a single
>>> configuration tree where later elements are overwritten by newer
>>> values.
>>> So given the configuration values shown here: http://pastie.org/618625
>>> The value of tests.store.class in config.xml (MemoryMessageStore) is
>>> overwritten with (SlowMessageStore) from the test.config. The
>>> additional values in the test.config are also propgated in to the
>>> final configuraiton.
>>>
>>> When I changed to use the DefaultConfigurationBuilder the entire
>>> virtualhosts section was overwritten as a result the other virtualhost
>>> sections in config.xml were lost.
>>>
>>> Is there a way I can get the behaviour as seen with the
>>> ConfigurationFactory but have the file parsing/loading of the
>>> DefaultConfigurationBuilder?
>>>
>> What you are experiencing is probably a result of the NodeCombiner being
>> used. In trunk you will find a "MergeCombiner" that may behave the way you
>> want it to. If you build trunk you should look at the updated documentation
>> as it provides some documentation on how the 3 combiners work and what
>> results they will produce in various situations.
>>
>> Ralph
>>
>
> The problem may also be related to the handling of list nodes. [1] contains
> a discussion about NodeCombiners used when constructing a combined
> configuration (which is done under the hood by DefaultConfigurationBuilder).
> It also mentions possible problems when dealing with list structures.
>
> In the description of the configuration definition file for
> DefaultConfigurationBuilder [2] it is explained how list nodes can be
> specified.
>
> Oliver
>
>
> [1]
> http://commons.apache.org/configuration/userguide/howto_combinedconfiguration.html#Node%20combiners
>
> [2]
> http://commons.apache.org/configuration/userguide/howto_configurationbuilder.html#Enhancements_of_the_configuration_definition_file
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org

Thanks for your suggestions Ralph and Oliver. I'll take a look at what
we are doing.

Cheers

Martin


-- 
Martin Ritchie

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


Re: [CONFIGURATION] Help with optional XML file in override section of configuration builder.

Posted by Oliver Heger <ol...@oliver-heger.de>.
Ralph Goers schrieb:
> 
> On Sep 16, 2009, at 4:37 AM, Martin Ritchie wrote:
> 
>>
>> Oliver,
>> Thanks for the pointer to use DefaultConfigurationBuilder.
>>
>> Whilst this now does not need to have the test.config property defined
>> or the file existing it does behave differently to the older
>> ConfigurationFactory.
>>
>> With the configuration as shown in the pastie
>> (http://pastie.org/617143) the ConfigurationFactory builds a single
>> configuration tree where later elements are overwritten by newer
>> values.
>> So given the configuration values shown here: http://pastie.org/618625
>> The value of tests.store.class in config.xml (MemoryMessageStore) is
>> overwritten with (SlowMessageStore) from the test.config. The
>> additional values in the test.config are also propgated in to the
>> final configuraiton.
>>
>> When I changed to use the DefaultConfigurationBuilder the entire
>> virtualhosts section was overwritten as a result the other virtualhost
>> sections in config.xml were lost.
>>
>> Is there a way I can get the behaviour as seen with the
>> ConfigurationFactory but have the file parsing/loading of the
>> DefaultConfigurationBuilder?
>>
> What you are experiencing is probably a result of the NodeCombiner being 
> used. In trunk you will find a "MergeCombiner" that may behave the way 
> you want it to. If you build trunk you should look at the updated 
> documentation as it provides some documentation on how the 3 combiners 
> work and what results they will produce in various situations.
> 
> Ralph
> 

The problem may also be related to the handling of list nodes. [1] 
contains a discussion about NodeCombiners used when constructing a 
combined configuration (which is done under the hood by 
DefaultConfigurationBuilder). It also mentions possible problems when 
dealing with list structures.

In the description of the configuration definition file for 
DefaultConfigurationBuilder [2] it is explained how list nodes can be 
specified.

Oliver


[1] 
http://commons.apache.org/configuration/userguide/howto_combinedconfiguration.html#Node%20combiners

[2] 
http://commons.apache.org/configuration/userguide/howto_configurationbuilder.html#Enhancements_of_the_configuration_definition_file

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