You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2001/11/19 14:27:04 UTC
cvs commit: xml-cocoon2/src/org/apache/cocoon/components/store FilesystemStore.java
cziegeler 01/11/19 05:27:04
Modified: src/org/apache/cocoon/components/store Tag: cocoon_20_branch
FilesystemStore.java
Log:
Implementing the keys() method
Revision Changes Path
No revision
No revision
1.1.1.1.2.7 +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.1.1.1.2.6
retrieving revision 1.1.1.1.2.7
diff -u -r1.1.1.1.2.6 -r1.1.1.1.2.7
--- FilesystemStore.java 2001/10/11 08:56:09 1.1.1.1.2.6
+++ FilesystemStore.java 2001/11/19 13:27:04 1.1.1.1.2.7
@@ -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