Example usage for org.apache.commons.configuration FileConfiguration getURL

List of usage examples for org.apache.commons.configuration FileConfiguration getURL

Introduction

In this page you can find the example usage for org.apache.commons.configuration FileConfiguration getURL.

Prototype

URL getURL();

Source Link

Document

Return the URL where the configuration is stored.

Usage

From source file:com.germinus.easyconf.FileConfigurationChangedReloadingStrategy.java

public void setConfiguration(FileConfiguration configuration) {
    super.setConfiguration(configuration);
    setSourceURL(configuration.getURL());
}

From source file:com.germinus.easyconf.AggregatedProperties.java

private Configuration addFileProperties(String fileName, CompositeConfiguration loadedConf)
        throws ConfigurationException {
    try {//  w  ww  . j  a v  a 2  s. c  o m
        FileConfiguration newConf = new PropertiesConfiguration(fileName);
        URL fileURL = newConf.getURL();
        log.debug("Adding file: " + fileURL);

        Long delay = getReloadDelay(loadedConf, newConf);
        if (delay != null) {
            FileChangedReloadingStrategy reloadingStrategy = new FileConfigurationChangedReloadingStrategy();
            if (log.isDebugEnabled()) {
                log.debug("File " + fileURL + " will be reloaded every " + delay + " seconds");
            }
            long milliseconds = delay.longValue() * 1000;
            reloadingStrategy.setRefreshDelay(milliseconds);
            newConf.setReloadingStrategy(reloadingStrategy);
        }

        addIncludedPropertiesSources(newConf, loadedConf);
        return newConf;
    } catch (org.apache.commons.configuration.ConfigurationException e) {
        if (log.isDebugEnabled()) {
            log.debug("Configuration source " + fileName + " ignored");
        }
        return null;
    }
}

From source file:com.liferay.portal.configuration.easyconf.ClassLoaderAggregateProperties.java

private Configuration _addFileProperties(String fileName, CompositeConfiguration loadedCompositeConfiguration)
        throws ConfigurationException {

    try {/*from   www .j ava2 s  .co m*/
        FileConfiguration newFileConfiguration = new PropertiesConfiguration(fileName);

        URL url = newFileConfiguration.getURL();

        if (_log.isDebugEnabled()) {
            _log.debug("Adding file " + url);
        }

        Long delay = _getReloadDelay(loadedCompositeConfiguration, newFileConfiguration);

        if (delay != null) {
            FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileConfigurationChangedReloadingStrategy();

            if (_log.isDebugEnabled()) {
                _log.debug("File " + url + " will be reloaded every " + delay + " seconds");
            }

            long milliseconds = delay.longValue() * 1000;

            fileChangedReloadingStrategy.setRefreshDelay(milliseconds);

            newFileConfiguration.setReloadingStrategy(fileChangedReloadingStrategy);
        }

        _addIncludedPropertiesSources(newFileConfiguration, loadedCompositeConfiguration);

        return newFileConfiguration;
    } catch (org.apache.commons.configuration.ConfigurationException ce) {
        if (_log.isDebugEnabled()) {
            _log.debug("Configuration source " + fileName + " ignored");
        }

        return null;
    }
}

From source file:org.gcube.common.homelibrary.util.config.easyconf.FileConfigurationChangedReloadingStrategy.java

@Override
public void setConfiguration(FileConfiguration configuration) {
    super.setConfiguration(configuration);
    setSourceURL(configuration.getURL());
}