giacomo     01/04/19 04:30:45

  Modified:    src/org/apache/cocoon/sitemap Tag: xml-cocoon2 Sitemap.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/components/pipeline Tag: xml-cocoon2
                        AbstractEventPipeline.java
                        AbstractStreamPipeline.java
                        CachingEventPipeline.java EventPipeline.java
                        NonCachingStreamPipeline.java
               src/org/apache/cocoon/environment Tag: xml-cocoon2
                        AbstractEnvironment.java Environment.java
               src/org/apache/cocoon/xml Tag: xml-cocoon2
                        ContentHandlerWrapper.java
  Added:       src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        ContentAggregator.java
  Log:
  Implementation of Content Aggregation at sitemap level.
  
  This implementation allows to express content aggregation in the sitemap:
  
      <map:aggregate              element="page"   
ns="http://foo.bar.com/myspace";>
       <map:part src="header"     element="header" 
ns="http://foo.bar.com/heading"/>
       <map:part src="navigation" element="nav"/>
       <map:part src="news"       element="content"/>
      </map:aggregate>
  
  The <map:aggregate> element is used instead of a <map:generate> to form a
  regular pipeline combination.
  
  The src attribute specifies the cocoon URI to use. The aggregator recursively
  calls the sitemap engine to obtain the pipelines that make up the specified
  URI. Note that this implementation is not yet able to use absolute URIs which
  would have to call the root sitemap for that and thus is limitted to resources
  available in the sitemap that specifies the aggregate element.
  
  The element attribute defines the element name to use to embed the aggregated
  content.
  
  The ns attribute specifies the namespace to use for the element specified
  with the element attribute. This attribute is optional.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.17  +6 -1      
xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java
  
  Index: Sitemap.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java,v
  retrieving revision 1.1.4.16
  retrieving revision 1.1.4.17
  diff -u -r1.1.4.16 -r1.1.4.17
  --- Sitemap.java      2001/04/12 16:00:58     1.1.4.16
  +++ Sitemap.java      2001/04/19 11:30:32     1.1.4.17
  @@ -21,7 +21,7 @@
    * Base interface for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.4.16 $ $Date: 2001/04/12 16:00:58 $
  + * @version CVS $Revision: 1.1.4.17 $ $Date: 2001/04/19 11:30:32 $
    */
   public interface Sitemap extends CompiledComponent, Configurable, 
