You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by ge...@apache.org on 2005/04/28 03:52:44 UTC
svn commit: r165083 -
/struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java
Author: germuska
Date: Wed Apr 27 18:52:39 2005
New Revision: 165083
URL: http://svn.apache.org/viewcvs?rev=165083&view=rev
Log:
Some simple refactorings to better enable use of a CatalogFactory initialized by some means other than the static digester based parsing which is built in to commons-chain.
Modified:
struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java
Modified: struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java
URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java?rev=165083&r1=165082&r2=165083&view=diff
==============================================================================
--- struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java (original)
+++ struts/core/trunk/src/share/org/apache/struts/chain/ComposableRequestProcessor.java Wed Apr 27 18:52:39 2005
@@ -64,6 +64,13 @@
/**
+ * <p>The {@link CatalogFactory} from which catalog containing the the
+ * base request-processing {@link Command} will be retrieved.</p>
+ */
+ protected CatalogFactory catalogFactory = null;
+
+
+ /**
* <p>The {@link Catalog} containing all of the available command chains
* for this module.
*/
@@ -92,6 +99,7 @@
public void destroy() {
super.destroy();
+ catalogFactory = null;
catalog = null;
command = null;
@@ -114,10 +122,12 @@
+ moduleConfig.getPrefix() + "'");
super.init(servlet, moduleConfig);
+ initCatalogFactory(servlet, moduleConfig);
+
ControllerConfig controllerConfig = moduleConfig.getControllerConfig();
String catalogName = controllerConfig.getCatalog();
- catalog = CatalogFactory.getInstance().getCatalog(catalogName);
+ catalog = this.catalogFactory.getCatalog(catalogName);
if (catalog == null) {
throw new ServletException("Cannot find catalog '" +
catalogName + "'");
@@ -134,6 +144,22 @@
/**
+ * <p>Establish the <code>CatalogFactory</code> which will be used to look up
+ * the catalog which has the request processing command.</p>
+ * <p>The base implementation simply calls <code>CatalogFactory.getInstance()</code>,
+ * unless the <code>catalogFactory</code> property of this object has already been set,
+ * in which case it is not changed.</p>
+ * @param servlet
+ * @param moduleConfig
+ */
+ protected void initCatalogFactory(ActionServlet servlet, ModuleConfig moduleConfig) {
+ if (this.catalogFactory != null) return;
+ this.catalogFactory = CatalogFactory.getInstance();
+
+ }
+
+
+ /**
* <p>Process an <code>HttpServletRequest</code> and create the
* corresponding <code>HttpServletResponse</code>.</p>
*
@@ -199,7 +225,16 @@
}
-
+ /**
+ * <p>Set the <code>CatalogFactory</code> instance which should be used to find
+ * the request-processing command. In the base implementation, if this value is not
+ * already set, then it will be initialized when {@link initCatalogFactory} is called.
+ * </p>
+ * @param catalogFactory
+ */
+ public void setCatalogFactory(CatalogFactory catalogFactory) {
+ this.catalogFactory = catalogFactory;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org