cziegeler 02/05/27 07:02:30 Modified: . changes.xml src/java/org/apache/cocoon Cocoon.java Processor.java ProcessorWrapper.java cocoon.roles src/java/org/apache/cocoon/components/pipeline AbstractEventPipeline.java AbstractStreamPipeline.java CacheableEventPipeline.java CachingEventPipeline.java CachingStreamPipeline.java EventPipeline.java NonCachingEventPipeline.java NonCachingStreamPipeline.java StreamPipeline.java src/java/org/apache/cocoon/components/source SitemapSource.java src/java/org/apache/cocoon/components/source/impl SitemapSource.java src/java/org/apache/cocoon/components/treeprocessor InvokeContext.java TreeProcessor.java src/java/org/apache/cocoon/components/treeprocessor/sitemap MountNode.java PipelinesNode.java src/java/org/apache/cocoon/environment ForwardRedirector.java src/webapp/WEB-INF cocoon.xconf Log: Removed event and stream pipeline...at least it compiles... Revision Changes Path 1.174 +5 -1 xml-cocoon2/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/changes.xml,v retrieving revision 1.173 retrieving revision 1.174 diff -u -r1.173 -r1.174 --- changes.xml 26 May 2002 22:06:02 -0000 1.173 +++ changes.xml 27 May 2002 14:02:29 -0000 1.174 @@ -4,7 +4,7 @@ <!-- History of Cocoon changes - $Id: changes.xml,v 1.173 2002/05/26 22:06:02 gianugo Exp $ + $Id: changes.xml,v 1.174 2002/05/27 14:02:29 cziegeler Exp $ --> <changes title="History of Changes"> @@ -38,6 +38,10 @@ </devs> <release version="@version@" date="@date@"> + <action dev="CZ" type="add"> + Replaced event pipeline and stream pipeline with one single component, + the processing pipeline. Added configurable pipelines to sitemap. + </action> <action dev="GR" type="add"> Added an "expires" directive to map:pipeline in order to manually set an "Expires:" HTTP header following Apache's 1.28 +11 -19 xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java Index: Cocoon.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- Cocoon.java 10 May 2002 10:17:08 -0000 1.27 +++ Cocoon.java 27 May 2002 14:02:29 -0000 1.28 @@ -71,8 +71,7 @@ import org.apache.cocoon.components.CocoonComponentManager; import org.apache.cocoon.components.language.generator.CompiledComponent; import org.apache.cocoon.components.language.generator.ProgramGenerator; -import org.apache.cocoon.components.pipeline.EventPipeline; -import org.apache.cocoon.components.pipeline.StreamPipeline; +import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.components.source.DelayedRefreshSourceWrapper; import org.apache.cocoon.components.source.URLSource; import org.apache.cocoon.environment.Environment; @@ -97,7 +96,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> (Apache Software Foundation, Exoffice Technologies) * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> * @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a> - * @version CVS $Id: Cocoon.java,v 1.27 2002/05/10 10:17:08 cziegeler Exp $ + * @version CVS $Id: Cocoon.java,v 1.28 2002/05/27 14:02:29 cziegeler Exp $ */ public class Cocoon extends AbstractLoggable @@ -472,16 +471,14 @@ * @param pipeline a <code>StreamPipeline</code> value * @param eventPipeline an <code>EventPipeline</code> value */ - protected void debug(Environment environment, - StreamPipeline pipeline, - EventPipeline eventPipeline) { + protected void debug(Environment environment, boolean internal) { String lineSeparator = System.getProperty("line.separator"); Map objectModel = environment.getObjectModel(); Request request = ObjectModelHelper.getRequest(objectModel); Session session = request.getSession(false); StringBuffer msg = new StringBuffer(); msg.append("DEBUGGING INFORMATION:").append(lineSeparator); - if (pipeline != null && eventPipeline != null) { + if (internal) { msg.append("INTERNAL "); } msg.append("REQUEST: ").append(request.getRequestURI()).append(lineSeparator).append(lineSeparator); @@ -583,7 +580,7 @@ if (this.getLogger().isDebugEnabled()) { ++activeRequestCount; if (this.getLogger().isDebugEnabled()) { - this.debug(environment, null, null); + this.debug(environment, false); } } @@ -607,15 +604,10 @@ /** * Process the given <code>Environment</code> to assemble - * a <code>StreamPipeline</code> and an <code>EventPipeline</code>. - * - * @param environment an <code>Environment</code> value - * @param pipeline a <code>StreamPipeline</code> value - * @param eventPipeline an <code>EventPipeline</code> value - * @return a <code>boolean</code> value - * @exception Exception if an error occurs + * a <code>ProcessingPipeline</code>. + * @since @next-version@ */ - public boolean process(Environment environment, StreamPipeline pipeline, EventPipeline eventPipeline) + public ProcessingPipeline processInternal(Environment environment) throws Exception { if (disposed) { throw new IllegalStateException("You cannot process a Disposed Cocoon engine."); @@ -625,16 +617,16 @@ if (this.getLogger().isDebugEnabled()) { ++activeRequestCount; if (this.getLogger().isDebugEnabled()) { - this.debug(environment, pipeline, eventPipeline); + this.debug(environment, true); } } if (this.threadSafeProcessor != null) { - return this.threadSafeProcessor.process(environment, pipeline, eventPipeline); + return this.threadSafeProcessor.processInternal(environment); } else { Processor processor = (Processor)this.componentManager.lookup(Processor.ROLE); try { - return processor.process(environment); + return processor.processInternal(environment); } finally { this.componentManager.release(processor); 1.7 +6 -7 xml-cocoon2/src/java/org/apache/cocoon/Processor.java Index: Processor.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Processor.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Processor.java 22 Feb 2002 07:03:48 -0000 1.6 +++ Processor.java 27 May 2002 14:02:29 -0000 1.7 @@ -51,15 +51,15 @@ package org.apache.cocoon; import org.apache.avalon.framework.component.Component; -import org.apache.cocoon.components.pipeline.EventPipeline; -import org.apache.cocoon.components.pipeline.StreamPipeline; +import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.environment.Environment; /** * * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> * (Apache Software Foundation, Exoffice Technologies) - * @version CVS $Id: Processor.java,v 1.6 2002/02/22 07:03:48 cziegeler Exp $ + * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> + * @version CVS $Id: Processor.java,v 1.7 2002/05/27 14:02:29 cziegeler Exp $ */ public interface Processor extends Component { @@ -80,10 +80,9 @@ /** * Process the given <code>Environment</code> to assemble - * a <code>StreamPipeline</code> and an <code>EventPipeline</code>. + * a <code>ProcessingPipeline</code>. + * @since @next-version@ */ - boolean process(Environment environment, - StreamPipeline pipeline, - EventPipeline eventPipeline) + ProcessingPipeline processInternal(Environment environment) throws Exception; } 1.7 +7 -8 xml-cocoon2/src/java/org/apache/cocoon/ProcessorWrapper.java Index: ProcessorWrapper.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/ProcessorWrapper.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ProcessorWrapper.java 22 Feb 2002 07:03:48 -0000 1.6 +++ ProcessorWrapper.java 27 May 2002 14:02:29 -0000 1.7 @@ -53,15 +53,14 @@ import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.thread.ThreadSafe; -import org.apache.cocoon.components.pipeline.EventPipeline; -import org.apache.cocoon.components.pipeline.StreamPipeline; +import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.environment.Environment; /** * This class is a wrapper around the real processor (the <code>Cocoon</code> class). * It is necessary to avoid infinite dispose loops * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: ProcessorWrapper.java,v 1.6 2002/02/22 07:03:48 cziegeler Exp $ + * @version CVS $Id: ProcessorWrapper.java,v 1.7 2002/05/27 14:02:29 cziegeler Exp $ */ public final class ProcessorWrapper implements Processor, Component, Disposable, ThreadSafe { @@ -86,12 +85,12 @@ /** * Process the given <code>Environment</code> to assemble - * a <code>StreamPipeline</code> and an <code>EventPipeline</code>. + * a <code>ProcessingPipeline</code>. + * @since @next-version@ */ - public boolean process(Environment environment, - StreamPipeline pipeline, - EventPipeline eventPipeline) + public ProcessingPipeline processInternal(Environment environment) throws Exception { - return this.processor.process(environment, pipeline, eventPipeline); + return this.processor.processInternal(environment); } + } 1.30 +0 -8 xml-cocoon2/src/java/org/apache/cocoon/cocoon.roles Index: cocoon.roles =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/cocoon.roles,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- cocoon.roles 27 May 2002 12:43:22 -0000 1.29 +++ cocoon.roles 27 May 2002 14:02:29 -0000 1.30 @@ -139,14 +139,6 @@ shorthand="cache" default-class="org.apache.cocoon.caching.impl.CacheImpl"/> - <role name="org.apache.cocoon.components.pipeline.StreamPipeline" - shorthand="stream-pipeline" - default-class="org.apache.cocoon.components.pipeline.NonCachingStreamPipeline"/> - - <role name="org.apache.cocoon.components.pipeline.EventPipeline" - shorthand="event-pipeline" - default-class="org.apache.cocoon.components.pipeline.NonCachingEventPipeline"/> - <role name="org.apache.cocoon.components.saxconnector.SAXConnector" shorthand="sax-connector"/> 1.11 +3 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java Index: AbstractEventPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractEventPipeline.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- AbstractEventPipeline.java 3 May 2002 10:59:01 -0000 1.10 +++ AbstractEventPipeline.java 27 May 2002 14:02:29 -0000 1.11 @@ -76,7 +76,9 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a * @author <a href="mailto:[EMAIL PROTECTED]">Nicola Ken Barozzi</a> * @author <a href="mailto:[EMAIL PROTECTED]">Peter Royal</a> - * @version CVS $Id: AbstractEventPipeline.java,v 1.10 2002/05/03 10:59:01 cziegeler Exp $ + * + * @deprecated by the ProcessingPipeline + * @version CVS $Id: AbstractEventPipeline.java,v 1.11 2002/05/27 14:02:29 cziegeler Exp $ */ public abstract class AbstractEventPipeline extends AbstractXMLProducer 1.9 +3 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractStreamPipeline.java Index: AbstractStreamPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractStreamPipeline.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- AbstractStreamPipeline.java 22 Feb 2002 07:00:11 -0000 1.8 +++ AbstractStreamPipeline.java 27 May 2002 14:02:29 -0000 1.9 @@ -73,7 +73,9 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> - * @version CVS $Id: AbstractStreamPipeline.java,v 1.8 2002/02/22 07:00:11 cziegeler Exp $ + * + * @deprecated by the ProcessingPipeline + * @version CVS $Id: AbstractStreamPipeline.java,v 1.9 2002/05/27 14:02:29 cziegeler Exp $ */ public abstract class AbstractStreamPipeline extends AbstractLoggable implements StreamPipeline, Disposable { protected EventPipeline eventPipeline; 1.5 +2 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/CacheableEventPipeline.java Index: CacheableEventPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/CacheableEventPipeline.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CacheableEventPipeline.java 22 Feb 2002 07:00:11 -0000 1.4 +++ CacheableEventPipeline.java 27 May 2002 14:02:29 -0000 1.5 @@ -60,7 +60,8 @@ * * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: CacheableEventPipeline.java,v 1.4 2002/02/22 07:00:11 cziegeler Exp $ + * @deprecated by the ProcessingPipeline + * @version CVS $Id: CacheableEventPipeline.java,v 1.5 2002/05/27 14:02:29 cziegeler Exp $ */ public interface CacheableEventPipeline { 1.11 +2 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/CachingEventPipeline.java Index: CachingEventPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/CachingEventPipeline.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- CachingEventPipeline.java 6 May 2002 12:28:50 -0000 1.10 +++ CachingEventPipeline.java 27 May 2002 14:02:29 -0000 1.11 @@ -82,8 +82,9 @@ * is invoked (e.g. by the CachingStreamPipeline) the CachingEventPipeline * does not cache! (If it would cache, the response would be cached twice!) * + * @deprecated by the ProcessingPipeline * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: CachingEventPipeline.java,v 1.10 2002/05/06 12:28:50 cziegeler Exp $ + * @version CVS $Id: CachingEventPipeline.java,v 1.11 2002/05/27 14:02:29 cziegeler Exp $ */ public class CachingEventPipeline extends AbstractEventPipeline 1.10 +2 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/CachingStreamPipeline.java Index: CachingStreamPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/CachingStreamPipeline.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- CachingStreamPipeline.java 6 May 2002 12:28:50 -0000 1.9 +++ CachingStreamPipeline.java 27 May 2002 14:02:29 -0000 1.10 @@ -83,8 +83,9 @@ * <li>b) the <code>EventPipeline</code> is cacheable</li> * </ul> * + * @deprecated by the ProcessingPipeline * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: CachingStreamPipeline.java,v 1.9 2002/05/06 12:28:50 cziegeler Exp $ + * @version CVS $Id: CachingStreamPipeline.java,v 1.10 2002/05/27 14:02:29 cziegeler Exp $ */ public class CachingStreamPipeline extends AbstractStreamPipeline { 1.5 +2 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/EventPipeline.java Index: EventPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/EventPipeline.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- EventPipeline.java 22 Feb 2002 07:00:11 -0000 1.4 +++ EventPipeline.java 27 May 2002 14:02:29 -0000 1.5 @@ -67,8 +67,9 @@ * depends on the pipeline assembly engine where they are defined (i.e. a given * sitemap file). * + * @deprecated by the ProcessingPipeline * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Id: EventPipeline.java,v 1.4 2002/02/22 07:00:11 cziegeler Exp $ + * @version CVS $Id: EventPipeline.java,v 1.5 2002/05/27 14:02:29 cziegeler Exp $ */ public interface EventPipeline extends XMLProducer, Component, Recomposable, Recyclable { 1.5 +2 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/NonCachingEventPipeline.java Index: NonCachingEventPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/NonCachingEventPipeline.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- NonCachingEventPipeline.java 22 Feb 2002 07:00:11 -0000 1.4 +++ NonCachingEventPipeline.java 27 May 2002 14:02:29 -0000 1.5 @@ -54,7 +54,8 @@ /** * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Id: NonCachingEventPipeline.java,v 1.4 2002/02/22 07:00:11 cziegeler Exp $ + * @deprecated by the ProcessingPipeline + * @version CVS $Id: NonCachingEventPipeline.java,v 1.5 2002/05/27 14:02:29 cziegeler Exp $ */ public class NonCachingEventPipeline extends AbstractEventPipeline implements Recyclable { 1.7 +2 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/NonCachingStreamPipeline.java Index: NonCachingStreamPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/NonCachingStreamPipeline.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- NonCachingStreamPipeline.java 2 May 2002 14:20:46 -0000 1.6 +++ NonCachingStreamPipeline.java 27 May 2002 14:02:29 -0000 1.7 @@ -58,8 +58,9 @@ /** * This is the non caching implementation of a processing pipeline. * + * @deprecated by the ProcessingPipeline * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Id: NonCachingStreamPipeline.java,v 1.6 2002/05/02 14:20:46 cziegeler Exp $ + * @version CVS $Id: NonCachingStreamPipeline.java,v 1.7 2002/05/27 14:02:29 cziegeler Exp $ */ public class NonCachingStreamPipeline extends AbstractStreamPipeline { 1.5 +2 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/StreamPipeline.java Index: StreamPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/StreamPipeline.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- StreamPipeline.java 22 Feb 2002 07:00:11 -0000 1.4 +++ StreamPipeline.java 27 May 2002 14:02:29 -0000 1.5 @@ -68,8 +68,9 @@ * depends on the pipeline assembly engine where they are defined (i.e. * a given sitemap file). * + * @deprecated by the ProcessingPipeline * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Id: StreamPipeline.java,v 1.4 2002/02/22 07:00:11 cziegeler Exp $ + * @version CVS $Id: StreamPipeline.java,v 1.5 2002/05/27 14:02:29 cziegeler Exp $ */ public interface StreamPipeline extends Component, Recomposable, Recyclable { 1.13 +11 -28 xml-cocoon2/src/java/org/apache/cocoon/components/source/SitemapSource.java Index: SitemapSource.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/SitemapSource.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- SitemapSource.java 24 Apr 2002 09:59:48 -0000 1.12 +++ SitemapSource.java 27 May 2002 14:02:29 -0000 1.13 @@ -58,9 +58,7 @@ import org.apache.cocoon.Processor; import org.apache.cocoon.caching.PipelineCacheKey; import org.apache.cocoon.components.CocoonComponentManager; -import org.apache.cocoon.components.pipeline.CacheableEventPipeline; -import org.apache.cocoon.components.pipeline.EventPipeline; -import org.apache.cocoon.components.pipeline.StreamPipeline; +import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.environment.Environment; import org.apache.cocoon.environment.ModifiableSource; import org.apache.cocoon.environment.Request; @@ -89,7 +87,7 @@ * Description of a source which is defined by a pipeline. * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: SitemapSource.java,v 1.12 2002/04/24 09:59:48 cziegeler Exp $ + * @version CVS $Id: SitemapSource.java,v 1.13 2002/05/27 14:02:29 cziegeler Exp $ */ public final class SitemapSource @@ -117,11 +115,8 @@ /** The prefix for the processing */ private String prefix; - /** The <code>EventPipeline</code> */ - private EventPipeline eventPipeline; - /** The <code>StreamPipeline</code> */ - private StreamPipeline pipeline; + private ProcessingPipeline processingPipeline; /** The redirect <code>Source</code> */ private Source redirectSource; @@ -238,7 +233,7 @@ try { ByteArrayOutputStream os = new ByteArrayOutputStream(); this.environment.setOutputStream(os); - this.pipeline.process(this.environment); + this.processingPipeline.process(this.environment); return new ByteArrayInputStream(os.toByteArray()); } catch (ProcessingException e) { @@ -266,20 +261,13 @@ public void refresh() { reset(); try { - // initialize the pipelines - this.eventPipeline = (EventPipeline)this.manager.lookup(EventPipeline.ROLE); - this.pipeline = (StreamPipeline)this.manager.lookup(StreamPipeline.ROLE); - - this.pipeline.setEventPipeline(eventPipeline); - // set dummy consumer - ((XMLProducer)eventPipeline).setConsumer(this); - this.environment.setURI(this.prefix, this.uri); - this.processor.process(this.environment, pipeline, eventPipeline); + this.processingPipeline = this.processor.processInternal(this.environment); this.environment.changeToLastContext(); String redirectURL = this.environment.getRedirectURL(); if (redirectURL == null) { - if (this.eventPipeline.getGenerator() != null && + // FIXME (CZ) - Caching +/* if (this.eventPipeline.getGenerator() != null && this.eventPipeline instanceof CacheableEventPipeline) { CacheableEventPipeline cep = (CacheableEventPipeline)this.eventPipeline; PipelineCacheKey pck = cep.generateKey(this.environment); @@ -293,7 +281,7 @@ this.lastModificationDate = HashUtil.hash(hashKey); } } - } + }*/ } else { if (redirectURL.indexOf(":") == -1) { redirectURL = "cocoon:/" + redirectURL; @@ -350,14 +338,11 @@ CocoonComponentManager.enterEnvironment(this.environment, this.environment.getObjectModel(), this.processor); - ((XMLProducer)eventPipeline).setConsumer(consumer); - eventPipeline.process(this.environment); + this.processingPipeline.process(this.environment, consumer); } finally { CocoonComponentManager.leaveEnvironment(); } } - } catch (ComponentException cme) { - throw new ProcessingException("Could not lookup pipeline components", cme); } catch (ProcessingException e) { // Preserve original exception throw e; @@ -370,10 +355,8 @@ } private void reset() { - if (this.eventPipeline != null) this.manager.release(this.eventPipeline); - if (this.pipeline != null) this.manager.release(this.pipeline); - this.eventPipeline = null; - this.pipeline = null; + if (this.processingPipeline != null) this.manager.release(this.processingPipeline); + this.processingPipeline = null; this.lastModificationDate = 0; this.environment.reset(); if (this.redirectSource != null) this.redirectSource.recycle(); 1.6 +12 -30 xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java Index: SitemapSource.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SitemapSource.java 29 Apr 2002 08:07:36 -0000 1.5 +++ SitemapSource.java 27 May 2002 14:02:29 -0000 1.6 @@ -64,9 +64,7 @@ import org.apache.cocoon.Processor; import org.apache.cocoon.caching.PipelineCacheKey; import org.apache.cocoon.components.CocoonComponentManager; -import org.apache.cocoon.components.pipeline.CacheableEventPipeline; -import org.apache.cocoon.components.pipeline.EventPipeline; -import org.apache.cocoon.components.pipeline.StreamPipeline; +import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.environment.Environment; import org.apache.cocoon.environment.ModifiableSource; import org.apache.cocoon.environment.Request; @@ -95,7 +93,7 @@ * Description of a source which is defined by a pipeline. * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: SitemapSource.java,v 1.5 2002/04/29 08:07:36 cziegeler Exp $ + * @version CVS $Id: SitemapSource.java,v 1.6 2002/05/27 14:02:29 cziegeler Exp $ */ public final class SitemapSource @@ -123,11 +121,8 @@ /** The prefix for the processing */ private String prefix; - /** The <code>EventPipeline</code> */ - private EventPipeline eventPipeline; - - /** The <code>StreamPipeline</code> */ - private StreamPipeline pipeline; + /** The <code>ProcessingPipeline</code> */ + private ProcessingPipeline processingPipeline; /** The redirect <code>Source</code> */ private Source redirectSource; @@ -248,11 +243,9 @@ try { ByteArrayOutputStream os = new ByteArrayOutputStream(); this.environment.setOutputStream(os); - this.pipeline.process(this.environment); + this.processingPipeline.process(this.environment); return new ByteArrayInputStream(os.toByteArray()); - } catch (IOException e) { - throw e; } catch (Exception e) { throw new IOException("Exception during processing of " + this.systemId); } finally { @@ -305,20 +298,14 @@ public void discardValidity() { reset(); try { - // initialize the pipelines - this.eventPipeline = (EventPipeline)this.manager.lookup(EventPipeline.ROLE); - this.pipeline = (StreamPipeline)this.manager.lookup(StreamPipeline.ROLE); - - this.pipeline.setEventPipeline(eventPipeline); - // set dummy consumer - ((XMLProducer)eventPipeline).setConsumer(this); this.environment.setURI(this.prefix, this.uri); - this.processor.process(this.environment, pipeline, eventPipeline); + this.processingPipeline = this.processor.processInternal(this.environment); this.environment.changeToLastContext(); String redirectURL = this.environment.getRedirectURL(); if (redirectURL == null) { - if (this.eventPipeline.getGenerator() != null && + // FIXME (CZ) - Caching + /*if (this.processingPipeline.getGenerator() != null && this.eventPipeline instanceof CacheableEventPipeline) { CacheableEventPipeline cep = (CacheableEventPipeline)this.eventPipeline; PipelineCacheKey pck = cep.generateKey(this.environment); @@ -332,7 +319,7 @@ this.lastModificationDate = HashUtil.hash(hashKey); } } - } + } */ } else { if (redirectURL.indexOf(":") == -1) { redirectURL = "cocoon:/" + redirectURL; @@ -389,14 +376,11 @@ CocoonComponentManager.enterEnvironment(this.environment, this.environment.getObjectModel(), this.processor); - ((XMLProducer)eventPipeline).setConsumer(consumer); - eventPipeline.process(this.environment); + this.processingPipeline.process(this.environment, consumer); } finally { CocoonComponentManager.leaveEnvironment(); } } - } catch (ComponentException cme) { - throw new SAXException("Could not lookup pipeline components", cme); } catch (SAXException e) { // Preserve original exception throw e; @@ -409,10 +393,8 @@ } private void reset() { - if (this.eventPipeline != null) this.manager.release(this.eventPipeline); - if (this.pipeline != null) this.manager.release(this.pipeline); - this.eventPipeline = null; - this.pipeline = null; + if (this.processingPipeline != null) this.manager.release(this.processingPipeline); + this.processingPipeline = null; this.lastModificationDate = 0; if (this.redirectSource != null) this.environment.release(this.redirectSource); this.environment.reset(); 1.8 +4 -67 xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java Index: InvokeContext.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- InvokeContext.java 27 May 2002 12:43:22 -0000 1.7 +++ InvokeContext.java 27 May 2002 14:02:29 -0000 1.8 @@ -58,8 +58,6 @@ import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.avalon.framework.logger.Loggable; -import org.apache.cocoon.components.pipeline.EventPipeline; -import org.apache.cocoon.components.pipeline.StreamPipeline; import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.environment.Environment; import org.apache.log.Logger; @@ -78,17 +76,13 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: InvokeContext.java,v 1.7 2002/05/27 12:43:22 cziegeler Exp $ + * @version CVS $Id: InvokeContext.java,v 1.8 2002/05/27 14:02:29 cziegeler Exp $ */ public class InvokeContext implements Recomposable, Disposable, Loggable { private List mapStack = new ArrayList(); - private StreamPipeline streamPipeline; - - private EventPipeline eventPipeline; - private boolean isInternalRequest; /** The current component manager, as set by the last call to compose() or recompose() */ @@ -121,22 +115,10 @@ } /** - * Create an <code>InvokeContext</code> with existing pipelines. This also means - * the current request is internal. - */ - public InvokeContext(StreamPipeline pipeline, EventPipeline eventPipeline) { - this.isInternalRequest = true; - this.streamPipeline = pipeline; - this.eventPipeline = eventPipeline; - } - - /** - * Create an <code>InvokeContext</code> with an existing pipeline. - * This also means the current request is internal. + * Create an <code>InvokeContext</code> */ - public InvokeContext(ProcessingPipeline pipeline) { - this.isInternalRequest = true; - this.processingPipeline = pipeline; + public InvokeContext(boolean internalRequest) { + this.isInternalRequest = internalRequest; } /** @@ -160,11 +142,6 @@ this.currentManager = manager; - // Recompose pipelines, if any. - if (this.streamPipeline != null) { - this.streamPipeline.recompose(manager); - this.eventPipeline.recompose(manager); - } if (this.processingPipeline != null) { this.processingPipeline.recompose(manager); } @@ -180,28 +157,6 @@ } /** - * Get the <code>EventPipeline</code>. If none already exists, a set of new - * pipelines is looked up. - */ - public final EventPipeline getEventPipeline() throws Exception { - if (this.eventPipeline == null) { - setupPipelines(); - } - return this.eventPipeline; - } - - /** - * Get the <code>StreamPipeline</code>. If none already exists, a set of new - * pipelines is looked up. - */ - public final StreamPipeline getStreamPipeline() throws Exception { - if (this.streamPipeline == null) { - setupPipelines(); - } - return this.streamPipeline; - } - - /** * Get the current <code>ProcessingPipeline</code> */ public ProcessingPipeline getProcessingPipeline() @@ -221,22 +176,6 @@ return this.processingPipeline; } - private final void setupPipelines() throws Exception { - // Keep current manager for proper release - this.pipelinesManager = this.currentManager; - - // Lookup pipelines - this.eventPipeline = (EventPipeline)this.pipelinesManager.lookup(EventPipeline.ROLE); - this.streamPipeline = (StreamPipeline)this.pipelinesManager.lookup(StreamPipeline.ROLE); - this.streamPipeline.setEventPipeline(this.eventPipeline); - - // Immediately recompose them to the current manager : pipelines are created - // by a parent of the current manager, but need to select component in this one, - // and not its parent. - this.eventPipeline.recompose(this.pipelinesManager); - this.streamPipeline.recompose(this.pipelinesManager); - } - /** * Is this an internal request ? */ @@ -305,8 +244,6 @@ // Release pipelines, if any if (!this.isInternalRequest && this.pipelinesManager != null) { - this.pipelinesManager.release(this.eventPipeline); - this.pipelinesManager.release(this.streamPipeline); if ( this.pipelineSelector != null) { this.pipelineSelector.release(this.processingPipeline); this.processingPipeline = null; 1.11 +34 -16 xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java Index: TreeProcessor.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- TreeProcessor.java 29 Apr 2002 13:23:03 -0000 1.10 +++ TreeProcessor.java 27 May 2002 14:02:29 -0000 1.11 @@ -80,8 +80,7 @@ import org.apache.cocoon.components.CocoonComponentManager; import org.apache.cocoon.components.ExtendedComponentSelector; import org.apache.cocoon.components.LifecycleHelper; -import org.apache.cocoon.components.pipeline.EventPipeline; -import org.apache.cocoon.components.pipeline.StreamPipeline; +import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.components.source.DelayedRefreshSourceWrapper; import org.apache.cocoon.components.source.SourceUtil; import org.apache.cocoon.components.source.URLSource; @@ -95,7 +94,7 @@ * Interpreted tree-traversal implementation of a pipeline assembly language. * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> - * @version CVS $Id: TreeProcessor.java,v 1.10 2002/04/29 13:23:03 cziegeler Exp $ + * @version CVS $Id: TreeProcessor.java,v 1.11 2002/05/27 14:02:29 cziegeler Exp $ */ public class TreeProcessor extends AbstractLoggable implements ThreadSafe, Processor, @@ -280,6 +279,16 @@ } } + /** + * Process the given <code>Environment</code> producing the output. + * @return If the processing is successfull <code>true</code> is returned. + * If not match is found in the sitemap <code>false</code> + * is returned. + * @throws ResourceNotFoundException If a sitemap component tries + * to access a resource which can not + * be found, e.g. the generator + * ConnectionResetException If the connection was reset + */ public boolean process(Environment environment) throws Exception { InvokeContext context = new InvokeContext(); @@ -292,19 +301,6 @@ } } - public boolean process(Environment environment, StreamPipeline pipeline, EventPipeline eventPipeline) - throws Exception { - InvokeContext context = new InvokeContext(pipeline, eventPipeline); - - context.setLogger(getLogger()); - - try { - return process(environment, context); - } finally { - context.dispose(); - } - } - protected boolean process(Environment environment, InvokeContext context) throws Exception { @@ -318,6 +314,28 @@ return this.rootNode.invoke(environment, context); } finally { CocoonComponentManager.leaveEnvironment(); + } + } + + /** + * Process the given <code>Environment</code> to assemble + * a <code>ProcessingPipeline</code>. + * @since @next-version@ + */ + public ProcessingPipeline processInternal(Environment environment) + throws Exception { + InvokeContext context = new InvokeContext( true ); + + context.setLogger(getLogger()); + + try { + if ( process(environment, context) ) { + return context.getProcessingPipeline(); + } else { + return null; + } + } finally { + context.dispose(); } } 1.4 +2 -2 xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java Index: MountNode.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- MountNode.java 29 Apr 2002 14:46:16 -0000 1.3 +++ MountNode.java 27 May 2002 14:02:30 -0000 1.4 @@ -67,7 +67,7 @@ /** * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> - * @version CVS $Id: MountNode.java,v 1.3 2002/04/29 14:46:16 cziegeler Exp $ + * @version CVS $Id: MountNode.java,v 1.4 2002/05/27 14:02:30 cziegeler Exp $ */ public class MountNode extends AbstractProcessingNode implements Composable { @@ -122,7 +122,7 @@ if (context.isInternalRequest()) { // Propagate pipelines - return processor.process(env, context.getStreamPipeline(), context.getEventPipeline()); + return (processor.processInternal(env) != null); } else { // Processor will create its own pipelines return processor.process(env); 1.5 +2 -4 xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java Index: PipelinesNode.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- PipelinesNode.java 29 Apr 2002 14:46:16 -0000 1.4 +++ PipelinesNode.java 27 May 2002 14:02:30 -0000 1.5 @@ -72,7 +72,7 @@ * Handles <map:pipelines> * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> - * @version CVS $Id: PipelinesNode.java,v 1.4 2002/04/29 14:46:16 cziegeler Exp $ + * @version CVS $Id: PipelinesNode.java,v 1.5 2002/05/27 14:02:30 cziegeler Exp $ */ public final class PipelinesNode extends SimpleParentProcessingNode @@ -122,9 +122,7 @@ // Build a redirector boolean internal = context.isInternalRequest(); ForwardRedirector redirector = new ForwardRedirector( - env, this.processor, this.manager, - (internal ? context.getEventPipeline() : null), - (internal ? context.getStreamPipeline() : null)); + env, this.processor, this.manager, internal); this.setupLogger(redirector); Map objectModel = env.getObjectModel(); 1.3 +11 -14 xml-cocoon2/src/java/org/apache/cocoon/environment/ForwardRedirector.java Index: ForwardRedirector.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/ForwardRedirector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ForwardRedirector.java 25 Apr 2002 09:30:48 -0000 1.2 +++ ForwardRedirector.java 27 May 2002 14:02:30 -0000 1.3 @@ -56,8 +56,6 @@ import org.apache.avalon.framework.component.ComponentManager; import org.apache.cocoon.environment.wrapper.EnvironmentWrapper; -import org.apache.cocoon.components.pipeline.StreamPipeline; -import org.apache.cocoon.components.pipeline.EventPipeline; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.Processor; @@ -70,7 +68,7 @@ * redirects using the "cocoon:" pseudo-protocol. * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> - * @version CVS $Id: ForwardRedirector.java,v 1.2 2002/04/25 09:30:48 cziegeler Exp $ + * @version CVS $Id: ForwardRedirector.java,v 1.3 2002/05/27 14:02:30 cziegeler Exp $ */ public class ForwardRedirector extends AbstractLoggable implements Redirector { @@ -88,19 +86,17 @@ to handle absolute "cocoon://..." redirects */ private ComponentManager manager; - /** The stream pipeline (can be null) used for internal redirects */ - private StreamPipeline streamPipe; + /** Is this internal*/ + private boolean internal; - /** The event pipeline (can be null) used for internal redirects */ - private EventPipeline eventPipe; - - public ForwardRedirector(Environment env, Processor processor, ComponentManager manager, - EventPipeline eventPipe, StreamPipeline streamPipe) { + public ForwardRedirector(Environment env, + Processor processor, + ComponentManager manager, + boolean internal) { this.env = env; this.processor = processor; this.manager = manager; - this.streamPipe = streamPipe; - this.eventPipe = eventPipe; + this.internal = internal; } /** @@ -201,10 +197,11 @@ boolean processingResult; - if (this.eventPipe == null && this.streamPipe == null) { + // FIXME - What to do here? + if ( !this.internal ) { processingResult = actualProcessor.process(newEnv); } else { - processingResult = actualProcessor.process(newEnv, this.streamPipe, this.eventPipe); + processingResult = actualProcessor.processInternal(newEnv) != null; } if (!processingResult) { 1.24 +0 -17 xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf Index: cocoon.xconf =================================================================== RCS file: /home/cvs/xml-cocoon2/src/webapp/WEB-INF/cocoon.xconf,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- cocoon.xconf 21 May 2002 10:16:20 -0000 1.23 +++ cocoon.xconf 27 May 2002 14:02:30 -0000 1.24 @@ -443,23 +443,6 @@ </jdbc> </datasources> - <!-- Stream Pipeline: - Either collects a Reader and lets it produce a character stream - or connects an EventPipeline with a Serializer and lets them produce - the character stream. Alternatives to CachingStreamPipeline are: - <stream-pipeline class="org.apache.cocoon.components.pipeline.NonCachingStreamPipeline"/> - --> - <stream-pipeline class="org.apache.cocoon.components.pipeline.CachingStreamPipeline" logger="core.stream-pipeline" pool-grow="4" pool-max="32" pool-min="8"/> - - <!-- Event Pipeline: - Connects the generator and the various transformers and produces a - character stream. Alternatives to CachingEventPipeline are: - <event-pipeline class="org.apache.cocoon.components.pipeline.NonCachingEventPipeline"/> - <event-pipeline class="org.apache.cocoon.components.profiler.ProfilingCachingEventPipeline"/> - <event-pipeline class="org.apache.cocoon.components.profiler.ProfilingNonCachingEventPipeline"/> - --> - <event-pipeline class="org.apache.cocoon.components.pipeline.CachingEventPipeline" logger="core.event-pipeline" pool-grow="4" pool-max="32" pool-min="8"/> - <!-- Compiling xml to byte streams. The xml-serializer "compiles" xml sax events into a byte stream and the xml-deserializer does the same vice versa.
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]