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

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

Introduction

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

Prototype

public PropertiesConfiguration(URL url) throws ConfigurationException 

Source Link

Document

Creates and loads the extended properties from the specified URL.

Usage

From source file:com.flipzu.stats.Config.java

private Config() {
    try {//w  w  w  . ja v  a2 s .  co  m
        config = new PropertiesConfiguration("estelaStats.properties");
    } catch (ConfigurationException e) {
        config = null;
        Debug.getInstance().logError("Config, Config() exception ", e);
    }
}

From source file:com.xiaoerge.littleastroapi.reading.ZodiacReadings.java

private ZodiacReadings() throws ConfigurationException, IOException {

    PropertiesConfiguration configs = new PropertiesConfiguration("app.properties");

    String horoscopeRest = configs.getString("app.zodiac.rest.get");

    HttpURLConnection con = (HttpURLConnection) new URL(horoscopeRest).openConnection();
    con.setRequestProperty("User-Agent", "LittleAstro-API-Java");

    BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()));

    String jstring = reader.readLine();

    Gson gson = new Gson();
    JsonParser parser = new JsonParser();
    JsonArray jArray = parser.parse(jstring).getAsJsonArray();

    signs = new ArrayList<ZodiacSign>();

    for (JsonElement obj : jArray) {
        ZodiacSign sign = gson.fromJson(obj, ZodiacSign.class);
        signs.add(sign);// ww w .j  a va2s  . c  om
    }
}

From source file:com.dattack.dbtools.GlobalConfiguration.java

/**
 * Load the global configuration from 'dbtools.properties' file.
 *
 * @return the global configuration//w ww. ja  va2  s. c o m
 * @throws ConfigurationException
 *             if an error occurs
 */
public static Configuration getConfiguration() throws ConfigurationException {

    Configuration conf = configuration;
    if (conf == null) {
        synchronized (GlobalConfiguration.class) {
            conf = configuration;
            if (conf == null) {
                conf = new PropertiesConfiguration(FilesystemUtils.locateFile(DBTOOLS_CONFIGURATION_FILENAME));
                configuration = conf;
            }
        }
    }
    return conf;
}

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

