giacomo     00/10/30 10:37:45

  Modified:    src/org/apache/cocoon/acting Tag: xml-cocoon2 Action.java
                        HelloAction.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
  Log:
  An Action can have an optional src attribute to obtain additional information 
like XSchemas or alike
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +4 -2      xml-cocoon/src/org/apache/cocoon/acting/Attic/Action.java
  
  Index: Action.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/Action.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- Action.java       2000/10/19 14:42:49     1.1.2.2
  +++ Action.java       2000/10/30 18:37:40     1.1.2.3
  @@ -20,7 +20,7 @@
   /**
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/10/19 14:42:49 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/10/30 18:37:40 $
    */
   public interface Action extends Component, ThreadSafe {
       /**
  @@ -37,6 +37,7 @@
        *                    calling environment which can be used
        *                    to select values this controller may need
        *                    (ie HttpRequest, HttpResponse).
  +     * @param source      A source <code>String</code> to the Action
        * @param parameters  The <code>Parameters</code> for this invocation
        * @return List       The returned <code>List</code> object with
        *                    sitemap substitution values which can be used
  @@ -47,7 +48,8 @@
        *                    be skipped.
        * @exception Exception Indicates something is totally wrong
        */
  -    public List act (EntityResolver resolver, Map objectModel, Parameters 
parameters) throws Exception;
  +    public List act(EntityResolver resolver, Map objectModel, String source, 
Parameters par)
  +    throws Exception;
   }
   
   
  
  
  
  1.1.2.3   +2 -2      
xml-cocoon/src/org/apache/cocoon/acting/Attic/HelloAction.java
  
  Index: HelloAction.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/acting/Attic/HelloAction.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- HelloAction.java  2000/10/19 14:42:52     1.1.2.2
  +++ HelloAction.java  2000/10/30 18:37:41     1.1.2.3
  @@ -23,14 +23,14 @@
   /**
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/10/19 14:42:52 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/10/30 18:37:41 $
    */
   public class HelloAction implements Action {
       /**
        * A simple Action that logs if the <code>Session</code> object
        * has been created
        */
  -    public List act (EntityResolver resolver, Map objectModel, Parameters 
par) throws Exception {
  +    public List act (EntityResolver resolver, Map objectModel, String src, 
Parameters par) throws Exception {
           HttpServletRequest req = (HttpServletRequest) 
objectModel.get("request");
           if (req != null) {
               HttpSession session = req.getSession (false);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.56  +27 -25    
xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
  retrieving revision 1.1.2.55
  retrieving revision 1.1.2.56
  diff -u -r1.1.2.55 -r1.1.2.56
  --- sitemap.xsl       2000/10/25 17:47:26     1.1.2.55
  +++ sitemap.xsl       2000/10/30 18:37:43     1.1.2.56
  @@ -61,6 +61,7 @@
   
       import org.apache.cocoon.Cocoon;
       import org.apache.cocoon.ProcessingException;
  +    import org.apache.cocoon.acting.Action;
       import org.apache.cocoon.environment.Environment;
       import org.apache.cocoon.sitemap.AbstractSitemap;
       import org.apache.cocoon.sitemap.ComponentHolder;
  @@ -75,7 +76,7 @@
        *
        * @author &lt;a href="mailto:[EMAIL PROTECTED]"&gt;Giacomo 
Pati&lt;/a&gt;
        * @author &lt;a href="mailto:[EMAIL PROTECTED]"&gt;Berin 
Loiritsch&lt;/a&gt;
  -     * @version CVS $Revision: 1.1.2.55 $ $Date: 2000/10/25 17:47:26 $
  +     * @version CVS $Revision: 1.1.2.56 $ $Date: 2000/10/30 18:37:43 $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap 
{
         static {
  @@ -165,9 +166,10 @@
             <xsl:variable name="type" select="translate(@name, '- ', '__')"/>
           <xsl:variable name="default" select="$type = ../@default"/>
           <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
  -       private boolean <xsl:value-of select="$type"/>Select (<xsl:value-of 
select="java:getParameterSource($factory-loader, string($factory),$config)"/> 
pattern, Map objectModel) {
  -           <xsl:value-of select="java:getMethodSource($factory-loader, 
string($factory),$config)"/>
  -       }       <xsl:for-each 
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:when[../map:select/@type=$type
 or (not(../map:select/@type) and $default)]">
  +        private boolean <xsl:value-of select="$type"/>Select (<xsl:value-of 
select="java:getParameterSource($factory-loader, string($factory),$config)"/> 
pattern, Map objectModel) {
  +          <xsl:value-of select="java:getMethodSource($factory-loader, 
string($factory),$config)"/>
  +        }
  +        <xsl:for-each 
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:when[../map:select/@type=$type
 or (not(../map:select/@type) and $default)]">
             <xsl:variable name="selector-name">
               <xsl:call-template name="generate-name">
                 <xsl:with-param name="prefix">selector_</xsl:with-param>
  @@ -383,20 +385,17 @@
         </xsl:call-template>
       </xsl:variable>
   
  -    <!-- get the name of this matcher in case it is defined in this sitemap 
? -->
  -    <xsl:variable name="local-matcher" 
select="/map:sitemap/map:components/map:matchers/map:[EMAIL PROTECTED]"/>
  -
       <!-- check if this matcher is a factory ? -->
       <xsl:variable name="is-factory">
         <xsl:choose>
  -        <xsl:when test="not($local-matcher)">
  +        <xsl:when test="/map:sitemap/map:components/map:matchers/map:[EMAIL 
PROTECTED]">
             <xsl:value-of select="false()"/>
           </xsl:when>
  -        <xsl:when test="$local-matcher/@factory">
  +        <xsl:when test="/map:sitemap/map:components/map:matchers/map:[EMAIL 
PROTECTED]/@factory">
             <xsl:value-of select="true()"/>
           </xsl:when>
  -        <xsl:when test="$local-matcher/@src">
  -          <xsl:value-of select="java:isFactory($factory-loader, 
string($local-matcher/@src))"/>
  +        <xsl:when test="/map:sitemap/map:components/map:matchers/map:[EMAIL 
PROTECTED]/@src">
  +          <xsl:value-of select="java:isFactory($factory-loader, 
