commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1072368 - in /commons/proper/configuration/trunk: conf/ src/java/org/apache/commons/configuration/ src/test/org/apache/commons/configuration/
Date Sat, 19 Feb 2011 16:09:54 GMT
Author: oheger
Date: Sat Feb 19 16:09:54 2011
New Revision: 1072368

URL: http://svn.apache.org/viewvc?rev=1072368&view=rev
Log:
[CONFIGURATION-389] Added support for ini files to DefaultConfigurationBuilder.

Added:
    commons/proper/configuration/trunk/conf/test.ini   (with props)
Modified:
    commons/proper/configuration/trunk/conf/testDigesterConfiguration3.xml
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
    commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java

Added: commons/proper/configuration/trunk/conf/test.ini
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/conf/test.ini?rev=1072368&view=auto
==============================================================================
--- commons/proper/configuration/trunk/conf/test.ini (added)
+++ commons/proper/configuration/trunk/conf/test.ini Sat Feb 19 16:09:54 2011
@@ -0,0 +1,3 @@
+; Test ini file to be included by a configuration definition
+[testini]
+loaded=yes

Propchange: commons/proper/configuration/trunk/conf/test.ini
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/proper/configuration/trunk/conf/testDigesterConfiguration3.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/conf/testDigesterConfiguration3.xml?rev=1072368&r1=1072367&r2=1072368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/conf/testDigesterConfiguration3.xml (original)
+++ commons/proper/configuration/trunk/conf/testDigesterConfiguration3.xml Sat Feb 19 16:09:54
2011
@@ -8,5 +8,6 @@
     <hierarchicalXml fileName="testDigesterConfigurationInclude1.xml" at="tables"/>
     <properties fileName="testDigesterConfigurationInclude2.properties" at="mail"/>
     <jndi prefix=""/>
+    <ini fileName="test.ini"/>
   </additional>
 </configuration>

Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java?rev=1072368&r1=1072367&r2=1072368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/DefaultConfigurationBuilder.java
Sat Feb 19 16:09:54 2011
@@ -31,16 +31,16 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.beanutils.DefaultBeanFactory;
 import org.apache.commons.configuration.beanutils.XMLBeanDeclaration;
 import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
+import org.apache.commons.configuration.resolver.CatalogResolver;
+import org.apache.commons.configuration.resolver.EntityRegistry;
+import org.apache.commons.configuration.resolver.EntityResolverSupport;
 import org.apache.commons.configuration.tree.ConfigurationNode;
 import org.apache.commons.configuration.tree.DefaultExpressionEngine;
 import org.apache.commons.configuration.tree.OverrideCombiner;
 import org.apache.commons.configuration.tree.UnionCombiner;
-import org.apache.commons.configuration.resolver.EntityRegistry;
-import org.apache.commons.configuration.resolver.CatalogResolver;
-import org.apache.commons.configuration.resolver.EntityResolverSupport;
 import org.apache.commons.lang.text.StrLookup;
-import org.apache.commons.logging.LogFactory;
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.xml.sax.EntityResolver;
 
 /**
@@ -377,6 +377,10 @@ public class DefaultConfigurationBuilder
     private static final ConfigurationProvider SYSTEM_PROVIDER = new ConfigurationProvider(
             SystemConfiguration.class);
 
+    /** Constant for the provider for ini files. */
+    private static final ConfigurationProvider INI_PROVIDER =
+            new FileConfigurationProvider(HierarchicalINIConfiguration.class);
+
     /** Constant for the provider for plist files. */
     private static final ConfigurationProvider PLIST_PROVIDER = new FileExtensionConfigurationProvider(
             "org.apache.commons.configuration.plist.XMLPropertyListConfiguration",
@@ -387,13 +391,15 @@ public class DefaultConfigurationBuilder
     private static final ConfigurationProvider BUILDER_PROVIDER = new ConfigurationBuilderProvider();
 
     /** An array with the names of the default tags. */
-    private static final String[] DEFAULT_TAGS =
-    {"properties", "xml", "hierarchicalXml", "jndi", "system", "plist", "configuration"};
+    private static final String[] DEFAULT_TAGS = {
+            "properties", "xml", "hierarchicalXml", "jndi", "system", "plist",
+            "configuration", "ini"
+    };
 
     /** An array with the providers for the default tags. */
     private static final ConfigurationProvider[] DEFAULT_PROVIDERS =
     {PROPERTIES_PROVIDER, XML_PROVIDER, XML_PROVIDER, JNDI_PROVIDER,
-            SYSTEM_PROVIDER, PLIST_PROVIDER, BUILDER_PROVIDER};
+            SYSTEM_PROVIDER, PLIST_PROVIDER, BUILDER_PROVIDER, INI_PROVIDER};
 
     /**
      * The serial version UID.

Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java?rev=1072368&r1=1072367&r2=1072368&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestDefaultConfigurationBuilder.java
Sat Feb 19 16:09:54 2011
@@ -623,6 +623,10 @@ public class TestDefaultConfigurationBui
         assertNotNull(config.getProperty("java.version"));
         assertEquals(System.getProperty("java.version"), config
                 .getString("java.version"));
+
+        // test INIConfiguration
+        assertEquals("Property from ini file not found", "yes",
+                config.getString("testini.loaded"));
     }
 
     /**



Mime
View raw message