dims        01/06/11 06:37:13

  Modified:    src/org/apache/cocoon/components/language/markup/sitemap/java
                        sitemap.xsl
  Log:
  Patch for "Code of a method longer than 65535 bytes".
  - Generate one method for each "map:match"
  
  Revision  Changes    Path
  1.15      +54 -27    
xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- sitemap.xsl       2001/06/11 10:51:17     1.14
  +++ sitemap.xsl       2001/06/11 13:37:06     1.15
  @@ -127,7 +127,7 @@
        *
        * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
        * @author <a href="mailto:[EMAIL PROTECTED]">Berin Loritsch</a>
  -     * @version CVS $Id: sitemap.xsl,v 1.14 2001/06/11 10:51:17 dims Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.15 2001/06/11 13:37:06 dims Exp $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, 
'/', '.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -142,7 +142,7 @@
   
         <!-- Generate matchers which implements CodeFactory -->
         <xsl:for-each select="/map:sitemap/map:components/map:matchers/map:matcher">
  -<xsl:call-template name="line-number"/>
  +        <xsl:call-template name="line-number"/>
           <xsl:variable name="src">
             <xsl:value-of select="@src"/>
           </xsl:variable>
  @@ -155,7 +155,7 @@
             }
             <!-- process all map:match elements with a type attribute refering to the 
current matcher factory iteration -->
             <xsl:for-each 
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:match[@type=$type
 or (not(@type) and $default)]">
  -<xsl:call-template name="line-number"/>
  +            <xsl:call-template name="line-number"/>
               <xsl:variable name="matcher-name">
                 <xsl:call-template name="generate-name">
                   <xsl:with-param name="prefix">matcher_</xsl:with-param>
  @@ -171,7 +171,7 @@
   
         <!-- Generate selectors which implements CodeFactory -->
         <xsl:for-each select="/map:sitemap/map:components/map:selectors/map:selector">
  -<xsl:call-template name="line-number"/>
  +        <xsl:call-template name="line-number"/>
           <xsl:variable name="src">
             <xsl:value-of select="@src"/>
           </xsl:variable>
  @@ -184,7 +184,7 @@
               <xsl:value-of 
select="XSLTFactoryLoader:getMethodSource($factory-loader, string($src),$config)"/>
             }
             <xsl:for-each 
