List of usage examples for org.apache.commons.configuration PropertiesConfiguration getProperty
public Object getProperty(String key)
From source file:fr.insalyon.creatis.vip.vipcoworkapplet.Cowork.java
/** Initializes the applet Main */ @Override// w w w . j av a 2s .com public void init() { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Cowork.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Cowork.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Cowork.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Cowork.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the applet */ try { java.awt.EventQueue.invokeAndWait(new Runnable() { public void run() { try { sessionId = getParameter("sessionId"); email = getParameter("email"); endpoint = getCodeBase().toString() + "/fr.insalyon.creatis.vip.portal.Main/coworkservice"; DesignFrame frame = new DesignFrame(true); frame.setAppletParams(endpoint, email, sessionId); String home = System.getProperty("user.home"); File config = new File(home + File.separator + ".cowork/config"); PropertiesConfiguration pc = new PropertiesConfiguration(config); String password = (String) pc.getProperty("password"), login = (String) pc.getProperty("login"); PasswordDialog p = new PasswordDialog(null, "Please login to the knowledge base"); while (password == null || login == null) { if (p.showDialog()) { login = p.getName(); password = p.getPass(); } if (login != null && password != null) { if (JOptionPane.showConfirmDialog(null, "Remember credentials (unencrypted)?", "Rememeber?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { pc.setProperty("password", password); pc.setProperty("login", login); pc.save(); } } } KnowledgeBase kb = new KnowledgeBase("jdbc:mysql://" + getCodeBase().getHost() + "/cowork", login, password, "http://cowork.i3s.cnrs.fr/"); frame.setKB(kb); frame.setVisible(true); } catch (ConfigurationException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, ExceptionUtils.getStackTrace(ex), "Error", JOptionPane.ERROR_MESSAGE); } catch (SQLException ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, ExceptionUtils.getStackTrace(ex), "Error", JOptionPane.ERROR_MESSAGE); } } }); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(null, ExceptionUtils.getStackTrace(ex), "Error", JOptionPane.ERROR_MESSAGE); } }
From source file:com.dhenton9000.embedded.jetty.PhantomJSTest.java
public final WebDriver configureDriver(PropertiesConfiguration sConfig) throws IOException { DesiredCapabilities sCaps = new DesiredCapabilities(); sCaps.setJavascriptEnabled(true);/*from w ww . j a v a 2 s .c om*/ sCaps.setCapability("takesScreenshot", false); if (sConfig.getProperty(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY) != null) { sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, sConfig.getProperty(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY)); } else { throw new IOException(String.format("Property '%s' not set!", PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY)); } // "phantomjs_driver_path" if (sConfig.getProperty(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY) != null) { LOG.debug("Test will use an external GhostDriver"); sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY, sConfig.getProperty(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY)); } else { LOG.debug("Test will use PhantomJS internal GhostDriver"); } WebDriver mDriver = new PhantomJSDriver(sCaps); return mDriver; }
From source file:com.jorge.db.Consultas.java
public Consultas() { try {//from www . jav a 2s . 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.dhenton9000.phantom.js.PhantomJSBase.java
protected final WebDriver configureDriver(PropertiesConfiguration sConfig) throws IOException { DesiredCapabilities sCaps = new DesiredCapabilities(); sCaps.setJavascriptEnabled(true);/*from w w w .j a v a 2 s . c om*/ sCaps.setCapability("takesScreenshot", false); if (sConfig.getProperty(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY) != null) { sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, sConfig.getProperty(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY)); } else { throw new IOException(String.format("Property '%s' not set!", PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY)); } // "phantomjs_driver_path" if (sConfig.getProperty(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY) != null) { LOG.debug("Test will use an external GhostDriver"); sCaps.setCapability(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY, sConfig.getProperty(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY)); } else { LOG.debug("Test will use PhantomJS internal GhostDriver"); } WebDriver mDriver = new PhantomJSDriver(sCaps); return mDriver; }
From source file:firmadigital.Parametros.java
private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown try {/*from w w w . j a v a 2s . co m*/ PropertiesConfiguration config = new PropertiesConfiguration("FirmaDigital.properties"); if (config.getProperty("web.web_service") == null) { config.setProperty("web.web_service", "https://celcer.sri.gob.ec/comprobantes-electronicos-ws/RecepcionComprobantes?wsdl"); config.save(); } if (config.getProperty("certificado.almacen") == null) { config.setProperty("certificado.almacen", System.getProperty("java.home") + File.separator + "lib\\security\\cacerts"); config.save(); } if (config.getProperty("certificado.direccion") == null) { config.setProperty("certificado.direccion", System.getProperty("user.home") + File.separator + "Certificado"); config.save(); } txtUbicacionAlmacenCertificado.setText((String) config.getProperty("certificado.almacen")); txtWebService.setText((String) config.getProperty("web.web_service")); txtCertificado.setText(config.getProperty("certificado.direccion").toString()); } catch (ConfigurationException ex) { Logger.getLogger(Parametros.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:firmadigital.Firma.java
private void cmdFirmarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdFirmarActionPerformed try {//w ww .j a v a2 s .c om PropertiesConfiguration config = new PropertiesConfiguration("FirmaDigital.properties"); if (config.getProperty("certificado.almacen") == null) { JOptionPane.showMessageDialog(null, "Primero debe ingrear a la pantalla de parmetros"); return; } } catch (ConfigurationException ex) { Logger.getLogger(Firma.class.getName()).log(Level.SEVERE, null, ex); } File folder = new File("C:\\fd\\Firmados"); folder.mkdirs(); if (!lblRutaArchivo.getText().isEmpty() && !lblNombreArchivo.getText().isEmpty()) { if (XAdESBESSignature.firmar(lblRutaArchivo.getText() + File.separator + lblNombreArchivo.getText(), lblNombreArchivo.getText(), "C:\\fd\\Firmados")) { lblRutaArchivo.setText("C:\\fd\\Firmados"); txtUbicacion.setText(lblRutaArchivo.getText() + File.separator + lblNombreArchivo.getText()); JOptionPane.showMessageDialog(null, "Firmado con xito"); } } else { JOptionPane.showMessageDialog(null, "Tiene que especificar un archivo"); } }
From source file:es.usc.citius.composit.transformer.wsc.wscxml.WSCTransformer.java
/** * The WSC specification does not define the ontology URI of the concepts. * Thus, the real URI of the ontology should be provided using the wsc-tranformer.properties */// w ww . ja v a 2 s . c o m public WSCTransformer() throws Exception { // NOTE: The inputs and outputs of the services should be automatically translated from instances to // concepts using the XML Reasoner PropertiesConfiguration props = new PropertiesConfiguration("wsc-transformer.properties"); this.taxonomyFile = (String) props.getProperty("taxonomy"); // Name of the taxonomy.xml file (it will be localized automatically) log.info("Taxonomy file name {}", this.taxonomyFile); // Name of the ontology.owl file (it will be localized automatically) this.ontologyFile = (String) props.getProperty("ontology"); log.info("Ontology file name {}", this.ontologyFile); }
From source file:com.mirth.connect.server.migration.Migrate3_1_0.java
private void migrateLog4jProperties() { PropertiesConfiguration log4jproperties = new PropertiesConfiguration(); log4jproperties.setDelimiterParsingDisabled(true); log4jproperties.setFile(new File(ClassPathResource.getResourceURI("log4j.properties"))); try {/*from w w w. jav a 2 s . c om*/ log4jproperties.load(); String level = (String) log4jproperties.getProperty("log4j.logger.shutdown"); if (level != null) { log4jproperties.setProperty("log4j.logger.undeploy", level); log4jproperties.clearProperty("log4j.logger.shutdown"); Logger.getLogger("undeploy").setLevel(Level.toLevel(level)); } level = (String) log4jproperties .getProperty("log4j.logger.com.mirth.connect.donkey.server.channel.RecoveryTask"); if (StringUtils.isBlank(level)) { level = "INFO"; log4jproperties.setProperty("log4j.logger.com.mirth.connect.donkey.server.channel.RecoveryTask", level); Logger.getLogger("com.mirth.connect.donkey.server.channel.RecoveryTask") .setLevel(Level.toLevel(level)); } log4jproperties.save(); } catch (ConfigurationException e) { logger.error("Failed to migrate log4j properties."); } }
From source file:com.mirth.connect.server.migration.Migrate3_0_0.java
@Override public void updateConfiguration(PropertiesConfiguration configuration) { if (configuration.getProperty("database").equals("derby")) { String url = (String) configuration.getProperty("database.url"); if (!StringUtils.contains(url, ";upgrade=")) { url += ";upgrade=true"; }//from www . j ava 2 s.c o m configuration.setProperty("database.url", url); } }
From source file:com.carmatech.maven.MergeOperation.java
private void filter(final PropertiesConfiguration properties) { final Matcher variableMatcher = Pattern.compile(PATTERN_FOR_VARIABLE).matcher(""); for (final Iterator<String> keys = properties.getKeys(); keys.hasNext();) { final String name = keys.next(); final Object value = properties.getProperty(name); if (isVariable(value, variableMatcher)) { final String variableName = variableMatcher.group(INDEX_GROUP_VARIABLE_NAME); overrideIfNotNull(properties, name, variableName, "System", System.getProperty(variableName)); overrideIfNotNull(properties, name, variableName, "Maven", project.getProperties().getProperty(variableName)); overrideIfNotNull(properties, name, variableName, "merged", properties.getProperty(variableName)); }/* ww w.j av a 2 s . c o m*/ } }