You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2013/07/31 21:37:12 UTC
svn commit: r1508999 - in /commons/proper/chain/trunk:
apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/
apps/example2/src/main/java/org/apache/commons/chain2/apps/example/
base/src/main/java/org/apache/commons/chain2/...
Author: britter
Date: Wed Jul 31 19:37:11 2013
New Revision: 1508999
URL: http://svn.apache.org/r1508999
Log:
CHAIN-86 - Make CatalogFactory an interface
Removed:
commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/CatalogFactory.java
Modified:
commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java
commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java
commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java
commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java
commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/CatalogFactoryBaseTestCase.java
commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigCatalogRule.java
commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigRuleSet.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/XmlConfigParserTestCase.java
commons/proper/chain/trunk/src/changes/changes.xml
commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java
commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java
commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java
Modified: commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java (original)
+++ commons/proper/chain/trunk/apps/cookbook-examples/src/main/java/org/apache/commons/chain2/cookbook/mailreader/MailReaderServlet.java Wed Jul 31 19:37:11 2013
@@ -19,6 +19,7 @@ package org.apache.commons.chain2.cookbo
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.CatalogFactory;
import org.apache.commons.chain2.Command;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -44,7 +45,7 @@ public class MailReaderServlet extends H
context.setLogger(response.getWriter());
CatalogFactory<String, Object, MailReader> catalogFactory =
- CatalogFactory.getInstance();
+ CatalogFactoryBase.getInstance();
Catalog<String, Object, MailReader> catalog =
catalogFactory.getCatalog();
Modified: commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java (original)
+++ commons/proper/chain/trunk/apps/example2/src/main/java/org/apache/commons/chain2/apps/example/ExampleServlet.java Wed Jul 31 19:37:11 2013
@@ -19,6 +19,7 @@ package org.apache.commons.chain2.apps.e
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.CatalogFactory;
import org.apache.commons.chain2.Command;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import org.apache.commons.chain2.web.servlet.ServletWebContext;
import org.apache.commons.chain2.web.servlet.ServletWebContextBase;
import org.apache.commons.logging.Log;
@@ -28,6 +29,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
import java.io.IOException;
/**
@@ -74,7 +76,7 @@ public class ExampleServlet extends Http
throws IOException {
CatalogFactory<String, Object, ServletWebContext<String, Object>> factory =
- CatalogFactory.getInstance();
+ CatalogFactoryBase.getInstance();
Catalog<String, Object, ServletWebContext<String, Object>> catalog =
factory.getCatalog(servletName);
Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java (original)
+++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/base/LookupCommand.java Wed Jul 31 19:37:11 2013
@@ -22,6 +22,7 @@ import org.apache.commons.chain2.Command
import org.apache.commons.chain2.Context;
import org.apache.commons.chain2.Filter;
import org.apache.commons.chain2.Processing;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import java.util.Map;
@@ -58,7 +59,7 @@ public class LookupCommand<K, V, C exten
* @since Chain 1.1
*/
public LookupCommand() {
- this(CatalogFactory.<K, V, C>getInstance());
+ this(CatalogFactoryBase.<K, V, C>getInstance());
}
/**
@@ -78,7 +79,7 @@ public class LookupCommand<K, V, C exten
private CatalogFactory<K, V, C> catalogFactory = null;
/**
- * <p>Set the {@link CatalogFactory} from which lookups will be
+ * <p>Set the {@link CatalogFactoryBase} from which lookups will be
* performed.</p>
*
* @param catalogFactory The Catalog Factory.
@@ -90,7 +91,7 @@ public class LookupCommand<K, V, C exten
}
/**
- * Return the {@link CatalogFactory} from which lookups will be performed.
+ * Return the {@link CatalogFactoryBase} from which lookups will be performed.
* @return The Catalog factory.
*
* @since Chain 1.1
@@ -323,7 +324,7 @@ public class LookupCommand<K, V, C exten
protected Catalog<K, V, C> getCatalog(C context) {
CatalogFactory<K, V, C> lookupFactory = this.catalogFactory;
if (lookupFactory == null) {
- lookupFactory = CatalogFactory.getInstance();
+ lookupFactory = CatalogFactoryBase.getInstance();
}
String catalogName = getCatalogName();
Modified: commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java (original)
+++ commons/proper/chain/trunk/base/src/main/java/org/apache/commons/chain2/impl/CatalogFactoryBase.java Wed Jul 31 19:37:11 2013
@@ -17,12 +17,16 @@
package org.apache.commons.chain2.impl;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.CatalogFactory;
+import org.apache.commons.chain2.Command;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* <p>A simple implementation of {@link CatalogFactory}.</p>
@@ -32,7 +36,7 @@ import org.apache.commons.chain2.Catalog
* @param <C> Type of the context associated with this command
* @version $Id$
*/
-public class CatalogFactoryBase<K, V, C extends Map<K, V>> extends CatalogFactory<K, V, C> {
+public class CatalogFactoryBase<K, V, C extends Map<K, V>> implements CatalogFactory<K, V, C> {
// ----------------------------------------------------------- Constructors
@@ -46,7 +50,7 @@ public class CatalogFactoryBase<K, V, C
// ----------------------------------------------------- Instance Variables
/**
- * <p>The default {@link Catalog} for this {@link CatalogFactory}.</p>
+ * <p>The default {@link Catalog} for this {@link CatalogFactoryBase}.</p>
*/
private Catalog<K, V, C> catalog = null;
@@ -104,7 +108,7 @@ public class CatalogFactoryBase<K, V, C
/**
* <p>Return an <code>Iterator</code> over the set of named
- * {@link Catalog}s known to this {@link CatalogFactory}.
+ * {@link Catalog}s known to this {@link CatalogFactoryBase}.
* If there are no known catalogs, an empty Iterator is returned.</p>
*
* @return An Iterator of the names of the Catalogs known by this factory.
@@ -114,4 +118,129 @@ public class CatalogFactoryBase<K, V, C
return catalogs.keySet().iterator();
}
+
+ public <CMD extends Command<K, V, C>> CMD getCommand(String commandID) {
+ String commandName = commandID;
+ String catalogName = null;
+ Catalog<K, V, C> catalog;
+
+ if (commandID != null) {
+ int splitPos = commandID.indexOf(DELIMITER);
+ if (splitPos != -1) {
+ catalogName = commandID.substring(0, splitPos);
+ commandName = commandID.substring(splitPos + DELIMITER.length());
+ if (commandName.contains(DELIMITER)) {
+ throw new IllegalArgumentException("commandID [" +
+ commandID +
+ "] has too many delimiters (reserved for future use)");
+ }
+ }
+ }
+
+ if (catalogName != null) {
+ catalog = this.getCatalog(catalogName);
+ if (catalog == null) {
+ Log log = LogFactory.getLog(CatalogFactoryBase.class);
+ log.warn("No catalog found for name: " + catalogName + ".");
+ return null;
+ }
+ } else {
+ catalog = this.getCatalog();
+ if (catalog == null) {
+ Log log = LogFactory.getLog(CatalogFactoryBase.class);
+ log.warn("No default catalog found.");
+ return null;
+ }
+ }
+
+ return catalog.<CMD>getCommand(commandName);
+ }
+
+ // ------------------------------------------------------- Static Variables
+
+ /**
+ * <p>The set of registered {@link CatalogFactoryBase} instances,
+ * keyed by the relevant class loader.</p>
+ */
+ private static final Map<ClassLoader, CatalogFactoryBase<?, ?, ? extends Map<?, ?>>> factories =
+ new HashMap<ClassLoader, CatalogFactoryBase<?, ?, ? extends Map<?, ?>>>();
+
+ // -------------------------------------------------------- Static Methods
+
+ /**
+ * <p>Return the singleton {@link CatalogFactoryBase} instance
+ * for the relevant <code>ClassLoader</code>. For applications
+ * that use a thread context class loader (such as web applications
+ * running inside a servet container), this will return a separate
+ * instance for each application, even if this class is loaded from
+ * a shared parent class loader.</p>
+ *
+ * @param <K> Context key type
+ * @param <V> Context value type
+ * @param <C> Type of the context associated with this command
+ * @return the per-application singleton instance of {@link CatalogFactoryBase}
+ */
+ public static <K, V, C extends Map<K, V>> CatalogFactory<K, V, C> getInstance() {
+ CatalogFactoryBase<?, ?, ? extends Map<?, ?>> factory;
+ ClassLoader cl = getClassLoader();
+ synchronized (factories) {
+ factory = factories.get(cl);
+ if (factory == null) {
+ factory = new CatalogFactoryBase<K, V, C>();
+ factories.put(cl, factory);
+ }
+ }
+
+ /* This should always convert cleanly because we are using the
+ * base most generic for definition. */
+ @SuppressWarnings("unchecked")
+ CatalogFactory<K, V, C> result = (CatalogFactory<K, V, C>) factory;
+
+ return result;
+ }
+
+ /**
+ * <p>Clear all references to registered catalogs, as well as to the
+ * relevant class loader. This method should be called, for example,
+ * when a web application utilizing this class is removed from
+ * service, to allow for garbage collection.</p>
+ */
+ public static void clear() {
+ synchronized (factories) {
+ factories.remove(getClassLoader());
+ }
+ }
+
+ // ------------------------------------------------------- Private Methods
+
+ /**
+ * <p>Return the relevant <code>ClassLoader</code> to use as a Map key
+ * for this request. If there is a thread context class loader, return
+ * that; otherwise, return the class loader that loaded this class.</p>
+ */
+ private static ClassLoader getClassLoader() {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null) {
+ cl = getClassLoader();
+ }
+ return cl;
+ }
+
+ /**
+ * Check to see if we have an implementation of a valid configuration
+ * parsing class loaded at runtime. If not, we throw an
+ * IllegalStateException.
+ */
+ public static void checkForValidConfigurationModule() {
+ try {
+ ClassLoader cl = getClassLoader();
+ cl.loadClass("org.apache.commons.chain2.config.ConfigParser");
+ } catch (ClassNotFoundException e) {
+ String msg = "Couldn't not find a configuration implementation. " +
+ "Load a chain configuration module such as xml-configuration " +
+ "into the classpath and try again.";
+ throw new IllegalStateException(msg, e);
+ }
+ }
+
}
Modified: commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/CatalogFactoryBaseTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/CatalogFactoryBaseTestCase.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/CatalogFactoryBaseTestCase.java (original)
+++ commons/proper/chain/trunk/base/src/test/java/org/apache/commons/chain2/impl/CatalogFactoryBaseTestCase.java Wed Jul 31 19:37:11 2013
@@ -47,7 +47,7 @@ public class CatalogFactoryBaseTestCase
/**
- * <p>The {@link CatalogFactory} instance under test.</p>
+ * <p>The {@link CatalogFactoryBase} instance under test.</p>
*/
protected CatalogFactory<String, Object, Context<String, Object>> factory = null;
@@ -60,8 +60,8 @@ public class CatalogFactoryBaseTestCase
*/
@Before
public void setUp() {
- CatalogFactory.clear();
- factory = CatalogFactory.getInstance();
+ CatalogFactoryBase.clear();
+ factory = CatalogFactoryBase.getInstance();
}
/**
@@ -70,7 +70,7 @@ public class CatalogFactoryBaseTestCase
@After
public void tearDown() {
factory = null;
- CatalogFactory.clear();
+ CatalogFactoryBase.clear();
}
@@ -78,7 +78,7 @@ public class CatalogFactoryBaseTestCase
/**
- * <p>Test a pristine instance of {@link CatalogFactory}.</p>
+ * <p>Test a pristine instance of {@link CatalogFactoryBase}.</p>
*/
@Test
public void testPristine() {
@@ -120,8 +120,8 @@ public class CatalogFactoryBaseTestCase
factory.addCatalog("foo", new CatalogBase<String, Object, Context<String, Object>>());
assertEquals(1, getCatalogCount());
assertTrue(!(catalog == factory.getCatalog("foo")));
- CatalogFactory.clear();
- factory = CatalogFactory.getInstance();
+ CatalogFactoryBase.clear();
+ factory = CatalogFactoryBase.getInstance();
assertEquals(0, getCatalogCount());
}
@@ -180,7 +180,7 @@ public class CatalogFactoryBaseTestCase
/**
* <p>Return the number of {@link Catalog}s defined in our
- * {@link CatalogFactory}.</p>
+ * {@link CatalogFactoryBase}.</p>
*/
private int getCatalogCount() {
Modified: commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigCatalogRule.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigCatalogRule.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigCatalogRule.java (original)
+++ commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigCatalogRule.java Wed Jul 31 19:37:11 2013
@@ -18,6 +18,7 @@ package org.apache.commons.chain2.config
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.CatalogFactory;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import org.apache.commons.digester3.Rule;
import org.xml.sax.Attributes;
@@ -26,7 +27,7 @@ import java.util.Map;
/**
* <p>Digester rule that will cause the top-most element on the Digester
* stack (if it is a {@link org.apache.commons.chain2.Catalog} to be registered with the
- * {@link org.apache.commons.chain2.CatalogFactory} instance for our application. If the attribute
+ * {@link org.apache.commons.chain2.impl.CatalogFactoryBase} instance for our application. If the attribute
* specified to our constructor has a value, that will be used as the name
* under which to register this {@link org.apache.commons.chain2.Catalog}. Otherwise, this will
* become the default {@link org.apache.commons.chain2.Catalog} for this application.</p>
@@ -85,7 +86,7 @@ class ConfigCatalogRule extends Rule {
public void begin(String namespace, String name, Attributes attributes) throws Exception {
// Retrieve any current Catalog with the specified name
Catalog<Object, Object, Map<Object, Object>> catalog;
- CatalogFactory<Object, Object, Map<Object, Object>> factory = CatalogFactory.getInstance();
+ CatalogFactory<Object, Object, Map<Object, Object>> factory = CatalogFactoryBase.getInstance();
String nameValue = attributes.getValue(nameAttribute);
if (nameValue == null) {
catalog = factory.getCatalog();
Modified: commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigRuleSet.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigRuleSet.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigRuleSet.java (original)
+++ commons/proper/chain/trunk/configuration/xml/src/main/java/org/apache/commons/chain2/config/xml/ConfigRuleSet.java Wed Jul 31 19:37:11 2013
@@ -35,7 +35,7 @@ import org.apache.commons.digester3.Rule
* <li><strong>catalogElement</strong> -- Name of the XML element representing
* the addition of a {@link org.apache.commons.chain2.Catalog}.
* Any such catalog that is created will be registered with the
- * {@link org.apache.commons.chain2.CatalogFactory} instance for our
+ * {@link org.apache.commons.chain2.impl.CatalogFactoryBase} instance for our
* application, under the name specified by the <code>nameAttribute</code>
* attribute (if present), or as the default {@link org.apache.commons.chain2.Catalog}.
* If not specified, the default value is <code>catalog</code>.</li>
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=1508999&r1=1508998&r2=1508999&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 Wed Jul 31 19:37:11 2013
@@ -19,6 +19,7 @@ package org.apache.commons.chain2.config
import org.apache.commons.chain2.CatalogFactory;
import org.apache.commons.chain2.config.ChainConfigurationException;
import org.apache.commons.chain2.config.ConfigParser;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import org.apache.commons.digester3.Digester;
import org.apache.commons.digester3.RuleSet;
@@ -161,7 +162,7 @@ public class XmlConfigParser implements
throw new ChainConfigurationException(msg, e);
}
// FIXME get rid of singleton pattern and create a new instance here
- return CatalogFactory.getInstance();
+ return CatalogFactoryBase.getInstance();
}
}
Modified: commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java (original)
+++ commons/proper/chain/trunk/configuration/xml/src/test/java/org/apache/commons/chain2/config/xml/XmlConfigParserTestCase.java Wed Jul 31 19:37:11 2013
@@ -36,6 +36,7 @@ import org.apache.commons.chain2.Context
import org.apache.commons.chain2.Processing;
import org.apache.commons.chain2.testutils.AddingCommand;
import org.apache.commons.chain2.impl.CatalogBase;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import org.apache.commons.chain2.impl.ChainBase;
import org.apache.commons.chain2.impl.ContextBase;
import org.apache.commons.chain2.testutils.DelegatingCommand;
@@ -88,7 +89,7 @@ public class XmlConfigParserTestCase {
}
private void init() {
- CatalogFactory.clear();
+ CatalogFactoryBase.clear();
catalog = new CatalogBase<String, Object, Context<String, Object>>();
context = new ContextBase();
parser = new XmlConfigParser();
Modified: commons/proper/chain/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/src/changes/changes.xml?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/src/changes/changes.xml (original)
+++ commons/proper/chain/trunk/src/changes/changes.xml Wed Jul 31 19:37:11 2013
@@ -41,6 +41,9 @@ The <action> type attribute can be add,u
<body>
<release version="2.0" description="Major release">
+ <action issue="CHAIN-86" dev="britter" type="update" due-to="Jonas Sprenger">
+ Make CatalogFactory an interface
+ </action>
<action issue="CHAIN-108" dev="britter" type="update">
Build fails with Java 6
</action>
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainListener.java Wed Jul 31 19:37:11 2013
@@ -29,8 +29,8 @@ import javax.servlet.ServletContextListe
import org.apache.commons.chain2.Catalog;
import org.apache.commons.chain2.CatalogFactory;
import org.apache.commons.chain2.config.xml.XmlConfigParser;
-import org.apache.commons.chain2.config.xml.XmlConfigParser;
import org.apache.commons.chain2.impl.CatalogBase;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import org.apache.commons.chain2.web.servlet.ServletWebContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -56,7 +56,7 @@ import org.apache.commons.logging.LogFac
* If not specified, it is expected that parsed resources will
* contain <code><catalog></code> elements (which will
* cause registration of the created {@link Catalog}s into
- * the {@link CatalogFactory} for this application, and no
+ * the {@link CatalogFactoryBase} for this application, and no
* servlet context attribute will be created.
* <strong>NOTE</strong> - This parameter is deprecated.</p>
* <li><strong>org.apache.commons.chain2.RULE_SET</strong> -
@@ -82,7 +82,7 @@ import org.apache.commons.logging.LogFac
*
* <p>If no attribute key is specified, on the other hand, parsed configuration
* resources are expected to contain <code><catalog></code> elements,
- * and the catalogs will be registered with the {@link CatalogFactory}
+ * and the catalogs will be registered with the {@link CatalogFactoryBase}
* for this web application.</p>
*
* <p>This class requires Servlet 2.3 or later. If you are running on
@@ -96,7 +96,7 @@ import org.apache.commons.logging.LogFac
*/
public class ChainListener implements ServletContextListener {
{
- CatalogFactory.checkForValidConfigurationModule();
+ CatalogFactoryBase.checkForValidConfigurationModule();
}
// ------------------------------------------------------ Manifest Constants
@@ -145,7 +145,7 @@ public class ChainListener implements Se
if (attr != null) {
context.removeAttribute(attr);
}
- CatalogFactory.clear();
+ CatalogFactoryBase.clear();
}
/**
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/ChainServlet.java Wed Jul 31 19:37:11 2013
@@ -26,9 +26,9 @@ import javax.servlet.http.HttpServletReq
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.chain2.Catalog;
-import org.apache.commons.chain2.CatalogFactory;
import org.apache.commons.chain2.config.xml.XmlConfigParser;
import org.apache.commons.chain2.impl.CatalogBase;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import org.apache.commons.chain2.web.servlet.ServletWebContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -53,7 +53,7 @@ import org.apache.commons.logging.LogFac
* If not specified, it is expected that parsed resources will
* contain <code><catalog></code> elements (which will
* cause registration of the created {@link Catalog}s into
- * the {@link CatalogFactory} for this application, and no
+ * the {@link CatalogFactoryBase} for this application, and no
* servet context attribute will be created.
* <strong>NOTE</strong> - This parameter is deprecated.</p>
* <li><strong>org.apache.commons.chain2.RULE_SET</strong> -
@@ -77,7 +77,7 @@ import org.apache.commons.logging.LogFac
*
* <p>If no attribute key is specified, on the other hand, parsed configuration
* resources are expected to contain <code><catalog></code> elements,
- * and the catalogs will be registered with the {@link CatalogFactory}
+ * and the catalogs will be registered with the {@link CatalogFactoryBase}
* for this web application.</p>
*
* <p>This class runs on Servlet 2.2 or later. If you are running on a
@@ -92,7 +92,7 @@ import org.apache.commons.logging.LogFac
*/
public class ChainServlet extends HttpServlet {
{
- CatalogFactory.checkForValidConfigurationModule();
+ CatalogFactoryBase.checkForValidConfigurationModule();
}
// ------------------------------------------------------ Manifest Constants
@@ -145,7 +145,7 @@ public class ChainServlet extends HttpSe
if (attr != null) {
context.removeAttribute(attr);
}
- CatalogFactory.clear();
+ CatalogFactoryBase.clear();
}
/**
Modified: commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java
URL: http://svn.apache.org/viewvc/commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java?rev=1508999&r1=1508998&r2=1508999&view=diff
==============================================================================
--- commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java (original)
+++ commons/proper/chain/trunk/web/src/main/java/org/apache/commons/chain2/web/servlet/ChainProcessor.java Wed Jul 31 19:37:11 2013
@@ -17,14 +17,15 @@
package org.apache.commons.chain2.web.servlet;
import org.apache.commons.chain2.Catalog;
-import org.apache.commons.chain2.CatalogFactory;
import org.apache.commons.chain2.Command;
+import org.apache.commons.chain2.impl.CatalogFactoryBase;
import org.apache.commons.chain2.web.ChainServlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
import java.io.IOException;
/**
@@ -98,13 +99,13 @@ public class ChainProcessor extends Chai
* is stored. This value is also used as the name of the
* context attribute under which the catalog is exposed to commands.
* If not specified, we will look up commands in the appropriate
- * {@link Catalog} retrieved from our {@link CatalogFactory}.</p>
+ * {@link Catalog} retrieved from our {@link CatalogFactoryBase}.</p>
*/
private String attribute = null;
/**
* <p>The name of the {@link Catalog} to retrieve from the
- * {@link CatalogFactory} for this application, or <code>null</code>
+ * {@link CatalogFactoryBase} for this application, or <code>null</code>
* to select the default {@link Catalog}.</p>
*/
private String catalog = null;
@@ -184,10 +185,10 @@ public class ChainProcessor extends Chai
throw new IllegalArgumentException(msg);
}
} else if (catalog != null) {
- theCatalog = CatalogFactory.<String, Object, ServletWebContext<String, Object>>getInstance()
+ theCatalog = CatalogFactoryBase.<String, Object, ServletWebContext<String, Object>>getInstance()
.getCatalog(catalog);
} else {
- theCatalog = CatalogFactory.<String, Object, ServletWebContext<String, Object>>getInstance()
+ theCatalog = CatalogFactoryBase.<String, Object, ServletWebContext<String, Object>>getInstance()
.getCatalog();
}
if (attribute == null) {