Java Code Examples for org.apache.commons.configuration.PropertiesConfiguration#setAutoSave()

The following examples show how to use org.apache.commons.configuration.PropertiesConfiguration#setAutoSave() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PropertiesConfigurationWrapper.java    From StatsAgg with Apache License 2.0 6 votes vote down vote up
private void readPropertiesConfigurationFile(File propertiesFile) {
    
    if (propertiesFile == null) {
        return;
    }
    
    try {
        if (propertiesFile.exists()) {
            configurationDirectory_ = propertiesFile.getParent();
            configurationFilename_ = propertiesFile.getName();

            propertiesConfiguration_ = new PropertiesConfiguration();
            propertiesConfiguration_.setDelimiterParsingDisabled(true);
            propertiesConfiguration_.setAutoSave(false);
            propertiesConfiguration_.load(propertiesFile);
        }
    }
    catch (Exception e) {
        logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e));
        
        configurationDirectory_ = null;
        configurationFilename_ = null;
        propertiesConfiguration_ = null;
    }
}
 
Example 2
Source File: PropertiesConfigurationWrapper.java    From StatsAgg with Apache License 2.0 6 votes vote down vote up
private void readPropertiesConfigurationFile(InputStream configurationInputStream) {
    
    if (configurationInputStream == null) {
        return;
    }
    
    try {
        configurationInputStream_ = configurationInputStream;
        
        propertiesConfiguration_ = new PropertiesConfiguration();
        propertiesConfiguration_.setDelimiterParsingDisabled(true);
        propertiesConfiguration_.setAutoSave(false);
        propertiesConfiguration_.load(configurationInputStream, null);
    }
    catch (Exception e) {
        logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e));
        
        configurationInputStream_ = null;
        propertiesConfiguration_ = null;
    }
}
 
Example 3
Source File: PropertiesConfigurationWrapper.java    From StatsAgg with Apache License 2.0 5 votes vote down vote up
private void readPropertiesConfigurationFile(String filePathAndFilename) {
    
    if (filePathAndFilename == null) {
        return;
    }
    
    try {
        File propertiesFile = new File(filePathAndFilename);
        boolean doesFileExist = FileIo.doesFileExist(filePathAndFilename);
        
        if (doesFileExist) {
            configurationDirectory_ = propertiesFile.getParent();
            configurationFilename_ = propertiesFile.getName();

            propertiesConfiguration_ = new PropertiesConfiguration();
            propertiesConfiguration_.setDelimiterParsingDisabled(true);
            propertiesConfiguration_.setAutoSave(false);
            propertiesConfiguration_.load(propertiesFile);
        }
    }
    catch (Exception e) {
        logger.error(e.toString() + System.lineSeparator() + StackTrace.getStringFromStackTrace(e));
        
        configurationDirectory_ = null;
        configurationFilename_ = null;
        propertiesConfiguration_ = null;
    }
}
 
Example 4
Source File: PropertiesConfigurationProperties.java    From pentaho-hadoop-shims with Apache License 2.0 5 votes vote down vote up
private static PropertiesConfiguration initPropertiesConfiguration( FileObject fileObject )
  throws FileSystemException, ConfigurationException {
  PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration( fileObject.getURL() );
  propertiesConfiguration.setAutoSave( true );
  FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
  fileChangedReloadingStrategy.setRefreshDelay( 1000L );
  propertiesConfiguration.setReloadingStrategy( fileChangedReloadingStrategy );
  return propertiesConfiguration;
}