You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2003/07/29 19:41:31 UTC
cvs commit: cocoon-2.0/lib/optional jisp-2.5.1.jar jisp_1_0_2.jar
vgritsenko 2003/07/29 10:41:30
Modified: . changes.xml
src/java/org/apache/cocoon/components/store
JispFilesystemStore.java JispStringKey.java
lib jars.xml
Added: lib/optional jisp-2.5.1.jar
Removed: lib/optional jisp_1_0_2.jar
Log:
Update jisp library. Fix bug #12291: implemented keys() and size() methods
Revision Changes Path
1.31 +8 -1 cocoon-2.0/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/cocoon-2.0/changes.xml,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- changes.xml 29 Jul 2003 13:54:28 -0000 1.30
+++ changes.xml 29 Jul 2003 17:41:29 -0000 1.31
@@ -44,6 +44,13 @@
<release version="@version@" date="@date@">
<action dev="VG" type="update">
+ Updated Jisp to the latest released version, 2.5.1.
+ </action>
+ <action dev="VG" type="fix" fixes-bug="12291">
+ Backported keys() and size() JispFilesystemStore method implementations
+ from the Excalibur version of the store.
+ </action>
+ <action dev="VG" type="update">
Updated FOP to the latest released version, 0.20.5.
</action>
<action dev="JH" type="fix" fixes-bug="4934" due-to="Ryder Rishel" due-to-email="ryderblue@yahoo.com">
1.2 +72 -7 cocoon-2.0/src/java/org/apache/cocoon/components/store/JispFilesystemStore.java
Index: JispFilesystemStore.java
===================================================================
RCS file: /home/cvs/cocoon-2.0/src/java/org/apache/cocoon/components/store/JispFilesystemStore.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JispFilesystemStore.java 9 Mar 2003 00:02:34 -0000 1.1
+++ JispFilesystemStore.java 29 Jul 2003 17:41:30 -0000 1.2
@@ -64,6 +64,7 @@
import org.apache.cocoon.util.IOUtils;
import com.coyotegulch.jisp.BTreeIndex;
+import com.coyotegulch.jisp.BTreeIterator;
import com.coyotegulch.jisp.IndexedObjectDatabase;
import com.coyotegulch.jisp.KeyNotFound;
import com.coyotegulch.jisp.KeyObject;
@@ -71,6 +72,7 @@
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Vector;
@@ -388,13 +390,15 @@
* @return Enumeration Object with all existing keys
*/
public Enumeration keys() {
- // TODO: Implementation
- return new Vector(0).elements();
+ try {
+ return new BTreeObjectEnumeration(new BTreeIterator(mIndex), this);
+ } catch (Exception ignore) {
+ return Collections.enumeration(Collections.EMPTY_LIST);
+ }
}
public int size() {
- // TODO: Unsupported
- return 0;
+ return mIndex.count();
}
/**
@@ -405,7 +409,68 @@
*/
private KeyObject wrapKeyObject(Object key) {
// TODO: Implementation of Integer and Long keys
- String skey = String.valueOf(key);
- return new JispStringKey(key.toString());
+ return new JispStringKey(String.valueOf(key));
+ }
+
+
+ class BTreeObjectEnumeration implements Enumeration
+ {
+ private BTreeIterator m_Iterator;
+ private JispFilesystemStore m_Store;
+
+ public BTreeObjectEnumeration(BTreeIterator iterator, JispFilesystemStore store)
+ {
+ m_Iterator = iterator;
+ m_Store = store;
+ }
+
+ public boolean hasMoreElements()
+ {
+ boolean hasMore = false;
+ Object tmp = null;
+
+ try
+ {
+ tmp = m_Iterator.getKey();
+
+ if(m_Iterator.moveNext())
+ {
+ hasMore = true;
+ }
+
+ /* resets iterator to the old state **/
+ m_Iterator.moveTo((KeyObject)tmp);
+ }
+ catch (IOException ioe)
+ {
+ m_Store.getLogger().error("store(..): Exception", ioe);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ m_Store.getLogger().error("store(..): Exception", cnfe);
+ }
+ return hasMore;
+ }
+
+ public Object nextElement()
+ {
+ Object tmp = null;
+
+ try
+ {
+ tmp = m_Iterator.getKey();
+ m_Iterator.moveNext();
+ }
+ catch (IOException ioe)
+ {
+ m_Store.getLogger().error("store(..): Exception", ioe);
+ }
+ catch (ClassNotFoundException cnfe)
+ {
+ m_Store.getLogger().error("store(..): Exception", cnfe);
+ }
+ // return the real key
+ return tmp.toString();
+ }
}
}
1.2 +1 -4 cocoon-2.0/src/java/org/apache/cocoon/components/store/JispStringKey.java
Index: JispStringKey.java
===================================================================
RCS file: /home/cvs/cocoon-2.0/src/java/org/apache/cocoon/components/store/JispStringKey.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JispStringKey.java 9 Mar 2003 00:02:34 -0000 1.1
+++ JispStringKey.java 29 Jul 2003 17:41:30 -0000 1.2
@@ -157,6 +157,3 @@
return mKey;
}
}
-
-
-
1.9 +1 -1 cocoon-2.0/lib/jars.xml
Index: jars.xml
===================================================================
RCS file: /home/cvs/cocoon-2.0/lib/jars.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- jars.xml 29 Jul 2003 13:54:31 -0000 1.8
+++ jars.xml 29 Jul 2003 17:41:30 -0000 1.9
@@ -338,7 +338,7 @@
<title>JISP</title>
<description></description>
<used-by>JISP file storage</used-by>
- <lib>optional/jisp_1_0_2.jar</lib>
+ <lib>optional/jisp-2.5.1.jar</lib>
<homepage>http://www.coyotegulch.com/algorithm/jisp/</homepage>
</file>
<file>
1.1 cocoon-2.0/lib/optional/jisp-2.5.1.jar
<<Binary file>>