Contextualizable, Processor {
       int GENERATOR = 1;
  @@ -31,6 +31,11 @@
       int ACTION = READER << 1;
       int MATCHER = ACTION << 1;
       int SELECTOR = MATCHER << 1;
  +
  +    /**
  +     * Process the given <code>Environment</code> 
  +     */
  +    boolean process(Environment environment) throws Exception;
   
       /**
        * Process the given <code>Environment</code> assebling 
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +319 -0    
xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ContentAggregator.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.98  +63 -1     
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.97
  retrieving revision 1.1.2.98
  diff -u -r1.1.2.97 -r1.1.2.98
  --- sitemap.xsl       2001/04/17 15:00:11     1.1.2.97
  +++ sitemap.xsl       2001/04/19 11:30:35     1.1.2.98
  @@ -65,6 +65,7 @@
       import java.util.HashMap;
       import java.util.Stack;
   
  +    import org.apache.avalon.Component;
       import org.apache.avalon.configuration.Configurable;
       import org.apache.avalon.configuration.Configuration;
       import org.apache.avalon.configuration.ConfigurationException;
  @@ -87,6 +88,7 @@
       import org.apache.cocoon.components.pipeline.EventPipeline;
       import org.apache.cocoon.sitemap.Sitemap;
       import org.apache.cocoon.sitemap.ErrorNotifier;
  +    import org.apache.cocoon.sitemap.ContentAggregator;
       import org.apache.cocoon.sitemap.Manager;
       import org.apache.cocoon.components.language.markup.xsp.XSPRequestHelper;
       import 
org.apache.cocoon.components.language.markup.xsp.XSPResponseHelper;
  @@ -96,7 +98,7 @@
        *
        * @author &lt;a href="mailto:[EMAIL PROTECTED]"&gt;Giacomo 
Pati&lt;/a&gt;
        * @author &lt;a href="mailto:[EMAIL PROTECTED]"&gt;Berin 
Loritsch&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.1.2.97 2001/04/17 15:00:11 
cziegeler Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.1.2.98 2001/04/19 11:30:35 giacomo 
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"/>";
  @@ -199,6 +201,7 @@
           try {
             <!-- configure well known components first -->
             load_component (Sitemap.GENERATOR, "!error-notifier!", 
"org.apache.cocoon.sitemap.ErrorNotifier", new DefaultConfiguration("", 
LOCATION), null);
  +          load_component (Sitemap.GENERATOR, "!content-aggregator!", 
"org.apache.cocoon.sitemap.ContentAggregator", new DefaultConfiguration("", 
LOCATION), null);
             load_component (Sitemap.TRANSFORMER, "!link-translator!", 
"org.apache.cocoon.sitemap.LinkTranslator", new DefaultConfiguration("", 
LOCATION), null);
   
             Configurer configurer = new Configurer(this, LOCATION);
  @@ -209,6 +212,7 @@
             configurer.configMatchers();
             configurer.configSelectors();
             configurer.configActions();
  +          configurer = null;
   
           /* catch any exception thrown by a component during configuration */
           } catch (Exception e) {
  @@ -962,6 +966,64 @@
       if ("<xsl:value-of select="@name"/>".equals(cocoon_view))
         return view_<xsl:value-of select="translate(@name, '- ', '__')"/> 
(pipeline, eventPipeline, listOfMaps, environment, internalRequest);
     </xsl:template> <!-- match="map:label" -->
  +
  +  <!-- generate the code to match a aggregate definition -->
  +  <xsl:template match="map:aggregate">
  +    <xsl:call-template name="setup-component">
  +      <xsl:with-param 
name="default-component">!content-aggregator!</xsl:with-param>
  +      <xsl:with-param 
name="method">eventPipeline.setGenerator</xsl:with-param>
  +      <xsl:with-param name="prefix">generator</xsl:with-param>
  +    </xsl:call-template>
  +    <xsl:variable name="ca">contentAggregator_<xsl:value-of 
select="generate-id(.)"/></xsl:variable>
  +    ContentAggregator <xsl:value-of select="$ca"/> = 
(ContentAggregator)eventPipeline.getGenerator();
  +    <xsl:value-of select="$ca"/>.setSitemap(this);
  +    <xsl:value-of select="$ca"/>.setEnvironment(environment);
  +    <xsl:if test="not (@element)">
  +      <xsl:call-template name="error">
  +        <xsl:with-param name="message">
  +          element attribute missing in aggregate element
  +        </xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:if>
  +    <xsl:choose>
  +      <xsl:when test="@ns">
  +        <xsl:value-of select="$ca"/>.setRootElement("<xsl:value-of 
select="@element"/>", "<xsl:value-of select="@ns"/>");
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsl:value-of select="$ca"/>.setRootElement("<xsl:value-of 
select="@element"/>", null);
  +      </xsl:otherwise>
  +    </xsl:choose>
  +    <xsl:apply-templates select="./map:part">
  +      <xsl:with-param name="ca"><xsl:value-of select="$ca"/></xsl:with-param>
  +    </xsl:apply-templates>
  +  </xsl:template> <!-- match="map:aggregate" -->
  +
  +  <!-- generate the code to match a aggregates part definition -->
  +  <xsl:template match="map:aggregate/map:part">
  +    <xsl:param name="ca"/>
  +    <xsl:if test="not (@src)">
  +      <xsl:call-template name="error">
  +        <xsl:with-param name="message">
  +          src attribute missing in aggregates part element
  +        </xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:if>
  +    <xsl:if test="not (@element)">
  +      <xsl:call-template name="error">
  +        <xsl:with-param name="message">
  +          element attribute missing in aggregates part element
  +        </xsl:with-param>
  +      </xsl:call-template>
  +    </xsl:if>
  +    <xsl:choose>
  +      <xsl:when test="@ns">
  +        <xsl:value-of select="$ca"/>.addPart("<xsl:value-of 
select="@src"/>", "<xsl:value-of select="@element"/>", "<xsl:value-of 
select="@ns"/>");
  +      </xsl:when>
  +      <xsl:otherwise>
  +        <xsl:value-of select="$ca"/>.addPart("<xsl:value-of 
select="@src"/>", "<xsl:value-of select="@element"/>", null);
  +      </xsl:otherwise>
  +    </xsl:choose>
  +  </xsl:template> <!-- match="map:aggregate/map:part" -->
   
     <!-- collect parameter definitions -->
     <xsl:template match="map:pipeline//parameter | map:action-set//parameter">
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +5 -1      
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/AbstractEventPipeline.java
  
  Index: AbstractEventPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/AbstractEventPipeline.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- AbstractEventPipeline.java        2001/04/13 16:02:22     1.1.2.3
  +++ AbstractEventPipeline.java        2001/04/19 11:30:37     1.1.2.4
  @@ -38,7 +38,7 @@
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
    * @author <a href="mailto:[EMAIL PROTECTED] Ziegeler">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/13 16:02:22 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2001/04/19 11:30:37 $
    */
   public abstract class AbstractEventPipeline
   extends AbstractXMLProducer
  @@ -85,6 +85,10 @@
           this.generatorParam = param;
       }
   
  +    public Generator getGenerator() {
  +        return this.generator;
  +    }
  +    
       public void addTransformer (String role, String source, Parameters param)
       throws Exception {
           this.transformers.add 
((Transformer)transformerSelector.select(role));
  
  
  
  1.1.2.3   +1 -13     
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/AbstractStreamPipeline.java
  
  Index: AbstractStreamPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/AbstractStreamPipeline.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- AbstractStreamPipeline.java       2001/04/18 12:05:52     1.1.2.2
  +++ AbstractStreamPipeline.java       2001/04/19 11:30:38     1.1.2.3
  @@ -38,7 +38,7 @@
    * resource
    * </UL>
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/04/18 12:05:52 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2001/04/19 11:30:38 $
    */
   public abstract class AbstractStreamPipeline extends AbstractLoggable 
implements StreamPipeline, Disposable {
       protected EventPipeline eventPipeline;
  @@ -80,14 +80,6 @@
           this.eventPipeline = eventPipeline;
       }
   
  -    public void setGenerator (String role, String source, Parameters param, 
Exception e) throws Exception {
  -        this.eventPipeline.setGenerator (role, source, param);
  -    }
  -
  -    public void setGenerator (String role, String source, Parameters param) 
throws Exception {
  -        this.eventPipeline.setGenerator (role, source, param);
  -    }
  -
       public EventPipeline getEventPipeline () {
           return this.eventPipeline;
       }
  @@ -124,10 +116,6 @@
           this.serializerParam = param;
           this.serializerMimeType = mimeType;
           this.sitemapSerializerMimeType = 
serializerSelector.getMimeTypeForRole(role);
  -    }
  -
  -    public void addTransformer (String role, String source, Parameters 
param) throws Exception {
  -        this.eventPipeline.addTransformer (role, source, param);
       }
   
       public boolean process(Environment environment)
  
  
  
  1.1.2.6   +2 -1      
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingEventPipeline.java
  
  Index: CachingEventPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/CachingEventPipeline.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- CachingEventPipeline.java 2001/04/17 10:33:12     1.1.2.5
  +++ CachingEventPipeline.java 2001/04/19 11:30:38     1.1.2.6
  @@ -57,7 +57,7 @@
    * does not cache! (If it would cache, the response would be cached twice!)
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/04/17 10:33:12 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/04/19 11:30:38 $
    */
   public final class CachingEventPipeline
   extends AbstractEventPipeline
  @@ -383,6 +383,7 @@
       }
   
       public void dispose() {
  +        super.dispose();
           if(this.eventCache != null)
               this.manager.release((Component)this.eventCache);
       }
  
  
  
  1.1.2.2   +3 -1      
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/EventPipeline.java
  
  Index: EventPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/EventPipeline.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- EventPipeline.java        2001/04/04 15:42:42     1.1.2.1
  +++ EventPipeline.java        2001/04/19 11:30:39     1.1.2.2
  @@ -15,14 +15,16 @@
   
   import org.apache.cocoon.Processor;
   import org.apache.cocoon.environment.Environment;
  +import org.apache.cocoon.generation.Generator;
   
   /**
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2001/04/04 15:42:42 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2001/04/19 11:30:39 $
    */
   public interface EventPipeline extends Component, Composer, Recyclable, 
Processor {
       public void setGenerator (String role, String source, Parameters param, 
Exception e) throws Exception;
       public void setGenerator (String role, String source, Parameters param) 
throws Exception;
  +    public Generator getGenerator ();
       public void addTransformer (String role, String source, Parameters 
param) throws Exception;
       public boolean process(Environment environment) throws Exception;
   }
  
  
  
  1.1.2.6   +1 -2      
xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/NonCachingStreamPipeline.java
  
  Index: NonCachingStreamPipeline.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/pipeline/Attic/NonCachingStreamPipeline.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- NonCachingStreamPipeline.java     2001/04/17 10:33:15     1.1.2.5
  +++ NonCachingStreamPipeline.java     2001/04/19 11:30:39     1.1.2.6
  @@ -20,7 +20,7 @@
    * resource
    * </UL>
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/04/17 10:33:15 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/04/19 11:30:39 $
    */
   public final class NonCachingStreamPipeline extends AbstractStreamPipeline {
   
  @@ -44,7 +44,6 @@
        */
       public void recycle() {
           getLogger().debug("Recycling of NonCachingStreamPipeline");
  -
           super.recycle();
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.14  +22 -3     
xml-cocoon/src/org/apache/cocoon/environment/Attic/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/AbstractEnvironment.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- AbstractEnvironment.java  2001/03/30 17:14:23     1.1.2.13
  +++ AbstractEnvironment.java  2001/04/19 11:30:42     1.1.2.14
  @@ -12,6 +12,7 @@
   import java.io.IOException;
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.util.ArrayList;
   import java.util.Map;
   import java.util.HashMap;
   
  @@ -27,7 +28,7 @@
   public abstract class AbstractEnvironment extends AbstractLoggable 
implements Environment {
   
       /** The current uri in progress */
  -    protected String uri = null;
  +    protected ArrayList uris = new ArrayList();
   
       /** The current prefix to strip off from the request uri */
       protected StringBuffer prefix = new StringBuffer();
  @@ -73,7 +74,7 @@
        */
       public AbstractEnvironment(String uri, String view, File context, String 
action)
       throws MalformedURLException {
  -        this.uri = uri;
  +        this.pushURI(uri);
           this.view = view;
           this.context = context.toURL();
           this.action = action;
  @@ -86,7 +87,7 @@
        * Returns the uri in progress. The prefix is stripped off
        */
       public String getURI() {
  -        return this.uri;
  +        return (String)this.uris.get(this.uris.size()-1);
       }
   
       /**
  @@ -94,6 +95,7 @@
        */
       public void changeContext(String prefix, String context)
       throws MalformedURLException {
  +        String uri = (String)this.uris.get(this.uris.size()-1);
           LogKit.getLoggerFor("cocoon").debug("Changing Cocoon context(" + 
context + ") to prefix(" + prefix + ")");
           LogKit.getLoggerFor("cocoon").debug("\tfrom context(" + 
this.context.toExternalForm() + ") and prefix(" + this.prefix + ")");
           LogKit.getLoggerFor("cocoon").debug("\tat URI " + uri);
  @@ -126,6 +128,7 @@
               );
           }
           LogKit.getLoggerFor("cocoon").debug("New context is " + 
this.context.toExternalForm());
  +        this.uris.set(this.uris.size()-1, uri);
       }
   
       /**
  @@ -182,5 +185,21 @@
           if (systemId.charAt(0) == '/')
               return new InputSource(this.context.getProtocol() + ":" + 
systemId);
           return new InputSource(new 
URL(this.context,systemId).toExternalForm());
  +    }
  +
  +    /**
  +     * Push a new URI for processing
  +     */
  +    public void pushURI(String uri) {
  +        this.uris.add(uri);
  +    }
  +
  +    /**
  +     * Pop last pushed URI
  +     */
  +    public String popURI() {
  +        String uri = (String)this.uris.get(this.uris.size()-1);
  +        this.uris.remove(this.uris.size()-1);
  +        return uri;
       }
   }
  
  
  
  1.1.2.17  +11 -1     
xml-cocoon/src/org/apache/cocoon/environment/Attic/Environment.java
  
  Index: Environment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/Environment.java,v
  retrieving revision 1.1.2.16
  retrieving revision 1.1.2.17
  diff -u -r1.1.2.16 -r1.1.2.17
  --- Environment.java  2001/04/18 12:05:54     1.1.2.16
  +++ Environment.java  2001/04/19 11:30:42     1.1.2.17
  @@ -20,7 +20,7 @@
    * Base interface for an environment abstraction
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.16 $ $Date: 2001/04/18 12:05:54 $
  + * @version CVS $Revision: 1.1.2.17 $ $Date: 2001/04/19 11:30:42 $
    */
   
   public interface Environment extends EntityResolver {
  @@ -74,6 +74,16 @@
        * Get the underlying object model
        */
       Map getObjectModel();
  +
  +    /**
  +     * Push a new URI for processing
  +     */
  +    void pushURI(String uri);
  +
  +    /**
  +     * Pop last pushed URI
  +     */
  +    String popURI();
   
   }
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +2 -2      
xml-cocoon/src/org/apache/cocoon/xml/Attic/ContentHandlerWrapper.java
  
  Index: ContentHandlerWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/xml/Attic/ContentHandlerWrapper.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- ContentHandlerWrapper.java        2001/04/15 13:56:05     1.1.2.6
  +++ ContentHandlerWrapper.java        2001/04/19 11:30:44     1.1.2.7
  @@ -27,12 +27,12 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Davanum Srinivas</a>
    *         (Apache Software Foundation, Computer Associates)
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/04/15 13:56:05 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/04/19 11:30:44 $
    */
   public class ContentHandlerWrapper extends AbstractXMLConsumer implements 
Recyclable {
   
       /** The current <code>ContentHandler</code>. */
  -    protected ContentHandler documentHandler=null;
  +    protected ContentHandler documentHandler;
   
       /**
        * Create a new <code>ContentHandlerWrapper</code> instance.
  
  
  

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