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/org/apache/cocoon/components/store FilesystemStore.java
Date Mon, 19 Nov 2001 13:39:44 GMT
cziegeler    01/11/19 05:39:44

  Modified:    src/org/apache/cocoon/components/store FilesystemStore.java
  Log:
  Implementing the keys() method
  
  Revision  Changes    Path
  1.8       +22 -3     xml-cocoon2/src/org/apache/cocoon/components/store/FilesystemStore.java
  
  Index: FilesystemStore.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/store/FilesystemStore.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- FilesystemStore.java	2001/10/11 07:28:19	1.7
  +++ FilesystemStore.java	2001/11/19 13:39:44	1.8
  @@ -161,8 +161,27 @@
      * Returns the list of stored files as an Enumeration of Files
      */
     public Enumeration keys() {
  -    /* Not yet implemented */
  -    return null;
  +    return new EnumerationFromFileArray(this.directoryFile.listFiles());
  +  }
  +
  +  final class EnumerationFromFileArray implements Enumeration {
  +      private File[] array;
  +      private int    index;
  +
  +      EnumerationFromFileArray(File[] array) {
  +          this.array = array;
  +          this.index = 0;
  +      }
  +      public boolean hasMoreElements() {
  +          return (this.index < this.array.length);
  +      }
  +      public Object nextElement() {
  +          if (this.hasMoreElements() == true) {
  +              this.index++;
  +              return this.array[index-1].getName();
  +          }
  +          return null;
  +      }
     }
   
     /* Utility Methods*/
  @@ -180,7 +199,7 @@
       return null;
     }
   
  -  public void free() {}  
  +  public void free() {}
   
     public Object getObject(Object key)
       throws IOException, ClassNotFoundException
  
  
  

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