You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2007/12/15 01:58:49 UTC

svn commit: r604361 [1/4] - in /directory/sandbox/akarasulu/bigbang: apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/core-integ/...

Author: akarasulu
Date: Fri Dec 14 16:58:40 2007
New Revision: 604361

URL: http://svn.apache.org/viewvc?rev=604361&view=rev
Log:
check pointing some work that breaks a bunch of things in private branch

Added:
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/CursorClosedException.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/EmptyCursor.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/InconsistentCursorStateException.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/InvalidCursorPositionException.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/IteratorCursor.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/SingletonCursor.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeCursor.java   (with props)
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTupleBrowserFactory.java   (with props)
Modified:
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/MasterTable.java
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.java
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Tuple.java
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowser.java
    directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/BasicServerAttribute.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttribute.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java
    directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/ListCursor.java
    directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultOptimizer.java
    directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultSearchEngine.java
    directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java
    directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/LeafEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ScopeEnumerator.java
    directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ScopeEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEnumerator.java
    directory/sandbox/akarasulu/bigbang/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEvaluator.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeEnumeration.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/BTreeTupleEnumeration.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
    directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/sandbox/akarasulu/bigbang/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/StandardThreadPool.java
    directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/test/java/org/apache/directory/server/ModifyRdnTest.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/entry/BinaryValue.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/entry/EntryAttribute.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Modification.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/ByteArrayComparator.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/MatchingRule.java
    directory/sandbox/akarasulu/bigbang/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/LdapDNTest.java

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.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/Index.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Index.java Fri Dec 14 16:58:40 2007
@@ -22,12 +22,14 @@
 
 import java.util.regex.Pattern;
 import java.io.File;
+import java.io.IOException;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.server.core.cursor.Cursor;
 
 
 /**
@@ -115,18 +117,18 @@
      *
      * @param attrVal the user provided value to normalize
      * @return the normalized value.
-     * @throws NamingException if something goes wrong.
+     * @throws IOException if something goes wrong.
      */
-    Object getNormalized( Object attrVal ) throws NamingException;
+    Object getNormalized( Object attrVal ) throws IOException;
 
 
     /**
      * Gets the total scan count for this index.
      *
      * @return the number of key/value pairs in this index
-     * @throws NamingException if their is a failure accessing the index
+     * @throws IOException on failure to access index db files
      */
-    int count() throws NamingException;
+    int count() throws IOException;
 
 
     /**
@@ -135,78 +137,78 @@
      *
      * @param attrVal the value of the attribute to get a scan count for
      * @return the number of key/value pairs in this index with the value value
-     * @throws NamingException if their is a failure accessing the index
+     * @throws IOException on failure to access index db files
      */
-    int count( Object attrVal ) throws NamingException;
+    int count( Object attrVal ) throws IOException;
 
 
-    int count( Object attrVal, boolean isGreaterThan ) throws NamingException;
+    int count( Object attrVal, boolean isGreaterThan ) throws IOException;
 
 
-    Object forwardLookup( Object attrVal ) throws NamingException;
+    Object forwardLookup( Object attrVal ) throws IOException;
 
 
-    Object reverseLookup( Object id ) throws NamingException;
+    Object reverseLookup( Object id ) throws IOException;
 
 
-    void add( Object attrVal, Object id ) throws NamingException;
+    void add( Object attrVal, Object id ) throws IOException;
 
 
-    void add( Attribute attr, Object id ) throws NamingException;
+    void add( Attribute attr, Object id ) throws IOException;
 
 
-    void add( Attributes attrs, Object id ) throws NamingException;
+    void add( Attributes attrs, Object id ) throws IOException;
 
 
-    void drop( Object entryId ) throws NamingException;
+    void drop( Object entryId ) throws IOException;
 
 
-    void drop( Object attrVal, Object id ) throws NamingException;
+    void drop( Object attrVal, Object id ) throws IOException;
 
 
     /**
      * If the Attribute does not have any values then this reduces to a 
      * drop(BigInteger) call.
      */
-    void drop( Attribute attr, Object id ) throws NamingException;
+    void drop( Attribute attr, Object id ) throws IOException;
 
 
     /**
      * If the Attribute for this index within the Attributes does not have any 
      * values then this reduces to a drop(BigInteger) call.
      */
-    void drop( Attributes attrs, Object id ) throws NamingException;
+    void drop( Attributes attrs, Object id ) throws IOException;
 
 
-    IndexEnumeration listReverseIndices( Object id ) throws NamingException;
+    Cursor<IndexRecord> listReverseIndices( Object id ) throws IOException;
 
 
-    IndexEnumeration listIndices() throws NamingException;
+    Cursor<IndexRecord> listIndices() throws IOException;
 
 
-    IndexEnumeration listIndices( Object attrVal ) throws NamingException;
+    Cursor<IndexRecord> listIndices( Object attrVal ) throws IOException;
 
 
-    IndexEnumeration listIndices( Object attrVal, boolean isGreaterThan ) throws NamingException;
+    Cursor<IndexRecord> listIndices( Object attrVal, boolean isGreaterThan ) throws IOException;
 
 
-    IndexEnumeration listIndices( Pattern regex ) throws NamingException;
+    Cursor<IndexRecord> listIndices( Pattern regex ) throws IOException;
 
 
-    IndexEnumeration listIndices( Pattern regex, String prefix ) throws NamingException;
+    Cursor<IndexRecord> listIndices( Pattern regex, String prefix ) throws IOException;
 
 
-    boolean hasValue( Object attrVal, Object id ) throws NamingException;
+    boolean hasValue( Object attrVal, Object id ) throws IOException;
 
 
-    boolean hasValue( Object attrVal, Object id, boolean isGreaterThan ) throws NamingException;
+    boolean hasValue( Object attrVal, Object id, boolean isGreaterThan ) throws IOException;
 
 
-    boolean hasValue( Pattern regex, Object id ) throws NamingException;
+    boolean hasValue( Pattern regex, Object id ) throws IOException;
 
 
-    void close() throws NamingException;
+    void close() throws IOException;
 
 
-    void sync() throws NamingException;
+    void sync() throws IOException;
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/MasterTable.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/MasterTable.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/MasterTable.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/MasterTable.java Fri Dec 14 16:58:40 2007
@@ -22,6 +22,7 @@
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
+import java.io.IOException;
 
 
 /**
@@ -46,7 +47,7 @@
      * @return the Attributes of the entry with operational attributes and all.
      * @throws NamingException if there is a read error on the underlying Db.
      */
