directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1308644 - in /directory/apacheds/trunk: core-avl/src/main/java/org/apache/directory/server/core/avltree/ jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/direc...
Date Tue, 03 Apr 2012 01:16:17 GMT
Author: elecharny
Date: Tue Apr  3 01:16:16 2012
New Revision: 1308644

URL: http://svn.apache.org/viewvc?rev=1308644&view=rev
Log:
o Fixed some compilation error
o Added a parameter for indexes to configure them to use the reverse table, or not

Modified:
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java
    directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Index.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
    directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlSingletonOrOrderedSetCursor.java Tue Apr  3 01:16:16 2012
@@ -22,7 +22,7 @@ package org.apache.directory.server.core
 
 import java.util.Comparator;
 
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 
@@ -32,7 +32,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AvlSingletonOrOrderedSetCursor<K, V> extends AbstractTupleCursor<K, SingletonOrOrderedSet<V>>
+public class AvlSingletonOrOrderedSetCursor<K, V> extends AbstractCursor<Tuple<K, SingletonOrOrderedSet<V>>>
 {
     /** The underlying AVL tree map */
     private AvlTreeMap<K, V> tree;

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/AvlTreeMapNoDupsWrapperCursor.java Tue Apr  3 01:16:16 2012
@@ -20,7 +20,7 @@
 package org.apache.directory.server.core.avltree;
 
 
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 
@@ -28,11 +28,11 @@ import org.apache.directory.shared.ldap.
 /**
  * A cursor that converts SingletonOrOrderedSet objects in the value from a
  * AvlTreeMap into Tuples with just K and V presuming that all the keys have
- * no duplicates. 
+ * no duplicates.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AvlTreeMapNoDupsWrapperCursor<K, V> extends AbstractTupleCursor<K, V>
+public class AvlTreeMapNoDupsWrapperCursor<K, V> extends AbstractCursor<Tuple<K, V>>
 {
     private final AvlSingletonOrOrderedSetCursor<K, V> wrapped;
     private final Tuple<K, V> returnedTuple = new Tuple<K, V>();

Modified: directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java (original)
+++ directory/apacheds/trunk/core-avl/src/main/java/org/apache/directory/server/core/avltree/KeyTupleAvlCursor.java Tue Apr  3 01:16:16 2012
@@ -20,7 +20,7 @@ package org.apache.directory.server.core
 
 
 import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 
@@ -32,7 +32,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class KeyTupleAvlCursor<K, V> extends AbstractTupleCursor<K, V>
+public class KeyTupleAvlCursor<K, V> extends AbstractCursor<Tuple<K, V>>
 {
     private final AvlTreeCursor<V> wrapped;
     private final K key;

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java Tue Apr  3 01:16:16 2012
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
@@ -26,7 +26,7 @@ import jdbm.btree.BTree;
 import jdbm.helper.TupleBrowser;
 
 import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 
@@ -39,7 +39,7 @@ import org.apache.directory.shared.ldap.
  * @param K The Key
  * @param V The associated value
  */
-public class DupsContainerCursor<K, V> extends AbstractTupleCursor<K, DupsContainer<V>>
+public class DupsContainerCursor<K, V> extends AbstractCursor<Tuple<K, DupsContainer<V>>>
 {
     /** The JDBM table we are building a cursor over */
     private final JdbmTable<K, V> table;
@@ -135,7 +135,7 @@ public class DupsContainerCursor<K, V> e
         while ( browser.getNext( jdbmTuple ) )
         {
             checkNotClosed( "afterKey()" );
-            K next = ( K ) jdbmTuple.getKey();
+            K next = jdbmTuple.getKey();
 
             int nextCompared = table.getKeyComparator().compare( next, key );
 
@@ -286,7 +286,7 @@ public class DupsContainerCursor<K, V> e
 
         if ( valueAvailable )
         {
-            returnedTuple.setKey( ( K ) jdbmTuple.getKey() );
+            returnedTuple.setKey( jdbmTuple.getKey() );
             returnedTuple.setValue( table.getDupsContainer( ( byte[] ) jdbmTuple.getValue() ) );
         }
         else

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsCursor.java Tue Apr  3 01:16:16 2012
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
@@ -24,7 +24,7 @@ import jdbm.btree.BTree;
 
 import org.apache.directory.server.core.avltree.ArrayTree;
 import org.apache.directory.server.core.avltree.ArrayTreeCursor;
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-class DupsCursor<K, V> extends AbstractTupleCursor<K, V>
+class DupsCursor<K, V> extends AbstractCursor<Tuple<K, V>>
 {
     private static final Logger LOG = LoggerFactory.getLogger( DupsCursor.class.getSimpleName() );
 

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Tue Apr  3 01:16:16 2012
@@ -33,9 +33,11 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.partition.impl.btree.LongComparator;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.AbstractIndex;
+import org.apache.directory.server.xdbm.EmptyIndexCursor;
 import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.cursor.EmptyCursor;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.MatchingRule;
@@ -120,7 +122,7 @@ public class JdbmIndex<K, O> extends Abs
      */
     public JdbmIndex()
     {
-        super();
+        super( true );
         initialized = false;
     }
 
@@ -130,7 +132,17 @@ public class JdbmIndex<K, O> extends Abs
      */
     public JdbmIndex( String attributeId )
     {
-        super( attributeId );
+        super( attributeId, true );
+        initialized = false;
+    }
+
+
+    /**
+     * Creates a JdbmIndex instance for a give AttributeId
+     */
+    public JdbmIndex( String attributeId, boolean withReverse )
+    {
+        super( attributeId, withReverse );
         initialized = false;
     }
 
@@ -225,16 +237,19 @@ public class JdbmIndex<K, O> extends Abs
          * is single valued according to its specification based on a schema
          * then duplicate keys should not be allowed within the reverse table.
          */
-        if ( attributeType.isSingleValued() )
+        if ( withReverse )
         {
-            reverse = new JdbmTable<Long, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, recMan,
-                LongComparator.INSTANCE, LongSerializer.INSTANCE, null );
-        }
-        else
-        {
-            reverse = new JdbmTable<Long, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, numDupLimit,
-                recMan,
-                LongComparator.INSTANCE, comp, LongSerializer.INSTANCE, null );
+            if ( attributeType.isSingleValued() )
+            {
+                reverse = new JdbmTable<Long, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, recMan,
+                    LongComparator.INSTANCE, LongSerializer.INSTANCE, null );
+            }
+            else
+            {
+                reverse = new JdbmTable<Long, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, numDupLimit,
+                    recMan,
+                    LongComparator.INSTANCE, comp, LongSerializer.INSTANCE, null );
+            }
         }
     }
 