public FirmaConfiguracion() {
    try {//from   w  ww  . j ava 2s  .c o  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:it.polimi.modaclouds.monitoring.ddaapi.Config.java

private Config() {
    try {// w ww .ja va 2 s.  c o  m
        config = new PropertiesConfiguration("dda.properties");
    } catch (ConfigurationException e) {
        try {
            File configFile = new File(
                    Config.class.getProtectionDomain().getCodeSource().getLocation().getPath());
            config = new PropertiesConfiguration(configFile.getParent() + "/dda.properties");
        } catch (ConfigurationException e2) {
            logger.warn("dda.properties file not found. Continuing without it.", e2);
        }
    }
}

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

public Instrucciones() {
    try {/* ww  w.j av a2 s .  com*/
        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:de.anhquan.vtv.VTVConfig.java

public void loadConfig(String filePath) {
    try {/*from   w w  w .j a  v  a  2s  .  co  m*/
        config = new PropertiesConfiguration(filePath);
    } catch (ConfigurationException e) {
        config = null;
        log.error("ConfigurationException : " + e.getMessage());
    }
}

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

public Consultas() {
    try {//from   www. j ava  2 s .  co m
        PropertiesConfiguration config = new PropertiesConfiguration("./quijotelu/Consultas.properties");
        if (config.getProperty("consulta.InformacionTributaria") == null) {
            config.setProperty("consulta.InformacionTributaria",
                    "SELECT RAZON_SOCIAL,NOMBRE_COMERCIAL,RUC,DIRECCION,OBLIGADO_CONTABILIDAD,CONTRIBUYENTE_ESPECIAL FROM V_INFO_TRIBUTARIA");
            config.save();
        }
        if (config.getProperty("consulta.FacturaMaestro") == null) {
            config.setProperty("consulta.FacturaMaestro",
                    "SELECT CODIGO,NUMERO,CODIGO_DOCUMENTO,ESTABLECIMIENTO,PUNTO_EMISION,SECUENCIAL,FECHA,TOTAL_SIN_IVA,TOTAL_CON_IVA,IVA,DESCUENTOS,TOTAL,ESTADO,TIPO_DOCUMENTO,DOCUMENTO,RAZON_SOCIAL,DIRECCION,TELEFONO,MAIL,GUIA_REMISION FROM V_INFO_FACTURA_MAESTRO");
            config.save();
        }
        if (config.getProperty("consulta.FacturaDetalle") == null) {
            config.setProperty("consulta.FacturaDetalle",
                    "SELECT CODIGO_PRINCIPAL,DESCRIPCION,CANTIDAD,PRECIO_UNITARIO,CODIGO_PORCENTAJE,PORCENTAJE_IVA,VALOR_IVA,DESCUENTO,PRECIO_TOTAL_SIN_IMPUESTO FROM V_INFO_FACTURA_DETALLE");
            config.save();
        }
        if (config.getProperty("consulta.RetencionMaestro") == null) {
            config.setProperty("consulta.RetencionMaestro",
                    "SELECT CODIGO,NUMERO,CODIGO_DOCUMENTO,ESTABLECIMIENTO,PUNTO_EMISION,SECUENCIAL,FECHA,TIPO_DOCUMENTO,DOCUMENTO,RAZON_SOCIAL,PERIODO_FISCAL,DIRECCION,TELEFONO,MAIL FROM V_INFO_RETENCION_MAESTRO");
            config.save();
        }
        if (config.getProperty("consulta.RetencionDetalle") == null) {
            config.setProperty("consulta.RetencionDetalle",
                    "select CODIGO,NUMERO,TIPO,CODIGO_SRI,BASE_IMPONIBLE,PORCENTAJE,VALOR_RETENIDO,TIPO_COMPROBANTE,NUMERO_COMPROBANTE,FECHA_COMPROBANTE from V_INFO_RETENCION_DETALLE");
            config.save();
        }
        if (config.getProperty("consulta.NotaCreditoMaestro") == null) {
            config.setProperty("consulta.NotaCreditoMaestro",
                    "SELECT CODIGO,NUMERO,CODIGO_DOCUMENTO,ESTABLECIMIENTO,PUNTO_EMISION,SECUENCIAL,FECHA,TIPO_DOCUMENTO,RAZON_SOCIAL,DOCUMENTO,DOCUMENTO_MODIFICADO,MODIFICADO,FECHA_MODIFICADO,TOTAL_SIN_IMPUESTOS,TOTAL_MODIFICADO,TOTAL_SIN_IVA,TOTAL_CON_IVA,IVA,MOTIVO,DIRECCION,TELEFONO,MAIL FROM V_INFO_NOTA_CREDITO_MAESTRO");
            config.save();
        }
        if (config.getProperty("consulta.NotaCreditoDetalle") == null) {
            config.setProperty("consulta.NotaCreditoDetalle",
                    "SELECT CODIGO,NUMERO,CODIGO_INTERNO,DESCRIPCION,CANTIDAD,PRECIO_UNITARIO,DESCUENTO,PRECIO_TOTAL_SIN_IMPUESTO,CODIGO_PORCENTAJE,PORCENTAJE_IVA,VALOR_IVA from V_INFO_NOTA_CREDITO_DETALLE");
            config.save();
        }
        if (config.getProperty("consulta.NotaDebitoMaestro") == null) {
            config.setProperty("consulta.NotaDebitoMaestro",
                    "SELECT CODIGO,NUMERO,CODIGO_DOCUMENTO,ESTABLECIMIENTO,PUNTO_EMISION,SECUENCIAL,FECHA,TIPO_DOCUMENTO,RAZON_SOCIAL,DOCUMENTO,DOCUMENTO_MODIFICADO,MODIFICADO,FECHA_MODIFICADO,TOTAL_SIN_IMPUESTOS,DIRECCION,TELEFONO,MAIL FROM V_INFO_NOTA_DEBITO_MAESTRO");
            config.save();
        }
        if (config.getProperty("consulta.NotaDebitoDetalle") == null) {
            config.setProperty("consulta.NotaDebitoDetalle",
                    "SELECT CODIGO, NUMERO, MOTIVO, VALOR FROM V_INFO_NOTA_DEBITO_DETALLE");
            config.save();
        }
        if (config.getProperty("consulta.GuiaRemision") == null) {
            config.setProperty("consulta.GuiaRemision",
                    "SELECT CODIGO,NUMERO,CODIGO_DOCUMENTO,ESTABLECIMIENTO,PUNTO_EMISION,SECUENCIAL,FECHA,DIRECCION_PARTIDA,RAZON_SOCIAL_TRANSPORTISTA,TIPO_DOCUMENTO,DOCUMENTO,PLACA FROM V_INFO_GUIA_REMISION");
            config.save();
        }
        if (config.getProperty("consulta.Destinatario") == null) {
            config.setProperty("consulta.Destinatario",
                    "SELECT CODIGO,NUMERO,DOCUMENTO,RAZON_SOCIAL,DIRECCION,MOTIVO_TRASLADO FROM V_INFO_DESTINATARIO");
            config.save();
        }
        if (config.getProperty("consulta.DestinatarioDetalle") == null) {
            config.setProperty("consulta.DestinatarioDetalle",
                    "SELECT CODIGO,NUMERO,DOCUMENTO,CODIGO_ARTICULO,NOMBRE_ARTICULO,CANTIDAD FROM V_INFO_DESTINATARIO_DETALLE");
            config.save();
        }
        if (config.getProperty("consulta.GuiaRemisionFactura") == null) {
            config.setProperty("consulta.GuiaRemisionFactura",
                    "SELECT CODIGO,NUMERO,CODIGO_FACTURA,NUMERO_FACTURA FROM V_INFO_GUIA_REMISION_FACTURA");
            config.save();
        }
        if (config.getProperty("consulta.FormaPago") == null) {
            config.setProperty("consulta.FormaPago",
                    "SELECT FACTURA,CODIGO,FORMA_PAGO,PLAZO,TIEMPO FROM V_FORMA_PAGO_FACTURA");
            config.save();
        }
        if (config.getProperty("consulta.FacturaPorcentajeIva") == null) {
            config.setProperty("consulta.FacturaPorcentajeIva",
                    "SELECT CODIGO,NUMERO,PORCENTAJE_IVA FROM V_INFO_FACTURA_PORCENTAJE_IVA");
            config.save();
        }
        InformacionTributaria = config.getProperty("consulta.InformacionTributaria").toString().replace("[", "")
                .replace("]", "");
        FacturaMaestro = config.getProperty("consulta.FacturaMaestro").toString().replace("[", "").replace("]",
                "");
        FacturaDetalle = config.getProperty("consulta.FacturaDetalle").toString().replace("[", "").replace("]",
                "");
        RetencionMaestro = config.getProperty("consulta.RetencionMaestro").toString().replace("[", "")
                .replace("]", "");
        RetencionDetalle = config.getProperty("consulta.RetencionDetalle").toString().replace("[", "")
                .replace("]", "");
        NotaCreditoMaestro = config.getProperty("consulta.NotaCreditoMaestro").toString().replace("[", "")
                .replace("]", "");
        NotaCreditoDetalle = config.getProperty("consulta.NotaCreditoDetalle").toString().replace("[", "")
                .replace("]", "");
        NotaDebitoMaestro = config.getProperty("consulta.NotaDebitoMaestro").toString().replace("[", "")
                .replace("]", "");
        NotaDebitoDetalle = config.getProperty("consulta.NotaDebitoDetalle").toString().replace("[", "")
                .replace("]", "");
        GuiaRemision = config.getProperty("consulta.GuiaRemision").toString().replace("[", "").replace("]", "");
        Destinatario = config.getProperty("consulta.Destinatario").toString().replace("[", "").replace("]", "");
        DestinatarioDetalle = config.getProperty("consulta.DestinatarioDetalle").toString().replace("[", "")
                .replace("]", "");
        GuiaRemisionFactura = config.getProperty("consulta.GuiaRemisionFactura").toString().replace("[", "")
                .replace("]", "");
        FormaPago = config.getProperty("consulta.FormaPago").toString().replace("[", "").replace("]", "");
        FacturaPorcentajeIva = config.getProperty("consulta.FacturaPorcentajeIva").toString().replace("[", "")
                .replace("]", "");
        //System.out.print("InformacionTributaria "+InformacionTributaria);
    } catch (ConfigurationException ex) {
        Logger.getLogger(Consultas.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.bacic5i5j.framework.Gemini.java

/**
 * ?Gemini?/*from w w w. java 2 s.c  om*/
 */
public void init() {
    //
    try {
        config = new PropertiesConfiguration("global.properties");
    } catch (ConfigurationException e) {
        System.err.println(
                "??classglobal.properties: "
                        + e.getMessage());
    }

    modules.add(new GeminiModule(this));
    this.injector = Guice.createInjector(modules);

    this.loggerFactory = this.injector.getInstance(LoggerFactory.class);
    this.logger = loggerFactory.getLogger(Gemini.class);

    this.logger.info("???");

    if (config != null) {
        logger.info(": " + config.getString("webapp.dir"));
    }
}

From source file:com.codspire.mojo.artifactlookup.PropertiesConfigurationTest.java

@Before
public void initProperty() throws Exception {
    config = new PropertiesConfiguration("artifact-lookup-maven-plugin.properties");
    config.setListDelimiter(',');
}