Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.PropertiesConfiguration$PropertiesWriter


        if (file.exists())
        {
            file.delete();
        }

        PropertiesConfiguration config = new PropertiesConfiguration();
        config.setFile(file);
        FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
        strategy.setRefreshDelay(500);
        config.setReloadingStrategy(strategy);

        assertNull("Initial value", config.getString("string"));

        // change the file
        FileWriter out = new FileWriter(file);
        out.write("string=value1");
        out.flush();
        out.close();

        Thread.sleep(2000);

        // test the automatic reloading
        assertEquals("Modified value with enabled reloading", "value1", config.getString("string"));
    }
View Full Code Here


    /**
     * Tests if a file from the classpath can be monitored.
     */
    public void testFromClassPath() throws Exception
    {
        PropertiesConfiguration config = new PropertiesConfiguration();
        config.setFileName(TEST_FILE);
        config.load();
        assertTrue(config.getBoolean("configuration.loaded"));
        FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
        config.setReloadingStrategy(strategy);
        assertEquals(config.getURL(), strategy.getFile().toURL());
    }
View Full Code Here

                // signal always a change
                return true;
            }
        };
        strategy.setRefreshDelay(100000);
        PropertiesConfiguration config = new PropertiesConfiguration(TEST_FILE);
        config.setReloadingStrategy(strategy);
        assertTrue("Reloading not required", strategy.reloadingRequired());
        assertTrue("Reloading no more required", strategy.reloadingRequired());
        strategy.reloadingPerformed();
        assertFalse("Reloading still required", strategy.reloadingRequired());
    }
View Full Code Here

        // now need to perform the queue-topic-topics-queues magic.
        // So make a new ConfigurationObject that will hold all the configuration for this queue.
        ConfigurationPlugin queueConfig = new QueueConfiguration.QueueConfig();

        // Initialise the queue with any Global values we may have
        PropertiesConfiguration newQueueConfig = new PropertiesConfiguration();
        newQueueConfig.setProperty("name", queue.getName());

        try
        {
            //Set the queue name
            CompositeConfiguration mungedConf = new CompositeConfiguration();
View Full Code Here

public class TopicConfig extends ConfigurationPlugin
{
    public TopicConfig()
    {
        setConfig(new PropertiesConfiguration());
    }
View Full Code Here

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

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

      throws ConfigurationException {
    final CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(new SystemConfiguration());
    String propertyFile = config.getString(propertiesFileKey);
    if (propertyFile != null) {
      config.addConfiguration(new PropertiesConfiguration(propertyFile));
    }

    List<Field> fields = new ArrayList<Field>();
    for (Class<?> settings : settingsArg) {
      fields.addAll(Arrays.asList(settings.getDeclaredFields()));
View Full Code Here

    PropertiesConfiguration.setDefaultListDelimiter('&');
    if (configPfad == null) {
      configPfad = "goobi_config.properties";
    }
    try {
      config = new PropertiesConfiguration(configPfad);
    } catch (ConfigurationException e) {
      config = new PropertiesConfiguration();
    }
    // config.setDelimiterParsingDisabled(true);
    config.setListDelimiter('|');

    config.setReloadingStrategy(new FileChangedReloadingStrategy());
View Full Code Here

        bind(CheckpointingFramework.class).to(NoOpCheckpointingFramework.class);
    }

    private void loadProperties(Binder binder) {
        try {
            config = new PropertiesConfiguration();
            config.load(coreConfigFileInputStream);

            // TODO - validate properties.

            /* Make all properties injectable. Do we need this? */
 
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.PropertiesConfiguration$PropertiesWriter

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.