Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.XMLConfiguration


    /**
     * Constructor.
     */
    public FoConfiguration()
    {
        this.config = new XMLConfiguration();

        // necessary because some attributes contain commas:
        config.setDelimiterParsingDisabled( true );

        loadDefaultConfig();
View Full Code Here


        registry.remove( "listElements.listElement(1)" );
        registry.save();

       
       
        XMLConfiguration configuration = new XMLConfiguration( dest );
        assertEquals( Arrays.asList( new String[]{"1", "3"} ), configuration.getList( "listElements.listElement" ) );
       
        // file in ${basedir}/target/conf/shared.xml
        Registry section = this.registry.getSection( "org.apache.maven.shared.app.user" );
        section.setString( "foo", "zloug" );
        section.save();
       
        configuration = new XMLConfiguration( new File("target/conf/shared.xml") );
        assertNotNull( configuration.getString( "foo" ) );
       
    }
View Full Code Here

        // Valid Configuration either has xml links to new files
        _finalConfig = new CompositeConfiguration(getConfig());
        List subFiles = getConfig().getList("xml[@fileName]");
        for (Object subFile : subFiles)
        {
            _finalConfig.addConfiguration(new XMLConfiguration((String) subFile));
        }

    }
View Full Code Here

     * Tests to watch a configuration file in a jar. In this case the jar file
     * itself should be monitored.
     */
    public void testFromJar() throws Exception
    {
        XMLConfiguration config = new XMLConfiguration();
        // use some jar: URL
        config.setURL(new URL("jar:" + new File("conf/resources.jar").getAbsoluteFile().toURL() + "!/test-jar.xml"));
        FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
        config.setReloadingStrategy(strategy);
        File file = strategy.getFile();
        assertNotNull("Strategy's file is null", file);
        assertEquals("Strategy does not monitor the jar file", "resources.jar", file.getName());
    }
View Full Code Here

     * create a XMLConfiguration.
     * @return the underlying configuration
     */
    protected Configuration createConfiguration()
    {
        return new XMLConfiguration();
    }
View Full Code Here

        // Valid Configuration either has xml links to new files
        _finalConfig = new CompositeConfiguration(getConfig());
        List subFiles = getConfig().getList("xml[@fileName]");
        for (Object subFile : subFiles)
        {
            _finalConfig.addConfiguration(new XMLConfiguration((String) subFile));
        }

    }
View Full Code Here

            protected String interpolate(String o)
            {
                return conf.interpolate(o);
            }
        });
        conf.addConfiguration(new XMLConfiguration(file)
        {
            protected String interpolate(String o)
            {
                return conf.interpolate(o);
            }
View Full Code Here

        // Valid Configuration either has xml links to new files
        _finalConfig = new CompositeConfiguration(getConfig());
        List subFiles = getConfig().getList("xml[@fileName]");
        for (Object subFile : subFiles)
        {
            _finalConfig.addConfiguration(new XMLConfiguration((String) subFile));
        }

        // all rules must have an access attribute or a default value
        if (_finalConfig.getList("rule[@access]").size() == 0 &&
            getConfig().getString("[@default-action]") == null)
View Full Code Here

        else if ( resource.endsWith( ".xml" ) )
        {
            try
            {
                logger.debug( "Loading XML configuration from classloader resource: {}", resource );
                configuration.addConfiguration( new XMLConfiguration( resource ), null, prefix );
            }
            catch ( ConfigurationException e )
            {
                throw new RegistryException(
                    "Unable to add configuration from resource '" + resource + "': " + e.getMessage(), e );
View Full Code Here

        else if ( file.getName().endsWith( ".xml" ) )
        {
            try
            {
                logger.debug( "Loading XML configuration from file: {}", file );
                configuration.addConfiguration( new XMLConfiguration( file ), null, prefix );
            }
            catch ( ConfigurationException e )
            {
                throw new RegistryException(
                    "Unable to add configuration from file '" + file.getName() + "': " + e.getMessage(), e );
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.XMLConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.