-    Attributes get( Object id ) throws NamingException;
+    Attributes get( Object id ) throws IOException;
 
 
     /**

Added: 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=604361&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java Fri Dec 14 16:58:40 2007
@@ -0,0 +1,381 @@
+/*
+ * 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;
+
+
+import org.apache.directory.server.core.cursor.AbstractCursor;
+import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
+import org.apache.directory.server.core.cursor.InconsistentCursorStateException;
+import org.apache.directory.shared.ldap.NotImplementedException;
+
+import java.io.IOException;
+
+
+/**
+ * @todo Man you better test this!!!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class NoDupsCursor extends AbstractCursor<Tuple>
+{
+    private final Tuple tuple = new Tuple();
+    private final TupleBrowserFactory factory;
+
+    private long pos = BEFORE_FIRST;
+    private long size;  // cache the size to prevent needless lookups
+    private boolean afterLast;
+    private boolean beforeFirst;
+    private TupleBrowser browser;
+    private boolean success;
+
+
+    public NoDupsCursor( TupleBrowserFactory factory ) throws IOException
+    {
+        this( factory, false );
+    }
+
+
+    public NoDupsCursor( TupleBrowserFactory factory, boolean afterLast ) throws IOException
+    {
+        this.factory = factory;
+
+        if ( afterLast )
+        {
+            afterLast();
+        }
+        else
+        {
+            beforeFirst();
+        }
+    }
+
+
+    public NoDupsCursor( TupleBrowserFactory factory, int absolute ) throws IOException
+    {
+        this.factory = factory;
+        absolute( absolute );
+    }
+
+
+    public NoDupsCursor( TupleBrowserFactory factory, Object key ) throws IOException
+    {
+        this.factory = factory;
+        beforeKey( key );
+    }
+
+
+    /**
+     * @todo
+     *
+     * This is a little tricky. How do we know where we are positioned?  We could
+     * do some check perhaps with getNext() and backup with getPrevious().
+     *
+     * @param key
+     * @throws IOException
+     */
+    private void beforeKey( Object key ) throws IOException
+    {
+        beforeFirst = false;
+        afterLast = false;
+        success = true;
+        size = factory.size();
+        pos = BEFORE_FIRST;
+        browser = factory.beforeKey( key );
+
+        throw new NotImplementedException( "Need to fix the todo on this before going further" );
+    }
+
+
+    public void beforeFirst() throws IOException
+    {
+        if ( ! beforeFirst )
+        {
+            beforeFirst = true;
+            afterLast = false;
+            success = false;
+            size = factory.size();
+            pos = BEFORE_FIRST;
+            browser = factory.beforeFirst();
+        }
+    }
+
+
+    public void afterLast() throws IOException
+    {
+        if ( ! afterLast )
+        {
+            beforeFirst = false;
+            afterLast = true;
+            success = false;
+            size = factory.size();
+            pos = size;
+            browser = factory.afterLast();
+        }
+    }
+
+
+    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( tuple );
+            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( tuple );
+        if ( success )
+        {
+            pos--;
+        }
+        return success;
+    }
+
+
+    public boolean next() throws IOException
+    {
+        return success = this.browser.getNext( tuple );
+    }
+
+
+    private boolean inRangeOnValue()
+    {
+        return pos > BEFORE_FIRST && pos < size;
+    }
+
+
+
+    public Tuple get() throws IOException
+    {
+        if ( ! inRangeOnValue() )
+        {
+            throw new InvalidCursorPositionException();
+        }
+
+        if ( success )
+        {
+            return tuple;
+        }
+        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 true;
+    }
+}

Propchange: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsCursor.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.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/NoDupsEnumeration.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/NoDupsEnumeration.java Fri Dec 14 16:58:40 2007
@@ -21,6 +21,7 @@
 
 
 import java.util.NoSuchElementException;