select="/map:sitemap/map:pipelines/map:pipeline/descendant::map:select[@type=$name or 
(not(@type) and $default)]/map:when">
  -<xsl:call-template name="line-number"/>
  +            <xsl:call-template name="line-number"/>
               <xsl:variable name="selector-name">
                 <xsl:call-template name="generate-name">
                   <xsl:with-param name="prefix">selector_</xsl:with-param>
  @@ -307,7 +307,7 @@
   
         <!-- generate methods for every map:resource element -->
         <xsl:for-each select="/map:sitemap/map:resources/map:resource">
  -<xsl:call-template name="line-number"/>
  +        <xsl:call-template name="line-number"/>
           /**
            * This is the internal resource named "<xsl:value-of select="@name"/>"
            * @param pipeline A &lt;code&gt;StreamPipeline&lt;/code&gt; holding the 
sitemap component collected so far
  @@ -332,7 +332,7 @@
   
         <!-- generate methods for every map:view element -->
         <xsl:for-each select="/map:sitemap/map:views/map:view">
  -<xsl:call-template name="line-number"/>
  +        <xsl:call-template name="line-number"/>
           /**
            * This is the method to produce the "<xsl:value-of select="@name"/>" view 
of the requested resource
            * @param pipeline A &lt;code&gt;StreamPipeline&lt;/code&gt; holding the 
sitemap component collected so far
  @@ -355,7 +355,7 @@
   
         <!-- generate methods for every map:action-set element -->
         <xsl:for-each select="/map:sitemap/map:action-sets/map:action-set">
  -<xsl:call-template name="line-number"/>
  +        <xsl:call-template name="line-number"/>
           /**
            * This is the method to process the "<xsl:value-of select="@name"/>" 
action-set of the requested resource
            * @param cocoon_action A &lt;code&gt;String&lt;/code&gt; holding the 
requested action
  @@ -443,23 +443,30 @@
              generate and transform elements */
           List listOfMaps = (List) new ArrayList();
           eventPipeline.setSitemap(this);
  -        Map map;
  -        Parameters param;
  -        Map objectModel = environment.getObjectModel();
  -        SitemapRedirector redirector = new SitemapRedirector(environment);
  -        String cocoon_view = environment.getView();
  -        String cocoon_action = environment.getAction();
   
           <!-- process the pipelines -->
           <!-- for each pipeline element generate a try/catch block -->
           <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
  -<xsl:call-template name="line-number"/>
  +          <xsl:call-template name="line-number"/>
             <xsl:variable name="pipeline-position" select="position()"/>
             <xsl:if test="@internal-only = 'yes' or @internal-only='true'">
               if (internalRequest) {
             </xsl:if>
             try {
  -            <xsl:apply-templates select="./*"/>
  +            <xsl:for-each select="./map:match">
  +              <!-- get the type of matcher used -->
  +              <xsl:variable name="matcher-type">
  +                <xsl:call-template name="get-parameter">
  +                  <xsl:with-param name="parname">type</xsl:with-param>
  +                  <xsl:with-param name="default"><xsl:value-of 
select="/map:sitemap/map:components/map:matchers/@default"/></xsl:with-param>
  +                </xsl:call-template>
  +              </xsl:variable>
  +              // method for handling "<xsl:value-of select="@pattern"/>" 
  +              if(<xsl:value-of select="$matcher-type"/>Match<xsl:value-of 
select="generate-id(.)"/>( 
  +                                                    environment, pipeline, 
eventPipeline,
  +                                                    internalRequest,listOfMaps))
  +                return true;
  +            </xsl:for-each>
             } catch (ConnectionResetException cre) {
               getLogger().debug("Connection reset by peer");
             } catch (ResourceNotFoundException rse) {
  @@ -470,7 +477,10 @@
                 <xsl:when test="(./map:handle-errors)">
                   getLogger().warn("Error, try to process the error page", e);
                   try {
  -                  return error_process_<xsl:value-of select="$pipeline-position"/> 
(environment, objectModel, e, internalRequest);
  +                  return error_process_<xsl:value-of select="$pipeline-position"/> 
(environment, 
  +                                                                                    
environment.getObjectModel(), 
  +                                                                                    
e, 
  +                                                                                    
internalRequest);
                   } catch (Exception ex) {
                     getLogger().warn("Sitemap Error Process", ex);
                   }
  @@ -490,8 +500,9 @@
   
         <!-- generate methods for every map:handle-errors elements in all 
map:pipeline elements -->
         <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
  -<xsl:call-template name="line-number"/>
  +        <xsl:call-template name="line-number"/>
           <xsl:variable name="pipeline-position" select="position()"/>
  +        <xsl:apply-templates select="./*"/>
           <xsl:if test="(./map:handle-errors)">
             private boolean error_process_<xsl:value-of select="$pipeline-position"/> 
(Environment environment, Map objectModel, Exception e, boolean internalRequest)
             throws Exception {
  @@ -598,11 +609,26 @@
   
   
       <!-- this is the actual code produced -->
  -    if ((map = <xsl:value-of select="$matcher-name"/>) != null) {
  -      getLogger().debug("Matched <xsl:value-of select="$matcher-type"/> 
<xsl:value-of select="$matcher-name2"/>");
  -      listOfMaps.add (map);
  -      <xsl:apply-templates/>
  -      listOfMaps.remove (listOfMaps.size()-1);
  +    // method for handling "<xsl:value-of select="@pattern"/>" 
  +    private boolean <xsl:value-of select="$matcher-type"/>Match<xsl:value-of 
select="generate-id(.)"/>(
  +                                    Environment environment, StreamPipeline 
pipeline, 
  +                                    EventPipeline eventPipeline,
  +                                    boolean internalRequest, List listOfMaps) 
  +            throws ConnectionResetException, ResourceNotFoundException, Exception {
  +        Map map;
  +        Parameters param;
  +        Map objectModel = environment.getObjectModel();
  +        SitemapRedirector redirector = new SitemapRedirector(environment);
  +        String cocoon_view = environment.getView();
  +        String cocoon_action = environment.getAction();
  +        
  +        if ((map = <xsl:value-of select="$matcher-name"/>) != null) {
  +          getLogger().debug("Matched <xsl:value-of select="$matcher-type"/> 
<xsl:value-of select="$matcher-name2"/>");
  +          listOfMaps.add (map);
  +          <xsl:apply-templates/>
  +          listOfMaps.remove (listOfMaps.size()-1);
  +        }
  +        return false;
       }
     </xsl:template> <!-- match="map:match" -->
   
  @@ -653,7 +679,7 @@
   
       <!-- loop through all the when cases -->
       <xsl:for-each select="./map:when">
  -<xsl:call-template name="line-number"/>
  +      <xsl:call-template name="line-number"/>
   
         <!-- get the pattern used -->
         <xsl:variable name="test-value">
  @@ -703,7 +729,7 @@
   
       <!-- this is the actual code produced on the otherwise element -->
       <xsl:for-each select="./map:otherwise">
  -<xsl:call-template name="line-number"/>
  +      <xsl:call-template name="line-number"/>
         else {
           getLogger().debug("Select Otherwise");
         <xsl:apply-templates/>
  @@ -1153,7 +1179,7 @@
   
       <xsl:variable name="ns" select="namespace-uri(.)"/>
       <xsl:for-each select="$components">
  -<xsl:call-template name="line-number"/>
  +      <xsl:call-template name="line-number"/>
         <xsl:variable name="is-factory-component"
           select="@src and ($name = 'matcher' or $name = 'selector') and 
XSLTFactoryLoader:isFactory($factory-loader, string(@src))"/>
         <xsl:if test="$is-factory-component=false()">
  @@ -1211,7 +1237,7 @@
   
       <!-- process content -->
       <xsl:for-each select="$components">
  -<xsl:call-template name="line-number"/>
  +      <xsl:call-template name="line-number"/>
         {
            DefaultConfiguration cconf<xsl:value-of select="$level"/> = new 
DefaultConfiguration("<xsl:value-of select="name(.)"/>", LOCATION);
         <xsl:for-each select="attribute::*[name(.)!=$qname]">
  @@ -1463,3 +1489,4 @@
     <xsl:template match="map:logicsheet|map:dependency|map:handle-errors"/>
   
   </xsl:stylesheet>
  +
  
  
  

----------------------------------------------------------------------
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