commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Eichstädt-Engelen" <thomas.eichstaedt-enge...@gmx.net>
Subject [configuration] Overriden Properties in CombinedConfiguration and the configuratinAt method
Date Fri, 26 Jan 2007 12:13:39 GMT
Hi,

i am using commons-configuration with constantly growing enthusiasm. Thank you for this great
job!

Now my question:

I am using CombinedConfiguration to make use of the Property overriding mechanism. My configuration-definition.xml
looks like this:

<configuration>
  <header>
    <result>
      <nodeCombiner config-class="org.apache.commons.configuration.tree.OverrideCombiner"/>
 
      <expressionEngine config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
    </result>
  </header>
  <override>
    <system />
    <xml fileName="${OPERATIONS_CONFIGURATION}" throwExceptionOnMissing="true"
      config-name="operationsConfiguration" config-optional="false">
      <reloadingStrategy refreshDelay="1000"
        config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
    </xml>
    <xml fileName="messageComposerConfiguration.xml" throwExceptionOnMissing="true"
      config-name="messageComposer" config-at="messageComposer" config-optional="false">
      <reloadingStrategy refreshDelay="1000"
        config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
    </xml>
    [... more xmlConfigurations ...]
  </override>
</configuration>

operationsConfiguration is intended to be a smaller (and more handy) configuration available
outside the archives (jars) containing only the relevant operational properties. It overrides
some values of the other xmlConfigurations of the e.g. backend libraries. So far so good ...
now i would like to use the BeanCreation mechanism furthermore. To provide data for those
beans i use the configurationAt(key) method to get a unique subtree containing all relevant
data.

And here is my problem:

Using the configurationAt(key) throws an IllegalArgumentException because the given key is
ambiguous. That is correct because it is overriden and added twice hence. It tried the workaround
to create a combined node via getRootNode(). It worked but in this case all the e.g. configured
ReloadingStratety disappears because i had to create a new XmlConfiguration.

Would it make sense to overload the configurationAt method in CombinedConfiguration to support
such a behaviour? Or (and that could be really possible) didn't i understand the concept of
the CombinedConfiguration exactly.

Kind regards,

Thomas E.-E.

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


Mime
View raw message