@@ -347,7 +362,14 @@ public class JdbmIndex<K, O> extends Abs
      */
     public K reverseLookup( Long id ) throws Exception
     {
-        return reverse.get( id );
+        if ( withReverse )
+        {
+            return reverse.get( id );
+        }
+        else
+        {
+            return null;
+        }
     }
 
 
@@ -362,7 +384,11 @@ public class JdbmIndex<K, O> extends Abs
     {
         // The pair to be removed must exists
         forward.put( attrVal, id );
-        reverse.put( id, attrVal );
+
+        if ( withReverse )
+        {
+            reverse.put( id, attrVal );
+        }
     }
 
 
@@ -375,7 +401,11 @@ public class JdbmIndex<K, O> extends Abs
         if ( forward.has( attrVal, id ) )
         {
             forward.remove( attrVal, id );
-            reverse.remove( id, attrVal );
+
+            if ( withReverse )
+            {
+                reverse.remove( id, attrVal );
+            }
         }
     }
 
@@ -396,7 +426,10 @@ public class JdbmIndex<K, O> extends Abs
         }
 
         // Remove the id -> key from the reverse index
-        reverse.remove( entryId );
+        if ( withReverse )
+        {
+            reverse.remove( entryId );
+        }
     }
 
 
@@ -406,7 +439,14 @@ public class JdbmIndex<K, O> extends Abs
     @SuppressWarnings("unchecked")
     public IndexCursor<K, O, Long> reverseCursor() throws Exception
     {
-        return new IndexCursorAdaptor<K, O, Long>( ( Cursor ) reverse.cursor(), false );
+        if ( withReverse )
+        {
+            return new IndexCursorAdaptor<K, O, Long>( ( Cursor ) reverse.cursor(), false );
+        }
+        else
+        {
+            return new EmptyIndexCursor<K, O, Long>();
+        }
     }
 
 
@@ -420,7 +460,14 @@ public class JdbmIndex<K, O> extends Abs
     @SuppressWarnings("unchecked")
     public IndexCursor<K, O, Long> reverseCursor( Long id ) throws Exception
     {
-        return new IndexCursorAdaptor<K, O, Long>( ( Cursor ) reverse.cursor( id ), false );
+        if ( withReverse )
+        {
+            return new IndexCursorAdaptor<K, O, Long>( ( Cursor ) reverse.cursor( id ), false );
+        }
+        else
+        {
+            return new EmptyIndexCursor<K, O, Long>();
+        }
     }
 
 
@@ -433,7 +480,14 @@ public class JdbmIndex<K, O> extends Abs
 
     public Cursor<K> reverseValueCursor( Long id ) throws Exception
     {
-        return reverse.valueCursor( id );
+        if ( withReverse )
+        {
+            return reverse.valueCursor( id );
+        }
+        else
+        {
+            return new EmptyCursor<K>();
+        }
     }
 
 
