Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.XMLConfiguration$XMLFileConfigurationDelegate


    }

    private XMLConfiguration createAndSaveVirtualHostConfiguration(String hostName, File configFile, String storeLocation)
            throws ConfigurationException
    {
        XMLConfiguration testConfiguration = new XMLConfiguration();
        testConfiguration.setProperty("virtualhost." + hostName + ".store.class",
                getTestProfileMessageStoreClassName());
        testConfiguration.setProperty("virtualhost." + hostName + ".store.environment-path", storeLocation);
        testConfiguration.save(configFile);
        return testConfiguration;
    }
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

                      registry.getList( "listElements.listElement" ) );

        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

        _host = InetAddress.getByName("localhost").getHostAddress();
        _groupName = "group" + getName();
        _masterPort = -1;

        FileUtils.delete(new File(_workDir), true);
        _configXml = new XMLConfiguration();
        _modelVhost = mock(org.apache.qpid.server.model.VirtualHost.class);


        BrokerTestHelper.setUp();
     }
View Full Code Here

    @Override
    public void setUp() throws Exception
    {
        super.setUp();
        BrokerTestHelper.setUp();
        _configXml = new XMLConfiguration();
        _configXml.addProperty("virtualhosts.virtualhost(-1).name", getName());
        _configXml.addProperty("virtualhosts.virtualhost(-1)."+getName()+".store.class", TestableMemoryMessageStore.class.getName());
        EventLogger eventLogger = new EventLogger();
        _virtualHostRegistry = new VirtualHostRegistry(eventLogger);
        _broker = mock(Broker.class);
View Full Code Here

    public void setUp() throws Exception
    {
        // Test does not directly use the AppRegistry but the configured broker
        // is required for the correct ConfigurationPlugin processing
        super.setUp();
        XMLConfiguration xmlConfig = new XMLConfiguration();
        xmlConfig.addProperty("base.element[@property]", "property");
        xmlConfig.addProperty("base.element.name", "name");
        // We make these strings as that is how they will be read from the file.
        xmlConfig.addProperty("base.element.positiveLong", String.valueOf(POSITIVE_LONG));
        xmlConfig.addProperty("base.element.negativeLong", String.valueOf(NEGATIVE_LONG));
        xmlConfig.addProperty("base.element.boolean", String.valueOf(true));
        xmlConfig.addProperty("base.element.double", String.valueOf(DOUBLE));
        for (int i = 0; i < LIST_SIZE; i++)
        {
            xmlConfig.addProperty("base.element.list", i);
        }

        //Use a composite configuration as this is what our broker code uses.
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlConfig);
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

        parse();
    }
   
    public void load(String fileName) {
        try {
            config = new XMLConfiguration(fileName);
            load();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

                    copier.copy(new File(FILE_CONFIG_DEFAULT),f);

                } else {
                    try {
                       
                        XMLConfiguration config = new XMLConfiguration(FILE_CONFIG);
                        config.setAutoSave(false);
                        config.load();

                        long ver = config.getLong("version");
                        if (VERSION_TAG > ver) {
                            // overwrite previous configuration file
                            copier.copy(new File(FILE_CONFIG_DEFAULT),f);                       
                        }
                    } catch (ConfigurationException e) {
View Full Code Here

TOP

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

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.