Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.PropertiesConfiguration.save()


        configuration = new PropertiesConfiguration(localPropsFile);
        _logger.info("Using local widget server properties file: " + localPropsFile.toString());
      } else {
        configuration = new PropertiesConfiguration("widgetserver.properties");
        configuration.setFile(localPropsFile);
        configuration.save();
        _logger.info("Using default widget server properties, configure your local server using: " + localPropsFile.toString());
      }
       context.setAttribute("properties", (Configuration) configuration);
      
       /*
 
View Full Code Here


        opensocialConfiguration = new PropertiesConfiguration(localOpenSocialPropsFile);
        _logger.info("Using local open social properties file: " + localOpenSocialPropsFile.toString());
      } else {
        opensocialConfiguration = new PropertiesConfiguration("opensocial.properties");
        opensocialConfiguration.setFile(localOpenSocialPropsFile);
        opensocialConfiguration.save();
        _logger.info("Using default open social properties, configure your local server using: " + localOpenSocialPropsFile.toString());
      }
      context.setAttribute("opensocial", (Configuration) opensocialConfiguration);
     
      /*
 
View Full Code Here

        featuresConfiguration = new PropertiesConfiguration(localFeaturesPropsFile);
        _logger.info("Loading local features file: " + localOpenSocialPropsFile.toString());
      } else {
        featuresConfiguration = new PropertiesConfiguration("features.properties");
        featuresConfiguration.setFile(localFeaturesPropsFile);
        featuresConfiguration.save();
        _logger.info("Loading default features, configure your local server using: " + localFeaturesPropsFile.toString());
      }
      FeatureLoader.loadFeatures(featuresConfiguration);
     
      /*
 
View Full Code Here

        config.setProperty("db.simulator.port", "" + port);
        config.setProperty("db.simulator.username", System.getProperty("user.name"));
        config.setProperty("db.simulator.password", "");

        config.save();
    }

    public static void initCloudstackDb() throws Exception {
        try {
            File dir = new File("../../../");
View Full Code Here

    }
    else {
      System.out.println("Data Migration failed. Reverting db.properties");
      //revert db.properties
      try {
        backupDBProps.save();
      } catch (ConfigurationException e) {
        e.printStackTrace();
      }
      if(encryptionType.equals("file")){
        //revert secret key in file
View Full Code Here

      }
      prop = dbProps.getProperty("db.usage.password");
      if(prop!=null && !prop.isEmpty()){
        newDBProps.setProperty("db.usage.password", "ENC("+msEncryptor.encrypt(prop)+")");
      }
      newDBProps.save(dbPropsFile.getAbsolutePath());
    } catch (Exception e) {    
      e.printStackTrace();
      return false;
    }
    System.out.println("Migrating db.properties Done.");
View Full Code Here

            System.out.println("Successfully updated secret key(s)");
        } else {
            System.out.println("Data Migration failed. Reverting db.properties");
            //revert db.properties
            try {
                backupDBProps.save();
            } catch (ConfigurationException e) {
                e.printStackTrace();
            }
            if (encryptionType.equals("file")) {
                //revert secret key in file
View Full Code Here

            }
            prop = dbProps.getProperty("db.usage.password");
            if (prop != null && !prop.isEmpty()) {
                newDBProps.setProperty("db.usage.password", "ENC(" + msEncryptor.encrypt(prop) + ")");
            }
            newDBProps.save(dbPropsFile.getAbsolutePath());
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        System.out.println("Migrating db.properties Done.");
View Full Code Here

  @Override
  public synchronized String currentConfig() {
    PropertiesConfiguration saver = new PropertiesConfiguration();
    StringWriter writer = new StringWriter();
    saver.copy(config);
    try { saver.save(writer); }
    catch (Exception e) {
      throw new MetricsConfigException("Error stringify config", e);
    }
    return writer.toString();
  }
View Full Code Here

  static String toString(Configuration c) {
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(buffer);
    PropertiesConfiguration tmp = new PropertiesConfiguration();
    tmp.copy(c);
    try { tmp.save(ps); }
    catch (Exception e) {
      throw new MetricsConfigException(e);
    }
    return buffer.toString();
  }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.