@@ -469,7 +523,14 @@ public class JdbmIndex<K, O> extends Abs
      */
     public boolean reverse( Long id ) throws Exception
     {
-        return reverse.has( id );
+        if ( withReverse )
+        {
+            return reverse.has( id );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -523,7 +584,14 @@ public class JdbmIndex<K, O> extends Abs
      */
     public boolean reverseGreaterOrEq( Long id ) throws Exception
     {
-        return reverse.hasGreaterOrEqual( id );
+        if ( withReverse )
+        {
+            return reverse.hasGreaterOrEqual( id );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -532,7 +600,14 @@ public class JdbmIndex<K, O> extends Abs
      */
     public boolean reverseGreaterOrEq( Long id, K attrVal ) throws Exception
     {
-        return reverse.hasGreaterOrEqual( id, attrVal );
+        if ( withReverse )
+        {
+            return reverse.hasGreaterOrEqual( id, attrVal );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -541,7 +616,14 @@ public class JdbmIndex<K, O> extends Abs
      */
     public boolean reverseLessOrEq( Long id ) throws Exception
     {
-        return reverse.hasLessOrEqual( id );
+        if ( withReverse )
+        {
+            return reverse.hasLessOrEqual( id );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -550,7 +632,14 @@ public class JdbmIndex<K, O> extends Abs
      */
     public boolean reverseLessOrEq( Long id, K attrVal ) throws Exception
     {
-        return reverse.hasLessOrEqual( id, attrVal );
+        if ( withReverse )
+        {
+            return reverse.hasLessOrEqual( id, attrVal );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -591,7 +680,14 @@ public class JdbmIndex<K, O> extends Abs
      */
     public boolean isDupsEnabled()
     {
-        return reverse.isDupsEnabled();
+        if ( withReverse )
+        {
+            return reverse.isDupsEnabled();
+        }
+        else
+        {
+            return false;
+        }
     }
 
 

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Tue Apr  3 01:16:16 2012
@@ -358,7 +358,7 @@ public class JdbmPartition extends Abstr
         {
             LOG.debug( "Supplied index {} is not a JdbmIndex.  "
                 + "Will create new JdbmIndex using copied configuration parameters.", index );
-            jdbmIndex = new JdbmIndex( index.getAttributeId() );
+            jdbmIndex = new JdbmIndex( index.getAttributeId(), true );
             jdbmIndex.setCacheSize( index.getCacheSize() );
             jdbmIndex.setNumDupLimit( JdbmIndex.DEFAULT_DUPLICATE_LIMIT );
             jdbmIndex.setWkDirPath( index.getWkDirPath() );
@@ -413,7 +413,7 @@ public class JdbmPartition extends Abstr
     /**
      * {@inheritDoc}
      */
-    protected final Index createSystemIndex( String oid, URI path )  throws Exception
+    protected final Index createSystemIndex( String oid, URI path, boolean withReverse )  throws Exception
     {
         LOG.debug( "Supplied index {} is not a JdbmIndex.  " +
          "Will create new JdbmIndex using copied configuration parameters." );
@@ -427,7 +427,7 @@ public class JdbmPartition extends Abstr
         }
         else
         {
-            jdbmIndex = new JdbmIndex( oid );
+            jdbmIndex = new JdbmIndex( oid, withReverse );
             jdbmIndex.setNumDupLimit( JdbmIndex.DEFAULT_DUPLICATE_LIMIT );
         }
 

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java Tue Apr  3 01:16:16 2012
@@ -55,6 +55,7 @@ public class JdbmRdnIndex<E> extends Jdb
 
     public JdbmRdnIndex()
     {
+        super();
         initialized = false;
     }
 

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleArrayCursor.java Tue Apr  3 01:16:16 2012
@@ -22,7 +22,7 @@ package org.apache.directory.server.core
 import org.apache.directory.server.core.avltree.ArrayTree;
 import org.apache.directory.server.core.avltree.ArrayTreeCursor;
 import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 
@@ -34,7 +34,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class KeyTupleArrayCursor<K, V> extends AbstractTupleCursor<K, V>
+public class KeyTupleArrayCursor<K, V> extends AbstractCursor<Tuple<K, V>>
 {
     private final ArrayTreeCursor<V> wrapped;
     private final K key;

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java Tue Apr  3 01:16:16 2012
@@ -25,7 +25,7 @@ import jdbm.btree.BTree;
 import jdbm.helper.TupleBrowser;
 
 import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 
@@ -37,7 +37,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class KeyTupleBTreeCursor<K, V> extends AbstractTupleCursor<K, V>
+public class KeyTupleBTreeCursor<K, V> extends AbstractCursor<Tuple<K, V>>
 {
     private final Comparator<V> comparator;
     private final BTree btree;

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java (original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java Tue Apr  3 01:16:16 2012
@@ -24,7 +24,7 @@ import java.io.IOException;
 import jdbm.helper.TupleBrowser;
 
 import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 
@@ -37,7 +37,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-class NoDupsCursor<K, V> extends AbstractTupleCursor<K, V>
+class NoDupsCursor<K, V> extends AbstractCursor<Tuple<K, V>>
 {
     private final JdbmTable<K, V> table;
 
@@ -190,7 +190,7 @@ class NoDupsCursor<K, V> extends Abstrac
         if ( browser.getPrevious( jdbmTuple ) )
         {
             if ( returnedTuple.getKey() != null && table.getKeyComparator().compare(
-                ( K ) jdbmTuple.getKey(), ( K ) returnedTuple.getKey() ) == 0 )
+                ( K ) jdbmTuple.getKey(), returnedTuple.getKey() ) == 0 )
             {
                 browser.getPrevious( jdbmTuple );
             }
@@ -211,6 +211,7 @@ class NoDupsCursor<K, V> extends Abstrac
     public boolean next() throws Exception
     {
         checkNotClosed( "previous()" );
+        
         if ( browser == null )
         {
             beforeFirst();
@@ -219,7 +220,7 @@ class NoDupsCursor<K, V> extends Abstrac
         if ( browser.getNext( jdbmTuple ) )
         {
             if ( returnedTuple.getKey() != null && table.getKeyComparator().compare(
-                ( K ) jdbmTuple.getKey(), ( K ) returnedTuple.getKey() ) == 0 )
+                ( K ) jdbmTuple.getKey(), returnedTuple.getKey() ) == 0 )
             {
                 browser.getNext( jdbmTuple );
             }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java Tue Apr  3 01:16:16 2012
@@ -159,7 +159,7 @@ public class AvlPartition extends Abstra
         {
             LOG.debug( "Supplied index {} is not a AvlIndex. "
                 + "Will create new AvlIndex using copied configuration parameters.", index );
-            avlIndex = new AvlIndex( index.getAttributeId() );
+            avlIndex = new AvlIndex( index.getAttributeId(), true );
         }
 
         avlIndex.init( schemaManager, schemaManager.lookupAttributeTypeRegistry( index.getAttributeId() ) );
@@ -171,7 +171,7 @@ public class AvlPartition extends Abstra
     /**
      * {@inheritDoc}
      */
-    protected final Index createSystemIndex( String oid, URI path ) throws Exception
+    protected final Index createSystemIndex( String oid, URI path, boolean withReverse ) throws Exception
     {
         LOG.debug( "Supplied index {} is not a JdbmIndex.  "
             + "Will create new JdbmIndex using copied configuration parameters." );
@@ -186,7 +186,7 @@ public class AvlPartition extends Abstra
         {
             LOG.debug( "Supplied index {} is not a AvlIndex. "
                 + "Will create new AvlIndex using copied configuration parameters." );
-            avlIndex = new AvlIndex( oid );
+            avlIndex = new AvlIndex( oid, withReverse );
         }
 
         return avlIndex;

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java Tue Apr  3 01:16:16 2012
@@ -175,6 +175,8 @@ public abstract class AbstractBTreeParti
     protected AttributeType ENTRY_UUID_AT;
     protected AttributeType ALIASED_OBJECT_NAME_AT;
 
+    private static final boolean NO_REVERSE = Boolean.FALSE;
+    private static final boolean WITH_REVERSE = Boolean.TRUE;
 
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
@@ -285,61 +287,61 @@ public abstract class AbstractBTreeParti
         // add missing system indices
         if ( getPresenceIndex() == null )
         {
-            Index<String, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID, partitionPath );
+            Index<String, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID, partitionPath, NO_REVERSE );
             addIndex( index );
         }
 
         if ( getOneLevelIndex() == null )
         {
-            Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID, partitionPath );
+            Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID, partitionPath, WITH_REVERSE );
             addIndex( index );
         }
 
         if ( getSubLevelIndex() == null )
         {
-            Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID, partitionPath );
+            Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_SUB_LEVEL_AT_OID, partitionPath, WITH_REVERSE );
             addIndex( index );
         }
 
         if ( getRdnIndex() == null )
         {
-            Index<ParentIdAndRdn<ID>, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_RDN_AT_OID, partitionPath );
+            Index<ParentIdAndRdn<ID>, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_RDN_AT_OID, partitionPath, WITH_REVERSE );
             addIndex( index );
         }
 
         if ( getAliasIndex() == null )
         {
-            Index<String, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID, partitionPath );
+            Index<String, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ALIAS_AT_OID, partitionPath, WITH_REVERSE );
             addIndex( index );
         }
 
         if ( getOneAliasIndex() == null )
         {
-            Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID, partitionPath );
+            Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_ONE_ALIAS_AT_OID, partitionPath, WITH_REVERSE );
             addIndex( index );
         }
 
         if ( getSubAliasIndex() == null )
         {
-            Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID, partitionPath );
+            Index<ID, Entry, ID> index = createSystemIndex( ApacheSchemaConstants.APACHE_SUB_ALIAS_AT_OID, partitionPath, WITH_REVERSE );
             addIndex( index );
         }
 
         if ( getObjectClassIndex() == null )
         {
-            Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.OBJECT_CLASS_AT_OID, partitionPath );
+            Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.OBJECT_CLASS_AT_OID, partitionPath, NO_REVERSE );
             addIndex( index );
         }
 
         if ( getEntryUuidIndex() == null )
         {
-            Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID, partitionPath );
+            Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID, partitionPath, WITH_REVERSE );
             addIndex( index );
         }
 
         if ( getEntryCsnIndex() == null )
         {
-            Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.ENTRY_CSN_AT_OID, partitionPath );
+            Index<String, Entry, ID> index = createSystemIndex( SchemaConstants.ENTRY_CSN_AT_OID, partitionPath, NO_REVERSE );
             addIndex( index );
         }
 
