You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Michiel Kalkman <mi...@gmail.com> on 2006/04/27 18:37:16 UTC

[Configuration]: Hierarchical configurations ?

Hi,
I now have a configuration 'configuration1.xml' like

<configuration>
  <xml fileName="SampleConfiguratie.xml"/>
</configuration>

Which gives me - with the following code - the keys/values provided in
SampleConfiguratie.xml:

final ConfigurationFactory configurationFactory = new
ConfigurationFactory();
configurationFactory.setConfigurationURL(...)
configuration=configurationFactory.getConfiguration();

Is it possible to create a second configuration configuration that refers to
the first ('configuration1.xml'), like:

<configuration>
  <configuration fileName="configuration1.xml"/>
</configuration>

and still get the same keys/values after getConfiguration() ?

Thanks for any replies,
Michiel

Re: [Configuration]: Hierarchical configurations ?

Posted by Oliver Heger <ol...@t-online.de>.
Michiel Kalkman wrote:

> Yeah,
> This is what I wanted to know  - although it's not exactly the answer I
> hoped for ...
>
> If you find out how it can be done with DefaultConfigurationBuilder - the
> class you mentioned -, please let us know !
>
> Thanks for your quick response.
>
> Regards,
> Michiel
>
>
Michiel,

I did implement the desired feature in DefaultConfigurationBuilder. You
can now use the new tag <configuration fileName="..."/> to include
another configuration definition file, just as in your example. The new
version is available in subversion.

Oliver

> On 4/28/06, Oliver Heger <ol...@t-online.de> wrote:
>
>>
>> Michiel Kalkman wrote:
>>
>> >Hi,
>> >I now have a configuration 'configuration1.xml' like
>> >
>> ><configuration>
>> >  <xml fileName="SampleConfiguratie.xml"/>
>> ></configuration>
>> >
>> >Which gives me - with the following code - the keys/values provided in
>> >SampleConfiguratie.xml:
>> >
>> >final ConfigurationFactory configurationFactory = new
>> >ConfigurationFactory();
>> >configurationFactory.setConfigurationURL(...)
>> >configuration=configurationFactory.getConfiguration();
>> >
>> >Is it possible to create a second configuration configuration that
>> refers
>> to
>> >the first ('configuration1.xml'), like:
>> >
>> ><configuration>
>> >  <configuration fileName="configuration1.xml"/>
>> ></configuration>
>> >
>> >and still get the same keys/values after getConfiguration() ?
>> >
>> >Thanks for any replies,
>> >Michiel
>> >
>> >
>> >
>> Hi Michiel,
>>
>> not sure if I understand you correctly: you want a configuration
>> definition file (to be processed by a ConfigurationFactory) to be
>> included into another one?
>>
>> In the current release (version 1.2) this is not supported. In
>> subversion [1] there is a new class DefaultConfigurationBuilder, which
>> can be used as alternative to ConfigurationFactory. The design of this
>> class makes it possible to add such an include feature quite easily. I
>> will have a look how this can be done. Note that there is still work on
>> this class and its documentation in progress.
>>
>> Unfortunately this won't help you with your current problem.
>>
>> Oliver
>>
>> [1] http://jakarta.apache.org/commons/configuration/cvs-usage.html
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>


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


Re: [Configuration]: Hierarchical configurations ?

Posted by Michiel Kalkman <mi...@gmail.com>.
Yeah,
This is what I wanted to know  - although it's not exactly the answer I
hoped for ...

If you find out how it can be done with DefaultConfigurationBuilder - the
class you mentioned -, please let us know !

Thanks for your quick response.

Regards,
Michiel


On 4/28/06, Oliver Heger <ol...@t-online.de> wrote:
>
> Michiel Kalkman wrote:
>
> >Hi,
> >I now have a configuration 'configuration1.xml' like
> >
> ><configuration>
> >  <xml fileName="SampleConfiguratie.xml"/>
> ></configuration>
> >
> >Which gives me - with the following code - the keys/values provided in
> >SampleConfiguratie.xml:
> >
> >final ConfigurationFactory configurationFactory = new
> >ConfigurationFactory();
> >configurationFactory.setConfigurationURL(...)
> >configuration=configurationFactory.getConfiguration();
> >
> >Is it possible to create a second configuration configuration that refers
> to
> >the first ('configuration1.xml'), like:
> >
> ><configuration>
> >  <configuration fileName="configuration1.xml"/>
> ></configuration>
> >
> >and still get the same keys/values after getConfiguration() ?
> >
> >Thanks for any replies,
> >Michiel
> >
> >
> >
> Hi Michiel,
>
> not sure if I understand you correctly: you want a configuration
> definition file (to be processed by a ConfigurationFactory) to be
> included into another one?
>
> In the current release (version 1.2) this is not supported. In
> subversion [1] there is a new class DefaultConfigurationBuilder, which
> can be used as alternative to ConfigurationFactory. The design of this
> class makes it possible to add such an include feature quite easily. I
> will have a look how this can be done. Note that there is still work on
> this class and its documentation in progress.
>
> Unfortunately this won't help you with your current problem.
>
> Oliver
>
> [1] http://jakarta.apache.org/commons/configuration/cvs-usage.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Re: [Configuration]: Hierarchical configurations ?

Posted by Oliver Heger <ol...@t-online.de>.
Michiel Kalkman wrote:

>Hi,
>I now have a configuration 'configuration1.xml' like
>
><configuration>
>  <xml fileName="SampleConfiguratie.xml"/>
></configuration>
>
>Which gives me - with the following code - the keys/values provided in
>SampleConfiguratie.xml:
>
>final ConfigurationFactory configurationFactory = new
>ConfigurationFactory();
>configurationFactory.setConfigurationURL(...)
>configuration=configurationFactory.getConfiguration();
>
>Is it possible to create a second configuration configuration that refers to
>the first ('configuration1.xml'), like:
>
><configuration>
>  <configuration fileName="configuration1.xml"/>
></configuration>
>
>and still get the same keys/values after getConfiguration() ?
>
>Thanks for any replies,
>Michiel
>
>  
>
Hi Michiel,

not sure if I understand you correctly: you want a configuration
definition file (to be processed by a ConfigurationFactory) to be
included into another one?

In the current release (version 1.2) this is not supported. In
subversion [1] there is a new class DefaultConfigurationBuilder, which
can be used as alternative to ConfigurationFactory. The design of this
class makes it possible to add such an include feature quite easily. I
will have a look how this can be done. Note that there is still work on
this class and its documentation in progress.

Unfortunately this won't help you with your current problem.

Oliver

[1] http://jakarta.apache.org/commons/configuration/cvs-usage.html

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