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
|