string(/map:sitemap/map:components/map:matchers/map:[EMAIL PROTECTED]/@src))"/>
           </xsl:when>
           <xsl:otherwise>
             <xsl:value-of select="false()"/>
  @@ -458,22 +457,17 @@
           </xsl:call-template>
         </xsl:variable>
   
  -      <!-- get the name of this selector in case it is defined in this 
sitemap ? -->
  -      <xsl:variable name="local-selector">
  -        <xsl:value-of 
select="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]"/>
  -      </xsl:variable>
  -
         <!-- check if this selector is a factory ? -->
         <xsl:variable name="is-factory">
           <xsl:choose>
  -          <xsl:when test="not($local-selector)">
  +          <xsl:when 
test="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]">
               <xsl:value-of select="false()"/>
             </xsl:when>
  -          <xsl:when test="$local-selector/@factory">
  +          <xsl:when 
test="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]/@factory">
               <xsl:value-of select="true()"/>
             </xsl:when>
  -          <xsl:when test="$local-selector/@src">
  -            <xsl:value-of select="java:isFactory($factory-loader, 
string($local-selector/@src))"/>
  +          <xsl:when 
test="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]/@src">
  +            <xsl:value-of select="java:isFactory($factory-loader, 
string(/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]/@src))"/>
             </xsl:when>
             <xsl:otherwise>
               <xsl:value-of select="false()"/>
  @@ -498,7 +492,7 @@
         <xsl:if test="position() > 1">
           else
         </xsl:if>
  -      if (<xsl:value-of select="translate($selector-type, '- ', 
'__')"/>Select (<xsl:value-of select="$selector-name"/>_expr, environment)) {
  +      if (<xsl:value-of select="translate($selector-type, '- ', 
'__')"/>Select (<xsl:value-of select="$selector-name"/>_expr, objectModel)) {
          <xsl:apply-templates/>
         }
       </xsl:for-each>
  @@ -509,7 +503,7 @@
         <xsl:apply-templates/>
         }
       </xsl:for-each>
  -  </xsl:template> <!-- match="/map:sitemap/map:select" -->
  +  </xsl:template> <!-- match="map:select" -->
   
     <!-- processing of an act element -->
     <xsl:template match="map:act">
  @@ -522,9 +516,17 @@
         </xsl:call-template>
       </xsl:variable>
   
  +    <!-- get the source parameter for the Action -->
  +    <xsl:variable name="action-source">
  +      <xsl:call-template name="get-parameter-as-string">
  +        <xsl:with-param name="parname">src</xsl:with-param>
  +        <xsl:with-param name="default">null</xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:variable>
  +
       <!-- gets the string how the action is to be invoced in java code -->
       <xsl:variable name="action-name">
  -      
((Action)((ComponentHolder)super.sitemapComponentManager.lookup("action:<xsl:value-of
 select="$selector-type2"/>")).get()).act
  +      
((Action)((ComponentHolder)super.sitemapComponentManager.lookup("action:<xsl:value-of
 select="$action-type"/>")).get()).act
       </xsl:variable>
   
       <!-- test if we have to define parameters for this action -->
  @@ -550,14 +552,14 @@
       <!-- generate the invocation of the act method of the action component 
-->
       <xsl:choose>
         <xsl:when test="./*">
  -        if ((list = <xsl:value-of select="$action-name"/> (environment, 
objectModel, <xsl:value-of select="$component-param"/>)) != null) {
  +        if ((list = <xsl:value-of select="$action-name"/> (environment, 
objectModel, substitute(listOfLists,<xsl:value-of select="$action-source"/>), 
<xsl:value-of select="$component-param"/>)) != null) {
             listOfLists.add (list);
             <xsl:apply-templates/>
             listOfList.remove(list);
           }
         </xsl:when>
         <xsl:otherwise>
  -        list = <xsl:value-of select="$action-name"/> (environment, 
objectModel, <xsl:value-of select="$component-param"/>);
  +        list = <xsl:value-of select="$action-name"/> (environment, 
objectModel, substitute(listOfLists,<xsl:value-of select="$action-source"/>), 
<xsl:value-of select="$component-param"/>);
         </xsl:otherwise>
       </xsl:choose>
     </xsl:template> <!-- match="map:act" -->
  
  
  

Reply via email to