sylvain     01/07/20 01:40:44

  Modified:    src/org/apache/cocoon/acting AbstractAction.java
               src/org/apache/cocoon/matching
                        WildcardHeaderMatcherFactory.java
                        WildcardParameterValueMatcherFactory.java
                        WildcardSessionStateMatcherFactory.java
               src/org/apache/cocoon/selection HeaderSelectorFactory.java
                        RequestSelectorFactory.java
                        SessionStateSelectorFactory.java
               webapp   sitemap.xmap
  Log:
  Removed map:parameter in configuration
  
  Revision  Changes    Path
  1.4       +18 -19    xml-cocoon2/src/org/apache/cocoon/acting/AbstractAction.java
  
  Index: AbstractAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/AbstractAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractAction.java       2001/07/11 08:47:47     1.3
  +++ AbstractAction.java       2001/07/20 08:40:44     1.4
  @@ -21,7 +21,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christian Haul</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2001/07/11 08:47:47 $
  + * @version CVS $Revision: 1.4 $ $Date: 2001/07/20 08:40:44 $
    */
   public abstract class AbstractAction extends AbstractLoggable
   implements Action, Configurable, Disposable {
  @@ -35,27 +35,26 @@
       /**
        * Configures the Action.
        *
  -     * Takes <code><map:parameter/></code> from action declaration and stores
  -     * them as key (<code>name</code>) and value (<code>value</code>)
  -     * in <code>settings</code>. This way global configuration options
  -     * can be used with actions.
  -     *
  -     * For nested configurations override this function in your
  -     * action.
  +     * Takes the children from the <code>Configuration</code> and stores them
  +     * them as key (configuration name) and value (configuration value)
  +     * in <code>settings</code>.
  +     * <br/>
  +     * This automates parsing of flat string-only configurations.
  +     * For nested configurations, override this function in your action.
        */
       public void configure(Configuration conf) throws ConfigurationException {
           if (conf != null) {
  -         String key = null;
  -         String val = null;
  -         Configuration[] parameters = conf.getChildren("map:parameter");
  -         this.settings = new HashMap(parameters.length);
  -         for ( int i = 0; i < parameters.length; i++) {
  -             key = parameters[i].getAttribute("name");
  -             val = parameters[i].getAttribute("value");
  -             if ( key != null )
  -                 this.settings.put(key, val);
  -         }
  -     }
  +         String key = null;
  +         String val = null;
  +         Configuration[] parameters = conf.getChildren();
  +         this.settings = new HashMap(parameters.length);
  +         for ( int i = 0; i < parameters.length; i++) {
  +                 key = parameters[i].getName();
  +                 val = parameters[i].getValue(null);
  +                 if ( key != null )
  +                     this.settings.put(key, val);
  +         }
  +     }
       }
   
       /**
  
  
  
  1.2       +14 -22    
xml-cocoon2/src/org/apache/cocoon/matching/WildcardHeaderMatcherFactory.java
  
  Index: WildcardHeaderMatcherFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardHeaderMatcherFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WildcardHeaderMatcherFactory.java 2001/07/11 09:50:01     1.1
  +++ WildcardHeaderMatcherFactory.java 2001/07/20 08:40:44     1.2
  @@ -25,7 +25,7 @@
    * </table>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christian Haul</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:50:01 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/07/20 08:40:44 $
    */
   
   public class WildcardHeaderMatcherFactory extends WildcardURIMatcherFactory {
  @@ -35,31 +35,23 @@
        */
       public String generateMethodSource (NodeList conf)
       throws ConfigurationException {
  -     String parameterName = null;
  -        Node node = null;
  -        Node attrNode = null;
  -        NamedNodeMap attributes = null;
   
  +        String parameterName = null;
  +
           int count = conf.getLength();
           for(int k = 0; k < count;k++) {
  -            node = conf.item(k);
  -         if (node.getNodeName() != null && 
  -             node.getNodeName().equals("map:parameter")) 
  -             {
  -                 attributes = node.getAttributes();
  -                 if (attributes != null) {
  -                     attrNode = attributes.getNamedItem("name");
  -                     if (attrNode != null && 
  -                         attrNode.getNodeValue().equals("parameter-name"))
  -                         {
  -                             attrNode = attributes.getNamedItem("value");
  -                             if (attrNode != null ) 
  -                                 parameterName=attrNode.getNodeValue();
  -                         }
  -                 }
  -             }
  +            Node node = conf.item(k);
  +            if (node.getNodeName() != null && 
  +                node.getNodeName().equals("parameter-name")) 
  +            {
  +                Node textNode = node.getFirstChild();
  +                if (textNode != null) {
  +                    parameterName = textNode.getNodeValue().trim();
  +                }
  +            }
           }
  -     return "HashMap map = new HashMap(1);" +
  +
  +    return "HashMap map = new HashMap(1);" +
            "String theParameter = null;" +
            "if (parameters == null) {"+
            "  theParameter = XSPRequestHelper.getHeader(objectModel, 
\""+parameterName+"\");" +
  
  
  
  1.2       +13 -21    
xml-cocoon2/src/org/apache/cocoon/matching/WildcardParameterValueMatcherFactory.java
  
  Index: WildcardParameterValueMatcherFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardParameterValueMatcherFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WildcardParameterValueMatcherFactory.java 2001/07/11 09:50:01     1.1
  +++ WildcardParameterValueMatcherFactory.java 2001/07/20 08:40:44     1.2
  @@ -29,7 +29,7 @@
    * </table>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christian Haul</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:50:01 $ */
  + * @version CVS $Revision: 1.2 $ $Date: 2001/07/20 08:40:44 $ */
   
   public class WildcardParameterValueMatcherFactory extends WildcardURIMatcherFactory 
{
   
  @@ -38,30 +38,22 @@
        */
       public String generateMethodSource (NodeList conf)
       throws ConfigurationException {
  -     String parameterName = null;
  -        Node node = null;
  -        Node attrNode = null;
  -        NamedNodeMap attributes = null;
   
  +        String parameterName = null;
  +
           int count = conf.getLength();
           for(int k = 0; k < count;k++) {
  -            node = conf.item(k);
  -         if (node.getNodeName() != null && 
  -             node.getNodeName().equals("map:parameter")) 
  -             {
  -                 attributes = node.getAttributes();
  -                 if (attributes != null) {
  -                     attrNode = attributes.getNamedItem("name");
  -                     if (attrNode != null && 
  -                         attrNode.getNodeValue().equals("parameter-name"))
  -                         {
  -                             attrNode = attributes.getNamedItem("value");
  -                             if (attrNode != null ) 
  -                                 parameterName=attrNode.getNodeValue();
  -                         }
  -                 }
  -             }
  +            Node node = conf.item(k);
  +            if (node.getNodeName() != null && 
  +                node.getNodeName().equals("parameter-name")) 
  +            {
  +                Node textNode = node.getFirstChild();
  +                if (textNode != null) {
  +                    parameterName = textNode.getNodeValue().trim();
  +                }
  +            }
           }
  +
        return "HashMap map = new HashMap(1);" +
            "String theParameter = null; " +
            "if (parameters == null) {"+
  
  
  
  1.2       +13 -22    
xml-cocoon2/src/org/apache/cocoon/matching/WildcardSessionStateMatcherFactory.java
  
  Index: WildcardSessionStateMatcherFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/matching/WildcardSessionStateMatcherFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WildcardSessionStateMatcherFactory.java   2001/07/11 09:50:01     1.1
  +++ WildcardSessionStateMatcherFactory.java   2001/07/20 08:40:44     1.2
  @@ -26,7 +26,7 @@
    * </table>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christian Haul</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:50:01 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/07/20 08:40:44 $
    */
   
   public class WildcardSessionStateMatcherFactory extends WildcardURIMatcherFactory {
  @@ -36,30 +36,22 @@
        */
       public String generateMethodSource (NodeList conf)
       throws ConfigurationException {
  -     String statekey=Constants.SESSION_STATE_ATTRIBUTE;
  -        Node node = null;
  -        Node attrNode = null;
  -        NamedNodeMap attributes = null;
   
  +        String statekey=Constants.SESSION_STATE_ATTRIBUTE;
  +        
           int count = conf.getLength();
           for(int k = 0; k < count;k++) {
  -            node = conf.item(k);
  -         if (node.getNodeName() != null && 
  -             node.getNodeName().equals("map:parameter")) 
  -             {
  -                 attributes = node.getAttributes();
  -                 if (attributes != null) {
  -                     attrNode = attributes.getNamedItem("name");
  -                     if (attrNode != null && 
  -                         attrNode.getNodeValue().equals("state-key"))
  -                         {
  -                             attrNode = attributes.getNamedItem("value");
  -                             if (attrNode != null ) 
  -                                 statekey=attrNode.getNodeValue();
  -                         }
  -                 }
  -             }
  +            Node node = conf.item(k);
  +            if (node.getNodeName() != null && 
  +                node.getNodeName().equals("state-key")) 
  +            {
  +                Node textNode = node.getFirstChild();
  +                if (textNode != null) {
  +                    statekey = textNode.getNodeValue().trim();
  +                }
  +            }
           }
  +
        return "HashMap map = new HashMap(1);" +
            "String currentState = null; " +
            "if (parameters == null) {"+
  @@ -73,5 +65,4 @@
            "} else {" +
            "return null;}";
       }
  -
   }
  
  
  
  1.2       +12 -21    
xml-cocoon2/src/org/apache/cocoon/selection/HeaderSelectorFactory.java
  
  Index: HeaderSelectorFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/HeaderSelectorFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HeaderSelectorFactory.java        2001/07/11 09:49:59     1.1
  +++ HeaderSelectorFactory.java        2001/07/20 08:40:44     1.2
  @@ -27,35 +27,26 @@
    * </table>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christian Haul</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:49:59 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/07/20 08:40:44 $
    */
   public class HeaderSelectorFactory extends ParameterSelectorFactory {
   
       public String generateMethodSource (NodeList conf)
       throws ConfigurationException {
  -     String parameterName = null;
  -        Node node = null;
  -        Node attrNode = null;
  -        NamedNodeMap attributes = null;
   
  +        String parameterName = null;
  +
           int count = conf.getLength();
           for(int k = 0; k < count;k++) {
  -            node = conf.item(k);
  -         if (node.getNodeName() != null && 
  -             node.getNodeName().equals("map:parameter")) 
  -             {
  -                 attributes = node.getAttributes();
  -                 if (attributes != null) {
  -                     attrNode = attributes.getNamedItem("name");
  -                     if (attrNode != null && 
  -                         attrNode.getNodeValue().equals("parameter-name"))
  -                         {
  -                             attrNode = attributes.getNamedItem("value");
  -                             if (attrNode != null ) 
  -                                 parameterName=attrNode.getNodeValue();
  -                         }
  -                 }
  -             }
  +            Node node = conf.item(k);
  +            if (node.getNodeName() != null && 
  +                node.getNodeName().equals("parameter-name")) 
  +            {
  +                Node textNode = node.getFirstChild();
  +                if (textNode != null) {
  +                    parameterName = textNode.getNodeValue().trim();
  +                }
  +            }
           }
   
           StringBuffer sb = new StringBuffer();
  
  
  
  1.2       +12 -21    
xml-cocoon2/src/org/apache/cocoon/selection/RequestSelectorFactory.java
  
  Index: RequestSelectorFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/RequestSelectorFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestSelectorFactory.java       2001/07/11 09:49:59     1.1
  +++ RequestSelectorFactory.java       2001/07/20 08:40:44     1.2
  @@ -27,35 +27,26 @@
    * </table>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christian Haul</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:49:59 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/07/20 08:40:44 $
    */
   public class RequestSelectorFactory extends ParameterSelectorFactory {
   
       public String generateMethodSource (NodeList conf)
       throws ConfigurationException {
  -     String parameterName = null;
  -        Node node = null;
  -        Node attrNode = null;
  -        NamedNodeMap attributes = null;
   
  +        String parameterName = null;
  +
           int count = conf.getLength();
           for(int k = 0; k < count;k++) {
  -            node = conf.item(k);
  -         if (node.getNodeName() != null && 
  -             node.getNodeName().equals("map:parameter")) 
  -             {
  -                 attributes = node.getAttributes();
  -                 if (attributes != null) {
  -                     attrNode = attributes.getNamedItem("name");
  -                     if (attrNode != null && 
  -                         attrNode.getNodeValue().equals("parameter-name"))
  -                         {
  -                             attrNode = attributes.getNamedItem("value");
  -                             if (attrNode != null ) 
  -                                 parameterName=attrNode.getNodeValue();
  -                         }
  -                 }
  -             }
  +            Node node = conf.item(k);
  +            if (node.getNodeName() != null && 
  +                node.getNodeName().equals("parameter-name")) 
  +            {
  +                Node textNode = node.getFirstChild();
  +                if (textNode != null) {
  +                    parameterName = textNode.getNodeValue().trim();
  +                }
  +            }
           }
   
           StringBuffer sb = new StringBuffer();
  
  
  
  1.2       +12 -21    
xml-cocoon2/src/org/apache/cocoon/selection/SessionStateSelectorFactory.java
  
  Index: SessionStateSelectorFactory.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/selection/SessionStateSelectorFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SessionStateSelectorFactory.java  2001/07/11 09:49:59     1.1
  +++ SessionStateSelectorFactory.java  2001/07/20 08:40:44     1.2
  @@ -28,35 +28,26 @@
    * </table>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christian Haul</a>
  - * @version CVS $Revision: 1.1 $ $Date: 2001/07/11 09:49:59 $
  + * @version CVS $Revision: 1.2 $ $Date: 2001/07/20 08:40:44 $
    */
   public class SessionStateSelectorFactory extends ParameterSelectorFactory {
   
       public String generateMethodSource (NodeList conf)
       throws ConfigurationException {
  -     String statekey=Constants.SESSION_STATE_ATTRIBUTE;
  -        Node node = null;
  -        Node attrNode = null;
  -        NamedNodeMap attributes = null;
   
  +        String statekey=Constants.SESSION_STATE_ATTRIBUTE;
  +        
           int count = conf.getLength();
           for(int k = 0; k < count;k++) {
  -            node = conf.item(k);
  -         if (node.getNodeName() != null && 
  -             node.getNodeName().equals("map:parameter")) 
  -             {
  -                 attributes = node.getAttributes();
  -                 if (attributes != null) {
  -                     attrNode = attributes.getNamedItem("name");
  -                     if (attrNode != null && 
  -                         attrNode.getNodeValue().equals("state-key"))
  -                         {
  -                             attrNode = attributes.getNamedItem("value");
  -                             if (attrNode != null ) 
  -                                 statekey=attrNode.getNodeValue();
  -                         }
  -                 }
  -             }
  +            Node node = conf.item(k);
  +            if (node.getNodeName() != null && 
  +                node.getNodeName().equals("state-key")) 
  +            {
  +                Node textNode = node.getFirstChild();
  +                if (textNode != null) {
  +                    statekey = textNode.getNodeValue().trim();
  +                }
  +            }
           }
   
           StringBuffer sb = new StringBuffer();
  
  
  
  1.38      +2 -2      xml-cocoon2/webapp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/webapp/sitemap.xmap,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- sitemap.xmap      2001/07/19 11:22:21     1.37
  +++ sitemap.xmap      2001/07/20 08:40:44     1.38
  @@ -99,10 +99,10 @@
      <map:matcher name="request" 
src="org.apache.cocoon.matching.RequestParamMatcher"/>
      <map:matcher name="sessionstate" 
src="org.apache.cocoon.matching.WildcardSessionStateMatcherFactory"/>
      <map:matcher name="next-page" 
src="org.apache.cocoon.matching.WildcardParameterValueMatcherFactory">
  -      <map:parameter name="parameter-name" value="next-state"/>
  +      <parameter-name>next-state</parameter-name>
      </map:matcher>
      <map:matcher name="referer-match" 
src="org.apache.cocoon.matching.WildcardHeaderMatcherFactory">
  -      <map:parameter name="parameter-name" value="referer"/>
  +      <parameter-name>referer</parameter-name>
      </map:matcher>
     </map:matchers>
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to