commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phineas Fung" <>
Subject [Configuration] read different XML configuration files based on FQCN
Date Thu, 09 Jun 2005 07:52:37 GMT

We have a few implementation classes that implements the same worker
interface, that are returned by  a factory at runtime.

Every implementation class needs to read an XML configuration file (to be
exact, a tree structure).  The XML hierarchy and fields in each
configuration file are the same, but contents are different for each
implementation class.

Unfortunately, all of these implementation classes will be used at the same
time, and I cannot figure out how to let each implementation class read its
own XML file.

If I do sth like this:

  <xml fileName="implementationClass_A.xml"/>
  <xml fileName="implementationClass_B.xml"/>
  <xml fileName="implementationClass_C.xml"/>

The values in implementationClass_C.xml will be overridden by those in A or
B.  What I want is:

Construct a ConfigurationRepository using the fully-qualified class name,
i.e. "ImplementationClass_C", then it'll read configuration values from
implementationClass_C.xml.  Another ConfigurationRepository using e.g.
"ImplementationClass_B", then it'll read configuration values from

Sample configuration files are:


    <cacheTree name="field1_field2_field3">
        <level sortingOrder="100" field="field1"/>
        <level sortingOrder="200" field="field2"/>
        <level sortingOrder="300" field="field3"/>

    <cacheTree name="field1_field3">
        <level sortingOrder="100" field="field1"/>
        <level sortingOrder="200" field="field3"/>

    <getterMethod methodName="get_Field1" cacheTree="field1_field3"/>
    <getterMethod methodName="get_Field1_Field2"
    <getterMethod methodName="get_Field1_Field3" cacheTree="field1_field3"/>
    <getterMethod methodName="get_Field1_Field2_Field3"
    <getterMethod methodName="get_Field1_Field2_Field3_Field4"


    <cacheTree name="field1_field2">
        <level sortingOrder="100" field="field1"/>
        <level sortingOrder="200" field="field2"/>

    <getterMethod methodName="get_Field1" cacheTree="field1_field2"/>
    <getterMethod methodName="get_Field1_Field2" cacheTree="field1_field2"/>

Any thoughts will be greatly appreciated.

Thanks alot.

Best Regards,

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message