Author: oheger
Date: Thu Oct 9 13:29:13 2008
New Revision: 703248
URL: http://svn.apache.org/viewvc?rev=703248&view=rev
Log:
[CONFIGURATION-338] PropertiesConfiguration now performs interpolation when
searching for include files; thanks to David Donn (david_donn at pacific dot
net dot au) for the patch
Added:
commons/proper/configuration/trunk/conf/include-interpol.properties (with
props)
Modified:
commons/proper/configuration/trunk/conf/test.properties
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
commons/proper/configuration/trunk/xdocs/changes.xml
Added: commons/proper/configuration/trunk/conf/include-interpol.properties
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/conf/include-interpol.properties?rev=703248&view=auto
==============================================================================
--- commons/proper/configuration/trunk/conf/include-interpol.properties (added)
+++ commons/proper/configuration/trunk/conf/include-interpol.properties Thu Oct
9 13:29:13 2008
@@ -0,0 +1,4 @@
+include.interpol.loaded = true
+
+
+
Propchange: commons/proper/configuration/trunk/conf/include-interpol.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/configuration/trunk/conf/include-interpol.properties
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/proper/configuration/trunk/conf/include-interpol.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: commons/proper/configuration/trunk/conf/test.properties
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/conf/test.properties?rev=703248&r1=703247&r2=703248&view=diff
==============================================================================
--- commons/proper/configuration/trunk/conf/test.properties (original)
+++ commons/proper/configuration/trunk/conf/test.properties Thu Oct 9 13:29:13
2008
@@ -5,6 +5,9 @@
include = include.properties
+include.file = include-interpol.properties
+include = ${include.file}
+
test.unescape = This \n string \t contains \" escaped \\ character\u0073
test.unescape.list-separator = This string contains \, an escaped list
separator
Modified:
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java?rev=703248&r1=703247&r2=703248&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java
(original)
+++
commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/PropertiesConfiguration.java
Thu Oct 9 13:29:13 2008
@@ -504,7 +504,7 @@
}
for (int i = 0; i < files.length; i++)
{
- loadIncludeFile(files[i].trim());
+ loadIncludeFile(interpolate(files[i].trim()));
}
}
result = false;
Modified:
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java?rev=703248&r1=703247&r2=703248&view=diff
==============================================================================
---
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
(original)
+++
commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
Thu Oct 9 13:29:13 2008
@@ -113,6 +113,16 @@
assertEquals("true", loaded);
}
+ /**
+ * test if includes properties from interpolated file
+ * name get loaded
+ */
+ public void testLoadIncludeInterpol() throws Exception
+ {
+ String loaded = conf.getString("include.interpol.loaded");
+ assertEquals("true", loaded);
+ }
+
public void testSetInclude() throws Exception
{
// change the include key
Modified: commons/proper/configuration/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/configuration/trunk/xdocs/changes.xml?rev=703248&r1=703247&r2=703248&view=diff
==============================================================================
--- commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ commons/proper/configuration/trunk/xdocs/changes.xml Thu Oct 9 13:29:13
2008
@@ -23,6 +23,11 @@
<body>
<release version="1.6" date="in SVN" description="">
+ <action dev="oheger" type="add" issue="CONFIGURATION-338" due-to="David
Donn">
+ PropertiesConfiguration now also performs interpolation when searching
+ for include files. This means that the name of a file to include can be
+ determined by another property.
+ </action>
<action dev="oheger" type="add" issue="CONFIGURATION-337" due-to="Ralph
Goers">
DefaultConfigurationBuilder now supports defining new configuration
providers in the configuration definition file.