craigmcc 02/02/23 14:54:18
Modified: conf/share struts-config_1_1.dtd
src/share/org/apache/struts/action ActionServlet.java
src/share/org/apache/struts/config ApplicationConfig.java
ConfigRuleSet.java
web/example/WEB-INF struts-config.xml web.xml
Added: src/example/org/apache/struts/webapp/example
DatabasePlugIn.java
src/share/org/apache/struts/action PlugIn.java
Removed: src/example/org/apache/struts/webapp/example
DatabaseServlet.java
Log:
Add a new lightweight API (org.apache.struts.action.PlugIn) for declaring
and configuring user application modules that need startup and shutdown
lifecycle notification.
Modify the canonical /struts-example application to do its pseudo database
setup in a PlugIn instead of in a separate servlet.
Revision Changes Path
1.12 +38 -25 jakarta-struts/conf/share/struts-config_1_1.dtd
Index: struts-config_1_1.dtd
===================================================================
RCS file: /home/cvs/jakarta-struts/conf/share/struts-config_1_1.dtd,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- struts-config_1_1.dtd 20 Jan 2002 05:34:08 -0000 1.11
+++ struts-config_1_1.dtd 23 Feb 2002 22:54:17 -0000 1.12
@@ -11,7 +11,7 @@
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
- $Id: struts-config_1_1.dtd,v 1.11 2002/01/20 05:34:08 craigmcc Exp $
+ $Id: struts-config_1_1.dtd,v 1.12 2002/02/23 22:54:17 craigmcc Exp $
-->
@@ -85,7 +85,7 @@
hierarchy, and contains nested elements for all of the other
configuration settings.
-->
-<!ELEMENT struts-config (data-sources?, form-beans?, global-exceptions?,
global-forwards?, action-mappings?, controller?, message-resources*)>
+<!ELEMENT struts-config (data-sources?, form-beans?, global-exceptions?,
global-forwards?, action-mappings?, controller?, message-resources*, plug-in*)>
<!ATTLIST struts-config id ID #IMPLIED>
@@ -496,24 +496,19 @@
<!ATTLIST message-resources parameter CDATA #REQUIRED>
-<!-- The "set-property" element specifies the name and value of an additional
- JavaBeans configuration property whose setter method will be called
- on the object that represents our surrounding element. This is especially
- useful when an extended implementation class (with additional properties)
- is configured on the <global-forwards> or <action-mappings> elements.
- The following attributes are defined:
-
- property Name of the JavaBeans property whose setter method
- will be called.
-
- value String representation of the value to which this
- property will be set, after suitable type conversion
--->
-<!ELEMENT set-property EMPTY>
-<!ATTLIST set-property id ID #IMPLIED>
-<!ATTLIST set-property property %PropName; #REQUIRED>
-<!ATTLIST set-property value CDATA #REQUIRED>
-
+<!-- The "plug-in" element specifies the fully qualified class name of a
+ general purpose application plug-in module that receives notification
+ of application startup and shutdown events. An instance of the
+ specified class is created for each element, and can be configured
+ with nested "set-property" elements. The following attributes
+ are supported:
+
+ className Fully qualified Java class name of the plug-in class
+ (must implement org.apache.struts.PlugIn).
+-->
+<!ELEMENT plug-in (set-property*)>
+<!ATTLIST plug-in id ID #IMPLIED>
+<!ATTLIST plug-in className %ClassName; #REQUIRED>
<!-- ========== Subordinate Elements ====================================== -->
@@ -522,11 +517,10 @@
<!-- The "description" element contains descriptive (paragraph length) text
about the surrounding element, suitable for use in GUI tools.
-->
-<!ELEMENT description (#PCDATA)>
+<!ELEMENT description (#PCDATA)>
<!ATTLIST description id ID #IMPLIED>
-
<!-- The "display-name" element contains a short (one line) description of
the surrounding element, suitable for use in GUI tools.
-->
@@ -538,7 +532,7 @@
specify the location, relative to the Struts configuration file, for small
and large images used to represent the surrounding element in GUI tools.
-->
-<!ELEMENT icon (small-icon?, large-icon?)>
+<!ELEMENT icon (small-icon?, large-icon?)>
<!ATTLIST icon id ID #IMPLIED>
@@ -546,14 +540,33 @@
configuration file, of a resource containing a large (32x32 pixel)
icon image.
-->
-<!ELEMENT large-icon (%Location;)>
+<!ELEMENT large-icon (%Location;)>
<!ATTLIST large-icon id ID #IMPLIED>
+<!-- The "set-property" element specifies the name and value of an additional
+ JavaBeans configuration property whose setter method will be called
+ on the object that represents our surrounding element. This is especially
+ useful when an extended implementation class (with additional properties)
+ is configured on the <global-forwards> or <action-mappings> elements.
+ The following attributes are defined:
+
+ property Name of the JavaBeans property whose setter method
+ will be called.
+
+ value String representation of the value to which this
+ property will be set, after suitable type conversion
+-->
+<!ELEMENT set-property EMPTY>
+<!ATTLIST set-property id ID #IMPLIED>
+<!ATTLIST set-property property %PropName; #REQUIRED>
+<!ATTLIST set-property value CDATA #REQUIRED>
+
+
<!-- The "small-icon" element specifies the location, relative to the Struts
configuration file, of a resource containing a small (16x16 pixel)
icon image.
-->
-<!ELEMENT small-icon (%Location;)>
+<!ELEMENT small-icon (%Location;)>
<!ATTLIST small-icon id ID #IMPLIED>
1.1
jakarta-struts/src/example/org/apache/struts/webapp/example/DatabasePlugIn.java
Index: DatabasePlugIn.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-struts/src/example/org/apache/struts/webapp/example/DatabasePlugIn.java,v
1.1 2002/02/23 22:54:17 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2002/02/23 22:54:17 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Struts", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.struts.webapp.example;
import java.io.BufferedInputStream;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.IOException;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.MissingResourceException;
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.digester.Digester;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.action.PlugIn;
import org.apache.struts.config.ApplicationConfig;
import org.apache.struts.util.MessageResources;
/**
* <p><strong>DatabasePlugIn</strong> initializes and finalizes the
* persistent storage of User and Subscription information for the Struts
* Demonstration Application.</p>
*
* @author Craig R. McClanahan
* @version $Revision: 1.1 $ $Date: 2002/02/23 22:54:17 $
*/
public final class DatabasePlugIn implements PlugIn {
// ----------------------------------------------------- Instance Variables
/**
* The application configuration for our owning sub-application.
*/
private ApplicationConfig config = null;
/**
* The database of Users and their associated Subscriptions, keyed by
* username.
*/
private Hashtable database = null;
/**
* The {@link ActionServlet} owning this application.
*/
private ActionServlet servlet = null;
// ------------------------------------------------------------- Properties
/**
* The debugging detail level for this servlet.
*/
private int debug = 0;
public int getDebug() {
return (this.debug);
}
public void setDebug(int debug) {
this.debug = debug;
}
/**
* The resource path of our persistent database storage file.
*/
private String pathname = "/WEB-INF/database.xml";
public String getPathname() {
return (this.pathname);
}
public void setPathname(String pathname) {
this.pathname = pathname;
}
// --------------------------------------------------------- PlugIn Methods
/**
* Gracefully shut down this database, releasing any resources
* that were allocated at initialization.
*/
public void destroy() {
if (debug >= 1)
servlet.log("Finalizing database plug in");
// NOTE: We do not attempt to unload the database because there
// is no portable way to do so. Real applications will have used
// a real database, with no need to unload it
// Remove the database from our application attributes
servlet.getServletContext().removeAttribute(Constants.DATABASE_KEY);
servlet = null;
config = null;
}
/**
* Initialize and load our initial database from persistent storage.
*
* @param config The ApplicationConfig for our owning sub-application
*
* @exception ServletException if we cannot configure ourselves correctly
*/
public void init(ApplicationConfig config) throws ServletException {
// Remember our associated configuration and servlet
this.config = config;
this.servlet = config.getServlet();
// Load our database from persistent storage
try {
load();
servlet.getServletContext().setAttribute(Constants.DATABASE_KEY,
database);
} catch (Exception e) {
servlet.log("Database load exception", e);
throw new UnavailableException
("Cannot load database from '" + pathname + "'");
}
}
// --------------------------------------------------------- Public Methods
/**
* Add a new User to our database.
*
* @param user The user to be added
*/
public void addUser(User user) {
database.put(user.getUsername(), user);
}
// ------------------------------------------------------ Private Methods
/**
* Load our database from its persistent storage version.
*
* @exception Exception if any problem occurs while loading
*/
private synchronized void load() throws Exception {
// Initialize our database
database = new Hashtable();
// Acquire an input stream to our database file
if (debug >= 1)
servlet.log("Loading database from '" + pathname + "'");
InputStream is =
servlet.getServletContext().getResourceAsStream(pathname);
if (is == null) {
servlet.log("No such resource available - loading empty database");
return;
}
BufferedInputStream bis = new BufferedInputStream(is);
// Construct a digester to use for parsing
Digester digester = new Digester();
digester.push(this);
digester.setDebug(debug);
digester.setNamespaceAware(true);
digester.setValidating(false);
digester.addObjectCreate("database/user",
"org.apache.struts.webapp.example.User");
digester.addSetProperties("database/user");
digester.addSetNext("database/user", "addUser");
digester.addObjectCreate("database/user/subscription",
"org.apache.struts.webapp.example.Subscription");
digester.addSetProperties("database/user/subscription");
digester.addSetTop("database/user/subscription", "setUser");
// Parse the input stream to initialize our database
digester.parse(bis);
bis.close();
}
}
1.92 +45 -8
jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java
Index: ActionServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- ActionServlet.java 23 Jan 2002 18:59:12 -0000 1.91
+++ ActionServlet.java 23 Feb 2002 22:54:17 -0000 1.92
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.91
2002/01/23 18:59:12 craigmcc Exp $
- * $Revision: 1.91 $
- * $Date: 2002/01/23 18:59:12 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/ActionServlet.java,v 1.92
2002/02/23 22:54:17 craigmcc Exp $
+ * $Revision: 1.92 $
+ * $Date: 2002/02/23 22:54:17 $
*
* ====================================================================
*
@@ -267,7 +267,7 @@
*
* @author Craig R. McClanahan
* @author Ted Husted
- * @version $Revision: 1.91 $ $Date: 2002/01/23 18:59:12 $
+ * @version $Revision: 1.92 $ $Date: 2002/02/23 22:54:17 $
*/
public class ActionServlet
@@ -381,8 +381,8 @@
log(internal.getMessage("finalizing"));
}
- destroyDataSources();
destroyApplications();
+ destroyDataSources();
destroyInternal();
getServletContext().removeAttribute(Action.ACTION_SERVLET_KEY);
@@ -405,9 +405,11 @@
initServlet();
// Initialize sub-applications as needed
+ getServletContext().setAttribute(Action.ACTION_SERVLET_KEY, this);
ApplicationConfig ac = initApplicationConfig("", config);
initApplicationMessageResources(ac);
initApplicationDataSources(ac);
+ initApplicationPlugIns(ac);
Enumeration names = getServletConfig().getInitParameterNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
@@ -419,9 +421,9 @@
(prefix, getServletConfig().getInitParameter(name));
initApplicationMessageResources(ac);
initApplicationDataSources(ac);
+ initApplicationPlugIns(ac);
}
destroyConfigDigester();
- getServletContext().setAttribute(Action.ACTION_SERVLET_KEY, this);
}
@@ -625,16 +627,27 @@
*/
protected void destroyApplications() {
+ ArrayList values = new ArrayList();
Enumeration names = getServletContext().getAttributeNames();
while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
+ values.add(names.nextElement());
+ }
+ Iterator keys = values.iterator();
+ while (keys.hasNext()) {
+ String name = (String) keys.next();
Object value = getServletContext().getAttribute(name);
if (value instanceof ApplicationConfig) {
+ ApplicationConfig config = (ApplicationConfig) value;
try {
- ((ApplicationConfig) value).getProcessor().destroy();
+ config.getProcessor().destroy();
} catch (Throwable t) {
;
}
+ PlugIn plugIns[] = config.findPlugIns();
+ for (int i = 0; i < plugIns.length; i++) {
+ int j = plugIns.length - (i + 1);
+ plugIns[j].destroy();
+ }
}
}
@@ -827,6 +840,30 @@
if ("".equals(config.getPrefix())) {
initDataSources();
}
+
+ }
+
+
+ /**
+ * <p>Initialize the plug ins for the specified sub-application.</p>
+ *
+ * @param config ApplicationConfig information for this application
+ *
+ * @exception ServletException if initialization cannot be performed
+ */
+ protected void initApplicationPlugIns
+ (ApplicationConfig config) throws ServletException {
+
+ if (debug >= 1) {
+ log("Initializing application path '" + config.getPrefix() +
+ "' plug ins");
+ }
+
+ PlugIn plugIns[] = config.findPlugIns();
+ for (int i = 0; i < plugIns.length; i++) {
+ plugIns[i].init(config);
+ }
+
}
1.1 jakarta-struts/src/share/org/apache/struts/action/PlugIn.java
Index: PlugIn.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/PlugIn.java,v 1.1
2002/02/23 22:54:17 craigmcc Exp $
* $Revision: 1.1 $
* $Date: 2002/02/23 22:54:17 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Struts", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.struts.action;
import javax.servlet.ServletException;
import org.apache.struts.config.ApplicationConfig;
/**
* <p>A <strong>PlugIn</strong> is a configuration wrapper for an application
* specific module or service that needs to be notified about application
* startup and application shutdown events (i.e. corresponding to when the
* container calls <code>init()</code> and <code>destroy()</code> on the
* corresponding {@link ActionServlet} instance). PlugIn modules can be
* configured in the <code>struts-config.xml</code> file, without the need
* to subclass {@link ActionServlet} simply to perform application lifecycle
* activities.</p>
*
* <p>Implementations of this interface must supply a zero-argument constructor
* for use by {@link ActionServlet}. Configuration can be accomplished by
* providing standard JavaBeans property setter methods, which will all have
* been called before the <code>init()</code> method is invoked.</p>
*
* @author Craig R. McClanahan
* @version $Revision: 1.1 $ $Date: 2002/02/23 22:54:17 $
*/
public interface PlugIn {
/**
* <p>Receive notification that our owning sub-application is being
* shut down.</p>
*/
public void destroy();
/**
* <p>Receive notification that the specified sub-applicaiton is being
* started up.</p>
*
* @param config ApplicationConfig for the sub-application with which
* this plug in is associated
*
* @exception ServletException if this <code>PlugIn</code> cannot
* be successfully initialized
*/
public void init(ApplicationConfig config) throws ServletException;
}
1.9 +40 -4
jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java
Index: ApplicationConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ApplicationConfig.java 20 Jan 2002 05:34:08 -0000 1.8
+++ ApplicationConfig.java 23 Feb 2002 22:54:18 -0000 1.9
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java,v
1.8 2002/01/20 05:34:08 craigmcc Exp $
- * $Revision: 1.8 $
- * $Date: 2002/01/20 05:34:08 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java,v
1.9 2002/02/23 22:54:18 craigmcc Exp $
+ * $Revision: 1.9 $
+ * $Date: 2002/02/23 22:54:18 $
*
* ====================================================================
*
@@ -64,10 +64,12 @@
import java.io.Serializable;
+import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import org.apache.commons.collections.FastHashMap;
import org.apache.struts.action.ActionServlet;
+import org.apache.struts.action.PlugIn;
import org.apache.struts.action.RequestProcessor;
@@ -82,7 +84,7 @@
* previous Struts behavior that only supported one application.</p>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.8 $ $Date: 2002/01/20 05:34:08 $
+ * @version $Revision: 1.9 $ $Date: 2002/02/23 22:54:18 $
* @since Struts 1.1
*/
@@ -153,6 +155,13 @@
protected FastHashMap messageResources = new FastHashMap();
+ /**
+ * The set of configured plug in modules for this application,
+ * if any, in the order they were declared and configured.
+ */
+ protected ArrayList plugIns = new ArrayList();
+
+
// ------------------------------------------------------------- Properties
@@ -349,6 +358,21 @@
/**
+ * Add a newly configured {@link PlugIn} instance to the set of
+ * plug in modules for this application.
+ *
+ * @param plugIn The new configured plugIn module
+ */
+ public void addPlugIn(PlugIn plugIn) {
+
+ if (configured)
+ throw new IllegalStateException("Configuration is frozen");
+ plugIns.add(plugIn);
+
+ }
+
+
+ /**
* Return the action configuration for the specified path, if any;
* otherwise return <code>null</code>.
*
@@ -496,6 +520,18 @@
new MessageResourcesConfig[messageResources.size()];
return ((MessageResourcesConfig[])
messageResources.values().toArray(results));
+
+ }
+
+
+ /**
+ * Return the configured plug in modules for this application. If there
+ * are none, a zero-length array is returned.
+ */
+ public PlugIn[] findPlugIns() {
+
+ PlugIn results[] = new PlugIn[plugIns.size()];
+ return ((PlugIn[]) plugIns.toArray(results));
}
1.7 +19 -4
jakarta-struts/src/share/org/apache/struts/config/ConfigRuleSet.java
Index: ConfigRuleSet.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ConfigRuleSet.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ConfigRuleSet.java 17 Jan 2002 00:15:05 -0000 1.6
+++ ConfigRuleSet.java 23 Feb 2002 22:54:18 -0000 1.7
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ConfigRuleSet.java,v 1.6
2002/01/17 00:15:05 craigmcc Exp $
- * $Revision: 1.6 $
- * $Date: 2002/01/17 00:15:05 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ConfigRuleSet.java,v 1.7
2002/02/23 22:54:18 craigmcc Exp $
+ * $Revision: 1.7 $
+ * $Date: 2002/02/23 22:54:18 $
*
* ====================================================================
*
@@ -74,7 +74,7 @@
* configuration file (<code>struts-config.xml</code>).</p>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.6 $ $Date: 2002/01/17 00:15:05 $
+ * @version $Revision: 1.7 $ $Date: 2002/02/23 22:54:18 $
* @since Struts 1.1
*/
@@ -249,6 +249,21 @@
digester.addSetProperty
("struts-config/message-resources/set-property",
+ "property", "value");
+
+ digester.addObjectCreate
+ ("struts-config/plug-in",
+ null, // Class name MUST be specified in the element
+ "className");
+ digester.addSetProperties
+ ("struts-config/plug-in");
+ digester.addSetNext
+ ("struts-config/plug-in",
+ "addPlugIn",
+ "org.apache.struts.action.PlugIn");
+
+ digester.addSetProperty
+ ("struts-config/plug-in/set-property",
"property", "value");
}
1.16 +9 -1 jakarta-struts/web/example/WEB-INF/struts-config.xml
Index: struts-config.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/web/example/WEB-INF/struts-config.xml,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- struts-config.xml 17 Jan 2002 00:15:05 -0000 1.15
+++ struts-config.xml 23 Feb 2002 22:54:18 -0000 1.16
@@ -156,7 +156,15 @@
<action path="/admin/removeMapping"
type="org.apache.struts.actions.RemoveMappingAction"/>
-
</action-mappings>
+
+
+ <!-- ========== Plug Ins Configuration ================================== -->
+
+ <plug-in className="org.apache.struts.webapp.example.DatabasePlugIn">
+ <set-property property="debug" value="9"/>
+ <set-property property="pathname" value="/WEB-INF/database.xml"/>
+ </plug-in>
+
</struts-config>
1.14 +0 -12 jakarta-struts/web/example/WEB-INF/web.xml
Index: web.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/web/example/WEB-INF/web.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- web.xml 16 Jul 2001 00:44:59 -0000 1.13
+++ web.xml 23 Feb 2002 22:54:18 -0000 1.14
@@ -7,18 +7,6 @@
<web-app>
- <!-- Database Initialization Servlet Configuration -->
- <servlet>
- <servlet-name>database</servlet-name>
- <servlet-class>org.apache.struts.webapp.example.DatabaseServlet</servlet-class>
- <init-param>
- <param-name>debug</param-name>
- <param-value>2</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
-
<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>