@@ -756,8 +758,8 @@ public abstract class AbstractBTreeParti
             rdnIdx.drop( id );
             oneLevelIdx.drop( id );
             subLevelIdx.drop( id );
-            entryCsnIdx.drop( id );
-            entryUuidIdx.drop( id );
+            entryCsnIdx.drop( entry.get( ENTRY_CSN_AT ).getString(), id );
+            entryUuidIdx.drop( entry.get( ENTRY_UUID_AT ).getString(), id );
 
             // Update the user indexes
             for ( Attribute attribute : entry )
@@ -1148,11 +1150,11 @@ public abstract class AbstractBTreeParti
         {
             // if the id exists in the index drop all existing attribute
             // value index entries and add new ones
-            if ( objectClassIdx.reverse( id ) )
+            for ( Value<?> value : entry.get( OBJECT_CLASS_AT ) )
             {
-                objectClassIdx.drop( id );
+                objectClassIdx.drop( value.getString(), id );
             }
-
+            
             for ( Value<?> value : mods )
             {
                 objectClassIdx.add( value.getString(), id );
@@ -1245,7 +1247,10 @@ public abstract class AbstractBTreeParti
              */
             if ( mods.size() == 0 )
             {
-                objectClassIdx.drop( id );
+                for ( Value<?> objectClass : entry.get( OBJECT_CLASS_AT ) )
+                {
+                    objectClassIdx.drop( objectClass.getString(), id );
+                }
             }
             else
             {
@@ -1818,8 +1823,9 @@ public abstract class AbstractBTreeParti
      */
     private void updateCsnIndex( Entry entry, ID id ) throws Exception
     {
-        entryCsnIdx.drop( id );
-        entryCsnIdx.add( entry.get( SchemaConstants.ENTRY_CSN_AT ).getString(), id );
+        String entryCsn = entry.get( SchemaConstants.ENTRY_CSN_AT ).getString();
+        entryCsnIdx.drop( entryCsn, id );
+        entryCsnIdx.add( entryCsn, id );
     }
 
 
@@ -2624,5 +2630,5 @@ public abstract class AbstractBTreeParti
      * @return The created index
      * @throws Exception If the index can't be created
      */
-     protected abstract Index createSystemIndex( String indexOid, URI path ) throws Exception;
+     protected abstract Index createSystemIndex( String indexOid, URI path, boolean withReverse ) throws Exception;
 }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/IndexCursorAdaptor.java Tue Apr  3 01:16:16 2012
@@ -6,22 +6,23 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.core.partition.impl.btree;
 
 
 import java.util.Iterator;
 
+import org.apache.directory.server.xdbm.AbstractIndexCursor;
 import org.apache.directory.server.xdbm.ForwardIndexEntry;
 import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.server.xdbm.IndexEntry;
@@ -31,7 +32,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.cursor.CursorIterator;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
-import org.apache.directory.shared.ldap.model.cursor.TupleCursor;
 
 
 /**
@@ -40,7 +40,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class IndexCursorAdaptor<K, O, ID> implements IndexCursor<K, O, ID>
+public class IndexCursorAdaptor<K, O, ID> extends AbstractIndexCursor<K, O, ID>
 {
     @SuppressWarnings("unchecked")
     final Cursor<Tuple> wrappedCursor;
@@ -83,9 +83,9 @@ public class IndexCursorAdaptor<K, O, ID
     @SuppressWarnings("unchecked")
     public void beforeValue( ID id, K key ) throws Exception
     {
-        if ( wrappedCursor instanceof TupleCursor )
+        if ( wrappedCursor instanceof IndexCursor )
         {
-            ( ( TupleCursor ) wrappedCursor ).beforeValue( key, id );
+            ( ( IndexCursor ) wrappedCursor ).beforeValue( key, id );
         }
     }
 
@@ -93,9 +93,9 @@ public class IndexCursorAdaptor<K, O, ID
     @SuppressWarnings("unchecked")
     public void afterValue( ID id, K key ) throws Exception
     {
-        if ( wrappedCursor instanceof TupleCursor )
+        if ( wrappedCursor instanceof IndexCursor )
         {
-            ( ( TupleCursor ) wrappedCursor ).afterValue( key, id );
+            ( ( IndexCursor ) wrappedCursor ).afterValue( key, id );
         }
     }
 
@@ -234,4 +234,12 @@ public class IndexCursorAdaptor<K, O, ID
         throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
             .concat( "." ).concat( "isLast()" ) ) );
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getUnsupportedMessage()
+    {
+        return UNSUPPORTED_MSG;
+    }
 }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndex.java Tue Apr  3 01:16:16 2012
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.xdbm;
 
@@ -44,6 +44,8 @@ public abstract class AbstractIndex<K, O
     /** whether or not this index has been initialized */
     protected boolean initialized;
 
+    /** Tells if this index has a Reverse table */
+    protected boolean withReverse;
 
     /**
      * Creates a new instance of AbstractIndex.
@@ -52,6 +54,18 @@ public abstract class AbstractIndex<K, O
      */
     protected AbstractIndex()
     {
+        this.withReverse = true;
+    }
+
+    
+    /**
+     * Creates a new instance of AbstractIndex.
+     * 
+     * @param attributeId the attribute ID
+     */
+    protected AbstractIndex( boolean withReverse )
+    {
+        this.withReverse = withReverse;
     }
 
 
@@ -60,9 +74,10 @@ public abstract class AbstractIndex<K, O
      * 
      * @param attributeId the attribute ID
      */
-    protected AbstractIndex( String attributeId )
+    protected AbstractIndex( String attributeId, boolean withReverse )
     {
         this.attributeId = attributeId;
+        this.withReverse = withReverse;
     }
 
 
@@ -132,4 +147,13 @@ public abstract class AbstractIndex<K, O
             throw new IllegalStateException( I18n.err( I18n.ERR_575, property ) );
         }
     }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasReverse()