+import java.io.IOException;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -59,6 +60,10 @@
     
     /**
      * Creates a cursor over a TupleBrowser where duplicates are not expected.
+     *
+     * @param browser the underlying tuple browser
+     * @param doAscendingScan true if scan is ascending, false if descending
+     * @throws NamingException if there are failures prefetching
      */
     public NoDupsEnumeration( TupleBrowser browser, boolean doAscendingScan ) throws NamingException
     {
@@ -165,15 +170,33 @@
     private void prefetch() throws NamingException
     {
         // Prefetch into tuple!
-        boolean isSuccess = false;
+        boolean isSuccess;
 
         if ( doAscendingScan )
         {
-            isSuccess = browser.getNext( prefetched );
+            try
+            {
+                isSuccess = browser.getNext( prefetched );
+            }
+            catch ( IOException e )
+            {
+                NamingException namingException = new NamingException( "browser.getNext() failure" );
+                namingException.setRootCause( e );
+                throw namingException;
+            }
         }
         else
         {
-            isSuccess = browser.getPrevious( prefetched );
+            try
+            {
+                isSuccess = browser.getPrevious( prefetched );
+            }
+            catch ( IOException e )
+            {
+                NamingException namingException = new NamingException( "browser.getPrevious() failure" );
+                namingException.setRootCause( e );
+                throw namingException;
+            }
         }
 
         hasNext = isSuccess;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.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/Table.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Table.java Fri Dec 14 16:58:40 2007
@@ -20,8 +20,9 @@
 package org.apache.directory.server.core.partition.impl.btree;
 
 
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
+import org.apache.directory.server.core.cursor.Cursor;
+
+import java.io.IOException;
 
 
 /**
@@ -98,9 +99,9 @@
      *
      * @param key the Object of the key to check for
      * @return true if the key exists, false otherwise.
-     * @throws NamingException if there is a failure to read the underlying Db
+     * @throws IOException if there is a failure to read the underlying Db
      */
-    boolean has( Object key ) throws NamingException;
+    boolean has( Object key ) throws IOException;
 
 
     /**
@@ -109,9 +110,9 @@
      * @param key the key Object to check for
      * @param value the value Object to check for
      * @return true if a record with the key and value exists, false otherwise.
-     * @throws NamingException if there is a failure to read the underlying Db
+     * @throws IOException if there is a failure to read the underlying Db
      */
-    boolean has( Object key, Object value ) throws NamingException;
+    boolean has( Object key, Object value ) throws IOException;
 
 
     /**
@@ -124,10 +125,10 @@
      * @param isGreaterThan boolean for greater than or less then comparison
      * @return true if a record with a key greater/less than the key argument
      * exists, false otherwise
-     * @throws NamingException if there is a failure to read the underlying Db,
+     * @throws IOException if there is a failure to read the underlying Db,
      * or if the underlying Db is not a Btree.
      */
-    boolean has( Object key, boolean isGreaterThan ) throws NamingException;
+    boolean has( Object key, boolean isGreaterThan ) throws IOException;
 
 
     /**
@@ -147,11 +148,11 @@
      * @param isGreaterThan boolean for greater than or less then comparison
      * @return true if a record with a key greater/less than the key argument
      * exists, false otherwise
-     * @throws NamingException if there is a failure to read the underlying Db
+     * @throws IOException if there is a failure to read the underlying Db
      * or if the underlying Db is not of the Btree type that allows sorted
      * duplicate values.
      */
-    boolean has( Object key, Object val, boolean isGreaterThan ) throws NamingException;
+    boolean has( Object key, Object val, boolean isGreaterThan ) throws IOException;
 
 
     // ------------------------------------------------------------------------
@@ -168,9 +169,9 @@
      * @param key the key of the record
      * @return the value of the record with key if key exists or null if
      * no such record exists.
-     * @throws NamingException if there is a failure to read the underlying Db
+     * @throws IOException if there is a failure to read the underlying Db
      */
-    Object get( Object key ) throws NamingException;
+    Object get( Object key ) throws IOException;
 
 
     /**
@@ -180,76 +181,79 @@
      * @param value the value of the record.
      * @return the last value present for key or null if this the key did not
      * exist before.
-     * @throws NamingException if there is a failure to read or write to
+     * @throws IOException if there is a failure to read or write to
      * the underlying Db
      */
-    Object put( Object key, Object value ) throws NamingException;
+    Object put( Object key, Object value ) throws IOException;
 
 
     /**
-     * Efficiently puts a set of values into the Table.  If the Table does not 
-     * support duplicate keys then only the first key within the enumeration is
-     * added.  If there are more elements left after this single addition an
-     * UnsupportedOperationException is thrown.  Nothing is added if the table
-     * does not support duplicates and there is more than one element in the
-     * enumeration.
+     * Puts a set of values into the Table.  If the Table does not support
+     * duplicate keys then only the first value found in the Cursor is added.
+     * If duplicate keys are not supported and there is more than one element
+     * in the Cursor an IllegalStateException will be raised without putting
+     * any values.
      *
      * @param key the key to use for the values
-     * @param values the values supplied as an enumeration
-     * @throws NamingException if something goes wrong
+     * @param values the values supplied as an cursor
+     * @return the replaced object or null if one did not exist
+     * @throws IOException if something goes wrong
      */
-    Object put( Object key, NamingEnumeration<? extends Object> values ) throws NamingException;
+    Object put( Object key, Cursor<Object> values ) throws IOException;
 
 
     /**
-     * Removes all records with key from this Table.
+     * Removes all records with a specified key from this Table.
      *
      * @param key the key of the records to remove
-     * @throws NamingException if there is a failure to read or write to
+     * @return the removed object or null if one did not exist for the key
+     * @throws IOException if there is a failure to read or write to
      * the underlying Db
      */
-    Object remove( Object key ) throws NamingException;
+    Object remove( Object key ) throws IOException;
 
 
     /**
-     * Removes a single specific record with key and value from this Table.
+     * Removes a single key value pair with a specified key and value from
+     * this Table.
      *
      * @param key the key of the record to remove
      * @param value the value of the record to remove
-     * @throws NamingException if there is a failure to read or write to
+     * @return the removed value object or null if one did not exist
+     * @throws IOException if there is a failure to read or write to
      * the underlying Db
      */
-    Object remove( Object key, Object value ) throws NamingException;
+    Object remove( Object key, Object value ) throws IOException;
 
 
     /**
      * Removes a set of values with the same key from this Table.  If this 
      * table does not allow duplicates the method will attempt to remove the 
-     * first value in the enumeration if one exists.  If there is more than one 
-     * value within the enumeration after the first drop an 
-     * UnsupportedOperationException is thrown.  Nothing is removed if there is 
-     * more than one element on the enumeration and the table does not support
-     * duplicates.
+     * first value in the Cursor if one exists.  If there is more than one
+     * value within the Cursor after the first an IllegalStateException is
+     * thrown.
      *
      * @param key the key of the records to remove
+     * @param values the values supplied as an enumeration
      * @return the first value removed
-     * @throws NamingException if there is a failure to read or write to
+     * @throws IOException if there is a failure to read or write to
      * the underlying Db
      */
-    Object remove( Object key, NamingEnumeration<? extends Object> values ) throws NamingException;
+    Object remove( Object key, Cursor<Object> values ) throws IOException;
 
 
     /**
-     * Sets a enumeration to the first record in the Table with a key value of
+     * Sets a Cursor to the first record in the Table with a key value of
      * key and enables single next steps across all duplicate records with
-     * this key.  This enumeration will only iterate over duplicates of the key.
+     * this key.  This Cursor will only iterate over duplicates of the key.
      * Unlike listTuples(Object) which returns Tuples from the enumerations 
-     * this just returns the values of the key.
+     * this just returns the values of the key as an Object.
      * 
      * @param key the key to iterate over
-     * @throws NamingException if the underlying browser could not be set
+     * @return the values of the key ONLY, not the Tuples
+     * @throws IOException if the underlying btree browser could not be set
      */
-    NamingEnumeration<Object> listValues( Object key ) throws NamingException;
+    Cursor<Object> listValues( Object key ) throws IOException;
 
 
     // ------------------------------------------------------------------------
@@ -261,9 +265,10 @@
      * Sets a cursor to the first record in the Table and enables single
      * next steps across all records.
      *
-     * @throws NamingException if the underlying cursor could not be set.
+     * @return the values as key value Tuples
+     * @throws IOException if the underlying cursor could not be set.
      */
-    NamingEnumeration<Tuple> listTuples() throws NamingException;
+    Cursor<Tuple> listTuples() throws IOException;
 
 
     /**
@@ -271,10 +276,14 @@
      * key and enables single next steps across all duplicate records with
      * this key.  This cursor will only iterate over duplicates of the key.
      *
+     * Unlike listValues(Object) this returns Tuples from the resulting 
+     * Cursor.
+     *
      * @param key the key to iterate over
-     * @throws NamingException if the underlying cursor could not be set
+     * @return the values as key value Tuples
+     * @throws IOException if the underlying cursor could not be set
      */
-    NamingEnumeration<Tuple> listTuples( Object key ) throws NamingException;
+    Cursor<Tuple> listTuples( Object key ) throws IOException;
 
 
     /**
@@ -287,9 +296,10 @@
      * @param isGreaterThan if true the cursor iterates up over ascending keys
      * greater than or equal to the key argument, but if false this cursor
      * iterates down over descending keys less than or equal to key argument
-     * @throws NamingException if the underlying cursor could not be set
+     * @return the values as key value Tuples
+     * @throws IOException if the underlying cursor could not be set
      */
-    NamingEnumeration<Tuple> listTuples( Object key, boolean isGreaterThan ) throws NamingException;
+    Cursor<Tuple> listTuples( Object key, boolean isGreaterThan ) throws IOException;
 
 
     /**
@@ -306,15 +316,16 @@
      * equal to it.
      * @param val the value to use to position this cursor to record with a
      * value greater/less than or equal to it.
-     * @param isGreaterThan if true the cursor iterates up over ascending 
-     * values greater than or equal to the val argument, but if false this 
-     * cursor iterates down over descending values less than or equal to val 
+     * @param isGreaterThan if true the cursor iterates up over ascending
+     * values greater than or equal to the val argument, but if false this
+     * cursor iterates down over descending values less than or equal to val
      * argument starting from the largest value going down
-     * @throws NamingException if the underlying cursor could not be set or
+     * @return the values as key value Tuples
+     * @throws IOException if the underlying cursor could not be set or
      * this method is called over a cursor on a table that does not have sorted
      * duplicates enabled.
      */
-    NamingEnumeration<Tuple> listTuples( Object key, Object val, boolean isGreaterThan ) throws NamingException;
+    Cursor<Tuple> listTuples( Object key, Object val, boolean isGreaterThan ) throws IOException;
 
 
     // ------------------------------------------------------------------------
@@ -325,9 +336,9 @@
      * Gets the count of the number of records in this Table.
      *
      * @return the number of records
-     * @throws NamingException if there is a failure to read the underlying Db
+     * @throws IOException if there is a failure to read the underlying Db
      */
-    int count() throws NamingException;
+    int count() throws IOException;
 
 
     /**
@@ -336,9 +347,9 @@
      *
      * @param key the Object key to count.
      * @return the number of duplicate records for a key.
-     * @throws NamingException if there is a failure to read the underlying Db
+     * @throws IOException if there is a failure to read the underlying Db
      */
-    int count( Object key ) throws NamingException;
+    int count( Object key ) throws IOException;
 
 
     /**
@@ -349,15 +360,15 @@
      * @param isGreaterThan boolean set to true to count for greater than and
      * equal to record keys, or false for less than or equal to keys.
      * @return the number of keys greater or less than key.
-     * @throws NamingException if there is a failure to read the underlying Db
+     * @throws IOException if there is a failure to read the underlying Db
      */
-    int count( Object key, boolean isGreaterThan ) throws NamingException;
+    int count( Object key, boolean isGreaterThan ) throws IOException;
 
 
     /**
      * Closes the underlying Db of this Table.
      *
-     * @throws NamingException on any failures
+     * @throws IOException on any failures
      */
-    void close() throws NamingException;
+    void close() throws IOException;
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Tuple.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/Tuple.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Tuple.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/Tuple.java Fri Dec 14 16:58:40 2007
@@ -51,7 +51,7 @@
      * @param key the key to set
      * @param value the value to set
      */
-    public Tuple(Object key, Object value)
+    public Tuple( Object key, Object value )
     {
         this.key = key;
         this.value = value;
@@ -73,10 +73,12 @@
      * Sets the key for this Tuple.
      *
      * @param key the new key to set
+     * @return this Tuple itself to set and return
      */
-    public void setKey( Object key )
+    public Tuple setKey( Object key )
     {
         this.key = key;
+        return this;
     }
 
 
@@ -95,9 +97,28 @@
      * Sets the value for this Tuple.
      *
      * @param value the new value to set
+     * @return this Tuple itself to set and return
      */
-    public void setValue( Object value )
+    public Tuple setValue( Object value )
     {
         this.value = value;
+        return this;
+    }
+
+
+    /**
+     * Sets both the key and the value for this Tuple in one call and returns
+     * this Tuple object.  This is useful for setting the tuples key and value
+     * then returning it.
+     *
+     * @param key the new key to set
+     * @param value the new value to set
+     * @return this Tuple itself to set and return
+     */
+    public Tuple setBoth( Object key, Object value )
+    {
+        this.key = key;
+        this.value = value;
+        return this;
     }
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowser.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/TupleBrowser.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowser.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowser.java Fri Dec 14 16:58:40 2007
@@ -20,11 +20,14 @@
 package org.apache.directory.server.core.partition.impl.btree;
 
 
-import javax.naming.NamingException;
+import java.io.IOException;
 
 
 /**
- * TupleBrowser interface used to abstract 
+ * TupleBrowser interface used to abstract underlying browser.  You might
+ * wonder why this interface was recreated when the same interface is present
+ * in jdbm.  It's to be implementation agnostic while not requiring other
+ * implementations to have dependencies on JDBM interfaces.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
@@ -37,9 +40,9 @@
      *
      * @param tuple the tuple to populate with a key/value pair
      * @return true if there was a next that was populated or false otherwise
-     * @throws NamingException @todo
+     * @throws IOException if there is a unexpected failure
      */
-    boolean getNext( Tuple tuple ) throws NamingException;
+    boolean getNext( Tuple tuple ) throws IOException;
 
 
     /**
@@ -48,7 +51,7 @@
      *
      * @param tuple the tuple to populate with a key/value pair
      * @return true if there was a previous value populated or false otherwise
-     * @throws NamingException @todo
+     * @throws IOException if there is an unexpected failure
      */
-    boolean getPrevious( Tuple tuple ) throws NamingException;
+    boolean getPrevious( Tuple tuple ) throws IOException;
 }

Added: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.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/TupleBrowserFactory.java?rev=604361&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java Fri Dec 14 16:58:40 2007
@@ -0,0 +1,68 @@
+/*
+ *  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;
+
+
+import java.io.IOException;
+
+
+/**
+ * Interface used to abstract underlying btree used.  Implementors can use
+ * this interface to reuse Cursors implemented in this package.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 491471 $
+ */
+public interface TupleBrowserFactory
+{
+    long size() throws IOException;
+
+    /**
+     * Gets a TupleBrowser positioned just before the first entry if one
+     * exists.  The getNext() method should return the first entry from the
+     * browser.
+     *
+     * @return the browser postitioned before the first entry
+     * @throws IOException if there are errors accessing the underlying btree
+     */
+    TupleBrowser beforeFirst() throws IOException;
+
+    /**
+     * Gets a TupleBrowser positioned just after the last entry if one
+     * exists.  The getPrevious() method should return the last entry from
+     * the  browser.
+     *
+     * @return the browser postitioned after the last entry
+     * @throws IOException if there are errors accessing the underlying btree
+     */
+    TupleBrowser afterLast() throws IOException;
+
+
+    /**
+     * Gets a new browser positioned just before a specific key.  If the key
+     * is not present then the browser is position at the "greatest" key it
+     * can find just before the key argument.
+     *
+     * @param key the key to be positioned in front of
+     * @return the tuple positioned browser
+     * @throws IOException if there are errors accessing the underlying btree
+     */
+    TupleBrowser beforeKey( Object key ) throws IOException;
+}
\ No newline at end of file

Propchange: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleBrowserFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.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/TupleEnumeration.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/TupleEnumeration.java Fri Dec 14 16:58:40 2007
@@ -40,7 +40,7 @@
 public class TupleEnumeration implements NamingEnumeration<Tuple>
 {
     private final Object key;
-    private final Iterator<? extends Object> iterator;
+    private final Iterator<Object> iterator;
     private final Tuple tuple = new Tuple();
 
 
@@ -50,7 +50,7 @@
      * @param key the keys whose duplicate values are to be returned
      * @param iterator the underlying iterator this cursor uses
      */
-    public TupleEnumeration( Object key, Iterator<? extends Object> iterator )
+    public TupleEnumeration( Object key, Iterator<Object> iterator )
     {
         this.key = key;
         tuple.setKey( key );

Added: 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=604361&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java Fri Dec 14 16:58:40 2007
@@ -0,0 +1,234 @@
+/*
+ * 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;
+
+
+import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.cursor.CursorClosedException;
+import org.apache.directory.server.core.cursor.InvalidCursorPositionException;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+
+/**
+ * A Cursor which returns the values of a single key as Tuples.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ValueArrayCursor implements Cursor<Tuple>
+{
+    private static final int BEFORE_FIRST = -1;
+
+    private final Object key;
+    private final List<Object> values;
+    private final Tuple tuple = new Tuple();
+
+    private boolean closed;
+    private int pos = BEFORE_FIRST;
+
+
+    public ValueArrayCursor( final Object key, final Object[] values )
+    {
+        this.key = key;
+        this.tuple.setKey( key );
+        this.values = Arrays.asList( values );
+    }
+
+
+    public ValueArrayCursor( final Object key, final List<Object> values )
+    {
+        this.key = key;
+        this.tuple.setKey( key );
+        this.values = values;
+    }
+
+
+    protected void checkClosed( String operation ) throws IOException
+    {
+        if ( closed )
+        {
+            throw new CursorClosedException( "Attempting " + operation
+                    + " operation on a closed Cursor." );
+        }
+    }
+
+
+    public void beforeFirst() throws IOException
+    {
+        checkClosed( "beforeFirst()" );
+        pos = BEFORE_FIRST;
+    }
+
+
+    public void afterLast() throws IOException
+    {
+        checkClosed( "afterLast()" );
+        pos = values.size();
+    }
+
+
+    public boolean absolute( int absolutePosition ) throws IOException
+    {
+        checkClosed( "absolute()" );
+        if ( absolutePosition >= values.size() )
+        {
+            pos = values.size();
+            return false;
+        }
+
+        if ( absolutePosition < 0 )
+        {
+            pos = BEFORE_FIRST;
+            return false;
+        }
+
+        pos = absolutePosition;
+        return true;
+    }
+
+
+    public boolean relative( int relativePosition ) throws IOException
+    {
+        checkClosed( "relative()" );
+        if ( ( relativePosition + pos ) >= values.size() )
+        {
+            pos = values.size();
+            return false;
+        }
+
+        if ( ( relativePosition + pos ) < 0 )
+        {
+            pos = BEFORE_FIRST;
+            return false;
+        }
+
+        pos += relativePosition;
+        return true;
+    }
+
+
+    public boolean first() throws IOException
+    {
+        checkClosed( "first()" );
+        pos = 0;
+        return true;
+    }
+
+
+    public boolean last() throws IOException
+    {
+        checkClosed( "last()" );
+        pos = values.size() - 1;
+        return true;
+    }
+
+
+    public boolean isFirst() throws IOException
+    {
+        checkClosed( "isFirst()" );
+        return pos == 0;
+    }
+
+
+    public boolean isLast() throws IOException
+    {
+        checkClosed( "isLast()" );
+        return pos == values.size() - 1;
+    }
+
+
+    public boolean isAfterLast() throws IOException
+    {
+        checkClosed( "isAfterLast()" );
+        return pos == values.size();
+    }
+
+
+    public boolean isBeforeFirst() throws IOException
+    {
+        checkClosed( "isBeforeFirst()" );
+        return pos == BEFORE_FIRST;
+    }
+
+
+    public boolean isClosed() throws IOException
+    {
+        return closed;
+    }
+
+
+    public boolean previous() throws IOException
+    {
+        checkClosed( "previous()" );
+        if ( pos <= BEFORE_FIRST )
+        {
+            return false;
+        }
+
+        pos--;
+        return inRangeOnValue();
+    }
+
+
+    private boolean inRangeOnValue()
+    {
+        return pos > BEFORE_FIRST && pos < values.size();
+    }
+
+
+    public boolean next() throws IOException
+    {
+        checkClosed( "next()" );
+        if ( pos >= values.size() )
+        {
+            return false;
+        }
+
+        pos++;
+        return inRangeOnValue();
+    }
+
+
+    public Tuple get() throws IOException
+    {
+        checkClosed( "get()" );
+        if ( inRangeOnValue() )
+        {
+            return tuple.setBoth( key, values.get( pos ) );
+        }
+
+        throw new InvalidCursorPositionException( "Cursor pos (" + pos
+                + ") not in value range [0-" + ( values.size() - 1 )+ "]" );
+    }
+
+
+    public boolean isElementReused()
+    {
+        return true;
+    }
+
+
+    public void close() throws IOException
+    {
+        closed = true;
+    }
+}

Propchange: directory/sandbox/akarasulu/bigbang/apacheds/btree-base/src/main/java/org/apache/directory/server/core/partition/impl/btree/ValueArrayCursor.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/BasicServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/BasicServerAttribute.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/BasicServerAttribute.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/BasicServerAttribute.java Fri Dec 14 16:58:40 2007
@@ -32,7 +32,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class BasicServerAttribute implements ServerAttribute<ServerValue<?>>
+public class BasicServerAttribute implements ServerAttribute
 {
     private HashSet<ServerValue<?>> values = new HashSet<ServerValue<?>>();
     private AttributeType attributeType;
@@ -88,7 +88,6 @@
     public BasicServerAttribute( String upId, AttributeType attributeType, ServerValue<?> val ) throws NamingException
     {
         this.attributeType = attributeType;
-        
         if ( val == null )
         {
             if ( attributeType.getSyntax().isHumanReadable() )
@@ -123,7 +122,6 @@
 
             values.add( val );
         }
-        
         setUpId( upId, attributeType );
     }
 
@@ -309,7 +307,7 @@
     }
 
 
-    public Iterator<ServerValue<?>> getAll()
+    public Iterator<? extends ServerValue<?>> getAll()
     {
         return iterator();
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java Fri Dec 14 16:58:40 2007
@@ -19,11 +19,9 @@
 package org.apache.directory.server.core.entry;
 
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -46,11 +44,11 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class DefaultServerEntry implements ServerEntry<ServerAttribute<ServerValue<?>>>
+public class DefaultServerEntry implements ServerEntry
 {
     private static final Logger LOG = LoggerFactory.getLogger( DefaultServerEntry.class );
 
-    private Map<AttributeType, ServerAttribute<ServerValue<?>>> serverAttributeMap = new HashMap<AttributeType, ServerAttribute<ServerValue<?>>>();
+    private Map<AttributeType, ServerAttribute> serverAttributeMap = new HashMap<AttributeType, ServerAttribute>();
     private ObjectClassAttribute objectClassAttribute;
     private final transient Registries registries;
     private transient AttributeType objectClassAT;
@@ -67,21 +65,13 @@
     }
 
 
-    private ServerAttribute<ServerValue<?>> setObjectClassAttribute( ServerAttribute<ServerValue<?>> objectClassAttribute ) throws NamingException
+    private ServerAttribute setObjectClassAttribute( ObjectClassAttribute objectClassAttribute ) throws NamingException
     {
-        this.objectClassAttribute = (ObjectClassAttribute)objectClassAttribute;
+        this.objectClassAttribute = objectClassAttribute;
         return serverAttributeMap.put( objectClassAT, objectClassAttribute );
     }
 
 
-    private ServerAttribute<ServerValue<?>> removeObjectClassAttribute( ServerAttribute<ServerValue<?>> objectClassAttribute ) throws NamingException
-    {
-        this.objectClassAttribute = (ObjectClassAttribute)objectClassAttribute;
-
-        return serverAttributeMap.remove( objectClassAT );
-    }
-
-
     public boolean addObjectClass( ObjectClass objectClass, String alias ) throws NamingException
     {
         return objectClassAttribute.addObjectClass( objectClass, alias );
@@ -154,13 +144,13 @@
     }
 
 
-    public ServerAttribute<ServerValue<?>> get( AttributeType attributeType )
+    public ServerAttribute get( AttributeType attributeType )
     {
         return serverAttributeMap.get( attributeType );
     }
 
 
-    public ServerAttribute<ServerValue<?>> put( ServerAttribute<ServerValue<?>> serverAttribute ) throws NamingException
+    public ServerAttribute put( ServerAttribute serverAttribute ) throws NamingException
     {
         if ( serverAttribute.getType().equals( objectClassAT ) && serverAttribute instanceof ObjectClassAttribute )
         {
@@ -170,12 +160,10 @@
         if ( serverAttribute.getType().equals( objectClassAT ) )
         {
             ObjectClassAttribute objectClassAttribute = new ObjectClassAttribute( registries );
-            
             for ( ServerValue<?> val : serverAttribute )
             {
                 objectClassAttribute.add( val );
             }
-            
             return setObjectClassAttribute( objectClassAttribute );
         }
 
@@ -183,58 +171,19 @@
     }
 
 
-    public List<ServerAttribute<ServerValue<?>>> put( ServerAttribute<ServerValue<?>>... serverAttributes ) throws NamingException
-    {
-        List<ServerAttribute<ServerValue<?>>> duplicatedAttributes = new ArrayList<ServerAttribute<ServerValue<?>>>();
-        
-        for ( ServerAttribute<ServerValue<?>> serverAttribute:serverAttributes )
-        {
-            if ( serverAttribute.getType().equals( objectClassAT ) )
-            {
-                if ( serverAttribute instanceof ObjectClassAttribute )
-                {
-                    setObjectClassAttribute( ( ObjectClassAttribute ) serverAttribute );
-                }
-                else
-                {
-                    ObjectClassAttribute objectClassAttribute = new ObjectClassAttribute( registries );
-                    
-                    for ( ServerValue<?> val : serverAttribute )
-                    {
-                        objectClassAttribute.add( val );
-                    }
-                    
-                    setObjectClassAttribute( objectClassAttribute );
-                }
-            }
-
-            if ( serverAttributeMap.containsKey( serverAttribute.getType() ) )
-            {
-                duplicatedAttributes.add( serverAttribute );
-            }
-            else
-            {
-                serverAttributeMap.put( serverAttribute.getType(), serverAttribute );
-            }
-        }
-        
-        return duplicatedAttributes;
-    }
-
-
-    public ServerAttribute<ServerValue<?>> put( String upId, AttributeType attributeType ) throws NamingException
+    public ServerAttribute put( String upId, AttributeType attributeType ) throws NamingException
     {
         throw new NotImplementedException();
     }
 
 
-    public ServerAttribute<ServerValue<?>> put( AttributeType attributeType ) throws NamingException
+    public ServerAttribute put( AttributeType attributeType ) throws NamingException
     {
         throw new NotImplementedException();
     }
 
 
-    public ServerAttribute<ServerValue<?>> remove( ServerAttribute<ServerValue<?>> serverAttribute ) throws NamingException
+    public ServerAttribute remove( ServerAttribute serverAttribute ) throws NamingException
     {
         if ( serverAttribute.getType().equals( objectClassAT ) )
         {
@@ -245,31 +194,9 @@
     }
 
 
-    public List<ServerAttribute<ServerValue<?>>> remove( ServerAttribute<ServerValue<?>>... serverAttributes ) throws NamingException
-    {
-        List<ServerAttribute<ServerValue<?>>> removedAttributes = new ArrayList<ServerAttribute<ServerValue<?>>>();
-        
-        for ( ServerAttribute<ServerValue<?>> serverAttribute:serverAttributes )
-        {
-            if ( serverAttribute.getType().equals( objectClassAT ) )
-            {
-                removeObjectClassAttribute( new ObjectClassAttribute( registries ) );
-            }
-
-            if ( serverAttributeMap.containsKey( serverAttribute.getType() ) )
-            {
-                serverAttributeMap.remove( serverAttribute.getType() );
-                removedAttributes.add( serverAttribute );
-            }
-        }
-        
-        return removedAttributes;
-    }
-
-
-    public ServerAttribute<ServerValue<?>> put( AttributeType attributeType, ServerValue<?> val ) throws NamingException
+    public ServerAttribute put( AttributeType attributeType, ServerValue<?> val ) throws NamingException
     {
-        ServerAttribute<ServerValue<?>> existing = serverAttributeMap.get( attributeType );
+        ServerAttribute existing = serverAttributeMap.get( attributeType );
 
         if ( existing != null )
         {
@@ -282,7 +209,7 @@
     }
 
 
-    public ServerAttribute<ServerValue<?>> put( String upId, AttributeType attributeType, ServerValue<?> val ) throws NamingException
+    public ServerAttribute put( String upId, AttributeType attributeType, ServerValue<?> val ) throws NamingException
     {
         if ( attributeType.equals( objectClassAT ) )
         {
@@ -293,9 +220,9 @@
     }
 
 
-    public ServerAttribute<ServerValue<?>> put( AttributeType attributeType, String val ) throws NamingException
+    public ServerAttribute put( AttributeType attributeType, String val ) throws NamingException
     {
-        ServerAttribute<ServerValue<?>> existing = serverAttributeMap.get( attributeType );
+        ServerAttribute existing = serverAttributeMap.get( attributeType );
 
         if ( attributeType.equals( objectClassAT ) )
         {
@@ -318,7 +245,7 @@
     }
 
 
-    public ServerAttribute<ServerValue<?>> put( String upId, AttributeType attributeType, String val ) throws NamingException
+    public ServerAttribute put( String upId, AttributeType attributeType, String val ) throws NamingException
     {
         if ( attributeType.equals( objectClassAT ) )
         {
@@ -329,14 +256,14 @@
     }
 
 
-    public ServerAttribute<ServerValue<?>> put( AttributeType attributeType, byte[] val ) throws NamingException
+    public ServerAttribute put( AttributeType attributeType, byte[] val ) throws NamingException
     {
         if ( attributeType.equals( objectClassAT ) )
         {
             throw new UnsupportedOperationException( "Only String values supported for objectClass attribute" );
         }
 
-        ServerAttribute<ServerValue<?>> existing = serverAttributeMap.get( attributeType );
+        ServerAttribute existing = serverAttributeMap.get( attributeType );
 
         if ( existing != null )
         {
@@ -349,7 +276,7 @@
     }
 
 
-    public ServerAttribute<ServerValue<?>> put( String upId, AttributeType attributeType, byte[] val ) throws NamingException
+    public ServerAttribute put( String upId, AttributeType attributeType, byte[] val ) throws NamingException
     {
         if ( attributeType.equals( objectClassAT ) )
         {
@@ -360,7 +287,7 @@
     }
 
 
-    public ServerAttribute<ServerValue<?>> remove( AttributeType attributeType ) throws NamingException
+    public ServerAttribute remove( AttributeType attributeType ) throws NamingException
     {
         if ( attributeType.equals( objectClassAT ) )
         {
@@ -402,7 +329,7 @@
     }
 
 
-    public Iterator<ServerAttribute<ServerValue<?>>> iterator()
+    public Iterator<ServerAttribute> iterator()
     {
         return Collections.unmodifiableMap( serverAttributeMap ).values().iterator();
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java Fri Dec 14 16:58:40 2007
@@ -38,7 +38,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ObjectClassAttribute implements ServerAttribute<ServerValue<?>>
+public class ObjectClassAttribute implements ServerAttribute
 {
     /** A logger */
     private static final Logger LOG = LoggerFactory.getLogger( ObjectClassAttribute.class );
@@ -398,7 +398,7 @@
      */
     public boolean add( ServerValue<?> val )
     {
-        return values.add( (ServerValue<?>)val );
+        return values.add( val );
     }
 
 
@@ -450,7 +450,7 @@
     }
 
 
-    public Iterator<ServerValue<?>> getAll()
+    public Iterator<? extends ServerValue<?>> getAll()
     {
         return iterator();
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttribute.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttribute.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttribute.java Fri Dec 14 16:58:40 2007
@@ -26,39 +26,18 @@
 
 
 /**
- * The server specific interface extending the EntryAttribute interface. It adds
- * three more methods which are Server side.
+ * Document me!
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public interface ServerAttribute<T extends ServerValue<?>> extends EntryAttribute<T>, Iterable<ServerValue<?>>
+public interface ServerAttribute extends EntryAttribute<ServerValue<?>>, Iterable<ServerValue<?>>
 {
-    /**
-     * Gets the attribute type associated with this ServerAttribute.
-     *
-     * @return the attributeType associated with this entry attribute
-     */
     AttributeType getType();
 
-    /**
-     * Get's the user provided identifier for this entry.  This is the value
-     * that will be used as the identifier for the attribute within the
-     * entry.  If this is a commonName attribute for example and the user
-     * provides "COMMONname" instead when adding the entry then this is
-     * the format the user will have that entry returned by the directory
-     * server.  To do so we store this value as it was given and track it
-     * in the attribute using this property.
-     *
-     * @return the user provided identifier for this attribute
-     */
+
     String getUpId();
 
-    /**
-     * Checks to see if this attribute is valid along with the values it contains.
-     *
-     * @return true if the attribute and it's values are valid, false otherwise
-     * @throws NamingException if there is a failure to check syntaxes of values
-     */
+
     boolean isValid() throws NamingException;
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerBinaryValue.java Fri Dec 14 16:58:40 2007
@@ -46,6 +46,10 @@
     /** logger for reporting errors that might not be handled properly upstream */
     private static final Logger LOG = LoggerFactory.getLogger( ServerBinaryValue.class );
 
+    /** used to dynamically lookup the attributeType when/if deserializing */
+    @SuppressWarnings ( { "FieldCanBeLocal", "UnusedDeclaration" } )
+    private final String oid;
+
     /** reference to the attributeType which is not serialized */
     private transient AttributeType attributeType;
 
@@ -81,6 +85,7 @@
         }
 
         this.attributeType = attributeType;
+        this.oid = attributeType.getOid();
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java Fri Dec 14 16:58:40 2007
@@ -24,8 +24,6 @@
 import org.apache.directory.shared.ldap.schema.ObjectClass;
 
 import javax.naming.NamingException;
-
-import java.util.List;
 import java.util.Set;
 
 
@@ -35,7 +33,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public interface ServerEntry<T extends ServerAttribute<ServerValue<?>>> extends Entry<T>, Iterable<T>
+public interface ServerEntry extends Entry<ServerAttribute>, Iterable<ServerAttribute>
 {
     // -----------------------------------------------------------------------
     // Schema Related Methods
@@ -184,7 +182,7 @@
      * @param attributeType the type of the attribute
      * @return the attribute of the specified type
      */
-    T get( AttributeType attributeType );
+    ServerAttribute get( AttributeType attributeType );
 
 
     /**
@@ -197,27 +195,13 @@
      * @return the existing attribute of the same type if it exists; otherwise
      * <code>null</code>
      */
-    T put( T attribute ) throws NamingException;
-
-    
-    /**
-     * Places non-null attributes in the attribute collection. If there is
-     * already an attribute with the same OID as any of the new attributes, 
-     * the old ones are removed from the collection and are returned by this 
-     * method. If there was no attribute with the same OID the return value 
-     * is <code>null</code>.
-     *
-     * @param attributes the attributes to be put
-     * @return the old attributes with the same OID, if exist; otherwise
-     *         <code>null</code>
-     */
-    List<T> put( T... attributes ) throws NamingException;
+    ServerAttribute put( ServerAttribute attribute ) throws NamingException;
 
     // no value put'ters
 
-    T put( String upId, AttributeType attributeType ) throws NamingException;
+    ServerAttribute put( String upId, AttributeType attributeType ) throws NamingException;
 
-    T put( AttributeType attributeType ) throws NamingException;
+    ServerAttribute put( AttributeType attributeType ) throws NamingException;
 
 
     /**
@@ -239,7 +223,7 @@
      *         <code>null</code>
      * @throws NamingException if there are resolution issues
      */
-    T put( AttributeType attributeType, ServerValue<?> val ) throws NamingException;
+    ServerAttribute put( AttributeType attributeType, ServerValue<?> val ) throws NamingException;
 
     /**
      * Places a new attribute with the supplied attributeType and value into this
@@ -257,7 +241,7 @@
      *         <code>null</code>
      * @throws NamingException if there are failures
      */
-    T put( String upId, AttributeType attributeType, ServerValue<?> val ) throws NamingException;
+    ServerAttribute put( String upId, AttributeType attributeType, ServerValue<?> val ) throws NamingException;
 
 
     /**
@@ -277,10 +261,10 @@
      *         <code>null</code>
      * @throws NamingException if there are failures
      */
-    T put( AttributeType attributeType, String val ) throws NamingException;
+    ServerAttribute put( AttributeType attributeType, String val ) throws NamingException;
 
 
-    T put( String upId, AttributeType attributeType, String val ) throws NamingException;
+    ServerAttribute put( String upId, AttributeType attributeType, String val ) throws NamingException;
 
 
     /**
@@ -300,10 +284,10 @@
      *         <code>null</code>
      * @throws NamingException if there are failures
      */
-    T put( AttributeType attributeType, byte[] val ) throws NamingException;
+    ServerAttribute put( AttributeType attributeType, byte[] val ) throws NamingException;
 
 
-    T put( String upId, AttributeType attributeType, byte[] val ) throws NamingException;
+    ServerAttribute put( String upId, AttributeType attributeType, byte[] val ) throws NamingException;
 
 
     /**
@@ -315,27 +299,5 @@
      * @return the removed attribute, if exists; otherwise <code>null</code>
      * @throws NamingException if there are failures
      */
-    T remove( AttributeType attributeType ) throws NamingException;
-
-    /**
-     * Places a non-null attribute into this ServerEntry. If there an attribute
-     * of the same exists, the existing one is removed from the set and is
-     * returned by this method. If there was no attribute of the same type the
-     * return value is <code>null</code>.
-     *
-     * @param attribute the attribute to be put into this ServerEntry
-     * @return the existing attribute of the same type if it exists; otherwise
-     * <code>null</code>
-     */
-    T remove( T attribute ) throws NamingException;
-
-    /**
-     * Removes the specified attributes. The removed attributes are
-     * returned by this method. If there were no attribute the return value
-     * is <code>null</code>.
-     *
-     * @param attributes the attributes to be removed
-     * @return the removed attribute, if exists; otherwise <code>null</code>
-     */
-    List<T> remove( T... attributes ) throws NamingException;
+    ServerAttribute remove( AttributeType attributeType ) throws NamingException;
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerModification.java Fri Dec 14 16:58:40 2007
@@ -23,8 +23,10 @@
 
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
 import org.apache.directory.shared.ldap.entry.ModificationOperation;
+import org.apache.directory.shared.ldap.entry.Value;
 
 /**
  * An internal implementation for a ModificationItem. The name has been
@@ -33,7 +35,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class ServerModification<T extends ServerAttribute<?>> implements Modification<T>, Serializable
+public class ServerModification implements Modification, Serializable
 {
     public static final long serialVersionUID = 1L;
     
@@ -41,7 +43,7 @@
     private ModificationOperation operation;
     
     /** The attribute which contains the modification */
-    private T attribute;
+    private EntryAttribute<? extends Value<?>> attribute;
  
     
     /**
@@ -88,7 +90,7 @@
     /**
      * @return the attribute containing the modifications
      */
-    public T getAttribute()
+    public EntryAttribute<? extends Value<?>> getAttribute()
     {
         return attribute;
     }
@@ -99,7 +101,7 @@
      *
      * @param attribute The modified attribute 
      */
-    public void setAttribute( T attribute )
+    public void setAttribute( EntryAttribute<? extends Value<?>> attribute )
     {
         this.attribute = attribute;
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java?rev=604361&r1=604360&r2=604361&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-integ/src/test/java/org/apache/directory/server/core/schema/SchemaServiceIT.java Fri Dec 14 16:58:40 2007
@@ -447,55 +447,6 @@
         assertNull( attrs.get( "objectClasses" ) );
     }
 
-    /**
-     * Test for DIRSERVER-1055.
-     * Check if modifyTimestamp and createTimestamp are present in the search result,
-     * if they are requested.
-     */
-    public void testSearchForSubSchemaSubEntryOperationalAttributesSelected() throws NamingException
-    {
-        SearchControls controls = new SearchControls();
-        controls.setSearchScope( SearchControls.OBJECT_SCOPE );
-        controls.setReturningAttributes( new String[]
-            { "creatorsName", "createTimestamp", "modifiersName", "modifyTimestamp" } );
-        
-        Map<String, Attributes> subSchemaEntry = new HashMap<String, Attributes>();
-        NamingEnumeration<SearchResult> results = getRootContext( service )
-        .search( "cn=schema", "(objectClass=subschema)", controls );
-        
-        while ( results.hasMore() )
-        {
-            SearchResult result = results.next();
-            subSchemaEntry.put( result.getName(), result.getAttributes() );
-        }
-        
-        // We should have only one entry in the result
-        assertEquals( 1, subSchemaEntry.size() );
-        
-        // It should be the normalized form of cn=schema
-        Attributes attrs = subSchemaEntry.get( "2.5.4.3=schema" );
-        
-        assertNotNull( attrs );
-        
-        // We should have 4 attribute in the result :
-        assertEquals( 4, attrs.size() );
-        
-        assertNull( attrs.get( "attributeTypes" ) );
-        assertNull( attrs.get( "cn" ) );
-        assertNotNull( attrs.get( "creatorsName" ) );
-        assertNotNull( attrs.get( "createTimestamp" ) );
-        assertNull( attrs.get( "dITContentRules" ) );
-        assertNull( attrs.get( "dITStructureRules" ) );
-        assertNull( attrs.get( "ldapSyntaxes" ) );
-        assertNull( attrs.get( "matchingRules" ) );
-        assertNull( attrs.get( "matchingRuleUse" ) );
-        assertNotNull( attrs.get( "modifiersName" ) );
-        assertNotNull( attrs.get( "modifyTimestamp" ) );
-        assertNull( attrs.get( "nameForms" ) );
-        assertNull( attrs.get( "objectClass" ) );
-        assertNull( attrs.get( "objectClasses" ) );
-    }
-
     public void testSearchForSubSchemaSubEntryBadFilter() throws NamingException
     {
         SearchControls controls = new SearchControls();

Added: directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java?rev=604361&view=auto
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java (added)
+++ directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java Fri Dec 14 16:58:40 2007
@@ -0,0 +1,53 @@
+/*
+ * 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;
+
+
+/**
+ * Simple class that contains often used Cursor code.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public abstract class AbstractCursor<T> implements Cursor<T>
+{
+    protected static final int BEFORE_FIRST = -1;
+    private boolean closed;
+
+
+    protected void checkClosed( String operation ) throws CursorClosedException
+    {
+        if ( isClosed() )
+        {
+            throw new CursorClosedException( "Attempting " + operation + " operation on a closed Cursor." );
+        }
+    }
+
+
+    public boolean isClosed()
+    {
+        return closed;
+    }
+
+
+    public void close()
+    {
+        closed = true;
+    }
+}

Propchange: directory/sandbox/akarasulu/bigbang/apacheds/core-shared/src/main/java/org/apache/directory/server/core/cursor/AbstractCursor.java
------------------------------------------------------------------------------
    svn:executable = *