Package org.apache.commons.configuration

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


    PropertiesConfiguration p = new PropertiesConfiguration();
    p.copy(c);
    if (header != null) {
      out.println(header);
    }
    try { p.save(out); }
    catch (Exception e) {
      throw new RuntimeException("Error saving config", e);
    }
  }
View Full Code Here


    PropertiesConfiguration p = new PropertiesConfiguration();
    p.copy(c);
    if (header != null) {
      out.println(header);
    }
    try { p.save(out); }
    catch (Exception e) {
      throw new RuntimeException("Error saving config", e);
    }
  }
View Full Code Here

  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

  @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

  @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

  public String serialize() {
    PropertiesConfiguration propConfig = new PropertiesConfiguration();
    propConfig.copy(this);
    StringWriter writer = new StringWriter();
    try {
      propConfig.save(writer);
    } catch (ConfigurationException e) {
      // this should never happen
      throw new IllegalStateException(e);
    }
    return writer.toString();
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

    }
    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

                    }
                }
               
                properties.setProperty(DroidGlobalProperty.LAST_UPDATE_CHECK.getName(), System.currentTimeMillis());
                try {
                    properties.save();
                } catch (ConfigurationException e) {
                    log.warn("Could not save the last update check time to the file: " + properties.getPath());
                }
            }
        }
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.