+    {
+        return withReverse;
+    }
 }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractIndexCursor.java Tue Apr  3 01:16:16 2012
@@ -102,53 +102,4 @@ public abstract class AbstractIndexCurso
     {
         return this.available = available;
     }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public Iterator<IndexEntry<V, ID>> iterator()
-    {
-        return new CursorIterator<IndexEntry<V, ID>>( this );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isAfterLast() throws Exception
-    {
-        throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
-            .concat( "." ).concat( "isAfterLast()" ) ) );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isBeforeFirst() throws Exception
-    {
-        throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
-            .concat( "." ).concat( "isBeforeFirst()" ) ) );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isFirst() throws Exception
-    {
-        throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
-            .concat( "." ).concat( "isFirst()" ) ) );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isLast() throws Exception
-    {
-        throw new UnsupportedOperationException( I18n.err( I18n.ERR_02014_UNSUPPORTED_OPERATION, getClass().getName()
-            .concat( "." ).concat( "isLast()" ) ) );
-    }
 }
\ No newline at end of file

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Index.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Index.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Index.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/Index.java Tue Apr  3 01:16:16 2012
@@ -261,4 +261,11 @@ public interface Index<K, O, ID>
      * @return true if duplicate keys are allowed false otherwise
      */
     boolean isDupsEnabled();
