Search in sources :

Example 1 with PropertiesBuilderParameters

use of org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters in project janusgraph by JanusGraph.

the class ConfigurationUtil method loadPropertiesConfig.

private static PropertiesConfiguration loadPropertiesConfig(PropertiesBuilderParameters params, boolean setCommaDelimiterHandler) throws ConfigurationException {
    FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<PropertiesConfiguration>(PropertiesConfiguration.class);
    PropertiesBuilderParameters newParams = params;
    if (setCommaDelimiterHandler) {
        newParams = newParams.setListDelimiterHandler(COMMA_DELIMITER_HANDLER);
    }
    return builder.configure(newParams).getConfiguration();
}
Also used : FileBasedConfigurationBuilder(org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder) PropertiesBuilderParameters(org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters) PropertiesConfiguration(org.apache.commons.configuration2.PropertiesConfiguration)

Example 2 with PropertiesBuilderParameters

use of org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters in project scheduling by ow2-proactive.

the class NodeCommandLineProperties method loadConfig.

/**
 * loads NodeSource configuration.
 *
 * @return NodeSource configuration
 */
public static Configuration loadConfig() throws ConfigurationException {
    Configuration config;
    File propertiesFile = new File(NodeCommandLineProperties.class.getClassLoader().getResource(PROPERTIES_FILE).getFile());
    PropertiesBuilderParameters propertyParameters = new Parameters().properties();
    propertyParameters.setFile(propertiesFile);
    propertyParameters.setThrowExceptionOnMissing(true);
    propertyParameters.setListDelimiterHandler(DELIMITER);
    FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<>(PropertiesConfiguration.class);
    builder.configure(propertyParameters);
    config = builder.getConfiguration();
    LOGGER.debug("NodeSources configuration loaded");
    return config;
}
Also used : Parameters(org.apache.commons.configuration2.builder.fluent.Parameters) PropertiesBuilderParameters(org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters) FileBasedConfigurationBuilder(org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder) PropertiesConfiguration(org.apache.commons.configuration2.PropertiesConfiguration) Configuration(org.apache.commons.configuration2.Configuration) PropertiesBuilderParameters(org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters) File(java.io.File) PropertiesConfiguration(org.apache.commons.configuration2.PropertiesConfiguration)

Aggregations

PropertiesConfiguration (org.apache.commons.configuration2.PropertiesConfiguration)2 FileBasedConfigurationBuilder (org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder)2 PropertiesBuilderParameters (org.apache.commons.configuration2.builder.fluent.PropertiesBuilderParameters)2 File (java.io.File)1 Configuration (org.apache.commons.configuration2.Configuration)1 Parameters (org.apache.commons.configuration2.builder.fluent.Parameters)1