vgritsenko    2002/08/07 19:55:23

  Modified:    src/java/org/apache/cocoon/caching ComponentCacheKey.java
                        PipelineCacheKey.java
  Log:
  Shorten a bit cache keys (even some cocoon docos could not be saved to 
FileStore). Use _ instead of :
  
  Revision  Changes    Path
  1.14      +10 -6     
xml-cocoon2/src/java/org/apache/cocoon/caching/ComponentCacheKey.java
  
  Index: ComponentCacheKey.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/ComponentCacheKey.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ComponentCacheKey.java    15 Jul 2002 08:17:27 -0000      1.13
  +++ ComponentCacheKey.java    8 Aug 2002 02:55:23 -0000       1.14
  @@ -71,6 +71,10 @@
       public static final int ComponentType_Serializer  = 5;
       public static final int ComponentType_Reader      = 7;
   
  +    // Converts Generator / Transformer / Serializer / Reader constants above
  +    // into string.
  +    private static final String[] COMPONENTS = { "X", "G", "T", "S", "R" };
  +
       /** The component type */
       private int type;
       /** The component identifier */
  @@ -104,9 +108,8 @@
           this.type = componentType;
           this.identifier = componentIdentifier;
           this.key = cacheKey;
  -    /** cachePoint */
  +        /** cachePoint */
           this.cachePoint = cachePoint;
  -
       }
   
       /**
  @@ -138,21 +141,22 @@
       }
   
       private String toString;
  +
       /**
        * toString
        * The FilesystemStore uses toString!
        */
       public String toString() {
           if (this.toString == null) {
  -            toString = "CCK:" + this.type + this.identifier + " - " + 
this.key.toString();
  +            toString = COMPONENTS[this.type] + '-' + this.identifier + '-' + 
this.key.toString();
           }
           return toString;
       }
   
       /**
  -     * check if we are a cachepoint 
  +     * Check if we are a cachepoint 
        */
  -    public boolean  isCachePoint() {
  +    public boolean isCachePoint() {
           return cachePoint;
       }
   }
  
  
  
  1.19      +13 -14    
xml-cocoon2/src/java/org/apache/cocoon/caching/PipelineCacheKey.java
  
  Index: PipelineCacheKey.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/caching/PipelineCacheKey.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- PipelineCacheKey.java     15 Jul 2002 08:17:27 -0000      1.18
  +++ PipelineCacheKey.java     8 Aug 2002 02:55:23 -0000       1.19
  @@ -107,17 +107,16 @@
       public void removeUntilCachePoint() {
           this.hashCode = 0;
           this.toString = null;
  -     int keyCount = this.keys.size();
  -
  -     while (keyCount > 0) {
  -             if 
(((ComponentCacheKey)this.keys.get(keyCount-1)).isCachePoint()) {
  -                     this.keys.remove(keyCount-1);
  -                     return;
  -             }
  -             this.keys.remove(keyCount-1);
  -             keyCount--;
  -     }
  +        int keyCount = this.keys.size();
   
  +        while (keyCount > 0) {
  +            if 
(((ComponentCacheKey)this.keys.get(keyCount-1)).isCachePoint()) {
  +                this.keys.remove(keyCount-1);
  +                return;
  +            }
  +            this.keys.remove(keyCount-1);
  +            keyCount--;
  +        }
       }
   
       /**
  @@ -175,6 +174,7 @@
       }
   
       private String toString;
  +
       /**
        * toString
        * The FilesystemStore uses toString!
  @@ -182,14 +182,13 @@
       public String toString() {
           if (this.toString == null) {
               StringBuffer buffer = new StringBuffer();
  -            buffer.append("PCK");
  +            buffer.append("PK");
               final int len = this.keys.size();
               for(int i=0; i < len; i++) {
  -                buffer.append(':').append(this.keys.get(i).toString());
  +                buffer.append('_').append(this.keys.get(i).toString());
               }
               this.toString = buffer.toString();
           }
           return toString;
       }
  -
   }
  
  
  

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