craigmcc    02/02/23 15:53:30

  Modified:    src/share/org/apache/struts/config ActionConfig.java
                        ApplicationConfig.java ControllerConfig.java
                        DataSourceConfig.java ExceptionConfig.java
                        FormBeanConfig.java FormPropertyConfig.java
                        ForwardConfig.java MessageResourcesConfig.java
  Log:
  Tighten up the immutability of the standard configuration objects (after
  initialization has been completed) by rippling this state all the way down
  the configuration object trees, instead of limiting it to the top level.
  
  Revision  Changes    Path
  1.5       +84 -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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ActionConfig.java 13 Jan 2002 00:25:36 -0000      1.4
  +++ ActionConfig.java 23 Feb 2002 23:53:29 -0000      1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ActionConfig.java,v 1.4 
2002/01/13 00:25:36 craigmcc Exp $
  - * $Revision: 1.4 $
  - * $Date: 2002/01/13 00:25:36 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ActionConfig.java,v 1.5 
2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.5 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -65,8 +65,8 @@
   
   import java.io.Serializable;
   import java.util.ArrayList;
  +import java.util.HashMap;
   import javax.servlet.http.HttpServletRequest;
  -import org.apache.commons.collections.FastHashMap;
   
   
   /**
  @@ -75,7 +75,7 @@
    * configuration file.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2002/01/13 00:25:36 $
  + * @version $Revision: 1.5 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
  @@ -86,17 +86,23 @@
   
   
       /**
  +     * Has configuration of this component been completed?
  +     */
  +    protected boolean configured = false;
  +
  +
  +    /**
        * The set of exception handling configurations for this
        * action, if any, keyed by the <code>type</code> property.
        */
  -    protected FastHashMap exceptions = new FastHashMap();
  +    protected HashMap exceptions = new HashMap();
   
   
       /**
        * The set of local forward configurations for this action, if any,
        * keyed by the <code>name</code> property.
        */
  -    protected FastHashMap forwards = new FastHashMap();
  +    protected HashMap forwards = new HashMap();
   
   
       // ------------------------------------------------------------- Properties
  @@ -112,6 +118,9 @@
       }
   
       public void setApplicationConfig(ApplicationConfig applicationConfig) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.applicationConfig = applicationConfig;
       }
   
  @@ -132,6 +141,9 @@
       }
   
       public void setAttribute(String attribute) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.attribute = attribute;
       }
   
  @@ -150,6 +162,9 @@
       }
   
       public void setForward(String forward) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.forward = forward;
       }
   
  @@ -168,6 +183,9 @@
       }
   
       public void setInclude(String include) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.include = include;
       }
   
  @@ -184,6 +202,9 @@
       }
   
       public void setInput(String input) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.input = input;
       }
   
  @@ -200,6 +221,9 @@
       }
   
       public void setMultipartClass(String multipartClass) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.multipartClass = multipartClass;
       }
   
  @@ -214,6 +238,9 @@
       }
   
       public void setName(String name) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.name = name;
       }
   
  @@ -230,6 +257,9 @@
       }
   
       public void setParameter(String parameter) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.parameter = parameter;
       }
   
  @@ -246,6 +276,9 @@
       }
   
       public void setPath(String path) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.path = path;
       }
   
  @@ -261,6 +294,9 @@
       }
   
       public void setPrefix(String prefix) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.prefix = prefix;
       }
   
  @@ -276,6 +312,9 @@
       }
   
       public void setRoles(String roles) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.roles = roles;
           if (roles == null) {
               roleNames = new String[0];
  @@ -318,6 +357,9 @@
       }
   
       public void setScope(String scope) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.scope = scope;
       }
   
  @@ -333,6 +375,9 @@
       }
   
       public void setSuffix(String suffix) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.suffix = suffix;
       }
   
  @@ -351,6 +396,9 @@
       }
   
       public void setType(String type) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.type = type;
       }
   
  @@ -366,6 +414,9 @@
       }
   
       public void setUnknown(boolean unknown) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.unknown = unknown;
       }
   
  @@ -380,6 +431,9 @@
       }
   
       public void setValidate(boolean validate) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.validate = validate;
       }
   
  @@ -398,6 +452,9 @@
        */
       public void addExceptionConfig(ExceptionConfig config) {
   
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           exceptions.put(config.getType(), config);
   
       }
  @@ -414,6 +471,9 @@
        */
       public void addForwardConfig(ForwardConfig config) {
   
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           forwards.put(config.getName(), config);
   
       }
  @@ -474,8 +534,17 @@
        */
       public void freeze() {
   
  -        exceptions.setFast(true);
  -        forwards.setFast(true);
  +        configured = true;
  +
  +        ExceptionConfig[] econfigs = findExceptionConfigs();
  +        for (int i = 0; i < econfigs.length; i++) {
  +            econfigs[i].freeze();
  +        }
  +
  +        ForwardConfig[] fconfigs = findForwardConfigs();
  +        for (int i = 0; i < fconfigs.length; i++) {
  +            fconfigs[i].freeze();
  +        }
   
       }
   
  @@ -490,6 +559,9 @@
        */
       public void removeExceptionConfig(ExceptionConfig config) {
   
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           exceptions.remove(config.getType());
   
       }
  @@ -505,6 +577,9 @@
        */
       public void removeForwardConfig(ForwardConfig config) {
   
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           forwards.remove(config.getName());
   
       }
  
  
  
  1.10      +72 -35    
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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ApplicationConfig.java    23 Feb 2002 22:54:18 -0000      1.9
  +++ ApplicationConfig.java    23 Feb 2002 23:53:29 -0000      1.10
  @@ -1,7 +1,7 @@
   /*
  - * $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 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java,v 
1.10 2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.10 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -65,9 +65,9 @@
   
   import java.io.Serializable;
   import java.util.ArrayList;
  +import java.util.HashMap;
   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;
  @@ -84,7 +84,7 @@
    * previous Struts behavior that only supported one application.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.9 $ $Date: 2002/02/23 22:54:18 $
  + * @version $Revision: 1.10 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
  @@ -117,42 +117,42 @@
        * The set of action configurations for this application, if any,
        * keyed by the <code>path</code> property.
        */
  -    protected FastHashMap actionConfigs = new FastHashMap();
  +    protected HashMap actionConfigs = new HashMap();
   
   
       /**
        * The set of JDBC data source configurations for this
        * application, if any, keyed by the <code>key</code> property.
        */
  -    protected FastHashMap dataSources = new FastHashMap();
  +    protected HashMap dataSources = new HashMap();
   
   
       /**
        * The set of exception handling configurations for this
        * application, if any, keyed by the <code>type</code> property.
        */
  -    protected FastHashMap exceptions = new FastHashMap();
  +    protected HashMap exceptions = new HashMap();
   
   
       /**
        * The set of form bean configurations for this application, if any,
        * keyed by the <code>name</code> property.
        */
  -    protected FastHashMap formBeans = new FastHashMap();
  +    protected HashMap formBeans = new HashMap();
   
   
       /**
        * The set of global forward configurations for this application, if any,
        * keyed by the <code>name</code> property.
        */
  -    protected FastHashMap forwards = new FastHashMap();
  +    protected HashMap forwards = new HashMap();
   
   
       /**
        * The set of message resources configurations for this
        * application, if any, keyed by the <code>key</code> property.
        */
  -    protected FastHashMap messageResources = new FastHashMap();
  +    protected HashMap messageResources = new HashMap();
   
   
       /**
  @@ -183,14 +183,16 @@
       protected ControllerConfig controllerConfig = null;
   
       public ControllerConfig getControllerConfig() {
  -        if (this.controllerConfig == null)
  +        if (this.controllerConfig == null) {
               this.controllerConfig = new ControllerConfig();
  +        }
           return (this.controllerConfig);
       }
   
       public void setControllerConfig(ControllerConfig cc) {
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           this.controllerConfig = cc;
       }
   
  @@ -259,8 +261,9 @@
        */
       public void addActionConfig(ActionConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           config.setApplicationConfig(this);
           actionConfigs.put(config.getPath(), config);
   
  @@ -278,8 +281,9 @@
        */
       public void addDataSourceConfig(DataSourceConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           dataSources.put(config.getKey(), config);
   
       }
  @@ -296,8 +300,9 @@
        */
       public void addExceptionConfig(ExceptionConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           exceptions.put(config.getType(), config);
   
       }
  @@ -314,8 +319,9 @@
        */
       public void addFormBeanConfig(FormBeanConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           formBeans.put(config.getName(), config);
   
       }
  @@ -332,8 +338,9 @@
        */
       public void addForwardConfig(ForwardConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           forwards.put(config.getName(), config);
   
       }
  @@ -350,8 +357,9 @@
        */
       public void addMessageResourcesConfig(MessageResourcesConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           messageResources.put(config.getKey(), config);
   
       }
  @@ -365,8 +373,9 @@
        */
       public void addPlugIn(PlugIn plugIn) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           plugIns.add(plugIn);
   
       }
  @@ -544,15 +553,37 @@
       public void freeze() {
   
           this.configured = true;
  -        actionConfigs.setFast(true);
  -        dataSources.setFast(true);
  -        exceptions.setFast(true);
  -        formBeans.setFast(true);
  -        forwards.setFast(true);
  -        messageResources.setFast(true);
  -        ActionConfig[] configs = findActionConfigs();
  -        for (int i = 0; i < configs.length; i++) {
  -            configs[i].freeze();
  +
  +        ActionConfig[] aconfigs = findActionConfigs();
  +        for (int i = 0; i < aconfigs.length; i++) {
  +            aconfigs[i].freeze();
  +        }
  +
  +        getControllerConfig().freeze();
  +
  +        DataSourceConfig[] dsconfigs = findDataSourceConfigs();
  +        for (int i = 0; i < dsconfigs.length; i++) {
  +            dsconfigs[i].freeze();
  +        }
  +
  +        ExceptionConfig[] econfigs = findExceptionConfigs();
  +        for (int i = 0; i < econfigs.length; i++) {
  +            econfigs[i].freeze();
  +        }
  +
  +        FormBeanConfig[] fbconfigs = findFormBeanConfigs();
  +        for (int i = 0; i < fbconfigs.length; i++) {
  +            fbconfigs[i].freeze();
  +        }
  +
  +        ForwardConfig[] fconfigs = findForwardConfigs();
  +        for (int i = 0; i < fconfigs.length; i++) {
  +            fconfigs[i].freeze();
  +        }
  +
  +        MessageResourcesConfig[] mrconfigs = findMessageResourcesConfigs();
  +        for (int i = 0; i < mrconfigs.length; i++) {
  +            mrconfigs[i].freeze();
           }
   
       }
  @@ -568,8 +599,9 @@
        */
       public void removeActionConfig(ActionConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           config.setApplicationConfig(null);
           actionConfigs.remove(config.getPath());
   
  @@ -586,8 +618,9 @@
        */
       public void removeExceptionConfig(ExceptionConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           exceptions.remove(config.getType());
   
       }
  @@ -603,8 +636,9 @@
        */
       public void removeDataSourceConfig(DataSourceConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           dataSources.remove(config.getKey());
   
       }
  @@ -620,8 +654,9 @@
        */
       public void removeFormBeanConfig(FormBeanConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           formBeans.remove(config.getName());
   
       }
  @@ -637,8 +672,9 @@
        */
       public void removeForwardConfig(ForwardConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           forwards.remove(config.getName());
   
       }
  @@ -654,8 +690,9 @@
        */
       public void removeMessageResourcesConfig(MessageResourcesConfig config) {
   
  -        if (configured)
  +        if (configured) {
               throw new IllegalStateException("Configuration is frozen");
  +        }
           messageResources.remove(config.getKey());
   
       }
  
  
  
  1.4       +50 -4     
jakarta-struts/src/share/org/apache/struts/config/ControllerConfig.java
  
  Index: ControllerConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ControllerConfig.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ControllerConfig.java     13 Jan 2002 04:21:18 -0000      1.3
  +++ ControllerConfig.java     23 Feb 2002 23:53:29 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ControllerConfig.java,v 
1.3 2002/01/13 04:21:18 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/01/13 04:21:18 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ControllerConfig.java,v 
1.4 2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -72,13 +72,22 @@
    * configuration file.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2002/01/13 04:21:18 $
  + * @version $Revision: 1.4 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
   public class ControllerConfig implements Serializable {
   
   
  +    // ----------------------------------------------------- Instance Variables
  +
  +
  +    /**
  +     * Has this component been completely configured?
  +     */
  +    protected boolean configured = false;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -92,6 +101,9 @@
       }
   
       public void setBufferSize(int bufferSize) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.bufferSize = bufferSize;
       }
   
  @@ -106,6 +118,9 @@
       }
   
       public void setContentType(String contentType) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.contentType = contentType;
       }
   
  @@ -120,6 +135,9 @@
       }
   
       public void setDebug(int debug) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.debug = debug;
       }
   
  @@ -134,6 +152,9 @@
       }
   
       public void setLocale(boolean locale) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.locale = locale;
       }
   
  @@ -148,6 +169,9 @@
       }
   
       public void setMaxFileSize(String maxFileSize) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.maxFileSize = maxFileSize;
       }
   
  @@ -164,6 +188,9 @@
       }
   
       public void setMultipartClass(String multipartClass) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.multipartClass = multipartClass;
       }
   
  @@ -178,6 +205,9 @@
       }
   
       public void setNocache(boolean nocache) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.nocache = nocache;
       }
   
  @@ -194,6 +224,9 @@
       }
   
       public void setProcessorClass(String processorClass) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.processorClass = processorClass;
       }
   
  @@ -208,11 +241,24 @@
       }
   
       public void setTempDir(String tempDir) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.tempDir = tempDir;
       }
   
   
       // --------------------------------------------------------- Public Methods
  +
  +
  +    /**
  +     * Freeze the configuration of this component.
  +     */
  +    public void freeze() {
  +
  +        configured = true;
  +
  +    }
   
   
       /**
  
  
  
  1.4       +32 -4     
jakarta-struts/src/share/org/apache/struts/config/DataSourceConfig.java
  
  Index: DataSourceConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/DataSourceConfig.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DataSourceConfig.java     16 Jan 2002 17:42:40 -0000      1.3
  +++ DataSourceConfig.java     23 Feb 2002 23:53:29 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/DataSourceConfig.java,v 
1.3 2002/01/16 17:42:40 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/01/16 17:42:40 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/DataSourceConfig.java,v 
1.4 2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -80,7 +80,7 @@
    * of them may be ignored by custom data source implementations.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2002/01/16 17:42:40 $
  + * @version $Revision: 1.4 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
  @@ -88,6 +88,15 @@
   
   
   
  +    // ----------------------------------------------------- Instance Variables
  +
  +
  +    /**
  +     * Has this component been completely configured?
  +     */
  +    protected boolean configured = false;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -102,6 +111,9 @@
       }
   
       public void setKey(String key) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.key = key;
       }
   
  @@ -127,6 +139,9 @@
       }
   
       public void setType(String type) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.type = type;
       }
   
  @@ -142,7 +157,20 @@
        */
       public void addProperty(String name, String value) {
   
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           properties.put(name, value);
  +
  +    }
  +
  +
  +    /**
  +     * Freeze the configuration of this data source.
  +     */
  +    public void freeze() {
  +
  +        configured = true;
   
       }
   
  
  
  
  1.3       +38 -4     
