commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Mansion <ja...@mansionfamily.plus.com>
Subject problems with configuration
Date Sat, 04 Aug 2007 15:12:22 GMT
Using configuration 1.4, XP, SunJVM 1.5.0_12

I'm trying to use configuration as a  newbie.

I have in my code:

    DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder() ;
    builder.setURL(getClass().getResource("standard-config.xml")) ;
    HierarchicalConfiguration cfg =
builder.configurationAt("processor-bean") ;

This fails with:

    java.lang.IllegalArgumentException: Passed in key must select
exactly one node: processor-bean


The standard-config.xml is:

<configuration>
    <!--Load the optional specified config file-->
    <xml fileName="standard-processor.xml" optional="true">
    </xml>
</configuration>

and standard-processor.xml is:

<standard-processor>
    <processor-bean config-class="com.msgware.mwdoc.Processor"
verbose="true">
       <fileLoader config-class="com.msgware.mwdoc.FileLoader">
       </fileLoader>
       <blockInferenceEngine
config-class="com.msgware.BlockInferenceEngine">
       </blockInferenceEngine>
    </processor-bean>
</standard-processor>


Unfortunately the fetchNodeList returns nothing.

If of the configurationAt instead I go:

            Configuration tmp = builder.getConfiguration() ;

            Iterator i = tmp.getKeys() ;

            while (i.hasNext())
            {
                System.out.println("Got key: "+i.next()) ;
            }

Then I get broadly what I had expected:

Got key: processor-bean.fileLoader[@config-class]
Got key: processor-bean.blockInferenceEngine[@config-class]
Got key: processor-bean[@config-class]
Got key: processor-bean[@verbose]

What am I doing wrong?



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


Mime
View raw message