use of org.apache.commons.configuration.PropertiesConfiguration in project cloudstack by apache.
the class TestDbSetup method updateSqlPort.
public static void updateSqlPort(int port, String propertyFileOverride) throws Exception {
PropertiesConfiguration config = new PropertiesConfiguration(propertyFileOverride);
System.out.println("File: " + propertyFileOverride + "; old: db.properties port: " + config.getProperty("db.cloud.port") + ", new port: " + port);
config.setProperty("db.cloud.port", "" + port);
config.setProperty("db.cloud.username", System.getProperty("user.name"));
config.setProperty("db.cloud.password", "");
config.setProperty("db.usage.port", "" + port);
config.setProperty("db.usage.username", System.getProperty("user.name"));
config.setProperty("db.usage.password", "");
config.setProperty("db.simulator.port", "" + port);
config.setProperty("db.simulator.username", System.getProperty("user.name"));
config.setProperty("db.simulator.password", "");
config.save();
}
use of org.apache.commons.configuration.PropertiesConfiguration in project oxTrust by GluuFederation.
the class UpdateCASAction method disable.
public void disable() {
try {
log.info("disable() CAS call");
// enable server-side storage in idp.properties
String idpConfFolder = shibboleth3ConfService.getIdpConfDir();
PropertiesConfiguration idpPropertiesConfiguration = new PropertiesConfiguration(idpConfFolder + Shibboleth3ConfService.SHIB3_IDP_PROPERTIES_FILE);
PropertiesConfigurationLayout layoutConfiguration = new PropertiesConfigurationLayout(idpPropertiesConfiguration);
// Restore default - client session storage
layoutConfiguration.getConfiguration().setProperty(IDP_SESSION_STORAGESERVICE, CLIENT_SESSION_STORAGESERVICE);
layoutConfiguration.getConfiguration().setProperty(IDP_CAS_STORAGESERVICE, configuration.getSessionStorageType());
layoutConfiguration.getConfiguration().save();
// disable CAS beans in relying-party.xml
updateShibboleth3Configuration();
log.info("disable() CAS - enabled");
} catch (Exception e) {
log.error("disable() CAS exception", e);
}
}
use of org.apache.commons.configuration.PropertiesConfiguration in project sakuli by ConSol.
the class SakuliPropertyPlaceholderConfigurer method modifySahiProxyPortPropertiesConfiguration.
/**
* writes the {@link SahiProxyProperties#PROXY_PORT} value as {@link SahiProxyProperties#SAHI_PROPERTY_PROXY_PORT_MAPPING}
* property to sahiConfigPropertyFilePath!
*/
protected void modifySahiProxyPortPropertiesConfiguration(String sahiConfigPropertyFilePath, Properties props) {
final String sahiProxyPort = props.getProperty(SahiProxyProperties.PROXY_PORT);
if (sahiProxyPort != null) {
try {
PropertiesConfiguration propConfig = new PropertiesConfiguration(sahiConfigPropertyFilePath);
propConfig.setAutoSave(true);
final String sahiMappingPropertyProxyPort = SahiProxyProperties.SAHI_PROPERTY_PROXY_PORT_MAPPING;
if (propConfig.containsKey(sahiMappingPropertyProxyPort)) {
propConfig.clearProperty(sahiMappingPropertyProxyPort);
}
//remove property after the test execution, so that the installation can't break
addToModifiedPropertiesMap(sahiConfigPropertyFilePath, sahiMappingPropertyProxyPort, null);
propConfig.addProperty(sahiMappingPropertyProxyPort, sahiProxyPort);
logger.debug("modify properties file '{}' with '{}={}'", sahiConfigPropertyFilePath, sahiMappingPropertyProxyPort, sahiProxyPort);
} catch (ConfigurationException e) {
logger.error("modify sahi properties went wrong", e);
}
}
}
use of org.apache.commons.configuration.PropertiesConfiguration in project sakuli by ConSol.
the class SakuliPropertyPlaceholderConfigurer method addPropertiesFromFile.
/**
* Reads in the properties for a specific file
*
* @param props Properties to update
* @param filePath path to readable properties file
* @param active activate or deactivate the function
*/
protected void addPropertiesFromFile(Properties props, String filePath, boolean active) {
if (active) {
logger.info("read in properties from '{}'", filePath);
try {
PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(filePath);
Iterator<String> keyIt = propertiesConfiguration.getKeys();
while (keyIt.hasNext()) {
String key = keyIt.next();
Object value = propertiesConfiguration.getProperty(key);
props.put(key, value);
}
} catch (ConfigurationException | NullPointerException e) {
throw new RuntimeException("Error by reading the property file '" + filePath + "'", e);
}
}
}
use of org.apache.commons.configuration.PropertiesConfiguration in project opennms by OpenNMS.
the class DefaultOtrsConfigDao method getProperties.
/**
* Retrieves the properties defined in the otrs.properties file.
*
* @return a
* <code>java.util.Properties object containing otrs plugin defined properties
* @throws IOException
*/
private Configuration getProperties() {
Configuration config = new PropertiesConfiguration();
String propsFile = null;
try {
propsFile = new File(new File(System.getProperty("opennms.home"), "etc"), "otrs.properties").getCanonicalPath();
LOG.debug("loading properties from: {}", propsFile);
config = new PropertiesConfiguration(propsFile);
} catch (final ConfigurationException e) {
LOG.error("Unable to load properties from {}", propsFile, e);
} catch (final IOException e) {
LOG.error("Exception when trying to find OTRS configuration properties from {}", propsFile, e);
}
return config;
}
Aggregations