Example usage for org.apache.commons.configuration PropertiesConfiguration setProperty

List of usage examples for org.apache.commons.configuration PropertiesConfiguration setProperty

Introduction

In this page you can find the example usage for org.apache.commons.configuration PropertiesConfiguration setProperty.

Prototype

public void setProperty(String key, Object value) 

Source Link

Document

Sets a new value for the specified property.

Usage

From source file:com.jorge.propiedades.CorreoConfiguracion.java

public CorreoConfiguracion() {
    try {//from www .  j  a v a2 s  . c  o m
        PropertiesConfiguration config = new PropertiesConfiguration("./quijotelu/Correo.properties");
        if (config.getProperty("correo.correo") == null) {
            config.setProperty("correo.correo", "jorjoluiso@gmail.com");
            config.save();
        }
        if (config.getProperty("correo.clave") == null) {
            config.setProperty("correo.clave", "suclave");
            config.save();
        }
        correo = (String) config.getProperty("correo.correo");
        clave = (String) config.getProperty("correo.clave");
    } catch (ConfigurationException ex) {
        Logger.getLogger(CorreoConfiguracion.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.jorge.propiedades.FirmaConfiguracion.java

public FirmaConfiguracion() {
    try {/*from   w  w  w  . j ava2s  .  co  m*/
        PropertiesConfiguration config = new PropertiesConfiguration("./quijotelu/Firma.properties");
        if (config.getProperty("Firma.Ruta_PKCS12") == null) {
            config.setProperty("Firma.Ruta_PKCS12", "/data/startup/BCE/jorge_luis_quiguango_teran.p12");
            config.save();
        }

        if (config.getProperty("Firma.Clave_PKCS12") == null) {
            config.setProperty("Firma.Clave_PKCS12", "Gluc4g0n");
            config.save();
        }
        PKCS12_RESOURCE = (String) config.getProperty("Firma.Ruta_PKCS12");
        PKCS12_PASSWORD = (String) config.getProperty("Firma.Clave_PKCS12");
    } catch (ConfigurationException ex) {
        Logger.getLogger(FirmaConfiguracion.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.impetus.kundera.ycsb.YCSBBaseTest.java

/**
 * @throws ConfigurationException//from   www .  j  a v  a 2s  .c  om
 * @throws IOException
 * @throws NumberFormatException
 */
protected void onUpdate() throws ConfigurationException, NumberFormatException, IOException {
    String[] workLoadList = config.getStringArray("workload.file");
    for (String workLoad : workLoadList) {
        PropertiesConfiguration workLoadConfig = new PropertiesConfiguration(workLoadPackage + "/" + workLoad);
        workLoadConfig.setProperty("readproportion", "0");
        workLoadConfig.setProperty("updateproportion", "1");
        workLoadConfig.setProperty("scanproportion", "0");
        workLoadConfig.setProperty("insertproportion", "0");
        workLoadConfig.save();
        process();
    }

}

From source file:GenerateWorkItems.java

private static void initTorque() {
    try {/*  www.  ja v a 2 s . c  o m*/
        PropertiesConfiguration tcfg = new PropertiesConfiguration();
        URL torqueURL = GenerateWorkItems.class.getResource("/Torque.properties");
        InputStream in = torqueURL.openStream();
        tcfg.load(in);

        /*tcfg.setProperty("torque.dsfactory.track.connection.user", "sysdba");
        tcfg.setProperty("torque.dsfactory.track.connection.password", "masterkey");
        tcfg.setProperty("torque.database.track.adapter", "firebird");
        tcfg.setProperty("torque.dsfactory.track.connection.driver", "org.firebirdsql.jdbc.FBDriver");
        tcfg.setProperty("torque.dsfactory.track.connection.url", "jdbc:firebirdsql://localhost/C:/Firebird_1_5/databases/TEST34.GDB");
        tcfg.setProperty("torque.dsfactory.track.factory", "org.apache.torque.dsfactory.SharedPoolDataSourceFactory");
        tcfg.setProperty("torque.dsfactory.track.pool.maxActive", "30");
        tcfg.setProperty("torque.dsfactory.track.pool.testOnBorrow","true");
        tcfg.setProperty("torque.dsfactory.track.pool.validationQuery","SELECT PKEY FROM TSTATE");
        */

        tcfg.setProperty("torque.applicationRoot", ".");
        tcfg.setProperty("torque.database.default", "track");
        tcfg.setProperty("torque.idbroker.clever.quantity", new Boolean(false));
        tcfg.setProperty("torque.idbroker.prefetch", new Boolean(false));
        tcfg.setProperty("torque.manager.useCache", new Boolean(true));
        in.close();
        Torque.init(tcfg);

    } catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.impetus.kundera.ycsb.YCSBBaseTest.java

/**
 * @throws ConfigurationException/*  w ww .  j  a  v  a 2  s .  co m*/
 * @throws IOException
 * @throws NumberFormatException
 */
protected void onRead() throws ConfigurationException, NumberFormatException, IOException {
    String[] workLoadList = config.getStringArray("workload.file");
    PropertiesConfiguration workLoadConfig = new PropertiesConfiguration(
            workLoadPackage + "/" + workLoadList[0]);
    workLoadConfig.setProperty("readproportion", "1");
    workLoadConfig.setProperty("updateproportion", "0");
    workLoadConfig.setProperty("scanproportion", "0");
    workLoadConfig.setProperty("insertproportion", "0");
    workLoadConfig.save();

    config.setProperty("workload.file", workLoadList[0]);
    config.save();
    process();

}

From source file:config.Login.java

private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed

    try {/*  ww  w .  j a  v  a 2s .co m*/
        String propFileName = "config.properties";
        PropertiesConfiguration prop = new PropertiesConfiguration(propFileName);

        // set the properties value
        prop.setProperty("Login", cmbOrderTimer.getSelectedItem().toString());

        prop.save();

    } catch (ConfigurationException ex) {
        Logger.getLogger(Timers.class.getName()).log(Level.SEVERE, null, ex);
    }

    JOptionPane.showMessageDialog(null, "Login updated. ");
    dispose();
}

From source file:com.jorge.db.Instrucciones.java

public Instrucciones() {
    try {/*from w w w.java  2s  .c  o  m*/
        PropertiesConfiguration config = new PropertiesConfiguration("./quijotelu/Respuesta.properties");
        if (config.getProperty("respuesta.VerificaComprobante") == null) {
            config.setProperty("respuesta.VerificaComprobante",
                    "SELECT count(*) FROM ELE_DOCUMENTO_ELECTRONICO");
            config.save();
        }
        if (config.getProperty("respuesta.InsertaComprobante") == null) {
            config.setProperty("respuesta.InsertaComprobante",
                    "INSERT INTO ELE_DOCUMENTO_ELECTRONICO(ID,CODIGO,NUMERO,NUMERO_AUTORIZACION,FECHA_AUTORIZACION,OBSERVACION,ESTADO) VALUES (S_ELE_DOCUMENTO_ELECTRONICO.NEXTVAL,?,?,?,?,?,?)");
            config.save();
        }
        if (config.getProperty("respuesta.ActualizaComprobante") == null) {
            config.setProperty("respuesta.ActualizaComprobante",
                    "UPDATE ELE_DOCUMENTO_ELECTRONICO SET NUMERO_AUTORIZACION=?,FECHA_AUTORIZACION=?,OBSERVACION=?,ESTADO=? WHERE CODIGO=? AND NUMERO=?");
            config.save();
        }
        if (config.getProperty("respuesta.CorreoAlternativo") == null) {
            config.setProperty("respuesta.CorreoAlternativo",
                    "SELECT MAIL_ALTERNATIVO FROM V_INFO_CORREO_ALTERNATIVO where DOCUMENTO=?");
            config.save();
        }
        verificarComprobante = config.getProperty("respuesta.VerificaComprobante").toString().replace("[", "")
                .replace("]", "");
        insertaComprobante = config.getProperty("respuesta.InsertaComprobante").toString().replace("[", "")
                .replace("]", "");
        actualizaComprobante = config.getProperty("respuesta.ActualizaComprobante").toString().replace("[", "")
                .replace("]", "");
        correoAlternativo = config.getProperty("respuesta.CorreoAlternativo").toString().replace("[", "")
                .replace("]", "");
    } catch (ConfigurationException ex) {
        Logger.getLogger(Instrucciones.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.liferay.ide.project.core.upgrade.UpgradeMetadataHandler.java

private void updateProperties(IFile file, String propertyName, String propertiesValue) throws Exception {
    File osfile = new File(file.getLocation().toOSString());
    PropertiesConfiguration pluginPackageProperties = new PropertiesConfiguration();
    pluginPackageProperties.load(osfile);
    pluginPackageProperties.setProperty(propertyName, propertiesValue);

    FileWriter output = new FileWriter(osfile);

    try {//from   w w w.  j  a  va 2s. c  o  m
        pluginPackageProperties.save(output);
    } finally {
        output.close();
    }

    file.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
}

From source file:com.jorge.propiedades.DirectorioConfiguracion.java

public DirectorioConfiguracion() {
    try {// w  ww. j  ava  2  s.c  om
        PropertiesConfiguration config = new PropertiesConfiguration("./quijotelu/Directorio.properties");
        if (config.getProperty("directorio.generado") == null) {
            config.setProperty("directorio.generado", "/app/quijotelu/generado");
            config.save();
        }
        if (config.getProperty("directorio.firmado") == null) {
            config.setProperty("directorio.firmado", "/app/quijotelu/firmado");
            config.save();
        }
        if (config.getProperty("directorio.autorizado") == null) {
            config.setProperty("directorio.autorizado", "/app/quijotelu/autorizado");
            config.save();
        }
        if (config.getProperty("directorio.noautorizado") == null) {
            config.setProperty("directorio.noautorizado", "/app/quijotelu/noautorizado");
            config.save();
        }
        if (config.getProperty("directorio.pdf") == null) {
            config.setProperty("directorio.pdf", "/app/quijotelu/pdf");
            config.save();
        }
        RutaArchivoNoAutorizado = (String) config.getProperty("directorio.noautorizado");
        RutaArchivoAutorizado = (String) config.getProperty("directorio.autorizado");
        RutaArchivoFirmado = (String) config.getProperty("directorio.firmado");
        RutaArchivoGenerado = (String) config.getProperty("directorio.generado");
        RutaArchivoPDF = (String) config.getProperty("directorio.pdf");

    } catch (ConfigurationException ex) {
        Logger.getLogger(DirectorioConfiguracion.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.linkedin.pinot.core.segment.index.converter.SegmentV1V2ToV3FormatConverter.java

private void createMetadataFile(File currentDir, File v3Dir) throws ConfigurationException {
    File v2MetadataFile = new File(currentDir, V1Constants.MetadataKeys.METADATA_FILE_NAME);
    File v3MetadataFile = new File(v3Dir, V1Constants.MetadataKeys.METADATA_FILE_NAME);

    final PropertiesConfiguration properties = new PropertiesConfiguration(v2MetadataFile);
    // update the segment version
    properties.setProperty(V1Constants.MetadataKeys.Segment.SEGMENT_VERSION, SegmentVersion.v3.toString());
    properties.save(v3MetadataFile);//w  w w. j  a v a 2  s.com
}