Search in sources :

Example 1 with PropertyEntry

use of org.openksavi.sponge.config.PropertyEntry in project sponge by softelnet.

the class DefaultConfigurationManager method setupXmlProperties.

private void setupXmlProperties() {
    for (Configuration configuration : rootConfig.getChildConfigurationsOf(ConfigurationConstants.TAG_PROPERTIES)) {
        String name = configuration.getAttribute(ConfigurationConstants.PROP_ATTRIBUTE_NAME, null);
        Object value = configuration.getValue();
        String systemProperty = System.getProperty(name);
        PropertyEntry entry = properties.get(name);
        if (systemProperty != null) {
            value = systemProperty;
        } else if (entry == null) {
            properties.put(name, new GenericPropertyEntry(value, isPropertyVariable(configuration), isPropertySystem(configuration)));
        } else {
            value = entry.getValue();
        }
        rootConfig.setVariable(name, value);
    }
}
Also used : XMLConfiguration(org.apache.commons.configuration2.XMLConfiguration) CommonsConfiguration(org.openksavi.sponge.core.config.CommonsConfiguration) Configuration(org.openksavi.sponge.config.Configuration) CombinedConfiguration(org.apache.commons.configuration2.CombinedConfiguration) PropertyEntry(org.openksavi.sponge.config.PropertyEntry)

Example 2 with PropertyEntry

use of org.openksavi.sponge.config.PropertyEntry in project sponge by softelnet.

the class DefaultConfigurationManager method getProperty.

@Override
public String getProperty(String name) {
    String systemProperty = System.getProperty(name);
    if (systemProperty != null) {
        return systemProperty;
    }
    PropertyEntry entry = properties.get(name);
    if (entry == null) {
        return null;
    }
    Object value = entry.getValue();
    return value != null ? String.valueOf(value) : null;
}
Also used : PropertyEntry(org.openksavi.sponge.config.PropertyEntry)

Aggregations

PropertyEntry (org.openksavi.sponge.config.PropertyEntry)2 CombinedConfiguration (org.apache.commons.configuration2.CombinedConfiguration)1 XMLConfiguration (org.apache.commons.configuration2.XMLConfiguration)1 Configuration (org.openksavi.sponge.config.Configuration)1 CommonsConfiguration (org.openksavi.sponge.core.config.CommonsConfiguration)1