jakarta-struts/src/share/org/apache/struts/config/ExceptionConfig.java
  
  Index: ExceptionConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ExceptionConfig.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExceptionConfig.java      13 Jan 2002 00:25:36 -0000      1.2
  +++ ExceptionConfig.java      23 Feb 2002 23:53:29 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ExceptionConfig.java,v 1.2 
2002/01/13 00:25:36 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/01/13 00:25:36 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ExceptionConfig.java,v 1.3 
2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -72,13 +72,22 @@
    * configuration file.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2002/01/13 00:25:36 $
  + * @version $Revision: 1.3 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
   public class ExceptionConfig implements Serializable {
   
   
  +    // ----------------------------------------------------- Instance Variables
  +
  +
  +    /**
  +     * Has this component been completely configured?
  +     */
  +    protected boolean configured = false;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -93,6 +102,9 @@
       }
   
       public void setHandler(String handler) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.handler = handler;
       }
   
  @@ -108,6 +120,9 @@
       }
   
       public void setKey(String key) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.key = key;
       }
   
  @@ -123,6 +138,9 @@
       }
   
       public void setPath(String path) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.path = path;
       }
   
  @@ -138,6 +156,9 @@
       }
   
       public void setScope(String scope) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.scope = scope;
       }
   
  @@ -153,11 +174,24 @@
       }
   
       public void setType(String type) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.type = type;
       }
   
   
       // --------------------------------------------------------- Public Methods
  +
  +
  +    /**
  +     * Freeze the configuration of this component.
  +     */
  +    public void freeze() {
  +
  +        configured = true;
  +
  +    }
   
   
       /**
  
  
  
  1.4       +42 -6     
jakarta-struts/src/share/org/apache/struts/config/FormBeanConfig.java
  
  Index: FormBeanConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/FormBeanConfig.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormBeanConfig.java       17 Jan 2002 00:15:05 -0000      1.3
  +++ FormBeanConfig.java       23 Feb 2002 23:53:29 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/FormBeanConfig.java,v 1.3 
2002/01/17 00:15:05 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/01/17 00:15:05 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/FormBeanConfig.java,v 1.4 
2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -64,7 +64,7 @@
   
   
   import java.io.Serializable;
  -import org.apache.commons.collections.FastHashMap;
  +import java.util.HashMap;
   
   
   /**
  @@ -73,7 +73,7 @@
    * configuration file.<p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2002/01/17 00:15:05 $
  + * @version $Revision: 1.4 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
  @@ -84,10 +84,16 @@
   
   
       /**
  +     * Has this component been completely configured?
  +     */
  +    protected boolean configured = false;
  +
  +
  +    /**
        * The set of FormProperty elements defining dynamic form properties for
        * this form bean, keyed by property name.
        */
  -    protected FastHashMap formProperties = new FastHashMap();
  +    protected HashMap formProperties = new HashMap();
   
   
       // ------------------------------------------------------------- Properties
  @@ -104,6 +110,9 @@
       }
   
       public void setDynamic(boolean dynamic) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.dynamic = dynamic;
       }
   
  @@ -121,6 +130,9 @@
       }
   
       public void setName(String name) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.name = name;
       }
   
  @@ -136,6 +148,9 @@
       }
   
       public void setType(String type) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.type = type;
           if ("org.apache.struts.action.DynaActionForm".equals(type)) {
               this.dynamic = true;
  @@ -154,6 +169,9 @@
        */
       public void addFormPropertyConfig(FormPropertyConfig config) {
   
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           formProperties.put(config.getName(), config);
   
       }
  @@ -186,12 +204,30 @@
   
   
       /**
  +     * Freeze the configuration of this component.
  +     */
  +    public void freeze() {
  +
  +        configured = true;
  +
  +        FormPropertyConfig[] fpconfigs = findFormPropertyConfigs();
  +        for (int i = 0; i < fpconfigs.length; i++) {
  +            fpconfigs[i].freeze();
  +        }
  +
  +    }
  +
  +
  +    /**
        * Remove the specified form property configuration instance.
        *
        * @param config FormPropertyConfig instance to be removed
        */
       public void removeFormPropertyConfig(FormPropertyConfig config) {
   
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           formProperties.remove(config.getName());
   
       }
  
  
  
  1.4       +29 -4     
jakarta-struts/src/share/org/apache/struts/config/FormPropertyConfig.java
  
  Index: FormPropertyConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/FormPropertyConfig.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FormPropertyConfig.java   17 Jan 2002 21:26:18 -0000      1.3
  +++ FormPropertyConfig.java   23 Feb 2002 23:53:29 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/FormPropertyConfig.java,v 
1.3 2002/01/17 21:26:18 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/01/17 21:26:18 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/FormPropertyConfig.java,v 
1.4 2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -74,7 +74,7 @@
    * configuration file.<p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2002/01/17 21:26:18 $
  + * @version $Revision: 1.4 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
  @@ -85,6 +85,12 @@
   
   
       /**
  +     * Has this component been completely configured?
  +     */
  +    protected boolean configured = false;
  +
  +
  +    /**
        * Have we calculated the initial value object yet?
        */
       protected transient boolean initialized = false;
  @@ -109,6 +115,9 @@
       }
   
       public void setInitial(String initial) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.initial = initial;
       }
   
  @@ -123,6 +132,9 @@
       }
   
       public void setName(String name) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.name = name;
       }
   
  @@ -139,6 +151,9 @@
       }
   
       public void setType(String type) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.type = type;
       }
   
  @@ -237,6 +252,16 @@
               initialized = true;
           }
           return (initialValue);
  +
  +    }
  +
  +
  +    /**
  +     * Freeze the configuration of this component.
  +     */
  +    public void freeze() {
  +
  +        configured = true;
   
       }
   
  
  
  
  1.3       +35 -4     