+    
+    
+    /**
+     * Tells if the index has a reverse table or not
+     * @return true if the index has a reverse table
+     */
+    boolean hasReverse();
 }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlIndex.java Tue Apr  3 01:16:16 2012
@@ -26,8 +26,10 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.partition.impl.btree.LongComparator;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.AbstractIndex;
+import org.apache.directory.server.xdbm.EmptyIndexCursor;
 import org.apache.directory.server.xdbm.IndexCursor;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
+import org.apache.directory.shared.ldap.model.cursor.EmptyCursor;
 import org.apache.directory.shared.ldap.model.cursor.Tuple;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.LdapComparator;
@@ -50,13 +52,19 @@ public class AvlIndex<K, O> extends Abst
 
     public AvlIndex()
     {
-        super();
+        super( true );
     }
 
 
     public AvlIndex( String attributeId )
     {
-        super( attributeId );
+        super( attributeId, true );
+    }
+
+
+    public AvlIndex( String attributeId, boolean withReverse )
+    {
+        super( attributeId, withReverse );
     }
 
 
@@ -98,13 +106,16 @@ public class AvlIndex<K, O> extends Abst
          * is single valued according to its specification based on a schema
          * then duplicate keys should not be allowed within the reverse table.
          */
-        if ( attributeType.isSingleValued() )
+        if ( withReverse )
         {
-            reverse = new AvlTable<Long, K>( attributeType.getName(), LongComparator.INSTANCE, comp, false );
-        }
-        else
-        {
-            reverse = new AvlTable<Long, K>( attributeType.getName(), LongComparator.INSTANCE, comp, true );
+            if ( attributeType.isSingleValued() )
+            {
+                reverse = new AvlTable<Long, K>( attributeType.getName(), LongComparator.INSTANCE, comp, false );
+            }
+            else
+            {
+                reverse = new AvlTable<Long, K>( attributeType.getName(), LongComparator.INSTANCE, comp, true );
+            }
         }
     }
 
@@ -112,7 +123,11 @@ public class AvlIndex<K, O> extends Abst
     public void add( K attrVal, Long id ) throws Exception
     {
         forward.put( attrVal, id );
-        reverse.put( id, attrVal );
+        
+        if ( withReverse )
+        {
+            reverse.put( id, attrVal );
+        }
     }
 
 
@@ -156,15 +171,18 @@ public class AvlIndex<K, O> extends Abst
      */
     public void drop( Long id ) throws Exception
     {
-        Cursor<Tuple<Long, K>> cursor = reverse.cursor( id );
-
-        while ( cursor.next() )
+        if ( withReverse )
         {
-            Tuple<Long, K> tuple = cursor.get();
-            forward.remove( tuple.getValue(), id );
+            Cursor<Tuple<Long, K>> cursor = reverse.cursor( id );
+    
+            while ( cursor.next() )
+            {
+                Tuple<Long, K> tuple = cursor.get();
+                forward.remove( tuple.getValue(), id );
+            }
+    
+            reverse.remove( id );
         }
-
-        reverse.remove( id );
     }
 
 
@@ -174,7 +192,11 @@ public class AvlIndex<K, O> extends Abst
     public void drop( K attrVal, Long id ) throws Exception
     {
         forward.remove( attrVal, id );
-        reverse.remove( id, attrVal );
+        
+        if ( withReverse )
+        {
+            reverse.remove( id, attrVal );
+        }
     }
 
 
