Return-Path: Delivered-To: apmail-xml-cocoon-cvs-archive@xml.apache.org Received: (qmail 78272 invoked by uid 500); 4 Jun 2002 08:55:41 -0000 Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Precedence: bulk Reply-To: cocoon-dev@xml.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 78263 invoked by uid 500); 4 Jun 2002 08:55:41 -0000 Delivered-To: apmail-xml-cocoon2-cvs@apache.org Date: 4 Jun 2002 08:55:48 -0000 Message-ID: <20020604085548.30570.qmail@icarus.apache.org> From: cziegeler@apache.org To: xml-cocoon2-cvs@apache.org Subject: cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl CachingProcessingPipeline.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N cziegeler 2002/06/04 01:55:48 Modified: lib/core avalon-excalibur-20020603.jar src/java/org/apache/cocoon/caching CacheValidityToSourceValidity.java SourceCacheValidity.java src/java/org/apache/cocoon/components/pipeline/impl CachingProcessingPipeline.java Log: Updated to latest excalibur. Now the SourceValidity.isValid() method has three return values which makes testing in general a little bit faster. Revision Changes Path 1.3 +345 -332 xml-cocoon2/lib/core/avalon-excalibur-20020603.jar <> 1.5 +6 -4 xml-cocoon2/src/java/org/apache/cocoon/caching/CacheValidityToSourceValidity.java Index: CacheValidityToSourceValidity.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/CacheValidityToSourceValidity.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CacheValidityToSourceValidity.java 29 May 2002 10:24:18 -0000 1.4 +++ CacheValidityToSourceValidity.java 4 Jun 2002 08:55:48 -0000 1.5 @@ -58,7 +58,7 @@ * * @since @next-version@ * @author Carsten Ziegeler - * @version CVS $Id: CacheValidityToSourceValidity.java,v 1.4 2002/05/29 10:24:18 cziegeler Exp $ + * @version CVS $Id: CacheValidityToSourceValidity.java,v 1.5 2002/06/04 08:55:48 cziegeler Exp $ */ public final class CacheValidityToSourceValidity implements SourceValidity { @@ -85,11 +85,13 @@ /** * Check if the component is still valid. - * If false is returned the isValid(SourceValidity) must be + * If 0 is returned the isValid(SourceValidity) must be * called afterwards! + * If -1 is returned, the component is not valid anymore and if +1 + * is returnd, the component is valid. */ - public boolean isValid() { - return false; + public int isValid() { + return 0; } /** 1.5 +4 -3 xml-cocoon2/src/java/org/apache/cocoon/caching/SourceCacheValidity.java Index: SourceCacheValidity.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/SourceCacheValidity.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- SourceCacheValidity.java 6 May 2002 13:22:31 -0000 1.4 +++ SourceCacheValidity.java 4 Jun 2002 08:55:48 -0000 1.5 @@ -58,7 +58,7 @@ * * @since @next-version@ * @author Carsten Ziegeler - * @version CVS $Id: SourceCacheValidity.java,v 1.4 2002/05/06 13:22:31 cziegeler Exp $ + * @version CVS $Id: SourceCacheValidity.java,v 1.5 2002/06/04 08:55:48 cziegeler Exp $ */ public final class SourceCacheValidity implements CacheValidity { @@ -78,8 +78,9 @@ * type and has the same values. */ public boolean isValid(CacheValidity validity) { - if (this.sourceValidity.isValid()) return true; - if (validity instanceof SourceCacheValidity) { + final int valid = this.sourceValidity.isValid(); + if (valid == 1) return true; + if (valid == 0 && validity instanceof SourceCacheValidity) { return this.sourceValidity.isValid(((SourceCacheValidity)validity).getSourceValidity()); } return false; 1.22 +11 -5 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.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- CachingProcessingPipeline.java 29 May 2002 10:24:18 -0000 1.21 +++ CachingProcessingPipeline.java 4 Jun 2002 08:55:48 -0000 1.22 @@ -92,7 +92,7 @@ * * @since @next-version@ * @author Carsten Ziegeler - * @version CVS $Id: CachingProcessingPipeline.java,v 1.21 2002/05/29 10:24:18 cziegeler Exp $ + * @version CVS $Id: CachingProcessingPipeline.java,v 1.22 2002/06/04 08:55:48 cziegeler Exp $ */ public class CachingProcessingPipeline extends AbstractProcessingPipeline @@ -396,8 +396,9 @@ SourceValidity[] validities = response.getValidityObjects(); int i = 0; while (responseIsValid && i < validities.length) { - boolean isValid = validities[i].isValid(); - if ( !isValid ) { + int valid = validities[i].isValid(); + boolean isValid = false; + if ( valid == 0) { final SourceValidity validity; if (i == 0) { // test generator @@ -432,6 +433,8 @@ validities[i] = validity; if (validity == null) responseIsUsable = false; } + } else { + isValid = (valid == 1); } if ( isValid ) i++; } @@ -674,8 +677,9 @@ throw new ProcessingException("Cached response is not correct."); } SourceValidity cachedValidity = validities[0]; - boolean valid = cachedValidity.isValid(); - if ( !valid ) { + int result = cachedValidity.isValid(); + boolean valid = false; + if ( result == 0 ) { // get reader validity and compare if (isCacheableProcessingComponent) { readerValidity = ((CacheableProcessingComponent)super.reader).generateValidity(); @@ -688,6 +692,8 @@ if (readerValidity != null) { valid = cachedValidity.isValid(readerValidity); } + } else { + valid = (result > 0); } if (valid) { ---------------------------------------------------------------------- In case of troubles, e-mail: webmaster@xml.apache.org To unsubscribe, e-mail: cocoon-cvs-unsubscribe@xml.apache.org For additional commands, e-mail: cocoon-cvs-help@xml.apache.org