commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1425931 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/ main/java/org/apache/commons/configuration/resolver/ test/java/org/apache/commons/configuration/
Date Wed, 26 Dec 2012 14:54:41 GMT
Author: oheger
Date: Wed Dec 26 14:54:41 2012
New Revision: 1425931

URL: http://svn.apache.org/viewvc?rev=1425931&view=rev
Log:
[CONFIGURATION-518] CatalogResolver now uses a ConfigurationInterpolator rather than a StrSubstitutor.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/resolver/CatalogResolver.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java?rev=1425931&r1=1425930&r2=1425931&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
Wed Dec 26 14:54:41 2012
@@ -810,6 +810,7 @@ public class DefaultConfigurationBuilder
             EntityResolver resolver = (EntityResolver) BeanHelper.createBean(decl, CatalogResolver.class);
             BeanHelper.setProperty(resolver, "fileSystem", getFileSystem());
             BeanHelper.setProperty(resolver, "baseDir", getBasePath());
+            BeanHelper.setProperty(resolver, "interpolator", getInterpolator());
             setEntityResolver(resolver);
         }
     }

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/resolver/CatalogResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/resolver/CatalogResolver.java?rev=1425931&r1=1425930&r2=1425931&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/resolver/CatalogResolver.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/resolver/CatalogResolver.java
Wed Dec 26 14:54:41 2012
@@ -26,7 +26,7 @@ import java.util.Vector;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.ConfigurationUtils;
 import org.apache.commons.configuration.FileSystem;
-import org.apache.commons.lang.text.StrSubstitutor;
+import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.xml.resolver.CatalogException;
@@ -122,12 +122,12 @@ public class CatalogResolver implements 
     }
 
     /**
-     * Set the StrSubstitutor.
-     * @param substitutor The StrSubstitutor.
+     * Set the {@code ConfigurationInterpolator}.
+     * @param ci the {@code ConfigurationInterpolator}
      */
-    public void setSubstitutor(StrSubstitutor substitutor)
+    public void setInterpolator(ConfigurationInterpolator ci)
     {
-        manager.setSubstitutor(substitutor);
+        manager.setInterpolator(ci);
     }
 
     /**
@@ -254,8 +254,8 @@ public class CatalogResolver implements 
         /** The base directory */
         private String baseDir = System.getProperty("user.dir");
 
-        /** The String Substitutor */
-        private StrSubstitutor substitutor;
+        /** The object for handling interpolation. */
+        private ConfigurationInterpolator interpolator;
 
         /**
          * Set the FileSystem
@@ -296,14 +296,14 @@ public class CatalogResolver implements 
             return this.baseDir;
         }
 
-        public void setSubstitutor(StrSubstitutor substitutor)
+        public void setInterpolator(ConfigurationInterpolator ci)
         {
-            this.substitutor = substitutor;
+            interpolator = ci;
         }
 
-        public StrSubstitutor getStrSubstitutor()
+        public ConfigurationInterpolator getInterpolator()
         {
-            return this.substitutor;
+            return interpolator;
         }
 
 
@@ -513,8 +513,8 @@ public class CatalogResolver implements 
         @Override
         protected String normalizeURI(String uriref)
         {
-            StrSubstitutor substitutor = ((CatalogManager) catalogManager).getStrSubstitutor();
-            String resolved = substitutor != null ? substitutor.replace(uriref) : uriref;
+            ConfigurationInterpolator ci = ((CatalogManager) catalogManager).getInterpolator();
+            String resolved = (ci != null) ? String.valueOf(ci.interpolate(uriref)) : uriref;
             return super.normalizeURI(resolved);
         }
     }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java?rev=1425931&r1=1425930&r2=1425931&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestVFSConfigurationBuilder.java
Wed Dec 26 14:54:41 2012
@@ -43,7 +43,6 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.slf4j.MDC;
 
@@ -886,7 +885,7 @@ public class TestVFSConfigurationBuilder
         assertEquals("Incorrect value retrieved","value1",value);
     }
 
-    @Test @Ignore
+    @Test
     public void testValidation2() throws Exception
     {
         factory.setFile(VALIDATION2_FILE);



Mime
View raw message