@@ -293,7 +315,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public boolean reverse( Long id ) throws Exception
     {
-        return reverse.has( id );
+        if ( withReverse )
+        {
+            return reverse.has( id );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -302,7 +331,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public boolean reverse( Long id, K attrVal ) throws Exception
     {
-        return reverse.has( id, attrVal );
+        if ( withReverse )
+        {
+            return reverse.has( id, attrVal );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -312,7 +348,14 @@ public class AvlIndex<K, O> extends Abst
     @SuppressWarnings("unchecked")
     public IndexCursor<K, O, Long> reverseCursor() throws Exception
     {
-        return new IndexCursorAdaptor( reverse.cursor(), false );
+        if ( withReverse )
+        {
+            return new IndexCursorAdaptor( reverse.cursor(), false );
+        }
+        else
+        {
+            return new EmptyIndexCursor<K, O, Long>();
+        }
     }
 
 
@@ -322,7 +365,14 @@ public class AvlIndex<K, O> extends Abst
     @SuppressWarnings("unchecked")
     public IndexCursor<K, O, Long> reverseCursor( Long id ) throws Exception
     {
-        return new IndexCursorAdaptor( reverse.cursor( id ), false );
+        if ( withReverse )
+        {
+            return new IndexCursorAdaptor( reverse.cursor( id ), false );
+        }
+        else
+        {
+            return new EmptyIndexCursor<K, O, Long>();
+        }
     }
 
 
@@ -331,7 +381,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public boolean reverseGreaterOrEq( Long id ) throws Exception
     {
-        return reverse.hasGreaterOrEqual( id );
+        if ( withReverse )
+        {
+            return reverse.hasGreaterOrEqual( id );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -340,7 +397,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public boolean reverseGreaterOrEq( Long id, K attrVal ) throws Exception
     {
-        return reverse.hasGreaterOrEqual( id, attrVal );
+        if ( withReverse )
+        {
+            return reverse.hasGreaterOrEqual( id, attrVal );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -349,7 +413,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public boolean reverseLessOrEq( Long id ) throws Exception
     {
-        return reverse.hasLessOrEqual( id );
+        if ( withReverse )
+        {
+            return reverse.hasLessOrEqual( id );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -358,7 +429,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public boolean reverseLessOrEq( Long id, K attrVal ) throws Exception
     {
-        return reverse.hasLessOrEqual( id, attrVal );
+        if ( withReverse )
+        {
+            return reverse.hasLessOrEqual( id, attrVal );
+        }
+        else
+        {
+            return false;
+        }
     }
 
 
@@ -367,7 +445,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public K reverseLookup( Long id ) throws Exception
     {
-        return reverse.get( id );
+        if ( withReverse )
+        {
+            return reverse.get( id );
+        }
+        else
+        {
+            return null;
+        }
     }
 
 
@@ -376,7 +461,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public Cursor<K> reverseValueCursor( Long id ) throws Exception
     {
-        return reverse.valueCursor( id );
+        if ( withReverse )
+        {
+            return reverse.valueCursor( id );
+        }
+        else
+        {
+            return new EmptyCursor<K>();
+        }
     }
 
 
@@ -403,7 +495,14 @@ public class AvlIndex<K, O> extends Abst
      */
     public boolean isDupsEnabled()
     {
-        return reverse.isDupsEnabled();
+        if ( withReverse )
+        {
+            return reverse.isDupsEnabled();
+        }
+        else
+        {
+            return false;
+        }
     }
 
 

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlRdnIndex.java Tue Apr  3 01:16:16 2012
@@ -40,12 +40,13 @@ public class AvlRdnIndex<E> extends AvlI
 
     public AvlRdnIndex()
     {
+        super();
     }
 
 
     public AvlRdnIndex( String attributeId )
     {
-        super( attributeId );
+        super( attributeId, true );
     }
 
 
@@ -77,7 +78,7 @@ public class AvlRdnIndex<E> extends AvlI
         LongComparator.INSTANCE.setSchemaManager( schemaManager );
 
         /*
-         * The forward key/value map stores attribute values to master table 
+         * The forward key/value map stores attribute values to master table
          * primary keys.  A value for an attribute can occur several times in
          * different entries so the forward map can have more than one value.
          */

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java Tue Apr  3 01:16:16 2012
@@ -24,7 +24,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.avltree.AvlTree;
 import org.apache.directory.server.core.avltree.AvlTreeCursor;
 import org.apache.directory.server.core.avltree.SingletonOrOrderedSet;
-import org.apache.directory.shared.ldap.model.cursor.AbstractTupleCursor;
+import org.apache.directory.shared.ldap.model.cursor.AbstractCursor;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.cursor.SingletonCursor;
@@ -35,12 +35,12 @@ import org.slf4j.LoggerFactory;
 
 /**
  * A Cursor which walks and advance over AvlTables that may contain duplicate
- * keys with values stored in an AvlTree.  All duplicate keys are traversed 
+ * keys with values stored in an AvlTree.  All duplicate keys are traversed
  * returning the key and the value in a Tuple.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AvlTableDupsCursor<K, V> extends AbstractTupleCursor<K, V>
+public class AvlTableDupsCursor<K, V> extends AbstractCursor<Tuple<K, V>>
 {
     private static final Logger LOG = LoggerFactory.getLogger( AvlTableDupsCursor.class.getSimpleName() );
 
@@ -136,10 +136,10 @@ public class AvlTableDupsCursor<K, V> ex
                 return;
             }
 
-            /* 
-             * The cursor over the values is only advanced if we're on the 
+            /*
+             * The cursor over the values is only advanced if we're on the
              * same key as the primary cursor.  This is because we want this
-             * method to really position us within a set of duplicate key 
+             * method to really position us within a set of duplicate key
              * entries at the proper value.
              */
             if ( table.getKeyComparator().compare( wrappedTuple.getKey(), key ) == 0 )
@@ -427,7 +427,7 @@ public class AvlTableDupsCursor<K, V> ex
 
         /*
          * If we get to this point then cursor has more elements and
-         * wrappedTuple holds the Tuple containing the key and the 
+         * wrappedTuple holds the Tuple containing the key and the
          * AvlTree of values for that key which the Cursor traverses.  All we
          * need to do is populate our tuple object with the key and the value
          * in the cursor.

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Tue Apr  3 01:16:16 2012
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.xdbm.search.impl;
 
@@ -96,7 +96,7 @@ public class DefaultSearchEngine<ID exte
 
 
     /**
-     * @see SearchEngine#cursor(org.apache.directory.shared.ldap.model.name.Dn, org.apache.directory.shared.ldap.model.message.AliasDerefMode, ExprNode, SearchControls)
+     * {@inheritDoc}
      */
     public IndexCursor<ID, Entry, ID> cursor( Dn base, AliasDerefMode aliasDerefMode, ExprNode filter,
         SearchControls searchCtls ) throws Exception
@@ -134,7 +134,6 @@ public class DefaultSearchEngine<ID exte
         {
             effectiveBase = base;
         }
-
         /*
          * If the base is an alias and alias dereferencing does occur on
          * finding the base then we set the effective base to the alias target
@@ -152,6 +151,7 @@ public class DefaultSearchEngine<ID exte
         if ( searchCtls.getSearchScope() == SearchControls.OBJECT_SCOPE )
         {
             ID effectiveBaseId = baseId;
+            
             if ( effectiveBase != base )
             {
                 effectiveBaseId = db.getEntryId( effectiveBase );

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java Tue Apr  3 01:16:16 2012
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.xdbm.search.impl;
 
@@ -116,7 +116,7 @@ public class SubstringCursor<ID extends 
         checkNotClosed( "afterLast()" );
 
         // to keep the cursor always *after* the last matched tuple
-        // This fixes an issue if the last matched tuple is also the last record present in the 
+        // This fixes an issue if the last matched tuple is also the last record present in the
         // index. In this case the wrapped cursor is positioning on the last tuple instead of positioning after that
         wrapped.afterLast();
         clear();
@@ -185,6 +185,7 @@ public class SubstringCursor<ID extends 
                 this.indexEntry.setId( entry.getId() );
                 this.indexEntry.setValue( entry.getValue() );
                 this.indexEntry.setEntry( entry.getEntry() );
+                
                 return true;
             }
         }

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java Tue Apr  3 01:16:16 2012
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.xdbm.search.impl;
 
@@ -127,8 +127,7 @@ public class SubstringEvaluator<ID exten
     @SuppressWarnings("unchecked")
     public boolean evaluate( IndexEntry<?, ID> indexEntry ) throws Exception
     {
-
-        if ( idx == null )
+        if ( ( idx == null ) || ( !idx.hasReverse() ) )
         {
             return evaluateWithoutIndex( ( IndexEntry<String, ID> ) indexEntry );
         }
@@ -196,7 +195,7 @@ public class SubstringEvaluator<ID exten
             IndexEntry<String, ID> rec = entries.get();
 
             // once match is found cleanup and return true
-            if ( regex.matcher( ( String ) rec.getValue() ).matches() )
+            if ( regex.matcher( rec.getValue() ).matches() )
             {
                 entries.close();
                 return true;
@@ -232,7 +231,7 @@ public class SubstringEvaluator<ID exten
             IndexEntry<String, ID> rec = entries.get();
 
             // once match is found cleanup and return true
-            if ( regex.matcher( ( String ) rec.getValue() ).matches() )
+            if ( regex.matcher( rec.getValue() ).matches() )
             {
                 entries.close();
                 return true;

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java Tue Apr  3 01:16:16 2012
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.server.xdbm;
 
@@ -307,8 +307,8 @@ public class PartitionTest
     {
         Dn dn = new Dn( schemaManager, "cn=JOhnny WAlkeR,ou=Sales,o=Good Times Co." );
 
-        Attribute attrib = new DefaultAttribute( SchemaConstants.OBJECT_CLASS_AT, schemaManager
-            .lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT ) );
+        Attribute attrib = new DefaultAttribute( "ObjectClass", schemaManager
+            .lookupAttributeTypeRegistry( "ObjectClass" ) );
 
         Modification add = new DefaultModification( ModificationOperation.REMOVE_ATTRIBUTE, attrib );
 
@@ -316,14 +316,12 @@ public class PartitionTest
         Entry lookedup = partition.lookup( entryId );
 
         // before modification: expect "person" tuple in objectClass index
-        assertTrue( partition.getObjectClassIndex().reverse( entryId ) );
         assertTrue( partition.getObjectClassIndex().forward( "person", entryId ) );
         assertTrue( lookedup.get( "objectClass" ).contains( "person" ) );
 
         lookedup = partition.modify( dn, add );
 
         // after modification: no tuple in objectClass index
-        assertFalse( partition.getObjectClassIndex().reverse( entryId ) );
         assertFalse( partition.getObjectClassIndex().forward( "person", entryId ) );
         assertNull( lookedup.get( "objectClass" ) );
     }
@@ -347,13 +345,11 @@ public class PartitionTest
         Entry lookedup = partition.lookup( entryId );
 
         assertNotSame( csn, lookedup.get( csnAt ).getString() );
-        assertNotSame( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
 
         lookedup = partition.modify( dn, add );
 
         String updateCsn = lookedup.get( csnAt ).getString();
         assertEquals( csn, updateCsn );
-        assertEquals( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
 
         csn = csnF.newInstance().toString();
 
@@ -361,13 +357,11 @@ public class PartitionTest
         modEntry.add( csnAt, csn );
 
         assertNotSame( csn, updateCsn );
-        assertNotSame( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
 
         lookedup = partition
             .modify( dn, new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE, csnAt, csn ) );
 
         assertEquals( csn, lookedup.get( csnAt ).getString() );
-        assertEquals( csn, partition.getEntryCsnIndex().reverseLookup( entryId ) );
     }
 
 

Modified: directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java?rev=1308644&r1=1308643&r2=1308644&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java Tue Apr  3 01:16:16 2012
@@ -414,12 +414,15 @@ public class AvlPartitionTest
     {
         assertEquals( 3, partition.getChildCount( 1L ) );
 
-        Cursor<IndexEntry<Long, Long>> cursor = partition.list( 1L );
+        Cursor<IndexEntry<Long, Long>> cursor = partition.list( 2L );
         assertNotNull( cursor );
         cursor.beforeFirst();
         assertTrue( cursor.next() );
-        assertEquals( 2L, ( long ) cursor.get().getId() );
+        assertEquals( 5L, ( long ) cursor.get().getId() );
         assertTrue( cursor.next() );
+        assertEquals( 6L, ( long ) cursor.get().getId() );
+        assertFalse( cursor.next() );
+        
         assertEquals( 3, partition.getChildCount( 1L ) );
 
         partition.delete( 2L );



Mime
View raw message