cvs commit: jakarta-struts/src/share/org/apache/struts/config/impl ModuleConfigImpl.java

2004-02-16 Thread martinc
martinc 2004/02/16 21:51:48

  Modified:conf/share struts-config_1_1.dtd
   src/share/org/apache/struts/config ConfigRuleSet.java
ModuleConfig.java
   src/share/org/apache/struts/config/impl
ModuleConfigImpl.java
  Log:
  Restore the functionality for the 'type' attribute on form-beans and
  global-forwards elements in the config file. This allows the class name
  to be specified for all sub-elements, rather than having to specify it
  explicitly for each one.
  
  PR: 26942
  Submitted by: Charlie Jones
  
  Revision  ChangesPath
  1.42  +1 -3  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.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- struts-config_1_1.dtd 1 Feb 2004 16:14:07 -   1.41
  +++ struts-config_1_1.dtd 17 Feb 2004 05:51:47 -  1.42
  @@ -135,7 +135,6 @@
typeFully qualified Java class to use when instantiating
ActionFormBean objects. If specified, the object must be a
subclass of the default class type.
  - DEPRECATED.
   
WARNING:  For Struts 1.0, this value is ignored.  You
can set the default implementation class name with the
  @@ -282,7 +281,6 @@
typeFully qualified Java class to use when instantiating
ActionForward objects.  If specified, the object must be a
subclass of the default class type.
  - DEPRECATED.
   
WARNING:  For Struts 1.0, this value is ignored.  You
can set the default implementation class name with the
  
  
  
  1.17  +128 -12   
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ConfigRuleSet.java10 Jan 2004 21:03:34 -  1.16
  +++ ConfigRuleSet.java17 Feb 2004 05:51:47 -  1.17
  @@ -177,11 +177,13 @@
   (struts-config/controller/set-property,
property, value);
   
  -digester.addObjectCreate
  +digester.addRule
  +(struts-config/form-beans,
  + new SetActionFormBeanClassRule());
  +
  +digester.addFactoryCreate
   (struts-config/form-beans/form-bean,
  - // org.apache.struts.config.FormBeanConfig,
  - org.apache.struts.action.ActionFormBean,
  - className);
  + new ActionFormBeanFactory());
   digester.addSetProperties
   (struts-config/form-beans/form-bean);
   digester.addSetNext
  @@ -223,11 +225,13 @@
   (struts-config/global-exceptions/exception/set-property,
property, value);
   
  -digester.addObjectCreate
  +digester.addRule
  +(struts-config/global-forwards,
  + new SetGlobalForwardClassRule());
  +
  +digester.addFactoryCreate
   (struts-config/global-forwards/forward,
  - // org.apache.struts.config.ForwardConfig,
  - org.apache.struts.action.ActionForward,
  - className);
  + new GlobalForwardFactory());
   digester.addSetProperties
   (struts-config/global-forwards/forward);
   digester.addSetNext
  @@ -315,6 +319,62 @@
   
   
   /**
  + * Class that sets the name of the class to use when creating action form bean
  + * instances. The value is set on the object on the top of the stack, which
  + * must be a codeorg.apache.struts.config.ModuleConfig/code.
  + */
  +final class SetActionFormBeanClassRule extends Rule {
  +
  +public SetActionFormBeanClassRule() {
  +super();
  +}
  +
  +public void begin(String namespace, String name, Attributes attributes) throws 
Exception {
  +String className = attributes.getValue(type);
  +if (className != null) {
  +ModuleConfig mc = (ModuleConfig) digester.peek();
  +mc.setActionFormBeanClass(className);
  +}
  +}
  +
  +}
  +
  +
  +/**
  + * An object creation factory which creates action form bean instances, taking
  + * into account the default class name, which may have been specified on the
  + * parent element and which is made available through the object on the top
  + * of the stack, which must be a
  + * codeorg.apache.struts.config.ModuleConfig/code.
  + */
  +final class 

cvs commit: jakarta-struts/src/share/org/apache/struts/config/impl ModuleConfigImpl.java

2003-10-10 Thread mrdon
mrdon   2003/10/10 15:03:33

  Modified:src/share/org/apache/struts/action RequestProcessor.java
   src/share/org/apache/struts/config/impl
ModuleConfigImpl.java
  Added:   src/share/org/apache/struts/config ActionConfigMatcher.java
  Removed: src/share/org/apache/struts/action ActionMappingMatcher.java
  Log:
  Moved wildcard action matching code into ModuleConfigImpl.findActionConfig()
  as several taglibs needed to match action mappings containing wildcards.
  Improved action mapping cloning to truely clone ActionConfig to support
  alternate action mapping classes.
  
  Revision  ChangesPath
  1.38  +5 -15 
jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java
  
  Index: RequestProcessor.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/RequestProcessor.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- RequestProcessor.java 5 Oct 2003 17:45:14 -   1.37
  +++ RequestProcessor.java 10 Oct 2003 22:03:33 -  1.38
  @@ -145,11 +145,6 @@
