craigmcc 01/12/30 17:58:26
Modified: conf/share struts-config_1_1.dtd
src/share/org/apache/struts/config ActionConfig.java
ApplicationConfig.java
Log:
Tag each ActionConfig with the ApplicationConfig it is associated with. This
will facilitate implementing the local-then-global lookup of appropriate
ExceptionConfig and ForwardConfig objects.
When the ApplicationConfig object is frozen, set all FastHashMap instances
to fast mode. NOTE: If we remove the ability to modify the configuration
after the controller servlet has started, these can all become regular
HashMap instances instead.
Revision Changes Path
1.5 +2 -2 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- struts-config_1_1.dtd 31 Dec 2001 01:14:36 -0000 1.4
+++ struts-config_1_1.dtd 31 Dec 2001 01:58:26 -0000 1.5
@@ -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.4 2001/12/31 01:14:36 craigmcc Exp $
+ $Id: struts-config_1_1.dtd,v 1.5 2001/12/31 01:58:26 craigmcc Exp $
-->
@@ -177,7 +177,7 @@
hierarchical Determines if the exception's class hierarchy should be
used to determine the correct handler.
- key Resource bundle key specifying the error message
+ key Message resources key specifying the error message
associated with this exception.
path The context-relative path of the resource to
1.3 +49 -9
jakarta-struts/src/share/org/apache/struts/config/ActionConfig.java
Index: ActionConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ActionConfig.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ActionConfig.java 31 Dec 2001 01:42:13 -0000 1.2
+++ ActionConfig.java 31 Dec 2001 01:58:26 -0000 1.3
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ActionConfig.java,v 1.2
2001/12/31 01:42:13 craigmcc Exp $
- * $Revision: 1.2 $
- * $Date: 2001/12/31 01:42:13 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ActionConfig.java,v 1.3
2001/12/31 01:58:26 craigmcc Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/12/31 01:58:26 $
*
* ====================================================================
*
@@ -74,7 +74,7 @@
* configuration file.</p>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.2 $ $Date: 2001/12/31 01:42:13 $
+ * @version $Revision: 1.3 $ $Date: 2001/12/31 01:58:26 $
* @since Struts 1.1
*/
@@ -102,6 +102,20 @@
/**
+ * The application configuration with which we are associated.
+ */
+ protected ApplicationConfig applicationConfig = null;
+
+ public ApplicationConfig getApplicationConfig() {
+ return (this.applicationConfig);
+ }
+
+ public void setApplicationConfig(ApplicationConfig applicationConfig) {
+ this.applicationConfig = applicationConfig;
+ }
+
+
+ /**
* The request-scope or session-scope attribute name under which our
* form bean is accessed, if it is different from the form bean's
* specified <code>name</code>.
@@ -369,10 +383,10 @@
/**
- * Add a new <code>ExceptionConfig</code> object to the set associated
+ * Add a new <code>ExceptionConfig</code> instance to the set associated
* with this action.
*
- * @param config The new configuration object to be added
+ * @param config The new configuration instance to be added
*
* @exception IllegalStateException if this application configuration
* has been frozen
@@ -385,10 +399,10 @@
/**
- * Add a new <code>ForwardConfig</code> object to the set of global
+ * Add a new <code>ForwardConfig</code> instance to the set of global
* forwards associated with this action.
*
- * @param config The new configuration object to be added
+ * @param config The new configuration instance to be added
*
* @exception IllegalStateException if this application configuration
* has been frozen
@@ -451,7 +465,33 @@
/**
- * Remove the forward configuration for the specified key.
+ * Freeze the configuration of this action.
+ */
+ public void freeze() {
+
+ exceptions.setFast(true);
+ forwards.setFast(true);
+
+ }
+
+
+ /**
+ * Remove the specified exception configuration instance.
+ *
+ * @param config ExceptionConfig instance to be removed
+ *
+ * @exception IllegalStateException if this application configuration
+ * has been frozen
+ */
+ public void removeExceptionConfig(ExceptionConfig config) {
+
+ exceptions.remove(config.getType());
+
+ }
+
+
+ /**
+ * Remove the specified forward configuration instance.
*
* @param config ForwardConfig instance to be removed
*
1.4 +62 -17
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ApplicationConfig.java 31 Dec 2001 01:42:13 -0000 1.3
+++ ApplicationConfig.java 31 Dec 2001 01:58:26 -0000 1.4
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java,v
1.3 2001/12/31 01:42:13 craigmcc Exp $
- * $Revision: 1.3 $
- * $Date: 2001/12/31 01:42:13 $
+ * $Header:
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java,v
1.4 2001/12/31 01:58:26 craigmcc Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/12/31 01:58:26 $
*
* ====================================================================
*
@@ -78,7 +78,7 @@
* previous Struts behavior that only supported one application.</p>
*
* @author Craig R. McClanahan
- * @version $Revision: 1.3 $ $Date: 2001/12/31 01:42:13 $
+ * @version $Revision: 1.4 $ $Date: 2001/12/31 01:58:26 $
* @since Struts 1.1
*/
@@ -221,10 +221,10 @@
/**
- * Add a new <code>ActionConfig</code> object to the set associated
+ * Add a new <code>ActionConfig</code> instance to the set associated
* with this application.
*
- * @param config The new configuration object to be added
+ * @param config The new configuration instance to be added
*
* @exception IllegalStateException if this application configuration
* has been frozen
@@ -233,16 +233,17 @@
if (configured)
throw new IllegalStateException("Configuration is frozen");
+ config.setApplicationConfig(this);
actions.put(config.getPath(), config);
}
/**
- * Add a new <code>DataSourceConfig</code> object to the set associated
+ * Add a new <code>DataSourceConfig</code> instance to the set associated
* with this application.
*
- * @param config The new configuration object to be added
+ * @param config The new configuration instance to be added
*
* @exception IllegalStateException if this application configuration
* has been frozen
@@ -257,10 +258,10 @@
/**
- * Add a new <code>ExceptionConfig</code> object to the set associated
+ * Add a new <code>ExceptionConfig</code> instance to the set associated
* with this application.
*
- * @param config The new configuration object to be added
+ * @param config The new configuration instance to be added
*
* @exception IllegalStateException if this application configuration
* has been frozen
@@ -275,10 +276,10 @@
/**
- * Add a new <code>FormBeanConfig</code> object to the set associated
+ * Add a new <code>FormBeanConfig</code> instance to the set associated
* with this application.
*
- * @param config The new configuration object to be added
+ * @param config The new configuration instance to be added
*
* @exception IllegalStateException if this application configuration
* has been frozen
@@ -293,10 +294,10 @@
/**
- * Add a new <code>ForwardConfig</code> object to the set of global
+ * Add a new <code>ForwardConfig</code> instance to the set of global
* forwards associated with this application.
*
- * @param config The new configuration object to be added
+ * @param config The new configuration instance to be added
*
* @exception IllegalStateException if this application configuration
* has been frozen
@@ -443,12 +444,56 @@
public void freeze() {
this.configured = true;
+ actions.setFast(true);
+ dataSources.setFast(true);
+ exceptions.setFast(true);
+ formBeans.setFast(true);
+ forwards.setFast(true);
+ ActionConfig[] configs = findActionConfigs();
+ for (int i = 0; i < configs.length; i++) {
+ configs[i].freeze();
+ }
}
/**
- * Remove the data source configuration for the specified key.
+ * Remove the specified action configuration instance.
+ *
+ * @param config ActionConfig instance to be removed
+ *
+ * @exception IllegalStateException if this application configuration
+ * has been frozen
+ */
+ public void removeActionConfig(ActionConfig config) {
+
+ if (configured)
+ throw new IllegalStateException("Configuration is frozen");
+ config.setApplicationConfig(null);
+ actions.remove(config.getPath());
+
+ }
+
+
+ /**
+ * Remove the specified exception configuration instance.
+ *
+ * @param config ActionConfig instance to be removed
+ *
+ * @exception IllegalStateException if this application configuration
+ * has been frozen
+ */
+ public void removeExceptionConfig(ExceptionConfig config) {
+
+ if (configured)
+ throw new IllegalStateException("Configuration is frozen");
+ exceptions.remove(config.getType());
+
+ }
+
+
+ /**
+ * Remove the specified data source configuration instance.
*
* @param config DataSourceConfig instance to be removed
*
@@ -465,7 +510,7 @@
/**
- * Remove the form bean configuration for the specified key.
+ * Remove the specified form bean configuration instance.
*
* @param config FormBeanConfig instance to be removed
*
@@ -482,7 +527,7 @@
/**
- * Remove the forward configuration for the specified key.
+ * Remove the specified forward configuration instance.
*
* @param config ForwardConfig instance to be removed
*
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>