You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2011/07/04 17:39:33 UTC

svn commit: r1142720 - in /directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm: AbstractIndex.java AbstractStore.java

Author: elecharny
Date: Mon Jul  4 15:39:33 2011
New Revision: 1142720

URL: http://svn.apache.org/viewvc?rev=1142720&view=rev
Log:
o Fixed the isDupsEnbled() method
o Improved the getSuffixId() method

Modified:
    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/AbstractStore.java

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=1142720&r1=1142719&r2=1142720&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 Mon Jul  4 15:39:33 2011
@@ -92,7 +92,7 @@ public abstract class AbstractIndex<K, O
      */
     public boolean isDupsEnabled()
     {
-        return false;
+        return !attributeType.isSingleValued();
     }
     
     

Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1142720&r1=1142719&r2=1142720&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java (original)
+++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java Mon Jul  4 15:39:33 2011
@@ -401,7 +401,9 @@ public abstract class AbstractStore<E, I
     protected ID getSuffixId() throws Exception
     {
         // TODO: optimize
-        return getEntryId( getSuffixDn() );
+        ParentIdAndRdn<ID> key = new ParentIdAndRdn<ID>( getRootId(), suffixDn.getRdns() );
+        
+        return rdnIdx.forwardLookup( key );
     }
 
 
@@ -763,20 +765,22 @@ public abstract class AbstractStore<E, I
         int dnSize = dn.size();
         int i = suffixDn.size();
 
-        ParentIdAndRdn<ID> key = new ParentIdAndRdn<ID>( getRootId(), suffixDn.getRdns() );
+        ParentIdAndRdn<ID> currentRdn = new ParentIdAndRdn<ID>( getRootId(), suffixDn.getRdns() );
 
         // Check into the Rdn index
-        ID curEntryId = rdnIdx.forwardLookup( key );
+        ID curEntryId = rdnIdx.forwardLookup( currentRdn );
 
-        for ( ; i < dnSize; i++ )
+        while ( i < dnSize )
         {
-            key = new ParentIdAndRdn<ID>( curEntryId, dn.getRdn( dnSize - 1 - i ) );
-            curEntryId = rdnIdx.forwardLookup( key );
+            currentRdn = new ParentIdAndRdn<ID>( curEntryId, dn.getRdn( dnSize - 1 - i ) );
+            curEntryId = rdnIdx.forwardLookup( currentRdn );
 
             if ( curEntryId == null )
             {
                 break;
             }
+            
+            i++;
         }
 
         return curEntryId;