*/
   protected ActionServlet servlet = null;
   
  -/**
  - * Matches action mapping paths against compiled wildcard patterns
  - */
  -protected ActionMappingMatcher matcher = null;
  -
   // - Public Methods
   
   
  @@ -188,7 +183,6 @@
   
   this.servlet = servlet;
   this.moduleConfig = moduleConfig;
  -matcher = new ActionMappingMatcher(moduleConfig.findActionConfigs());
   }
   
   /**
  @@ -663,13 +657,9 @@
  String path)
   throws IOException {
   
  -// Is there a directly defined or wildcard-matched mapping for this 
  -// path?
  +// Is there a mapping for this path?
   ActionMapping mapping = (ActionMapping)
   moduleConfig.findActionConfig(path);
  -if (mapping == null) {
  -mapping = matcher.match(path);
  -}
   
   // If a mapping is found, put it in the request and return it
   if (mapping != null) {
  
  
  
  1.1  
jakarta-struts/src/share/org/apache/struts/config/ActionConfigMatcher.java
  
  Index: ActionConfigMatcher.java
  ===
  /*
   * $Header: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/ActionConfigMatcher.java,v 
1.1 2003/10/10 22:03:33 mrdon Exp $
   * $Revision: 1.1 $
   * $Date: 2003/10/10 22:03:33 $
   *
   * 
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 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 acknowledgement:
   *   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 name, without prior written
   *permission of the Apache Software Foundation.
   *
   * 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 

cvs commit: jakarta-struts/src/share/org/apache/struts/config/impl ModuleConfigImpl.java

2002-12-07 Thread craigmcc
craigmcc2002/12/07 18:09:45

  Modified:src/share/org/apache/struts/action DynaActionFormClass.java
   src/share/org/apache/struts/config FormBeanConfig.java
   src/share/org/apache/struts/config/impl
ModuleConfigImpl.java
  Log:
  Make it possible to use DynaActionForms in more than one module, even
  though they have the same form name.  This required making the static
  collection of created DynaActionFormClass instances use a key composed of
  the form bean name *and* the module prefix.
  
  Removed redundant getDynaActionFormClass() method from DynaActionFormClass.
  It wasn't being used anywhere, and createDynaActionFormClass() did the
  correct thing already.
  
  PR: Bugzilla #13837
  Submitted by: Gen Kagawa kagawa at sun12.tis.co.jp
  
  Revision  ChangesPath
  1.11  +8 -28 
jakarta-struts/src/share/org/apache/struts/action/DynaActionFormClass.java
  
  Index: DynaActionFormClass.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/action/DynaActionFormClass.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DynaActionFormClass.java  15 Nov 2002 06:02:42 -  1.10
  +++ DynaActionFormClass.java  8 Dec 2002 02:09:44 -   1.11
  @@ -308,35 +308,15 @@
   if (dynaClasses == null) {
   dynaClasses = new HashMap();
   }
  +String key =
  +config.getName() + config.getModuleConfig().getPrefix();
   DynaActionFormClass dynaClass =
  -(DynaActionFormClass) dynaClasses.get(config.getName());
  +(DynaActionFormClass) dynaClasses.get(key);
   if (dynaClass == null) {
   dynaClass = new DynaActionFormClass(config);
  -dynaClasses.put(config.getName(), dynaClass);
  +dynaClasses.put(key, dynaClass);
   }
   return (dynaClass);
  -}
  -
  -}
  -
  -
  -/**
  - * Return an existing codeDynaActionFormClass/code of the specified
  - * name, if one has been configured previously.  If no such instance has
  - * been configured, return codenull/code instead.
  - *
  - * @param name Name of the codeDynaActionFormClass/code to be
  - *  returned
  - */
  -public static DynaActionFormClass
  -getDynaActionFormClass(String name) {
  -
  -synchronized (lock) {
  -if (dynaClasses == null) {
  -return (null);
  -} else {
  -return ((DynaActionFormClass) dynaClasses.get(name));
  -}
   }
   
   }
  
  
  
  1.9   +34 -4 
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FormBeanConfig.java   19 Jul 2002 04:42:21 -  1.8
  +++ FormBeanConfig.java   8 Dec 2002 02:09:44 -   1.9
  @@ -123,6 +123,36 @@
   
   
   /**
  + * The {@link ModuleConfig} with which this form bean definition
  + * is associated.
  + */
  +protected ModuleConfig moduleConfig = null;
  +
  +
  +/**
  + * Return the {@link ModuleConfig} with which this form bean definition
  + * is associated.
  + */
  +public ModuleConfig getModuleConfig() {
  +return (this.moduleConfig);
  +}
  +
  +
  +/**
  + * Set the {@link ModuleConfig} with which this form bean definition
  + * is associated.
  + *
  + * @param moduleConfig The new {@link ModuleConfig} or codenull/code
  + *  to disassociate this form bean configuration from any module
  + */
  +public void setModuleConfig(ModuleConfig moduleConfig) {
  +if (configured) {
  +throw new IllegalStateException(Configuration is frozen);
  +}
  +this.moduleConfig = moduleConfig;
  +}
  +
  +/**
* The unique identifier of this form bean, which is used to reference this
* bean in codeActionMapping/code instances as well as for the name of
* the request or session attribute under which the corresponding form bean
  
  
  
  1.2   +6 -4  
jakarta-struts/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java
  
  Index: ModuleConfigImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-struts/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ModuleConfigImpl.java 6 Nov 2002 04:48:29 -   1.1
  +++ ModuleConfigImpl.java 8 Dec 2002 02:09:45