cziegeler 02/05/27 07:56:28 Modified: src/java/org/apache/cocoon/components/pipeline AbstractProcessingPipeline.java ProcessingPipeline.java src/java/org/apache/cocoon/components/pipeline/impl CachingProcessingPipeline.java src/java/org/apache/cocoon/components/source SitemapSource.java src/java/org/apache/cocoon/components/source/impl SitemapSource.java Log: Minor updates Revision Changes Path 1.12 +11 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java Index: AbstractProcessingPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- AbstractProcessingPipeline.java 27 May 2002 13:14:52 -0000 1.11 +++ AbstractProcessingPipeline.java 27 May 2002 14:56:28 -0000 1.12 @@ -51,6 +51,7 @@ package org.apache.cocoon.components.pipeline; import org.apache.avalon.excalibur.pool.Recyclable; +import org.apache.excalibur.source.SourceValidity; import org.apache.avalon.framework.component.Component; import org.apache.avalon.framework.component.ComponentException; import org.apache.avalon.framework.component.ComponentManager; @@ -81,7 +82,7 @@ * * @since @next-version@ * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: AbstractProcessingPipeline.java,v 1.11 2002/05/27 13:14:52 cziegeler Exp $ + * @version CVS $Id: AbstractProcessingPipeline.java,v 1.12 2002/05/27 14:56:28 cziegeler Exp $ */ public abstract class AbstractProcessingPipeline extends AbstractLogEnabled @@ -614,4 +615,13 @@ return this.process( environment ); } + /** + * Return valid validity objects for the event pipeline + * If the "event pipeline" (= the complete pipeline without the + * serializer) is cacheable and valid, return all validity objects. + * Otherwise return <code>null</code> + */ + public SourceValidity[] getValiditiesForEventPipeline() { + return null; + } } 1.7 +10 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java Index: ProcessingPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- ProcessingPipeline.java 27 May 2002 13:14:52 -0000 1.6 +++ ProcessingPipeline.java 27 May 2002 14:56:28 -0000 1.7 @@ -57,6 +57,7 @@ import org.apache.cocoon.environment.Environment; import org.apache.cocoon.generation.Generator; import org.apache.cocoon.xml.XMLConsumer; +import org.apache.excalibur.source.SourceValidity; /** * A <code>ProcessingPipeline<code> produces the response for a given request. @@ -78,7 +79,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a> - * @version CVS $Id: ProcessingPipeline.java,v 1.6 2002/05/27 13:14:52 cziegeler Exp $ + * @version CVS $Id: ProcessingPipeline.java,v 1.7 2002/05/27 14:56:28 cziegeler Exp $ */ public interface ProcessingPipeline extends Component, Recomposable { @@ -151,4 +152,12 @@ */ boolean process(Environment environment, XMLConsumer consumer) throws ProcessingException; + + /** + * Return valid validity objects for the event pipeline + * If the "event pipeline" (= the complete pipeline without the + * serializer) is cacheable and valid, return all validity objects. + * Otherwise return <code>null</code> + */ + SourceValidity[] getValiditiesForEventPipeline(); } 1.13 +12 -1 xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java Index: CachingProcessingPipeline.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl/CachingProcessingPipeline.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- CachingProcessingPipeline.java 27 May 2002 12:06:13 -0000 1.12 +++ CachingProcessingPipeline.java 27 May 2002 14:56:28 -0000 1.13 @@ -89,7 +89,7 @@ * * @since @next-version@ * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: CachingProcessingPipeline.java,v 1.12 2002/05/27 12:06:13 cziegeler Exp $ + * @version CVS $Id: CachingProcessingPipeline.java,v 1.13 2002/05/27 14:56:28 cziegeler Exp $ */ public class CachingProcessingPipeline extends AbstractProcessingPipeline @@ -704,6 +704,17 @@ } return true; + } + + /** + * Return valid validity objects for the event pipeline + * If the "event pipeline" (= the complete pipeline without the + * serializer) is cacheable and valid, return all validity objects. + * Otherwise return <code>null</code> + */ + public SourceValidity[] getValiditiesForEventPipeline() { + // FIXME (CZ) - Implement this + return null; } /** 1.15 +3 -19 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.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- SitemapSource.java 27 May 2002 14:31:26 -0000 1.14 +++ SitemapSource.java 27 May 2002 14:56:28 -0000 1.15 @@ -86,8 +86,9 @@ /** * Description of a source which is defined by a pipeline. * + * @deprecated by the Avalon Excalibur Source Resolving * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: SitemapSource.java,v 1.14 2002/05/27 14:31:26 cziegeler Exp $ + * @version CVS $Id: SitemapSource.java,v 1.15 2002/05/27 14:56:28 cziegeler Exp $ */ public final class SitemapSource @@ -265,24 +266,7 @@ this.environment.changeToLastContext(); this.processingPipeline = this.processor.processInternal(this.environment); String redirectURL = this.environment.getRedirectURL(); - if (redirectURL == null) { - // FIXME (CZ) - Caching -/* if (this.eventPipeline.getGenerator() != null && - this.eventPipeline instanceof CacheableEventPipeline) { - CacheableEventPipeline cep = (CacheableEventPipeline)this.eventPipeline; - PipelineCacheKey pck = cep.generateKey(this.environment); - Map validity = null; - if (pck != null) { - validity = cep.generateValidity(this.environment); - if (validity != null) { - // the event pipeline is cacheable - // now calculate a last modification date - String hashKey = pck.toString() + validity.toString(); - this.lastModificationDate = HashUtil.hash(hashKey); - } - } - }*/ - } else { + if (redirectURL != null) { if (redirectURL.indexOf(":") == -1) { redirectURL = "cocoon:/" + redirectURL; } 1.8 +12 -36 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.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- SitemapSource.java 27 May 2002 14:31:26 -0000 1.7 +++ SitemapSource.java 27 May 2002 14:56:28 -0000 1.8 @@ -53,7 +53,7 @@ import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceException; import org.apache.excalibur.source.SourceValidity; -import org.apache.excalibur.source.impl.validity.TimeStampValidity; +import org.apache.excalibur.source.impl.validity.AggregatedValidity; import org.apache.avalon.excalibur.pool.Recyclable; import org.apache.avalon.excalibur.xml.XMLizable; import org.apache.avalon.framework.component.ComponentException; @@ -93,15 +93,15 @@ * 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.7 2002/05/27 14:31:26 cziegeler Exp $ + * @version CVS $Id: SitemapSource.java,v 1.8 2002/05/27 14:56:28 cziegeler Exp $ */ public final class SitemapSource extends AbstractXMLConsumer implements Source, XMLizable, Recyclable { - /** The last modification date or 0 */ - private long lastModificationDate; + /** validities for the internal pipeline */ + private AggregatedValidity sourceValidity; /** The system id */ private String systemId; @@ -204,17 +204,6 @@ } /** - * Get the last modification date of the source or 0 if it - * is not possible to determine the date. - */ - public long getLastModified() { - if (this.needsRefresh) { - this.discardValidity(); - } - return this.lastModificationDate; - } - - /** * Get the content length of the source or -1 if it * is not possible to determine the length. */ @@ -275,11 +264,7 @@ if (this.redirectSource != null) { return this.redirectValidity; } - if (this.lastModificationDate < 1) { - return null; - } else { - return new TimeStampValidity( this.lastModificationDate ); - } + return this.sourceValidity; } /** @@ -304,22 +289,13 @@ this.processingPipeline = this.processor.processInternal(this.environment); String redirectURL = this.environment.getRedirectURL(); if (redirectURL == null) { - // FIXME (CZ) - Caching - /*if (this.processingPipeline.getGenerator() != null && - this.eventPipeline instanceof CacheableEventPipeline) { - CacheableEventPipeline cep = (CacheableEventPipeline)this.eventPipeline; - PipelineCacheKey pck = cep.generateKey(this.environment); - Map validity = null; - if (pck != null) { - validity = cep.generateValidity(this.environment); - if (validity != null) { - // the event pipeline is cacheable - // now calculate a last modification date - String hashKey = pck.toString() + validity.toString(); - this.lastModificationDate = HashUtil.hash(hashKey); - } + SourceValidity[] eventPipelineValidities = this.processingPipeline.getValiditiesForEventPipeline(); + if ( eventPipelineValidities != null ) { + this.sourceValidity = new AggregatedValidity(); + for(int i=0; i < eventPipelineValidities.length;i++) { + this.sourceValidity.add(eventPipelineValidities[i]); } - } */ + } } else { if (redirectURL.indexOf(":") == -1) { redirectURL = "cocoon:/" + redirectURL; @@ -395,7 +371,7 @@ private void reset() { if (this.processingPipeline != null) this.manager.release(this.processingPipeline); this.processingPipeline = null; - this.lastModificationDate = 0; + this.sourceValidity = null; if (this.redirectSource != null) this.environment.release(this.redirectSource); this.environment.reset(); this.redirectSource = null;
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]