cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/pipeline/impl CachingProcessingPipeline.java
Date Tue, 04 Jun 2002 08:55:48 GMT
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
  
  	<<Binary file>>
  
  
  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 <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @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 <code>false</code> is returned the isValid(SourceValidity) must be
  +     * If <code>0</code> 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 <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @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 <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @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


Mime
View raw message