commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1492853 - in /commons/proper/chain/trunk: ./ configuration/api/src/main/java/org/apache/commons/chain2/config/ configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ configuration/xml/src/test/java/org/apache/commons/chain2/...
Date Thu, 13 Jun 2013 20:32:15 GMT
Author: britter
Date: Thu Jun 13 20:32:14 2013
New Revision: 1492853

URL: http://svn.apache.org/r1492853
Log:
CHAIN-87 - Change method signature of ConfigParser.parse(URL)

Modified:
    commons/proper/chain/trunk/configuration/api/src/main/java/org/apache/commons/chain2/config/ConfigParser.java
    commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/XmlConfigParser.java
    commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/AbstractXmlParserTest.java
    commons/proper/chain/trunk/pom.xml
    commons/proper/chain/trunk/src/changes/changes.xml

Modified: commons/proper/chain/trunk/configuration/api/src/main/java/org/apache/commons/chain2/config/ConfigParser.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/configuration/api/src/main/java/org/apache/commons/chain2/config/ConfigParser.java?rev=1492853&r1=1492852&r2=1492853&view=diff
==============================================================================
--- commons/proper/chain/trunk/configuration/api/src/main/java/org/apache/commons/chain2/config/ConfigParser.java
(original)
+++ commons/proper/chain/trunk/configuration/api/src/main/java/org/apache/commons/chain2/config/ConfigParser.java
Thu Jun 13 20:32:14 2013
@@ -17,8 +17,10 @@
 package org.apache.commons.chain2.config;
 
 import java.net.URL;
+import java.util.Map;
 
 import org.apache.commons.chain2.Catalog;
+import org.apache.commons.chain2.CatalogFactory;
 
 /**
  * <p>Facade class to abstract the functionality of parsing an arbitrary
@@ -40,9 +42,13 @@ public interface ConfigParser {
      * if you have included one or more <code>factory</code> elements in your
      * configuration resource.</p>
      *
+     * @param <K> - the type of keys maintained by the context associated with this
command
+     * @param <V> - the type of mapped values
+     * @param <C> - Type of the context associated with this command
      * @param url <code>URL</code> of the configuration document to be parsed
+     * @return a CatalogFactory instance parsed from the given location
      * @exception ChainConfigurationException if a parsing error occurs
      */
-    void parse(URL url) throws ChainConfigurationException;
+    <K, V, C extends Map<K, V>> CatalogFactory<K, V, C> parse(URL url)
throws ChainConfigurationException;
 
 }

Modified: commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/XmlConfigParser.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/XmlConfigParser.java?rev=1492853&r1=1492852&r2=1492853&view=diff
==============================================================================
--- commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/XmlConfigParser.java
(original)
+++ commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/XmlConfigParser.java
Thu Jun 13 20:32:14 2013
@@ -16,12 +16,14 @@
  */
 package org.apache.commons.chain2.config.xml;
 
+import org.apache.commons.chain2.CatalogFactory;
 import org.apache.commons.chain2.config.ChainConfigurationException;
 import org.apache.commons.chain2.config.ConfigParser;
 import org.apache.commons.digester3.Digester;
 import org.apache.commons.digester3.RuleSet;
 
 import java.net.URL;
+import java.util.Map;
 
 /**
  * <p>Class to parse the contents of an XML configuration file (using
@@ -137,11 +139,14 @@ public class XmlConfigParser implements 
      * if you have included one or more <code>factory</code> elements in your
      * configuration resource.</p>
      *
+     * @param <K> - the type of keys maintained by the context associated with this
command
+     * @param <V> - the type of mapped values
+     * @param <C> - Type of the context associated with this command
      * @param url <code>URL</code> of the XML document to be parsed
-     *
+     * @return a CatalogFactory instance parsed from the given location
      * @exception ChainConfigurationException if a parsing error occurs
      */
-    public void parse(URL url) throws ChainConfigurationException {
+    public <K, V, C extends Map<K, V>> CatalogFactory<K, V, C> parse(URL
url) throws ChainConfigurationException {
         // Prepare our Digester instance
         Digester digester = getDigester();
         digester.clear();
@@ -155,6 +160,8 @@ public class XmlConfigParser implements 
                     url);
             throw new ChainConfigurationException(msg, e);
         }
+        // FIXME get rid of singleton pattern and create a new instance here
+        return CatalogFactory.getInstance();
     }
 
 }

Modified: commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/AbstractXmlParserTest.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/AbstractXmlParserTest.java?rev=1492853&r1=1492852&r2=1492853&view=diff
==============================================================================
--- commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/AbstractXmlParserTest.java
(original)
+++ commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/AbstractXmlParserTest.java
Thu Jun 13 20:32:14 2013
@@ -113,9 +113,7 @@ public abstract class AbstractXmlParserT
             throw new IllegalArgumentException(msg);
         }
 
-        parser.parse(url);
-        CatalogFactory<String, Object, Context<String, Object>> catalogFactory
-                = CatalogFactoryBase.getInstance();
+        CatalogFactory<String, Object, Context<String, Object>> catalogFactory
= parser.parse(url);
         catalog = catalogFactory.getCatalog("foo");
     }
 

Modified: commons/proper/chain/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/pom.xml?rev=1492853&r1=1492852&r2=1492853&view=diff
==============================================================================
--- commons/proper/chain/trunk/pom.xml (original)
+++ commons/proper/chain/trunk/pom.xml Thu Jun 13 20:32:14 2013
@@ -108,6 +108,11 @@
       <name>Elijah Zupancic</name>
       <email>elijah at zupancic dot name</email>
     </developer>
+    <developer>
+      <id>britter</id>
+      <name>Benedikt Ritter</name>
+      <email>britter at apache dot org</email>
+    </developer>
   </developers>
 
   <contributors>

Modified: commons/proper/chain/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/changes/changes.xml?rev=1492853&r1=1492852&r2=1492853&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/changes/changes.xml (original)
+++ commons/proper/chain/trunk/src/changes/changes.xml Thu Jun 13 20:32:14 2013
@@ -41,6 +41,9 @@ The <action> type attribute can be add,u
 
   <body>
     <release version="2.0" description="Major release">
+      <action issue="CHAIN-87" dev="britter" type="update">
+          Change method signature of ConfigParser.parse(URL)
+      </action>
       <action issue="CHAIN-79" dev="simonetripodi" type="update">
         Extract APIs in a separate module from default core implementation
       </action>



Mime
View raw message