List of usage examples for org.apache.commons.configuration PropertiesConfiguration getProperty
public Object getProperty(String key)
From source file:info.extensiblecatalog.OAIToolkit.utils.XcOaiIdConfigUtil.java
public static void init(String fileName) throws Exception { PropertiesConfiguration props = ConfigUtil.load(fileName); oaiIdDomainName = (String) props.getProperty("oaiIdentifierDomainName"); oaiIdRepositoryIdentifier = (String) props.getProperty("oaiIdentifierRepositoryIdentifier"); prglog.info("[PRG] XC OAI ID parameters: fileName: " + fileName + ", Oai Identifier Domain name: " + oaiIdDomainName + ", Oai Id Repository Identifier: " + oaiIdRepositoryIdentifier); }
From source file:com.trackplus.persist.TpEm.java
public static void initEntityManagerFactory(PropertiesConfiguration tcfg, String persistUnit) { Properties properties = new Properties(); properties.put("javax.persistence.jdbc.driver", tcfg.getProperty("torque.dsfactory.track.connection.driver")); properties.put("javax.persistence.jdbc.url", tcfg.getProperty("torque.dsfactory.track.connection.url")); properties.put("javax.persistence.jdbc.user", tcfg.getProperty("torque.dsfactory.track.connection.user")); properties.put("javax.persistence.jdbc.password", tcfg.getProperty("torque.dsfactory.track.connection.password")); emf = Persistence.createEntityManagerFactory(persistUnit, properties); }
From source file:info.extensiblecatalog.OAIToolkit.db.DButil.java
private static void load(String fileName) throws Exception { PropertiesConfiguration props = ConfigUtil.load(fileName); host = (String) props.getProperty("db.host"); port = (String) props.getProperty("db.port"); database = (String) props.getProperty("db.database"); user = (String) props.getProperty("db.user"); password = (String) props.getProperty("db.password"); prglog.info("[PRG] DB parameters: fileName: " + fileName + ", host: " + host + ", port: " + port + ", database: " + database + ", user: " + user + ", password: " + password.replaceAll(".", "*")); }
From source file:com.carmatech.maven.utils.MergeUtils.java
public static void putAll(final PropertiesConfiguration target, final PropertiesConfiguration source) { for (final Iterator<String> sourceKeys = source.getKeys(); sourceKeys.hasNext();) { final String key = sourceKeys.next(); final Object value = source.getProperty(key); target.setProperty(key, value);// w w w. j ava 2 s .com } }
From source file:com.xemantic.tadedon.configuration.Configurations.java
/** * Copies property identified by {@code key} from the {@code srcConf} to {@code dstConf}. * This method will also copy property comments. * * @param defaultConf// w w w .jav a 2 s . co m * @param conf * @param key */ public static void copyProperty(String key, PropertiesConfiguration srcConf, PropertiesConfiguration dstConf) { LOG.debug("Copying property: {}", key); Object value = srcConf.getProperty(key); dstConf.setProperty(key, value); String comment = srcConf.getLayout().getComment(key); if (comment != null) { dstConf.getLayout().setComment(key, comment); } }
From source file:com.carmatech.maven.model.MergerTestUtils.java
public static void assertThatPropertiesAreSameAsSources(final File targetFile) throws Exception { final PropertiesConfiguration properties = new PropertiesConfiguration(targetFile); assertThat(properties.getString("FamilyName"), is("Skywalker")); assertThat(properties.getString("first_name"), is("Luke")); assertThat(properties.getString("Sabrolaser"), is("bLuE")); assertThat(properties.getProperty("planets"), isObject(asList("endor", "tatooine", "naboo", "coruscant", "alderaan", "kamino", "yavin"))); assertThat(properties.getProperty("children"), is(nullValue())); }
From source file:com.bluelotussoftware.example.apache.commons.Application.java
private String getName() { PropertiesConfiguration config = ConfigManager.instance().getConfig(); String name = (String) config.getProperty("name"); return name;// w w w .j a v a 2 s .co m }
From source file:com.bluelotussoftware.example.apache.commons.Application.java
/** * <p>Retrieves the background property from the properties file on * the system disk.</p>/*from w w w. j av a 2 s . co m*/ * @return the background color assigned in the properties file. * @throws ConfigurationException if an <code>Exception</code> is encountered. */ public String getBackground() throws ConfigurationException { PropertiesConfiguration config = ConfigManager.instance().getConfig(); String background = (String) config.getProperty("colors.background"); return background; }
From source file:com.jorge.propiedades.CorreoConfiguracion.java
public CorreoConfiguracion() { try {// w ww. j a v a 2 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 {// w w w . j a v a2 s .c om 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); } }