commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralph Goers (JIRA)" <>
Subject [jira] Commented: (CONFIGURATION-353) Allow Commons Configuration to set system properties
Date Thu, 25 Jun 2009 01:35:07 GMT


Ralph Goers commented on CONFIGURATION-353:

bq.That change is weird. Why does it work only with PropertiesConfiguration?
Because a) it is wierd to populate system properties from anything other than properties and
b) this is meant to be a simple way of getting system properties set for an application instead
of putting lots of -Ds in a startup script. More complicated XML is unnecessary.

bq. SystemConfiguration.setSystemProperties(new PropertiesConfiguration(""));
DefaultConfigurationBuilder allows the property file name to be variable, which is required
for my use case. If you are really inquiring about why not do SystemConfiguration.setSystemProperties(new
PropertiesConfiguration(filename)) then I must have missed where that constructor could accept
an XML properties file. Also, DefaultConfigurationBuilder's base path needs to be passed in
along with the file name.

bq.ConfigurationUtils.copy(new PropertiesConfiguration(""), new SystemConfiguration());
The intent was not to create a new SystemConfiguration. The intent was to get the system properties
set as my first comment indicates.

Here is an example usage. repoURL is defined in along with other system
properties used by the application.

<?xml version="1.0" encoding="UTF-8"?>
                                Test configuration definition file that demonstrates complex
<configuration systemProperties="">
                                <result delimiterParsingDisabled="true" forceReloadCheck="true"
                                                <expressionEngine config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"
                                                <nodeCombiner config-class="org.apache.commons.configuration.tree.MergeCombiner"
                                <entity-resolver catalogFiles="${sys:repoURL}/repositoryResolver.xml"
debug="true" />
                                <fileSystem config-class="org.apache.commons.configuration.VFSFileSystem"
                                                <lookup config-prefix="mdc" config-class="org.slf4j.ext.MDCStrLookup"
                                                <lookup config-prefix="expr" config-class="org.apache.commons.configuration.interpol.ExprLookup">
name="String" value="Class:org.apache.commons.lang.StringUtils" />
                                                <provider config-tag="multifile"
                                                delimiterParsingDisabled="true" attributeSplittingDisabled="true"
                                                config-name="fiConfig" schemaValidation="${sys:schemaValidation}">
                                                <reloadingStrategy delay="60000"
                                <xml fileName="${sys:repoURL}/defaults/env-defaults.xml"
config-name="defaultConfig" optional="true"
                                                delimiterParsingDisabled="true" attributeSplittingDisabled="true"
                                                <reloadingStrategy config-class="org.apache.commons.configuration.reloading.VFSFileMonitorReloadingStrategy"

> Allow Commons Configuration to set system properties
> ----------------------------------------------------
>                 Key: CONFIGURATION-353
>                 URL:
>             Project: Commons Configuration
>          Issue Type: New Feature
>    Affects Versions: 1.6
>         Environment: All
>            Reporter: Ralph Goers
>             Fix For: 1.6
> SystemConfiguration allows the system properties to be accessed as a configuration and
used in a combined configuration. However, no mechanism is available to set system properties
from an external file. Such a facility would alleviate having to place a bunch of -D options
on the command line.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message