You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2004/04/03 05:01:35 UTC

cvs commit: cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation SessionPostTransformer.java

joerg       2004/04/02 19:01:35

  Modified:    src/documentation/xdocs/userdocs/xsp logicsheet-forms.xml
               src/documentation/xdocs/tutorial tutorial-develop-webapp.xml
               .        status.xml
               src/webapp/samples/simpleform/three sitemap.xmap
               src/webapp/samples/simpleform/four sitemap.xmap
               src/java/org/apache/cocoon/acting
                        AbstractValidatorAction.java
               src/blocks/databases/samples/tutorial sitemap.xmap
               src/webapp/samples/simpleform/two sitemap.xmap
               src/blocks/session-fw/java/org/apache/cocoon/webapps/session/acting
                        SessionFormAction.java
               src/webapp/samples/simpleform/one sitemap.xmap
               src/blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation
                        SessionPostTransformer.java
  Log:
  renamed validate-set to constraint-set for consistency (the element name is also constraint-set)
  
  Revision  Changes    Path
  1.7       +2 -2      cocoon-2.1/src/documentation/xdocs/userdocs/xsp/logicsheet-forms.xml
  
  Index: logicsheet-forms.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/xsp/logicsheet-forms.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- logicsheet-forms.xml	23 Mar 2004 19:29:02 -0000	1.6
  +++ logicsheet-forms.xml	3 Apr 2004 03:01:35 -0000	1.7
  @@ -65,7 +65,7 @@
        <map:act type="form-validator">
           <!-- add you favourite database action here -->
           <map:parameter name="descriptor" value="descriptor.xml"/>
  -        <map:parameter name="validate-set" value="car-reservation"/>
  +        <map:parameter name="constraint-set" value="car-reservation"/>
       <map:generate type="serverpages" src="OK.xsp"/>
       <map:transform src="stylesheets/dynamic-page2html.xsl"/>
       <map:serialize/>
  @@ -98,7 +98,7 @@
   
          <map:act type="form-validator">
            <map:parameter name="descriptor" value="descriptor.xml"/>
  -         <map:parameter name="validate-set" value="car-reservation"/>
  +         <map:parameter name="constraint-set" value="car-reservation"/>
            <!-- add you favourite database action here -->
   
            <map:generate type="file" src="OK.xml"/>
  
  
  
  1.6       +2 -2      cocoon-2.1/src/documentation/xdocs/tutorial/tutorial-develop-webapp.xml
  
  Index: tutorial-develop-webapp.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/documentation/xdocs/tutorial/tutorial-develop-webapp.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- tutorial-develop-webapp.xml	6 Mar 2004 02:26:14 -0000	1.5
  +++ tutorial-develop-webapp.xml	3 Apr 2004 03:01:35 -0000	1.6
  @@ -460,11 +460,11 @@
   <map:action-sets>
     <map:action-set name="process">
      <map:act type="form" action="Create Department">
  -     <map:parameter name="validate-set" value="add"/>
  +     <map:parameter name="constraint-set" value="add"/>
        <map:act type="dbAdd"/>
      </map:act>
      <map:act type="form" action="Update Department">
  -     <map:parameter name="validate-set" value="update"/>
  +     <map:parameter name="constraint-set" value="update"/>
        <map:act type="dbUpd"/>
      </map:act>
      <map:act type="dbDel" action="Delete Department"/>
  
  
  
  1.296     +5 -2      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.295
  retrieving revision 1.296
  diff -u -r1.295 -r1.296
  --- status.xml	3 Apr 2004 01:32:28 -0000	1.295
  +++ status.xml	3 Apr 2004 03:01:35 -0000	1.296
  @@ -212,7 +212,10 @@
     <changes>
   
    <release version="@version@" date="@date@">
  -    <action dev="AG" type="update">
  +   <action dev="JH" type="fix" due-to="Derek Hohls">
  +     Renamed validate-set to constraint-set for consistency (the element name is also constraint-set).
  +   </action>
  +   <action dev="AG" type="update">
        Updated bsf to 2.3.0
      </action>
      <action dev="JH" type="fix" fixes-bug="15841">
  
  
  
  1.5       +10 -36    cocoon-2.1/src/webapp/samples/simpleform/three/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/simpleform/three/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	11 Mar 2004 16:25:50 -0000	1.4
  +++ sitemap.xmap	3 Apr 2004 03:01:35 -0000	1.5
  @@ -29,7 +29,7 @@
          |
          | The instance data is stored as an attribute with the same name as the 
          | form using an output module. Here we decide to use the RequestAttributeMap
  -       |  module. This would allows
  +       | module. This allows
          | a) to store instances for several forms and 
          | b) to access a particular instance and value using JXPath syntax.
          |
  @@ -37,7 +37,7 @@
          | of the new Document.
          |
          +-->
  -   <map:transformer name="sfinstance" 
  +   <map:transformer name="simpleform-instance-extraction" 
                       logger="sitemap.transformer.simpleform-request" 
                       src="org.apache.cocoon.transformation.SimpleFormInstanceExtractionTransformer">
        <output name="request-attr-map"/>
  @@ -52,13 +52,13 @@
          | this instance has been instructed to ignore validation results because 
          | looking up the instance data requires to augment the element name with
          | the form name and thus differ from the validation result names.
  -	   |
  +       |
          | The instance extractor places the form instances into a map with the 
          | form name as key. Furthermore, it has been instructed to create a root
  -       |  element wrapping the instance data with the same name as the form. 
  +       | element wrapping the instance data with the same name as the form. 
          | Hence we need to included the form's name twice in the element name 
          | used for the lookup.
  -	   |
  +       |
          | In addition, we may want to be able to select from a XSP if the form 
          | data should be replaced with values from the instance or from the 
          | request. Therefore, a different attribute is used to protect element 
  @@ -80,7 +80,7 @@
          <from-parameter>org.apache.cocoon.components.modules.output.OutputModule</from-parameter>
          <input-module name="request-attr"/>
        </input-module>
  -      </map:transformer>
  +   </map:transformer>
      
     </map:transformers>
     
  @@ -104,9 +104,7 @@
   
   <!--+
       | These views provide different 'standard' views to the samples.
  -    |
       +-->
  -
    <map:views>
     <map:view name="content" from-label="content">
      <map:serialize type="xml"/>
  @@ -123,56 +121,32 @@
   
    </map:views>
   
  -
   <!--+
       | Pipelines
  -    |
       +-->
  -
  -
    <map:pipelines>
  -
     <map:pipeline>
  -
  -
      <!-- some redirections -->
      <map:match pattern="">
        <map:redirect-to uri="index"/>
      </map:match>
  -   
  -
   
      <map:match pattern="index">
  -     <!--+
  -         | this branch contains the failed validation.
  -         | Since the "success" pipeline ends with a resource, the following is only 
  -         | applied if validation has not been successful.
  -         |
  -         +-->
       <map:generate type="file" src="form.xml"/>    
  -    <!--+
  -        | extract the instance data
  -        +-->
  -    <map:transform type="sfinstance"/>
  -    <!--+
  -        | fill in the instance data 
  -        +-->
  +    <!-- extract the instance data -->
  +    <map:transform type="simpleform-instance-extraction"/>
  +    <!-- fill in the instance data -->
       <map:transform type="simpleform-instance"/>
       <map:call resource="static-page">
         <map:parameter name="file" value="form"/>
       </map:call>
      </map:match>
   
  -
  -
      <!-- some redirections -->
      <map:match pattern="*">
        <map:redirect-to uri="index"/>
      </map:match>
  -        
  +
     </map:pipeline>
    </map:pipelines>
  -
   </map:sitemap>
  -
  -<!-- end of file -->
  
  
  
  1.5       +7 -14     cocoon-2.1/src/webapp/samples/simpleform/four/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/simpleform/four/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	11 Mar 2004 16:25:50 -0000	1.4
  +++ sitemap.xmap	3 Apr 2004 03:01:35 -0000	1.5
  @@ -53,7 +53,7 @@
          | of the new Document.
          |
          +-->
  -   <map:transformer name="sfinstance" 
  +   <map:transformer name="simpleform-instance-extraction"
                       logger="sitemap.transformer.simpleform-request" 
                       src="org.apache.cocoon.transformation.SimpleFormInstanceExtractionTransformer">
        <output name="request-attr-map"/>
  @@ -167,7 +167,7 @@
                  +-->
              <map:act type="form-validator">
                <map:parameter name="descriptor" value="descriptor.xml"/>
  -             <map:parameter name="validate-set" value="car-reservation"/>
  +             <map:parameter name="constraint-set" value="car-reservation"/>
                <!--+
                    | this is the success case
                    |
  @@ -185,20 +185,13 @@
            | this branch contains the failed validation.
            | Since the "success" pipeline ends with a resource, the following is only 
            | applied if validation has not been successful.
  -         |
            +-->
       <map:generate type="file" src="form.xml"/>    
  -    <!--+
  -        | extract the instance data
  -        +-->
  -    <map:transform type="sfinstance"/>
  -    <!--+
  -        | fill in the instance data 
  -        +-->
  +    <!-- extract the instance data -->
  +    <map:transform type="simpleform-instance-extraction"/>
  +    <!-- fill in the instance data -->
       <map:transform type="simpleform-instance"/>
  -    <!--+
  -        | fill in the request parameters, and error tags 
  -        +-->
  +    <!-- fill in the request parameters, and error tags -->
       <map:transform type="simpleform"/>
       <map:call resource="static-page">
         <map:parameter name="file" value="form"/>
  @@ -209,7 +202,7 @@
      <map:match pattern="*">
        <map:redirect-to uri="index"/>
      </map:match>
  -        
  +
     </map:pipeline>
    </map:pipelines>
   
  
  
  
  1.12      +29 -20    cocoon-2.1/src/java/org/apache/cocoon/acting/AbstractValidatorAction.java
  
  Index: AbstractValidatorAction.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/acting/AbstractValidatorAction.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractValidatorAction.java	28 Mar 2004 20:51:24 -0000	1.11
  +++ AbstractValidatorAction.java	3 Apr 2004 03:01:35 -0000	1.12
  @@ -66,11 +66,11 @@
    * <pre>
    * &lt;map:act type="validator"&gt;
    *         &lt;parameter name="descriptor" value="context://descriptor.xml"&gt;
  - *         &lt;parameter name="validate-set" value="is-logged-in"&gt;
  + *         &lt;parameter name="constraint-set" value="is-logged-in"&gt;
    * &lt;/map:act&gt;
    * </pre>
    *
  - * <p>The parameter "validate-set" tells to take a given
  + * <p>The parameter "constraint-set" tells to take a given
    * "constraint-set" from description file and test all parameters
    * against given criteria. This variant is more powerful, more aspect
    * oriented and more flexibile than the previous one, because it
  @@ -223,12 +223,22 @@
           if (conf == null)
               return null;
   
  -        String valstr =
  -            parameters.getParameter("validate", (String) settings.get("validate", "")).trim();
  -        String valsetstr =
  -            parameters
  -                .getParameter("validate-set", (String) settings.get("validate-set", ""))
  -                .trim();
  +        String valStr =
  +            parameters.getParameter("validate", (String)settings.get("validate", "")).trim();
  +        String valSetStr =
  +            parameters.getParameter("validate-set", (String)settings.get("validate-set", "")).trim();
  +        String constraintSetStr =
  +            parameters.getParameter("constraint-set", (String)settings.get("constraint-set", "")).trim();
  +        if (!"".equals(valSetStr)) {
  +            if (getLogger().isInfoEnabled()) {
  +                getLogger().info("Using sitemap parameter 'validate-set' for specifying "
  +                                 + "the constraint-set for the ValidatorActions is deprecated in "
  +                                 + "favor of 'constraint-set' due to consistency in the naming.");
  +            }
  +            if ("".equals(constraintSetStr)) {
  +                constraintSetStr = valSetStr;
  +            }
  +        }
           Map desc = this.indexConfiguration(conf.getChildren("parameter"));
   
           Map actionMap = new HashMap();
  @@ -236,18 +246,17 @@
           Collection params = null;
           boolean allOK = false;
   
  -        if (!"".equals(valstr)) {
  -            if (getLogger().isDebugEnabled())
  -                getLogger().debug(
  -                    "Validating parameters " + "as specified via 'validate' parameter");
  -            params = this.getSetOfParameterNamesFromSitemap(valstr, desc);
  -
  -        } else if (!"".equals(valsetstr)) {
  -            if (getLogger().isDebugEnabled())
  -                getLogger().debug(
  -                    "Validating parameters " + "from given constraint-set " + valsetstr);
  +        if (!"".equals(valStr)) {
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Validating parameters as specified via 'validate' parameter");
  +            }
  +            params = this.getSetOfParameterNamesFromSitemap(valStr, desc);
  +        } else if (!"".equals(constraintSetStr)) {
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("Validating parameters from given constraint-set " + constraintSetStr);
  +            }
               Map csets = this.indexConfiguration(conf.getChildren("constraint-set"));
  -            params = this.resolveConstraints(valsetstr, csets);
  +            params = this.resolveConstraints(constraintSetStr, csets);
           }
           
           if (params == null) {
  
  
  
  1.7       +4 -4      cocoon-2.1/src/blocks/databases/samples/tutorial/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/databases/samples/tutorial/sitemap.xmap,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- sitemap.xmap	11 Mar 2004 16:25:47 -0000	1.6
  +++ sitemap.xmap	3 Apr 2004 03:01:35 -0000	1.7
  @@ -39,20 +39,20 @@
    <map:action-sets>
     <map:action-set name="process">
      <map:act type="form-validator" action="Create Department">
  -     <map:parameter name="validate-set" value="add"/>
  +     <map:parameter name="constraint-set" value="add"/>
        <map:act type="dbAdd"/>
      </map:act>
      <map:act type="form-validator" action="Update Department">
  -     <map:parameter name="validate-set" value="update"/>
  +     <map:parameter name="constraint-set" value="update"/>
        <map:act type="dbUpd"/>
      </map:act>
      <map:act type="dbDel" action="Delete Department"/>
      <map:act type="form-validator" action="Create Employee">
  -     <map:parameter name="validate-set" value="add"/>
  +     <map:parameter name="constraint-set" value="add"/>
        <map:act type="dbAdd"/>
      </map:act>
      <map:act type="form-validator" action="Update Employee">
  -     <map:parameter name="validate-set" value="update"/>
  +     <map:parameter name="constraint-set" value="update"/>
        <map:act type="dbUpd"/>
      </map:act>
      <map:act type="dbDel" action="Delete Employee"/>
  
  
  
  1.5       +1 -1      cocoon-2.1/src/webapp/samples/simpleform/two/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/simpleform/two/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	11 Mar 2004 16:25:50 -0000	1.4
  +++ sitemap.xmap	3 Apr 2004 03:01:35 -0000	1.5
  @@ -100,7 +100,7 @@
                  +-->
              <map:act type="form-validator">
                <map:parameter name="descriptor" value="descriptor.xml"/>
  -             <map:parameter name="validate-set" value="car-reservation"/>
  +             <map:parameter name="constraint-set" value="car-reservation"/>
                <!--+
                    | this is the success case
                    |
  
  
  
  1.7       +3 -3      cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/acting/SessionFormAction.java
  
  Index: SessionFormAction.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/acting/SessionFormAction.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SessionFormAction.java	5 Mar 2004 13:02:22 -0000	1.6
  +++ SessionFormAction.java	3 Apr 2004 03:01:35 -0000	1.7
  @@ -52,7 +52,7 @@
    * through the "src" attribute
    * (the format is defined in AbstractValidatorAction).
    * Then the constraint-set to be used has to be identified
  - * through the "validate-set" element
  + * through the "constraint-set" element
    *
    * <pre>
    *    &lt;session:form name="info_form&gt;
  @@ -61,7 +61,7 @@
    *        &lt;session:inputxml name="name" type="text" context="trackdemo" path="/user/name"/&gt;
    *      &lt;/session:content&gt;
    *      &lt;session:validate src="descriptor.xml"&gt;
  - *        &lt;validate-set name="form_a_set"/&gt;
  + *        &lt;constraint-set name="form_a_set"/&gt;
    *      &lt;/session:validate&gt;
    *    &lt;/session:form&gt;
    * </pre>
  
  
  
  1.5       +1 -1      cocoon-2.1/src/webapp/samples/simpleform/one/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/simpleform/one/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	11 Mar 2004 16:25:50 -0000	1.4
  +++ sitemap.xmap	3 Apr 2004 03:01:35 -0000	1.5
  @@ -75,7 +75,7 @@
      <map:match pattern="index">
        <map:act type="form-validator">
           <map:parameter name="descriptor" value="descriptor.xml"/>
  -        <map:parameter name="validate-set" value="car-reservation"/>
  +        <map:parameter name="constraint-set" value="car-reservation"/>
           <!--+
               | this is the success case
               +-->
  
  
  
  1.8       +6 -6      cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation/SessionPostTransformer.java
  
  Index: SessionPostTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/session-fw/java/org/apache/cocoon/webapps/session/transformation/SessionPostTransformer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SessionPostTransformer.java	19 Mar 2004 14:16:54 -0000	1.7
  +++ SessionPostTransformer.java	3 Apr 2004 03:01:35 -0000	1.8
  @@ -96,7 +96,7 @@
       /** The form validation rules */
       public static final String FORM_VALIDATION_ELEMENT = "validate";
       public static final String FORM_VALIDATION_SOURCE_ATTRIBUTE = "src";
  -    public static final String FORM_VALIDATESET_ELEMENT = "validate-set";
  +    public static final String FORM_VALIDATESET_ELEMENT = "constraint-set";
   
       /** State: no element parsed */
       private static final int STATE_OUTSIDE = 0;
  @@ -332,7 +332,7 @@
                       session.setAttribute(this.formName, conf);
   
                       if (validationDoc != null) {
  -                        //validationDoc contains "validate-set" element
  +                        //validationDoc contains "constraint-set" element
                           validationDoc.normalize();
                           Node validationNode = validationDoc.getFirstChild();
                           while (validationNode.getNodeType() != Node.ELEMENT_NODE) {
  @@ -348,14 +348,14 @@
                               String validationXML = XMLUtils.serializeNode(validationNode, props);
                               DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
                               conf = builder.build(new ByteArrayInputStream(validationXML.getBytes()));
  -                            session.setAttribute(this.formName + "validate-set", conf);
  +                            session.setAttribute(this.formName + "constraint-set", conf);
                           }
                       }
   
                   } catch (SourceException se) {
                       throw new ProcessingException("Cannot resolve" + source, se);
                   } catch (ConfigurationException ce) {
  -                    throw new ProcessingException("Error building Configuration out of validate-set element", ce);
  +                    throw new ProcessingException("Error building Configuration out of constraint-set element", ce);
                   }
   
               } else if (validationDoc != null) {
  @@ -379,7 +379,7 @@
                           Session session = this.getSessionManager().getSession(true);
                           session.setAttribute(this.formName, conf);
                           //the constraint-set to validate is the first and single one
  -                        session.setAttribute(this.formName + "validate-set", conf.getChildren("constraint-set")[0]);
  +                        session.setAttribute(this.formName + "constraint-set", conf.getChildren("constraint-set")[0]);
   
                       }
                   } catch (ConfigurationException ce) {