jakarta-struts/src/share/org/apache/struts/config/ForwardConfig.java
  
  Index: ForwardConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ForwardConfig.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ForwardConfig.java        13 Jan 2002 00:25:36 -0000      1.2
  +++ ForwardConfig.java        23 Feb 2002 23:53:29 -0000      1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ForwardConfig.java,v 1.2 
2002/01/13 00:25:36 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2002/01/13 00:25:36 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ForwardConfig.java,v 1.3 
2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -72,13 +72,22 @@
    * configuration file.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2002/01/13 00:25:36 $
  + * @version $Revision: 1.3 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
   public class ForwardConfig implements Serializable {
   
   
  +    // ----------------------------------------------------- Instance Variables
  +
  +
  +    /**
  +     * Has this component been completely configured?
  +     */
  +    protected boolean configured = false;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -94,6 +103,9 @@
       }
   
       public void setContextRelative(boolean contextRelative) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.contextRelative = contextRelative;
       }
   
  @@ -109,6 +121,9 @@
       }
   
       public void setName(String name) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.name = name;
       }
   
  @@ -125,6 +140,9 @@
       }
   
       public void setPath(String path) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.path = path;
       }
   
  @@ -139,11 +157,24 @@
       }
   
       public void setRedirect(boolean redirect) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.redirect = redirect;
       }
   
   
       // --------------------------------------------------------- Public Methods
  +
  +
  +    /**
  +     * Freeze the configuration of this component.
  +     */
  +    public void freeze() {
  +
  +        configured = true;
  +
  +    }
   
   
       /**
  
  
  
  1.4       +35 -4     
jakarta-struts/src/share/org/apache/struts/config/MessageResourcesConfig.java
  
  Index: MessageResourcesConfig.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/MessageResourcesConfig.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- MessageResourcesConfig.java       20 Jan 2002 05:34:08 -0000      1.3
  +++ MessageResourcesConfig.java       23 Feb 2002 23:53:29 -0000      1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/MessageResourcesConfig.java,v
 1.3 2002/01/20 05:34:08 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2002/01/20 05:34:08 $
  + * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/MessageResourcesConfig.java,v
 1.4 2002/02/23 23:53:29 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/02/23 23:53:29 $
    *
    * ====================================================================
    *
  @@ -73,13 +73,22 @@
    * configuration file.</p>
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2002/01/20 05:34:08 $
  + * @version $Revision: 1.4 $ $Date: 2002/02/23 23:53:29 $
    * @since Struts 1.1
    */
   
   public class MessageResourcesConfig implements Serializable {
   
   
  +    // ----------------------------------------------------- Instance Variables
  +
  +
  +    /**
  +     * Has this component been completely configured?
  +     */
  +    protected boolean configured = false;
  +
  +
       // ------------------------------------------------------------- Properties
   
   
  @@ -95,6 +104,9 @@
       }
   
       public void setFactory(String factory) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.factory = factory;
       }
   
  @@ -110,6 +122,9 @@
       }
   
       public void setKey(String key) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.key = key;
       }
   
  @@ -124,6 +139,9 @@
       }
   
       public void setNull(boolean nullValue) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.nullValue = nullValue;
       }
   
  @@ -139,11 +157,24 @@
       }
   
       public void setParameter(String parameter) {
  +        if (configured) {
  +            throw new IllegalStateException("Configuration is frozen");
  +        }
           this.parameter = parameter;
       }
   
   
       // --------------------------------------------------------- Public Methods
  +
  +
  +    /**
  +     * Freeze the configuration of this component.
  +     */
  +    public void freeze() {
  +
  +        configured = true;
  +
  +    }
   
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to