directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r604680 - in /directory/sandbox/akarasulu/bigbang/apacheds: btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ core-cursor/src/main/java/org/apache/directory/server/core/cursor/ core-cursor/src/test/java/org/apa...
Date Sun, 16 Dec 2007 19:54:32 GMT
Author: akarasulu
Date: Sun Dec 16 11:54:30 2007
New Revision: 604680

URL: http://svn.apache.org/viewvc?rev=604680&view=rev
Log:
still not compiling and moving classes around with new modules, also removed absolute() method on Cursor since this is going to be problematic with most btree packages

Added:
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/CursorBehaviorTests.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/SingletonCursorTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java
Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/ListCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/SingletonCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/ListCursorTest.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java Sun Dec 16 11:54:30 2007
@@ -103,7 +103,7 @@
     }
 
 
-    public boolean before( Tuple element ) throws IOException
+    public void before( Tuple element ) throws IOException
     {
         throw new NotImplementedException();
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java Sun Dec 16 11:54:30 2007
@@ -73,7 +73,7 @@
     }
 
 
-    public boolean before( Tuple element ) throws IOException
+    public void before( Tuple element ) throws IOException
     {
         throw new NotImplementedException();
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java Sun Dec 16 11:54:30 2007
@@ -27,7 +27,6 @@
  */
 public abstract class AbstractCursor<E> implements Cursor<E>
 {
-    protected static final int BEFORE_FIRST = -1;
     private boolean closed;
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/Cursor.java Sun Dec 16 11:54:30 2007
@@ -23,18 +23,19 @@
 
 
 /**
- * A simple cursor concept for bidirectionally enumerating over elements.
- * Cursors unlike iterators request to advance to an element by calling next()
- * or previous() which returns true or false if the request succeeds.  Other
- * operations for relative and absolute advances are provided.  If the cursor
- * does not advance, then the Cursor is either positioned before the first
- * element or after the last element in which case the user of the Cursor must
- * stop advancing in the respective direction.  If an advance succeeds a get()
+ * A Cursor for bidirectional traversal over elements in a dataset. Cursors
+ * unlike Iterators or Enumerations may advance to an element by calling
+ * next() or previous() which returns true or false if the request succeeds
+ * with a viable element at the new position.  Operations for relative
+ * positioning in larger increments are provided.  If the cursor can not
+ * advance, then the Cursor is either positioned before the first element or
+ * after the last element in which case the user of the Cursor must stop
+ * advancing in the respective direction.  If an advance succeeds a get()
  * operation retreives the current object at the Cursors position.
  *
- * Although this interface presumes Cursors can advance bidirectionally, one
- * or more either direction may not be supported.  In this case
- * implementations should throw UnsupportedOperationExceptions.
+ * Although this interface presumes Cursors can advance bidirectionally,
+ * implementations may restrict this by throwing
+ * UnsupportedOperationExceptions.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -42,31 +43,40 @@
 public interface Cursor<E>
 {
     /**
-     * Positions this Cursor just before the element.  If the element value
-     * does not exist in the dataset, the Cursor is advanced to a data element
-     * with the greatest value in the dataset less than the element argument.
+     * Prepares this Cursor, so a subsequent call to Cursor#next() with a
+     * true return value, will have positioned the Cursor on a dataset element
+     * equal to or greater than the element argument but not less.  A call to
+     * Cursor#previous() with a true return value will position the Cursor on
+     * a dataset element less than the argument.  If Cursor#next() returns
+     * false then the Cursor is past the last element and so all values in the
+     * dataset are less than the argument.  If Cursor#previous() returns false
+     * then the Cursor is positioned before the first element and all elements
+     * in the dataset are greater than the argument.
      *
      * @param element the element to be positioned before
-     * @return true if get() will yeild a valid value, false otherwise
-     * @throws IOException if there are problems positioning this cursor or if
-     * this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws IOException with problems accessing the underlying btree
+     * @throws UnsupportedOperationException if this method is not supported
      */
-    boolean before( E element ) throws IOException;
+    void before( E element ) throws IOException;
 
 
     /**
-     * Positions this Cursor just after the element.  If the element value
-     * does not exist in the dataset, the Cursor is advanced to a data element
-     * with the smallest value in the dataset greater than the element argument.
+     * Prepares this Cursor, so a subsequent call to Cursor#previous() with a
+     * true return value, will have positioned the Cursor on a dataset element
+     * equal to or less than the element argument but not greater. A call to
+     * Cursor#next() with a true return value will position the Cursor on a
+     * dataset element greater than the argument.  If Cursor#next() returns
+     * false then the Cursor is past the last element and so all values in the
+     * dataset are less than or equal to the argument.  If Cursor#previous()
+     * returns false then the Cursor is positioned before the first element
+     * and all elements in the dataset are greater than the argument.
      *
      * @param element the element to be positioned after
-     * @return true if get() will yeild a valid value, false otherwise
      * @throws IOException if there are problems positioning this cursor or if
      * this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
-    boolean after( E element ) throws IOException;
+    void after( E element ) throws IOException;
 
 
     /**
@@ -74,7 +84,7 @@
      *
      * @throws IOException if there are problems positioning this cursor or if
      * this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     void beforeFirst() throws IOException;
 
@@ -84,43 +94,34 @@
      *
      * @throws IOException if there are problems positioning this Cursor or if
      * this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     void afterLast() throws IOException;
 
 
     /**
-     * Positions this Curser at the nth element.  Zero based indexing is used.
-     *
-     * If the specified position is past the first or last element, the Cursor
-     * is positioned before the first or after the last element respectively.
-     *
-     * @param absolutePosition the absolute position to move this Cursor to
-     * @return true if the position has been successfully changed to the
-     * element at the specified position, false otherwise
-     * @throws IOException if there are problems positioning this Cursor or if
-     * this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
-     */
-    boolean absolute( int absolutePosition ) throws IOException;
-
-
-    /**
-     * Positions this Curser n places relative to the present position.  Zero
-     * based indexing is used and negative index values may be provided for
-     * representing the direction.
+     * Positions this Curser an offset number of elements before or after the
+     * current position.  Negative offsets are used to move the Cursor's
+     * position back, while positive offsets are used to advance the Cursor's
+     * position forward.
      *
      * If the specified position is past the first or last element, the Cursor
      * is positioned before the first or after the last element respectively.
      *
-     * @param relativePosition the relative position to move this Cursor to
-     * @return true if the position has been successfully changed to the
-     * element relative to the current position, false otherwise
+     * Note that this is not the most efficient means to advance a Cursor over
+     * a BTree.  The best mechanism is to advance by using a specific key via
+     * the Cursor#before() and Cursor#after() methods.  Most implementations
+     * of this method will have to walk through BTree records.
+     *
+     * @param offset the relative offset to move this Cursor to
+     * @return true if the position has been successfully changed to an
+     * existing element retreivable by Cursor#get() at the new relative
+     * position, of this Cursor, otherwise false
      * @throws IOException if there are problems positioning this Cursor or if
      * this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
-    boolean relative( int relativePosition ) throws IOException;
+    boolean relative( int offset ) throws IOException;
 
 
     /**
@@ -130,7 +131,7 @@
      * element, false otherwise
      * @throws IOException if there are problems positioning this Cursor or if
      * this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean first() throws IOException;
 
@@ -142,7 +143,7 @@
      * element, false otherwise
      * @throws IOException if there are problems positioning this Cursor or if
      * this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean last() throws IOException;
 
@@ -154,7 +155,7 @@
      * otherwise
      * @throws IOException if there are problems determining this Cursor's
      * position, or if this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean isFirst() throws IOException;
 
@@ -166,7 +167,7 @@
      * otherwise
      * @throws IOException if there are problems determining this Cursor's
      * position, or if this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean isLast() throws IOException;
 
@@ -178,7 +179,7 @@
      * otherwise
      * @throws IOException if there are problems determining this Cursor's
      * position, or if this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean isAfterLast() throws IOException;
 
@@ -190,7 +191,7 @@
      * otherwise
      * @throws IOException if there are problems determining this Cursor's
      * position, or if this Cursor is closed
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean isBeforeFirst() throws IOException;
 
@@ -201,7 +202,7 @@
      *
      * @return true if this Cursor is closed, false otherwise
      * @throws IOException if there are problems determining the cursor's closed state
-     * @throws UnsupportedOperationException if this operation is not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean isClosed() throws IOException;
 
@@ -211,7 +212,7 @@
      *
      * @return true if the advance succeeded, false otherwise
      * @throws IOException if there are problems advancing to the next position
-     * @throws UnsupportedOperationException if advances in this direction are not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean previous() throws IOException;
 
@@ -222,7 +223,7 @@
      * @return true if the advance succeeded, false otherwise
      * @throws IOException if there are problems advancing to this Cursor to
      * the next position, or if this Cursor is closed
-     * @throws UnsupportedOperationException if advances in this direction are not supported
+     * @throws UnsupportedOperationException if this method is not supported
      */
     boolean next() throws IOException;
 
@@ -259,7 +260,7 @@
      * Repeated calls to this method after this Cursor has already been
      * called should not fail with exceptions.
      *
-     * @throws IOException if this Cursor cannot be closed
+     * @throws IOException if for some reason this Cursor could not be closed
      */
     void close() throws IOException;
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java Sun Dec 16 11:54:30 2007
@@ -30,17 +30,15 @@
  */
 public class EmptyCursor<E> extends AbstractCursor<E>
 {
-    public boolean before( E element ) throws IOException
+    public void before( E element ) throws IOException
     {
         checkClosed( "before()" );
-        return false;
     }
 
 
-    public boolean after( E element ) throws IOException
+    public void after( E element ) throws IOException
     {
         checkClosed( "after()" );
-        return false;
     }
 
 
@@ -53,14 +51,6 @@
     public void afterLast() throws CursorClosedException
     {
         checkClosed( "afterLast()" );
-    }
-
-
-    @SuppressWarnings ( { "UnusedDeclaration" } )
-    public boolean absolute( int absolutePosition ) throws CursorClosedException
-    {
-        checkClosed( "absolute()" );
-        return false;
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java Sun Dec 16 11:54:30 2007
@@ -40,13 +40,13 @@
     }
 
 
-    public boolean before( E element ) throws IOException
+    public void before( E element ) throws IOException
     {
         throw new UnsupportedOperationException( "Cannot advance before an element on the underlying Iterator." );
     }
 
 
-    public boolean after( E element ) throws IOException
+    public void after( E element ) throws IOException
     {
         throw new UnsupportedOperationException( "Cannot advance after an element on the underlying Iterator." );
     }
@@ -61,12 +61,6 @@
     public void afterLast() throws IOException
     {
         throw new UnsupportedOperationException( "Cannot adanvce after last on the underlying Iterator." );
-    }
-
-
-    public boolean absolute( int absolutePosition ) throws IOException
-    {
-        throw new UnsupportedOperationException( "Cannot advance to an absolute postion on the underlying Iterator." );
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/ListCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/ListCursor.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/ListCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/ListCursor.java Sun Dec 16 11:54:30 2007
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.util.Collections;
 import java.util.List;
+import java.util.Comparator;
 
 
 /**
@@ -36,6 +37,7 @@
 public class ListCursor<E> extends AbstractCursor<E>
 {
     private final List<E> list;
+    private final Comparator<E> comparator;
     private final int start;
     private final int end;
     private int index = -1;
@@ -49,11 +51,12 @@
      * advance operations (next() or previous()) to properly return values
      * using the get() operation.
      *
+     * @param comparator an optional comparator to use for ordering
      * @param start the lower bound index
      * @param list the list this ListCursor operates on
      * @param end the upper bound index
      */
-    public ListCursor( int start, List<E> list, int end )
+    public ListCursor( Comparator<E> comparator, int start, List<E> list, int end )
     {
         if ( start < 0 || start > list.size() )
         {
@@ -73,6 +76,8 @@
                     + end + "' just does not make sense" );
         }
 
+        this.comparator = comparator;
+
         //noinspection ConstantConditions
         if ( list != null )
         {
@@ -90,6 +95,24 @@
 
 
     /**
+     * Creates a new ListCursor with lower (inclusive) and upper (exclusive)
+     * bounds.
+     *
+     * As with all Cursors, this ListCursor requires a successful return from
+     * advance operations (next() or previous()) to properly return values
+     * using the get() operation.
+     *
+     * @param start the lower bound index
+     * @param list the list this ListCursor operates on
+     * @param end the upper bound index
+     */
+    public ListCursor( int start, List<E> list, int end )
+    {
+        this( null, start, list, end );
+    }
+
+
+    /**
      * Creates a new ListCursor with a specific upper (exclusive) bound: the
      * lower (inclusive) bound defaults to 0.
      *
@@ -99,7 +122,13 @@
      */
     public ListCursor( List<E> list, int end )
     {
-        this( 0, list, end );
+        this( null, 0, list, end );
+    }
+
+
+    public ListCursor( Comparator<E> comparator, List<E> list, int end )
+    {
+        this( comparator, 0, list, end );
     }
 
 
@@ -113,7 +142,13 @@
      */
     public ListCursor( int start, List<E> list )
     {
-        this( start, list, list.size() );
+        this( null, start, list, list.size() );
+    }
+
+
+    public ListCursor( Comparator<E> comparator, int start, List<E> list )
+    {
+        this( comparator, start, list, list.size() );
     }
 
 
@@ -125,7 +160,13 @@
      */
     public ListCursor( List<E> list )
     {
-        this( 0, list, list.size() );
+        this( null, 0, list, list.size() );
+    }
+
+
+    public ListCursor( Comparator<E> comparator, List<E> list )
+    {
+        this( comparator, 0, list, list.size() );
     }
 
 
@@ -135,54 +176,100 @@
     public ListCursor()
     {
         //noinspection unchecked
-        this( 0, Collections.EMPTY_LIST, 0 );
+        this( null, 0, Collections.EMPTY_LIST, 0 );
     }
 
 
-    public boolean before( E element ) throws IOException
+    public ListCursor( Comparator<E> comparator )
     {
-        throw new NotImplementedException();
+        //noinspection unchecked
+        this( comparator, 0, Collections.EMPTY_LIST, 0 );
     }
 
 
-    public boolean after( E element ) throws IOException
+    /**
+     * @throws IllegalStateException if the underlying list is not sorted
+     * and/or a comparator is not provided.
+     */
+    public void before( E element ) throws IOException
     {
-        throw new NotImplementedException();
-    }
+        checkClosed( "before()" );
 
+        if ( comparator == null )
+        {
+            throw new IllegalStateException();
+        }
 
-    public void beforeFirst() throws IOException
-    {
-        checkClosed( "beforeFirst()" );
-        this.index = -1;
-    }
+        // handle some special cases
+        if ( list.size() == 0 )
+        {
+            return;
+        }
+        else if ( list.size() == 1 )
+        {
+            if ( comparator.compare( element, list.get( 0 ) ) <= 0 )
+            {
+                beforeFirst();
+            }
+            else
+            {
+                afterLast();
+            }
+        }
 
+        throw new NotImplementedException( "don't know if list is sorted and checking that is not worth it" );
 
-    public void afterLast() throws IOException
-    {
-        checkClosed( "afterLast()" );
-        this.index = end;
+        // check if increasing or decreasing order is in effect
+//        if ( comparator.compare( list.get( 0 ), list.get( list.size() - 1 ) ) > 0 )
+//        {
+//        }
+//        else
+//        {
+//        }
     }
 
 
-    public boolean absolute( int index ) throws IOException
+    public void after( E element ) throws IOException
     {
-        checkClosed( "absolute()" );
+        checkClosed( "after()" );
 
-        if ( index < start )
+        if ( comparator == null )
         {
-            this.index = -1;
-            return false;
+            throw new IllegalStateException();
         }
 
-        if ( index >= end )
+        // handle some special cases
+        if ( list.size() == 0 )
         {
-            this.index = end;
-            return false;
+            return;
         }
+        else if ( list.size() == 1 )
+        {
+            if ( comparator.compare( element, list.get( 0 ) ) >= 0 )
+            {
+                afterLast();
+            }
+            else
+            {
+                beforeFirst();
+            }
+        }
+
+        throw new NotImplementedException( "don't know if list is sorted and checking that is not worth it" );
+    }
+
+
+    public void beforeFirst() throws IOException
+    {
+        checkClosed( "beforeFirst()" );
+        this.index = -1;
+    }
+
 
-        this.index = index;
-        return true;
+    public void afterLast() throws IOException
+    {
+        checkClosed( "afterLast()" );
+        this.index = end;
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/SingletonCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/SingletonCursor.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/SingletonCursor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/main/java/org/apache/directory/server/core/cursor/SingletonCursor.java Sun Dec 16 11:54:30 2007
@@ -24,7 +24,7 @@
 
 
 /**
- * A Cursor on a single element.
+ * A Cursor over a single element.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
@@ -51,7 +51,7 @@
     }
 
 
-    public boolean before( E element ) throws IOException
+    public void before( E element ) throws IOException
     {
         checkClosed( "before()" );
 
@@ -65,18 +65,16 @@
 
         if ( comparison < 0 )
         {
-            absolute( 0 );
-            return true;
+            first();
         }
         else
         {
             beforeFirst();
-            return false;
         }
     }
 
 
-    public boolean after( E element ) throws IOException
+    public void after( E element ) throws IOException
     {
         checkClosed( "after()" );
 
@@ -90,13 +88,11 @@
 
         if ( comparison > 0 )
         {
-            absolute( 0 );
-            return true;
+            first();
         }
         else
         {
             afterLast();
-            return false;
         }
     }
 
@@ -116,33 +112,6 @@
         beforeFirst = false;
         afterLast = true;
         onSingleton = false;
-    }
-
-
-    public boolean absolute( int absolutePosition ) throws IOException
-    {
-        checkClosed( "()" );
-        if ( absolutePosition == 0 )
-        {
-            beforeFirst = false;
-            onSingleton = true;
-            afterLast = false;
-            return true;
-        }
-        else if ( absolutePosition > 0 )
-        {
-            beforeFirst = false;
-            onSingleton = false;
-            afterLast = true;
-            return false;
-        }
-        else
-        {
-            beforeFirst = true;
-            onSingleton = false;
-            afterLast = false;
-            return false;
-        }
     }
 
 

Added: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/CursorBehaviorTests.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/CursorBehaviorTests.java?rev=604680&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/CursorBehaviorTests.java (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/CursorBehaviorTests.java Sun Dec 16 11:54:30 2007
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.core.cursor;
+
+
+/**
+ * Presuming a pristine Cursor's underlying data structure is initialized and
+ * populated with the expected data and given to the methods of this class,
+ * the class methods test various properties of the Cursor.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class CursorBehaviorTests
+{
+}
+

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/ListCursorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/ListCursorTest.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/ListCursorTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/ListCursorTest.java Sun Dec 16 11:54:30 2007
@@ -42,7 +42,6 @@
         ListCursor<String> cursor = new ListCursor<String>();
 
         assertFirstLastOnNewCursor( cursor, 0, 0, 0 );
-        assertAbsolute( cursor, 0, 0, 0 );
         assertRelative( cursor, 0, 0, 0 );
 
         // close test
@@ -55,7 +54,6 @@
     {
         ListCursor<String> cursor = new ListCursor<String>( Collections.singletonList( "singleton" ) );
         assertFirstLastOnNewCursor( cursor, 1, 0, 1 );
-        assertAbsolute( cursor, 1, 0, 1 );
         assertRelative( cursor, 1, 0, 1 );
         cursor.close();
 
@@ -149,21 +147,18 @@
         // test with bounds of the list itself
         ListCursor<String> cursor = new ListCursor<String>( list );
         assertFirstLastOnNewCursor( cursor, 5, 0, 5 );
-        assertAbsolute( cursor, 5, 0, 5 );
         assertRelative( cursor, 5, 0, 5 );
         cursor.close();
 
         // test with nonzero lower bound
         cursor = new ListCursor<String>( 1, list );
         assertFirstLastOnNewCursor( cursor, 5, 1, 5 );
-        assertAbsolute( cursor, 5, 1, 5 );
         assertRelative( cursor, 5, 1, 5 );
         cursor.close();
 
         // test with nonzero lower bound and upper bound
         cursor = new ListCursor<String>( 1, list, 4 );
         assertFirstLastOnNewCursor( cursor, 5, 1, 4 );
-        assertAbsolute( cursor, 5, 1, 4 );
         assertRelative( cursor, 5, 1, 4 );
 
         // close test
@@ -357,43 +352,6 @@
     }
 
 
-    protected void assertAbsolute( Cursor cursor, int listSize, int lowerBound, int upperBound )
-            throws IOException
-    {
-        String prefix = "[size, " + listSize + "] [lower, " + lowerBound + "] [upper, " + upperBound + "]: ";
-
-        // test absolute() advance with change of position below lower bound
-        cursor.afterLast();
-        assertFalse( prefix + "cursor.absolute(" + ( lowerBound - 1 ) +
-                ") should return false and change state to before first", cursor.absolute( lowerBound - 1 ) );
-        assertTrue( prefix + "cursor.relative(" + ( lowerBound - 1 ) +
-                ") should change pos to before first", cursor.isBeforeFirst() );
-        assertFalse( prefix + "cursor.relative(" + ( lowerBound - 1 ) +
-                ") should --NOT-- change pos to after last", cursor.isAfterLast() );
-
-        if ( listSize == 0 )
-        {
-            // Corner case!!!  Technically the 0th index is the 1st element
-            // which is greater than 0 elements which is the size of the list
-            // so technically the observed state change for index = 0 should be
-            // the same as when index > 0.
-            cursor.beforeFirst();
-            assertFalse( "empty cursor.absolute(0) should fail but change state to after last", cursor.absolute( 0 ) );
-            assertFalse( "empty cursor.absolute(0) should change pos to after last", cursor.isBeforeFirst() );
-            assertTrue( "empty cursor.absolute(0) should change pos to after last", cursor.isAfterLast() );
-        }
-
-        // test absolute() advance with change of position above upper bound
-        cursor.beforeFirst();
-        assertFalse( prefix + "cursor.absolute(" + ( upperBound + 1 )
-                + ") should return false but change state to after last", cursor.absolute( upperBound + 1 ) );
-        assertFalse( prefix + "cursor.absolute(" + ( upperBound + 1 ) + ") should change pos to after last",
-                cursor.isBeforeFirst() );
-        assertTrue( prefix + "cursor.absolute(" + ( upperBound + 1 ) + ") should change pos to after last",
-                cursor.isAfterLast() );
-    }
-
-
     protected void assertRelative( Cursor cursor, int listSize, int lowerBound, int upperBound )
             throws IOException
     {
@@ -455,16 +413,6 @@
             fail( "cursor.close() after closing the cursor should not fail with exceptions" );
         }
 
-
-        try
-        {
-            cursor.absolute( 1 );
-            fail( "cursor.absolute() after closing the cursor should fail with an IOException" );
-        }
-        catch ( IOException e )
-        {
-            assertNotNull( e );
-        }
 
         try
         {

Added: directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/SingletonCursorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/SingletonCursorTest.java?rev=604680&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/SingletonCursorTest.java (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-cursor/src/test/java/org/apache/directory/server/core/cursor/SingletonCursorTest.java Sun Dec 16 11:54:30 2007
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.core.cursor;
+
+
+/**
+ * Tests for the correct behavoir of a Cursor over a single element.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SingletonCursorTest
+{
+}

Added: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeCursor.java?rev=604680&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeCursor.java (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeCursor.java Sun Dec 16 11:54:30 2007
@@ -0,0 +1,377 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.core.partition.impl.btree.jdbm;
+
+
+import jdbm.btree.BTree;
+import jdbm.helper.Tuple;
+import jdbm.helper.TupleBrowser;
+import org.apache.directory.server.core.cursor.AbstractCursor;
+import org.apache.directory.server.core.cursor.InconsistentCursorStateException;
+import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
+import org.apache.directory.shared.ldap.NotImplementedException;
+
+import java.io.IOException;
+
+
+/**
+ * A Cursor across JDBM based BTree keys.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BTreeCursor extends AbstractCursor
+{
+    private final Tuple jdbmTuple = new Tuple();
+
+    private BTree btree;
+    private TupleBrowser browser;
+    private int pos = BEFORE_FIRST;
+    private int size;  // cache the size to prevent needless lookups
+    private boolean afterLast;
+    private boolean beforeFirst;
+    private boolean success;
+
+
+    BTreeCursor( BTree btree ) throws IOException
+    {
+        this.btree = btree;
+        beforeFirst();
+    }
+
+
+    public void before( Object element ) throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public boolean after( Object element ) throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public void beforeFirst() throws IOException
+    {
+        if ( ! beforeFirst )
+        {
+            beforeFirst = true;
+            afterLast = false;
+            success = false;
+            size = btree.size();
+            pos = BEFORE_FIRST;
+            browser = btree.browse();
+        }
+    }
+
+
+    public void afterLast() throws IOException
+    {
+        if ( ! afterLast )
+        {
+            beforeFirst = false;
+            afterLast = true;
+            success = false;
+            size = btree.size();
+            pos = size;
+            browser = btree.browse( null );
+        }
+    }
+
+
+    public boolean absolute( int absolutePosition ) throws IOException
+    {
+        // -------------------------------------------------------------------
+        // Special cases under or above the valid range puts the cursor
+        // respectively before the first or after the last position
+        // -------------------------------------------------------------------
+
+        if ( absolutePosition >= size )
+        {
+            afterLast();
+            return false;
+        }
+
+        if ( absolutePosition < 0 )
+        {
+            beforeFirst();
+            return false;
+        }
+
+        // -------------------------------------------------------------------
+        // Special case where position is valid and that's the new position
+        // -------------------------------------------------------------------
+
+        if ( absolutePosition == pos )
+        {
+            return success;
+        }
+
+        // -------------------------------------------------------------------
+        // Special easy to get to cases where we don't have to walk the tree
+        // -------------------------------------------------------------------
+
+        if ( absolutePosition == 0 && beforeFirst )
+        {
+            return next();
+        }
+
+        if ( ( absolutePosition == size - 1  ) && afterLast )
+        {
+            return previous();
+        }
+
+        // -------------------------------------------------------------------
+        // Cases we have to walk the tree forward or backwards to get to target
+        // -------------------------------------------------------------------
+
+        if ( absolutePosition > pos )
+        {
+            while ( success && pos < absolutePosition )
+            {
+                next();
+            }
+        }
+        else
+        {
+            while ( success && pos > absolutePosition )
+            {
+                previous();
+            }
+        }
+
+        return success;
+    }
+
+
+    public boolean relative( int relativePosition ) throws IOException
+    {
+        // -------------------------------------------------------------------
+        // Special cases under or above the valid range puts the cursor
+        // respectively before the first or after the last position
+        // -------------------------------------------------------------------
+
+        if ( ( relativePosition + pos ) >= size )
+        {
+            afterLast();
+            return false;
+        }
+
+        if ( ( relativePosition + pos ) < 0 )
+        {
+            beforeFirst();
+            return false;
+        }
+
+        // -------------------------------------------------------------------
+        // Special case where position is valid and that's the new position
+        // -------------------------------------------------------------------
+
+        if ( relativePosition == 0 )
+        {
+            return success;
+        }
+
+        // -------------------------------------------------------------------
+        // Cases we have to walk the tree forward or backwards
+        // -------------------------------------------------------------------
+
+        if ( relativePosition > 0 )
+        {
+            for ( ; success && relativePosition > 0; relativePosition-- )
+            {
+                next();
+            }
+        }
+        else
+        {
+            for ( ; success && relativePosition < 0; relativePosition++ )
+            {
+                previous();
+            }
+        }
+
+        return success;
+    }
+
+
+    public boolean first() throws IOException
+    {
+        if ( beforeFirst )
+        {
+            return next();
+        }
+
+        if ( pos == 0 )
+        {
+            return success;
+        }
+
+        beforeFirst();
+        return next();
+    }
+
+
+    public boolean last() throws IOException
+    {
+        if ( afterLast )
+        {
+            return previous();
+        }
+
+        if ( pos == ( size - 1 ) )
+        {
+            return success;
+        }
+
+        afterLast();
+        return previous();
+    }
+
+
+    public boolean isFirst() throws IOException
+    {
+        return pos == 0;
+    }
+
+
+    public boolean isLast() throws IOException
+    {
+        return pos == ( size - 1 );
+    }
+
+
+    public boolean isAfterLast() throws IOException
+    {
+        return afterLast;
+    }
+
+
+    public boolean isBeforeFirst() throws IOException
+    {
+        return beforeFirst;
+    }
+
+
+    public boolean previous() throws IOException
+    {
+        if ( beforeFirst )
+        {
+            return false;
+        }
+
+        if ( afterLast )
+        {
+            success = browser.getPrevious( jdbmTuple );
+            if ( success )
+            {
+                afterLast = false;
+                beforeFirst = false;
+                pos = size - 1;
+            }
+            return success;
+        }
+
+        if ( pos == 0 )
+        {
+            success = false;
+            afterLast = false;
+            beforeFirst = true;
+            pos = BEFORE_FIRST;
+            return false;
+        }
+
+        success = browser.getPrevious( jdbmTuple );
+        if ( success )
+        {
+            pos--;
+        }
+        return success;
+    }
+
+
+    public boolean next() throws IOException
+    {
+        if ( afterLast )
+        {
+            return false;
+        }
+
+        if ( beforeFirst )
+        {
+            success = browser.getNext( jdbmTuple );
+            if ( success )
+            {
+                afterLast = false;
+                beforeFirst = false;
+                pos = 0;
+            }
+            return success;
+        }
+
+        if ( pos == size - 1 )
+        {
+            success = false;
+            afterLast = true;
+            beforeFirst = false;
+            pos = size;
+            return false;
+        }
+
+        success = browser.getNext( jdbmTuple );
+        if ( success )
+        {
+            pos++;
+        }
+        return success;
+    }
+
+
+    private boolean inRangeOnValue()
+    {
+        return pos > BEFORE_FIRST && pos < size;
+    }
+
+
+
+    public Object get() throws IOException
+    {
+        if ( ! inRangeOnValue() )
+        {
+            throw new InvalidCursorPositionException();
+        }
+
+        if ( success )
+        {
+            return jdbmTuple.getKey();
+        }
+        else
+        {
+            throw new InconsistentCursorStateException( "Seems like the position is in range however the " +
+                    "last operation failed to produce a successful result" );
+        }
+    }
+
+
+    public boolean isElementReused()
+    {
+        return false;
+    }
+}
\ No newline at end of file

Added: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java?rev=604680&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleCursor.java Sun Dec 16 11:54:30 2007
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.directory.server.core.partition.impl.btree.jdbm;
+
+
+import org.apache.directory.server.core.cursor.AbstractCursor;
+import org.apache.directory.server.core.partition.impl.btree.Tuple;
+import org.apache.directory.server.core.partition.impl.btree.TupleBrowserFactory;
+import org.apache.directory.server.core.partition.impl.btree.TupleBrowser;
+import org.apache.directory.shared.ldap.NotImplementedException;
+
+import java.io.IOException;
+import java.util.Comparator;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BTreeTupleCursor extends AbstractCursor<Tuple>
+{
+    private final Object key;
+    private final Tuple tuple = new Tuple();
+    private final TupleBrowserFactory factory;
+    private final Comparator comparator;
+
+    private jdbm.helper.Tuple jdbmTuple = new jdbm.helper.Tuple();
+    private TupleBrowser browser;
+    private boolean success;
+
+
+
+    public BTreeTupleCursor( TupleBrowserFactory factory, Object key, Comparator comparator )
+            throws IOException
+    {
+        this.key = key;
+        this.factory = factory;
+        this.comparator = comparator;
+    }
+
+
+    public void before( Tuple element ) throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public void after( Tuple element ) throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public void beforeFirst() throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public void afterLast() throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public boolean absolute( int absolutePosition ) throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public boolean relative( int relativePosition ) throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public boolean first() throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public boolean last() throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public boolean isFirst() throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public boolean isLast() throws IOException
+    {
+        return false;
+    }
+
+
+    public boolean isAfterLast() throws IOException
+    {
+        return false;
+    }
+
+
+    public boolean isBeforeFirst() throws IOException
+    {
+        return false;
+    }
+
+
+    public boolean previous() throws IOException
+    {
+        return false;
+    }
+
+
+    public boolean next() throws IOException
+    {
+        return false;
+    }
+
+
+    public Tuple get() throws IOException
+    {
+        throw new NotImplementedException();
+    }
+
+
+    public boolean isElementReused()
+    {
+        return true;
+    }
+}
\ No newline at end of file

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=604680&r1=604679&r2=604680&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Sun Dec 16 11:54:30 2007
@@ -29,6 +29,8 @@
 import org.apache.directory.server.core.cursor.IteratorCursor;
 import org.apache.directory.server.core.cursor.SingletonCursor;
 import org.apache.directory.server.core.partition.impl.btree.*;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.cursor.KeyCursor;
+import org.apache.directory.server.core.partition.impl.btree.jdbm.cursor.TupleCursor;
 import org.apache.directory.server.schema.SerializableComparator;
 
 import javax.naming.NamingException;
@@ -982,7 +984,7 @@
         if ( values instanceof BTreeRedirect )
         {
             BTree tree = getBTree( ( BTreeRedirect ) values );
-            return new BTreeCursor( tree );
+            return new KeyCursor( tree );
         }
         
         throw new IllegalStateException( "When using duplicate keys either a TreeSet or BTree is used for values." );
@@ -1174,7 +1176,7 @@
 //            return new BTreeTupleEnumeration( getBTree( ( BTreeRedirect ) values ),
 //                comparator.getValueComparator(), key, val, isGreaterThan );
             JdbmTupleBrowserFactory factory = new JdbmTupleBrowserFactory( getBTree( ( BTreeRedirect ) values ) );
-            Cursor<Tuple> cursor = new BTreeTupleCursor( factory, key, comparator.getValueComparator() );
+            Cursor<Tuple> cursor = new TupleCursor( factory, key, comparator.getValueComparator() );
             if ( isGreaterThan )
             {
                 cursor.after( new Tuple( key, val ) );



Mime
View raw message