directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1378577 [1/2] - in /directory/apacheds/branches/apacheds-mvbt: core-annotations/src/main/java/org/apache/directory/server/core/factory/ core-api/src/main/java/org/apache/directory/server/core/api/ core-api/src/main/java/org/apache/director...
Date Wed, 29 Aug 2012 14:26:00 GMT
Author: elecharny
Date: Wed Aug 29 14:25:58 2012
New Revision: 1378577

URL: http://svn.apache.org/viewvc?rev=1378577&view=rev
Log:
o Using UUID instead of Long
o Removed the call to the SnapshoRecordManager, as it makes the client to block
o Added some lock to protect the write operation from being conducted concurrently

Added:
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/UuidSerializer.java
Modified:
    directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
    directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
    directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
    directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
    directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
    directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/Partition.java
    directory/apacheds/branches/apacheds-mvbt/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java
    directory/apacheds/branches/apacheds-mvbt/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
    directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
    directory/apacheds/branches/apacheds-mvbt/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndexTest.java
    directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStoreTest.java

Modified: directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java Wed Aug 29 14:25:58 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 import java.io.File;
 import java.util.Set;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.avl.AvlPartition;
@@ -67,7 +68,7 @@ public class AvlPartitionFactory impleme
         }
 
         AvlPartition avlPartition = ( AvlPartition ) partition;
-        Set<Index<?, Entry, Long>> indexedAttributes = avlPartition.getIndexedAttributes();
+        Set<Index<?, Entry, UUID>> indexedAttributes = avlPartition.getIndexedAttributes();
 
         AvlIndex<Object, Entry> index = new AvlIndex<Object, Entry>( attributeId, false );
         //index.setCacheSize( cacheSize );

Modified: directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java Wed Aug 29 14:25:58 2012
@@ -171,9 +171,9 @@ public class DSAnnotationProcessor
                 partition.setId( createPartition.name() );
                 partition.setSuffixDn( new Dn( service.getSchemaManager(), createPartition.suffix() ) );
 
-                if ( partition instanceof AbstractBTreePartition<?> )
+                if ( partition instanceof AbstractBTreePartition )
                 {
-                    AbstractBTreePartition<?> btreePartition = ( AbstractBTreePartition<?> ) partition;
+                    AbstractBTreePartition btreePartition = ( AbstractBTreePartition ) partition;
                     btreePartition.setCacheSize( createPartition.cacheSize() );
                     btreePartition.setPartitionPath( new File( service
                         .getInstanceLayout().getPartitionsDirectory(),

Modified: directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java Wed Aug 29 14:25:58 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 import java.io.File;
 import java.util.Set;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
@@ -67,7 +68,7 @@ public class JdbmPartitionFactory implem
         }
 
         JdbmPartition jdbmPartition = ( JdbmPartition ) partition;
-        Set<Index<?, Entry, Long>> indexedAttributes = jdbmPartition.getIndexedAttributes();
+        Set<Index<?, Entry, UUID>> indexedAttributes = jdbmPartition.getIndexedAttributes();
 
         JdbmIndex<Object, Entry> index = new JdbmIndex<Object, Entry>( attributeId, false );
         index.setCacheSize( cacheSize );

Modified: directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java Wed Aug 29 14:25:58 2012
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 import java.io.File;
 import java.util.Set;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.partition.ldif.LdifPartition;
@@ -67,7 +68,7 @@ public class LdifPartitionFactory implem
         }
 
         LdifPartition ldifPartition = ( LdifPartition ) partition;
-        Set<Index<?, Entry, Long>> indexedAttributes = ldifPartition.getIndexedAttributes();
+        Set<Index<?, Entry, UUID>> indexedAttributes = ldifPartition.getIndexedAttributes();
 
         AvlIndex<Object, Entry> index = new AvlIndex<Object, Entry>( attributeId, false );
         //index.setCacheSize( cacheSize );

Modified: directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java Wed Aug 29 14:25:58 2012
@@ -26,6 +26,7 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+
 import org.apache.directory.ldap.client.api.AbstractLdapConnection;
 import org.apache.directory.ldap.client.api.EntryCursorImpl;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
@@ -382,7 +383,15 @@ public class LdapCoreSessionConnection e
 
         DeleteResponse deleteResponse = delete( deleteRequest );
 
-        processResponse( deleteResponse );
+        try
+        {
+            processResponse( deleteResponse );
+        }
+        catch ( LdapException e )
+        {
+            System.out.println( "Cannot delete " + dn );
+            throw e;
+        }
     }
 
 

Modified: directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/Partition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/Partition.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/Partition.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-api/src/main/java/org/apache/directory/server/core/api/partition/Partition.java Wed Aug 29 14:25:58 2012
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.entry.ServerSearchResult;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
@@ -52,6 +53,13 @@ import org.apache.directory.shared.ldap.
  */
 public interface Partition
 {
+    /** root ID common to all partitions */
+    UUID ROOT_ID = new UUID( 0L, 0L );
+
+    /** Default id used for context entry if context entry doesn't exists */
+    UUID DEFAULT_ID = new UUID( 0L, 1L );
+
+
     // -----------------------------------------------------------------------
     // C O N F I G U R A T I O N   M E T H O D S
     // -----------------------------------------------------------------------

Modified: directory/apacheds/branches/apacheds-mvbt/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-avl/src/main/java/org/apache/directory/server/core/avltree/ArrayMarshaller.java Wed Aug 29 14:25:58 2012
@@ -115,6 +115,7 @@ public class ArrayMarshaller<E> implemen
             data = byteStream.toByteArray();
 
             // Try to deserialize, just to see
+            /*
             try
             {
                 deserialize( data );
@@ -124,6 +125,7 @@ public class ArrayMarshaller<E> implemen
                 System.out.println( I18n.err( I18n.ERR_438, Strings.dumpBytes( data ) ) );
                 throw npe;
             }
+            */
 
             out.close();
         }

Modified: directory/apacheds/branches/apacheds-mvbt/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-integ/src/test/java/org/apache/directory/server/core/authz/SearchAuthorizationIT.java Wed Aug 29 14:25:58 2012
@@ -190,11 +190,12 @@ public class SearchAuthorizationIT exten
         {
             Entry entry = entries.get();
             Dn childRdn = entry.getDn();
+
             recursivelyDelete( childRdn );
         }
 
         entries.close();
-        
+
         reusableAdminCon.delete( rdn );
     }
 
@@ -319,7 +320,7 @@ public class SearchAuthorizationIT exten
             results.put( result.getDn().getName(), result );
             counter++;
         }
-        
+
         cursor.close();
 
         recursivelyDelete( base );
@@ -340,7 +341,7 @@ public class SearchAuthorizationIT exten
     {
         LdapConnection connection = getAdminConnection();
         Dn base = addSearchData( new Dn( "ou=system" ), 3, 10 );
-        
+
         EntryCursor entries = connection.search( base.getName(), "(objectClass=*)", SearchScope.SUBTREE,
             "+" );
         int counter = 0;
@@ -350,7 +351,7 @@ public class SearchAuthorizationIT exten
             entries.get();
             counter++;
         }
-        
+
         entries.close();
 
         assertEquals( 10, counter );

Modified: directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/core-shared/src/main/java/org/apache/directory/server/core/shared/partition/DefaultPartitionNexus.java Wed Aug 29 14:25:58 2012
@@ -31,6 +31,8 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 import java.util.UUID;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import javax.naming.ConfigurationException;
 
@@ -141,6 +143,9 @@ public class DefaultPartitionNexus exten
     /** The cn=schema Dn */
     private Dn subschemSubentryDn;
 
+    /** A lock used to protect against concurrent operations */
+    private ReadWriteLock rwLock = new ReentrantReadWriteLock( true );
+
 
     /**
      * Creates the root nexus singleton of the entire system.  The root DSE has
@@ -446,8 +451,17 @@ public class DefaultPartitionNexus exten
      */
     public void add( AddOperationContext addContext ) throws LdapException
     {
-        Partition partition = getPartition( addContext.getDn() );
-        partition.add( addContext );
+        try
+        {
+            rwLock.writeLock().lock();
+
+            Partition partition = getPartition( addContext.getDn() );
+            partition.add( addContext );
+        }
+        finally
+        {
+            rwLock.writeLock().unlock();
+        }
 
         Attribute at = addContext.getEntry().get( SchemaConstants.ENTRY_CSN_AT );
         directoryService.setContextCsn( at.getString() );
@@ -502,8 +516,17 @@ public class DefaultPartitionNexus exten
      */
     public void delete( DeleteOperationContext deleteContext ) throws LdapException
     {
-        Partition partition = getPartition( deleteContext.getDn() );
-        partition.delete( deleteContext );
+        try
+        {
+            rwLock.writeLock().lock();
+
+            Partition partition = getPartition( deleteContext.getDn() );
+            partition.delete( deleteContext );
+        }
+        finally
+        {
+            rwLock.writeLock().unlock();
+        }
     }
 
 
@@ -524,9 +547,18 @@ public class DefaultPartitionNexus exten
             return true;
         }
 
-        Partition partition = getPartition( dn );
+        try
+        {
+            rwLock.readLock().lock();
+
+            Partition partition = getPartition( dn );
 
-        return partition.hasEntry( hasEntryContext );
+            return partition.hasEntry( hasEntryContext );
+        }
+        finally
+        {
+            rwLock.readLock().unlock();
+        }
     }
 
 
@@ -535,9 +567,18 @@ public class DefaultPartitionNexus exten
      */
     public EntryFilteringCursor list( ListOperationContext listContext ) throws LdapException
     {
-        Partition partition = getPartition( listContext.getDn() );
+        try
+        {
+            rwLock.readLock().lock();
 
-        return partition.list( listContext );
+            Partition partition = getPartition( listContext.getDn() );
+
+            return partition.list( listContext );
+        }
+        finally
+        {
+            rwLock.readLock().unlock();
+        }
     }
 
 
@@ -561,18 +602,27 @@ public class DefaultPartitionNexus exten
             return retval;
         }
 
-        Partition partition = getPartition( dn );
-        Entry entry = partition.lookup( lookupContext );
-
-        if ( entry == null )
+        try
         {
-            LdapNoSuchObjectException e = new LdapNoSuchObjectException( "Attempt to lookup non-existant entry: "
-                + dn.getName() );
+            rwLock.readLock().lock();
 
-            throw e;
-        }
+            Partition partition = getPartition( dn );
+            Entry entry = partition.lookup( lookupContext );
+
+            if ( entry == null )
+            {
+                LdapNoSuchObjectException e = new LdapNoSuchObjectException( "Attempt to lookup non-existant entry: "
+                    + dn.getName() );
+
+                throw e;
+            }
 
-        return entry;
+            return entry;
+        }
+        finally
+        {
+            rwLock.readLock().unlock();
+        }
     }
 
 
@@ -587,9 +637,18 @@ public class DefaultPartitionNexus exten
             return;
         }
 
-        Partition partition = getPartition( modifyContext.getDn() );
+        try
+        {
+            rwLock.writeLock().lock();
 
-        partition.modify( modifyContext );
+            Partition partition = getPartition( modifyContext.getDn() );
+
+            partition.modify( modifyContext );
+        }
+        finally
+        {
+            rwLock.writeLock().unlock();
+        }
 
         Entry alteredEntry = modifyContext.getAlteredEntry();
 
@@ -605,13 +664,22 @@ public class DefaultPartitionNexus exten
      */
     public void move( MoveOperationContext moveContext ) throws LdapException
     {
-        // Get the current partition
-        Partition partition = getPartition( moveContext.getDn() );
+        try
+        {
+            rwLock.writeLock().lock();
 
-        // We also have to get the new partition as it can be different
-        //Partition newBackend = getPartition( opContext.getNewDn() );
+            // Get the current partition
+            Partition partition = getPartition( moveContext.getDn() );
 
-        partition.move( moveContext );
+            // We also have to get the new partition as it can be different
+            //Partition newBackend = getPartition( opContext.getNewDn() );
+
+            partition.move( moveContext );
+        }
+        finally
+        {
+            rwLock.writeLock().unlock();
+        }
     }
 
 
@@ -620,8 +688,17 @@ public class DefaultPartitionNexus exten
      */
     public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException
     {
-        Partition partition = getPartition( moveAndRenameContext.getDn() );
-        partition.moveAndRename( moveAndRenameContext );
+        try
+        {
+            rwLock.writeLock().lock();
+
+            Partition partition = getPartition( moveAndRenameContext.getDn() );
+            partition.moveAndRename( moveAndRenameContext );
+        }
+        finally
+        {
+            rwLock.writeLock().unlock();
+        }
     }
 
 
@@ -630,8 +707,17 @@ public class DefaultPartitionNexus exten
      */
     public void rename( RenameOperationContext renameContext ) throws LdapException
     {
-        Partition partition = getPartition( renameContext.getDn() );
-        partition.rename( renameContext );
+        try
+        {
+            rwLock.writeLock().lock();
+
+            Partition partition = getPartition( renameContext.getDn() );
+            partition.rename( renameContext );
+        }
+        finally
+        {
+            rwLock.writeLock().unlock();
+        }
     }
 
 
@@ -809,9 +895,18 @@ public class DefaultPartitionNexus exten
             base.apply( schemaManager );
         }
 
-        Partition backend = getPartition( base );
+        try
+        {
+            rwLock.readLock().lock();
+
+            Partition backend = getPartition( base );
 
-        return backend.search( searchContext );
+            return backend.search( searchContext );
+        }
+        finally
+        {
+            rwLock.readLock().unlock();
+        }
     }
 
 

Modified: directory/apacheds/branches/apacheds-mvbt/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/interceptors/admin/src/main/java/org/apache/directory/server/core/admin/AdministrativePointInterceptor.java Wed Aug 29 14:25:58 2012
@@ -31,7 +31,6 @@ import java.util.concurrent.locks.Reentr
 import javax.naming.directory.SearchControls;
 
 import org.apache.directory.server.constants.ServerDNConstants;
-import org.apache.directory.server.core.shared.DefaultCoreSession;
 import org.apache.directory.server.core.api.CoreSession;
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.InterceptorEnum;
@@ -63,6 +62,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.api.partition.PartitionNexus;
+import org.apache.directory.server.core.shared.DefaultCoreSession;
 import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.entry.Attribute;

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java Wed Aug 29 14:25:58 2012
@@ -74,7 +74,7 @@ public class DupsContainerCursor<K, V> e
     public DupsContainerCursor( JdbmTable<K, V> table ) throws IOException
     {
         LOG_CURSOR.debug( "Creating DupsContainerCursor {}", this );
-        
+
         if ( !table.isDupsEnabled() )
         {
             throw new IllegalStateException( I18n.err( I18n.ERR_572 ) );
@@ -405,7 +405,7 @@ public class DupsContainerCursor<K, V> e
     {
         if ( browser != null )
         {
-            browser.close();
+            //browser.close();
         }
     }
 }

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java Wed Aug 29 14:25:58 2012
@@ -24,13 +24,12 @@ import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.net.URI;
+import java.util.UUID;
 
 import jdbm.RecordManager;
 import jdbm.recman.BaseRecordManager;
-import jdbm.recman.SnapshotRecordManager;
 
 import org.apache.directory.server.core.partition.impl.btree.IndexCursorAdaptor;
-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;
@@ -43,6 +42,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.MatchingRule;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.comparators.SerializableComparator;
+import org.apache.directory.shared.ldap.model.schema.comparators.UuidComparator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,7 +52,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class JdbmIndex<K, V> extends AbstractIndex<K, V, Long>
+public class JdbmIndex<K, V> extends AbstractIndex<K, V, UUID>
 {
     /** A logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( JdbmIndex.class.getSimpleName() );
@@ -73,14 +73,14 @@ public class JdbmIndex<K, V> extends Abs
      * the value of the btree is the entry id of the entry containing an attribute with
      * that value
      */
-    protected JdbmTable<K, Long> forward;
+    protected JdbmTable<K, UUID> forward;
 
     /**
      * the reverse btree where the btree key is the entry id of the entry containing a
      * value for the indexed attribute, and the btree value is the value of the indexed
      * attribute
      */
-    protected JdbmTable<Long, K> reverse;
+    protected JdbmTable<UUID, K> reverse;
 
     /**
      * the JDBM record manager for the file containing this index
@@ -158,7 +158,7 @@ public class JdbmIndex<K, V> extends Abs
 
         BaseRecordManager base = new BaseRecordManager( path );
         base.disableTransactions();
-        this.recMan = new SnapshotRecordManager( base, DEFAULT_INDEX_CACHE_SIZE );
+        this.recMan = base; //new SnapshotRecordManager( base, DEFAULT_INDEX_CACHE_SIZE );
 
         try
         {
@@ -206,11 +206,11 @@ public class JdbmIndex<K, V> extends Abs
          * primary keys.  A value for an attribute can occur several times in
          * different entries so the forward map can have more than one value.
          */
-        LongComparator.INSTANCE.setSchemaManager( schemaManager );
+        UuidComparator.INSTANCE.setSchemaManager( schemaManager );
         comp.setSchemaManager( schemaManager );
 
-        forward = new JdbmTable<K, Long>( schemaManager, attributeType.getOid() + FORWARD_BTREE, numDupLimit, recMan,
-            comp, LongComparator.INSTANCE, null, LongSerializer.INSTANCE );
+        forward = new JdbmTable<K, UUID>( schemaManager, attributeType.getOid() + FORWARD_BTREE, numDupLimit, recMan,
+            comp, UuidComparator.INSTANCE, null, UuidSerializer.INSTANCE );
 
         /*
          * Now the reverse map stores the primary key into the master table as
@@ -222,14 +222,14 @@ public class JdbmIndex<K, V> extends Abs
         {
             if ( attributeType.isSingleValued() )
             {
-                reverse = new JdbmTable<Long, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, recMan,
-                    LongComparator.INSTANCE, LongSerializer.INSTANCE, null );
+                reverse = new JdbmTable<UUID, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, recMan,
+                    UuidComparator.INSTANCE, UuidSerializer.INSTANCE, null );
             }
             else
             {
-                reverse = new JdbmTable<Long, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, numDupLimit,
+                reverse = new JdbmTable<UUID, K>( schemaManager, attributeType.getOid() + REVERSE_BTREE, numDupLimit,
                     recMan,
-                    LongComparator.INSTANCE, comp, LongSerializer.INSTANCE, null );
+                    UuidComparator.INSTANCE, comp, UuidSerializer.INSTANCE, null );
             }
         }
     }
@@ -332,7 +332,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * @see Index#forwardLookup(java.lang.Object)
      */
-    public Long forwardLookup( K attrVal ) throws Exception
+    public UUID forwardLookup( K attrVal ) throws Exception
     {
         return forward.get( attrVal );
     }
@@ -341,7 +341,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public K reverseLookup( Long id ) throws Exception
+    public K reverseLookup( UUID id ) throws Exception
     {
         if ( withReverse )
         {
@@ -361,7 +361,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public synchronized void add( K attrVal, Long id ) throws Exception
+    public synchronized void add( K attrVal, UUID id ) throws Exception
     {
         // The pair to be removed must exists
         forward.put( attrVal, id );
@@ -376,7 +376,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public synchronized void drop( K attrVal, Long id ) throws Exception
+    public synchronized void drop( K attrVal, UUID id ) throws Exception
     {
         // The pair to be removed must exists
         if ( forward.has( attrVal, id ) )
@@ -394,7 +394,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public void drop( Long entryId ) throws Exception
+    public void drop( UUID entryId ) throws Exception
     {
         if ( withReverse )
         {
@@ -402,7 +402,7 @@ public class JdbmIndex<K, V> extends Abs
             {
                 // Build a cursor to iterate on all the keys referencing
                 // this entryId
-                Cursor<Tuple<Long, K>> values = reverse.cursor( entryId );
+                Cursor<Tuple<UUID, K>> values = reverse.cursor( entryId );
 
                 while ( values.next() )
                 {
@@ -429,48 +429,48 @@ public class JdbmIndex<K, V> extends Abs
     // Index Cursor Operations
     // ------------------------------------------------------------------------
     @SuppressWarnings("unchecked")
-    public Cursor<IndexEntry<K, Long>> reverseCursor() throws Exception
+    public Cursor<IndexEntry<K, UUID>> reverseCursor() throws Exception
     {
         if ( withReverse )
         {
-            return new IndexCursorAdaptor<K, Long>( ( Cursor ) reverse.cursor(), false );
+            return new IndexCursorAdaptor<K>( ( Cursor ) reverse.cursor(), false );
         }
         else
         {
-            return new EmptyIndexCursor<K, Long>();
+            return new EmptyIndexCursor<K>();
         }
     }
 
 
     @SuppressWarnings("unchecked")
-    public Cursor<IndexEntry<K, Long>> forwardCursor() throws Exception
+    public Cursor<IndexEntry<K, UUID>> forwardCursor() throws Exception
     {
-        return new IndexCursorAdaptor<K, Long>( ( Cursor ) forward.cursor(), true );
+        return new IndexCursorAdaptor<K>( ( Cursor ) forward.cursor(), true );
     }
 
 
     @SuppressWarnings("unchecked")
-    public Cursor<IndexEntry<K, Long>> reverseCursor( Long id ) throws Exception
+    public Cursor<IndexEntry<K, UUID>> reverseCursor( UUID id ) throws Exception
     {
         if ( withReverse )
         {
-            return new IndexCursorAdaptor<K, Long>( ( Cursor ) reverse.cursor( id ), false );
+            return new IndexCursorAdaptor<K>( ( Cursor ) reverse.cursor( id ), false );
         }
         else
         {
-            return new EmptyIndexCursor<K, Long>();
+            return new EmptyIndexCursor<K>();
         }
     }
 
 
     @SuppressWarnings("unchecked")
-    public Cursor<IndexEntry<K, Long>> forwardCursor( K key ) throws Exception
+    public Cursor<IndexEntry<K, UUID>> forwardCursor( K key ) throws Exception
     {
-        return new IndexCursorAdaptor<K, Long>( ( Cursor ) forward.cursor( key ), true );
+        return new IndexCursorAdaptor<K>( ( Cursor ) forward.cursor( key ), true );
     }
 
 
-    public Cursor<K> reverseValueCursor( Long id ) throws Exception
+    public Cursor<K> reverseValueCursor( UUID id ) throws Exception
     {
         if ( withReverse )
         {
@@ -483,7 +483,7 @@ public class JdbmIndex<K, V> extends Abs
     }
 
 
-    public Cursor<Long> forwardValueCursor( K key ) throws Exception
+    public Cursor<UUID> forwardValueCursor( K key ) throws Exception
     {
         return forward.valueCursor( key );
     }
@@ -504,7 +504,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean forward( K attrVal, Long id ) throws Exception
+    public boolean forward( K attrVal, UUID id ) throws Exception
     {
         return forward.has( attrVal, id );
     }
@@ -513,7 +513,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean reverse( Long id ) throws Exception
+    public boolean reverse( UUID id ) throws Exception
     {
         if ( withReverse )
         {
@@ -529,7 +529,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean reverse( Long id, K attrVal ) throws Exception
+    public boolean reverse( UUID id, K attrVal ) throws Exception
     {
         return forward.has( attrVal, id );
     }
@@ -547,7 +547,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean forwardGreaterOrEq( K attrVal, Long id ) throws Exception
+    public boolean forwardGreaterOrEq( K attrVal, UUID id ) throws Exception
     {
         return forward.hasGreaterOrEqual( attrVal, id );
     }
@@ -565,7 +565,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean forwardLessOrEq( K attrVal, Long id ) throws Exception
+    public boolean forwardLessOrEq( K attrVal, UUID id ) throws Exception
     {
         return forward.hasLessOrEqual( attrVal, id );
     }
@@ -574,7 +574,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean reverseGreaterOrEq( Long id ) throws Exception
+    public boolean reverseGreaterOrEq( UUID id ) throws Exception
     {
         if ( withReverse )
         {
@@ -590,7 +590,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean reverseGreaterOrEq( Long id, K attrVal ) throws Exception
+    public boolean reverseGreaterOrEq( UUID id, K attrVal ) throws Exception
     {
         if ( withReverse )
         {
@@ -606,7 +606,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean reverseLessOrEq( Long id ) throws Exception
+    public boolean reverseLessOrEq( UUID id ) throws Exception
     {
         if ( withReverse )
         {
@@ -622,7 +622,7 @@ public class JdbmIndex<K, V> extends Abs
     /**
      * {@inheritDoc}
      */
-    public boolean reverseLessOrEq( Long id, K attrVal ) throws Exception
+    public boolean reverseLessOrEq( UUID id, K attrVal ) throws Exception
     {
         if ( withReverse )
         {

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Wed Aug 29 14:25:58 2012
@@ -20,15 +20,16 @@
 package org.apache.directory.server.core.partition.impl.btree.jdbm;
 
 
+import java.util.UUID;
+
 import jdbm.RecordManager;
-import jdbm.helper.LongSerializer;
 import jdbm.helper.Serializer;
 import jdbm.helper.StringComparator;
 
-import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.MasterTable;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.model.schema.comparators.SerializableComparator;
+import org.apache.directory.shared.ldap.model.schema.comparators.UuidComparator;
 
 
 /**
@@ -36,59 +37,10 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class JdbmMasterTable<E> extends JdbmTable<Long, E> implements MasterTable<Long, E>
+public class JdbmMasterTable<E> extends JdbmTable<UUID, E> implements MasterTable<E>
 {
     private static final StringComparator STRCOMP = new StringComparator();
 
-    private static final SerializableComparator<Long> LONG_COMPARATOR =
-        new SerializableComparator<Long>( "1.3.6.1.4.1.18060.0.4.1.1.2" )
-        {
-            private static final long serialVersionUID = 4048791282048841016L;
-
-
-            public int compare( Long o1, Long o2 )
-            {
-                if ( o1 == null )
-                {
-                    throw new IllegalArgumentException( I18n.err( I18n.ERR_525 ) );
-                }
-                else if ( o2 == null )
-                {
-                    throw new IllegalArgumentException( I18n.err( I18n.ERR_526 ) );
-                }
-
-                if ( o1 == ( long ) o2 )
-                {
-                    return 0;
-                }
-
-                if ( o1 == ( long ) o2 )
-                {
-                    return 0;
-                }
-
-                if ( o1 >= 0 )
-                {
-                    if ( o2 >= 0 )
-                    {
-                        return ( o1 > ( long ) o2 ) ? 1 : -1;
-                    }
-                    else
-                    {
-                        return -1;
-                    }
-                }
-                else if ( o2 >= 0 )
-                {
-                    return 1;
-                }
-                else
-                {
-                    return ( o1 < ( long ) o2 ) ? -1 : 1;
-                }
-            }
-        };
-
     private static final SerializableComparator<String> STRING_COMPARATOR =
         new SerializableComparator<String>( "1.3.6.1.4.1.18060.0.4.1.1.3" )
         {
@@ -113,7 +65,7 @@ public class JdbmMasterTable<E> extends 
      */
     public JdbmMasterTable( RecordManager recMan, SchemaManager schemaManager ) throws Exception
     {
-        super( schemaManager, DBF, recMan, LONG_COMPARATOR, LongSerializer.INSTANCE,
+        super( schemaManager, DBF, recMan, UuidComparator.INSTANCE, UuidSerializer.INSTANCE,
             new EntrySerializer( schemaManager ) );
         adminTbl = new JdbmTable<String, String>( schemaManager, "admin", recMan, STRING_COMPARATOR, null, null );
         String seqValue = adminTbl.get( SEQPROP_KEY );
@@ -123,7 +75,7 @@ public class JdbmMasterTable<E> extends 
             adminTbl.put( SEQPROP_KEY, "0" );
         }
 
-        LONG_COMPARATOR.setSchemaManager( schemaManager );
+        UuidComparator.INSTANCE.setSchemaManager( schemaManager );
         STRING_COMPARATOR.setSchemaManager( schemaManager );
     }
 
@@ -131,7 +83,7 @@ public class JdbmMasterTable<E> extends 
     protected JdbmMasterTable( RecordManager recMan, SchemaManager schemaManager, String dbName, Serializer serializer )
         throws Exception
     {
-        super( schemaManager, DBF, recMan, LONG_COMPARATOR, LongSerializer.INSTANCE, serializer );
+        super( schemaManager, DBF, recMan, UuidComparator.INSTANCE, UuidSerializer.INSTANCE, serializer );
         adminTbl = new JdbmTable<String, String>( schemaManager, dbName, recMan, STRING_COMPARATOR, null, null );
         String seqValue = adminTbl.get( SEQPROP_KEY );
 
@@ -152,19 +104,9 @@ public class JdbmMasterTable<E> extends 
      * @throws Exception if the admin table storing sequences cannot be
      *                         read and written to.
      */
-    public Long getNextId( E entry ) throws Exception
+    public UUID getNextId( E entry ) throws Exception
     {
-        Long nextVal;
-        Long lastVal;
-
-        synchronized ( adminTbl )
-        {
-            lastVal = new Long( adminTbl.get( SEQPROP_KEY ) );
-            nextVal = lastVal + 1L;
-            adminTbl.put( SEQPROP_KEY, nextVal.toString() );
-        }
-
-        return nextVal;
+        return UUID.randomUUID();
     }
 
 

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java Wed Aug 29 14:25:58 2012
@@ -27,10 +27,10 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.UUID;
 
 import jdbm.RecordManager;
 import jdbm.recman.BaseRecordManager;
-import jdbm.recman.SnapshotRecordManager;
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.api.partition.Partition;
@@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class JdbmPartition extends AbstractBTreePartition<Long>
+public class JdbmPartition extends AbstractBTreePartition
 {
     /** static logger */
     private static final Logger LOG = LoggerFactory.getLogger( JdbmPartition.class );
@@ -112,13 +112,13 @@ public class JdbmPartition extends Abstr
             }
             else
             {
-                optimizer = new DefaultOptimizer<Entry, Long>( this );
+                optimizer = new DefaultOptimizer<Entry>( this );
             }
 
-            EvaluatorBuilder<Long> evaluatorBuilder = new EvaluatorBuilder<Long>( this, schemaManager );
-            CursorBuilder<Long> cursorBuilder = new CursorBuilder<Long>( this, evaluatorBuilder );
+            EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( this, schemaManager );
+            CursorBuilder cursorBuilder = new CursorBuilder( this, evaluatorBuilder );
 
-            searchEngine = new DefaultSearchEngine<Long>( this, cursorBuilder, evaluatorBuilder, optimizer );
+            searchEngine = new DefaultSearchEngine( this, cursorBuilder, evaluatorBuilder, optimizer );
 
             // Create the underlying directories (only if needed)
             File partitionDir = new File( getPartitionPath() );
@@ -146,7 +146,7 @@ public class JdbmPartition extends Abstr
             }
 
             // Now, create the entry cache for this partition
-            recMan = new SnapshotRecordManager( baseRecordManager, cacheSize );
+            recMan = baseRecordManager; //new SnapshotRecordManager( baseRecordManager, cacheSize );
 
             // Create the master table (the table containing all the entries)
             master = new JdbmMasterTable<Entry>( recMan, schemaManager );
@@ -160,18 +160,18 @@ public class JdbmPartition extends Abstr
             // then add all index objects to a list
             List<String> allIndices = new ArrayList<String>();
 
-            for ( Index<?, Entry, Long> index : systemIndices.values() )
+            for ( Index<?, Entry, UUID> index : systemIndices.values() )
             {
                 allIndices.add( index.getAttribute().getOid() );
             }
 
-            List<Index<?, Entry, Long>> indexToBuild = new ArrayList<Index<?, Entry, Long>>();
+            List<Index<?, Entry, UUID>> indexToBuild = new ArrayList<Index<?, Entry, UUID>>();
 
             // this loop is used for two purposes
             // one for collecting all user indices
             // two for finding a new index to be built
             // just to avoid another iteration for determining which is the new index
-            for ( Index<?, Entry, Long> index : userIndices.values() )
+            for ( Index<?, Entry, UUID> index : userIndices.values() )
             {
                 String indexOid = index.getAttribute().getOid();
                 allIndices.add( indexOid );
@@ -203,18 +203,18 @@ public class JdbmPartition extends Abstr
     /**
      * {@inheritDoc}}
      */
-    public Long getDefaultId()
+    public UUID getDefaultId()
     {
-        return 1L;
+        return new UUID( 0L, 1L );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public Long getRootId()
+    public UUID getRootId()
     {
-        return 0L;
+        return new UUID( 0L, 0L );
     }
 
 
@@ -232,13 +232,13 @@ public class JdbmPartition extends Abstr
         }
 
         // Sync all system indices
-        for ( Index<?, Entry, Long> idx : systemIndices.values() )
+        for ( Index<?, Entry, UUID> idx : systemIndices.values() )
         {
             idx.sync();
         }
 
         // Sync all user defined userIndices
-        for ( Index<?, Entry, Long> idx : userIndices.values() )
+        for ( Index<?, Entry, UUID> idx : userIndices.values() )
         {
             idx.sync();
         }
@@ -254,9 +254,9 @@ public class JdbmPartition extends Abstr
      * @param userIndexes then user defined indexes to create
      * @throws Exception in case of any problems while building the index
      */
-    private void buildUserIndex( List<Index<?, Entry, Long>> userIndexes ) throws Exception
+    private void buildUserIndex( List<Index<?, Entry, UUID>> userIndexes ) throws Exception
     {
-        Cursor<Tuple<Long, Entry>> cursor = master.cursor();
+        Cursor<Tuple<UUID, Entry>> cursor = master.cursor();
         cursor.beforeFirst();
 
         while ( cursor.next() )
@@ -269,9 +269,9 @@ public class JdbmPartition extends Abstr
 
                 LOG.info( "building the index for attribute type {}", atType );
 
-                Tuple<Long, Entry> tuple = cursor.get();
+                Tuple<UUID, Entry> tuple = cursor.get();
 
-                Long id = tuple.getKey();
+                UUID id = tuple.getKey();
                 Entry entry = tuple.getValue();
 
                 Attribute entryAttr = entry.get( atType );
@@ -344,7 +344,7 @@ public class JdbmPartition extends Abstr
     /**
      * {@inheritDoc}
      */
-    protected Index<?, Entry, Long> convertAndInit( Index<?, Entry, Long> index ) throws Exception
+    protected Index<?, Entry, UUID> convertAndInit( Index<?, Entry, UUID> index ) throws Exception
     {
         JdbmIndex<?, Entry> jdbmIndex;
 

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java Wed Aug 29 14:25:58 2012
@@ -24,14 +24,13 @@ package org.apache.directory.server.core
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.util.UUID;
 
 import javax.naming.NamingException;
 
 import jdbm.recman.BaseRecordManager;
-import jdbm.recman.SnapshotRecordManager;
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
-import org.apache.directory.server.core.partition.impl.btree.LongComparator;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.ParentIdAndRdn;
 import org.apache.directory.server.xdbm.ParentIdAndRdnComparator;
@@ -39,6 +38,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.MatchingRule;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.ldap.model.schema.comparators.UuidComparator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class JdbmRdnIndex extends JdbmIndex<ParentIdAndRdn<Long>, Entry>
+public class JdbmRdnIndex extends JdbmIndex<ParentIdAndRdn<UUID>, Entry>
 {
 
     /** A logger for this class */
@@ -86,7 +86,7 @@ public class JdbmRdnIndex extends JdbmIn
         //System.out.println( "IDX Created index " + path );
         BaseRecordManager base = new BaseRecordManager( path );
         base.disableTransactions();
-        this.recMan = new SnapshotRecordManager( base, cacheSize );
+        this.recMan = base; //new SnapshotRecordManager( base, cacheSize );
 
         try
         {
@@ -127,13 +127,13 @@ public class JdbmRdnIndex extends JdbmIn
             throw new IOException( I18n.err( I18n.ERR_574, attributeType.getName() ) );
         }
 
-        ParentIdAndRdnComparator<Long> comp = new ParentIdAndRdnComparator<Long>( mr.getOid() );
+        ParentIdAndRdnComparator<UUID> comp = new ParentIdAndRdnComparator<UUID>( mr.getOid() );
 
-        LongComparator.INSTANCE.setSchemaManager( schemaManager );
+        UuidComparator.INSTANCE.setSchemaManager( schemaManager );
 
-        forward = new JdbmTable<ParentIdAndRdn<Long>, Long>( schemaManager, attributeType.getOid() + FORWARD_BTREE,
-            recMan, comp, null, LongSerializer.INSTANCE );
-        reverse = new JdbmTable<Long, ParentIdAndRdn<Long>>( schemaManager, attributeType.getOid() + REVERSE_BTREE,
-            recMan, LongComparator.INSTANCE, LongSerializer.INSTANCE, null );
+        forward = new JdbmTable<ParentIdAndRdn<UUID>, UUID>( schemaManager, attributeType.getOid() + FORWARD_BTREE,
+            recMan, comp, null, UuidSerializer.INSTANCE );
+        reverse = new JdbmTable<UUID, ParentIdAndRdn<UUID>>( schemaManager, attributeType.getOid() + REVERSE_BTREE,
+            recMan, UuidComparator.INSTANCE, UuidSerializer.INSTANCE, null );
     }
 }

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java Wed Aug 29 14:25:58 2012
@@ -1081,7 +1081,7 @@ public class JdbmTable<K, V> extends Abs
     {
         if ( browser != null )
         {
-            browser.close();
+            //browser.close();
         }
     }
 }

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java Wed Aug 29 14:25:58 2012
@@ -246,7 +246,7 @@ public class KeyBTreeCursor<E> extends A
     {
         if ( browser != null )
         {
-            browser.close();
+            //browser.close();
         }
     }
 }

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java Wed Aug 29 14:25:58 2012
@@ -349,7 +349,7 @@ public class KeyTupleBTreeCursor<K, V> e
     {
         if ( browser != null )
         {
-            browser.close();
+            //browser.close();
         }
     }
 }

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java Wed Aug 29 14:25:58 2012
@@ -217,7 +217,7 @@ class NoDupsCursor<K, V> extends Abstrac
     public boolean next() throws Exception
     {
         checkNotClosed( "previous()" );
-        
+
         if ( browser == null )
         {
             beforeFirst();
@@ -283,7 +283,7 @@ class NoDupsCursor<K, V> extends Abstrac
     {
         if ( browser != null )
         {
-            browser.close();
+            //browser.close();
         }
     }
 }

Added: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/UuidSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/UuidSerializer.java?rev=1378577&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/UuidSerializer.java (added)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/UuidSerializer.java Wed Aug 29 14:25:58 2012
@@ -0,0 +1,109 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.apache.directory.server.core.partition.impl.btree.jdbm;
+
+
+import java.io.IOException;
+import java.util.UUID;
+
+import jdbm.helper.Serializer;
+
+
+/**
+ * A {@link Serializer} for Longs
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class UuidSerializer implements Serializer
+{
+    private static final long serialVersionUID = 237756689544852128L;
+    public static final UuidSerializer INSTANCE = new UuidSerializer();
+
+
+    public byte[] serialize( Object o ) throws IOException
+    {
+        UUID uuid = ( UUID ) o;
+        byte[] bites = new byte[16];
+
+        long id = uuid.getMostSignificantBits();
+
+        bites[0] = ( byte ) ( id >> 56 );
+        bites[1] = ( byte ) ( id >> 48 );
+        bites[2] = ( byte ) ( id >> 40 );
+        bites[3] = ( byte ) ( id >> 32 );
+        bites[4] = ( byte ) ( id >> 24 );
+        bites[5] = ( byte ) ( id >> 16 );
+        bites[6] = ( byte ) ( id >> 8 );
+        bites[7] = ( byte ) id;
+
+        id = uuid.getLeastSignificantBits();
+
+        bites[8] = ( byte ) ( id >> 56 );
+        bites[9] = ( byte ) ( id >> 48 );
+        bites[10] = ( byte ) ( id >> 40 );
+        bites[11] = ( byte ) ( id >> 32 );
+        bites[12] = ( byte ) ( id >> 24 );
+        bites[13] = ( byte ) ( id >> 16 );
+        bites[14] = ( byte ) ( id >> 8 );
+        bites[15] = ( byte ) id;
+
+        return bites;
+    }
+
+
+    public Object deserialize( byte[] bites ) throws IOException
+    {
+        long msb;
+        msb = bites[0] + ( ( bites[0] < 0 ) ? 256 : 0 );
+        msb <<= 8;
+        msb += bites[1] + ( ( bites[1] < 0 ) ? 256 : 0 );
+        msb <<= 8;
+        msb += bites[2] + ( ( bites[2] < 0 ) ? 256 : 0 );
+        msb <<= 8;
+        msb += bites[3] + ( ( bites[3] < 0 ) ? 256 : 0 );
+        msb <<= 8;
+        msb += bites[4] + ( ( bites[4] < 0 ) ? 256 : 0 );
+        msb <<= 8;
+        msb += bites[5] + ( ( bites[5] < 0 ) ? 256 : 0 );
+        msb <<= 8;
+        msb += bites[6] + ( ( bites[6] < 0 ) ? 256 : 0 );
+        msb <<= 8;
+        msb += bites[7] + ( ( bites[7] < 0 ) ? 256 : 0 );
+
+        long lsb;
+        lsb = bites[8] + ( ( bites[8] < 0 ) ? 256 : 0 );
+        lsb <<= 8;
+        lsb += bites[9] + ( ( bites[9] < 0 ) ? 256 : 0 );
+        lsb <<= 8;
+        lsb += bites[10] + ( ( bites[10] < 0 ) ? 256 : 0 );
+        lsb <<= 8;
+        lsb += bites[11] + ( ( bites[11] < 0 ) ? 256 : 0 );
+        lsb <<= 8;
+        lsb += bites[12] + ( ( bites[12] < 0 ) ? 256 : 0 );
+        lsb <<= 8;
+        lsb += bites[13] + ( ( bites[13] < 0 ) ? 256 : 0 );
+        lsb <<= 8;
+        lsb += bites[14] + ( ( bites[14] < 0 ) ? 256 : 0 );
+        lsb <<= 8;
+        lsb += bites[15] + ( ( bites[15] < 0 ) ? 256 : 0 );
+
+        return new UUID( msb, lsb );
+    }
+}

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndexTest.java Wed Aug 29 14:25:58 2012
@@ -28,6 +28,7 @@ import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.IOException;
+import java.util.UUID;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.xdbm.Index;
@@ -41,6 +42,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.After;
 import org.junit.Before;
@@ -56,7 +58,7 @@ import org.junit.Test;
 public class JdbmIndexTest
 {
     private static File dbFileDir;
-    Index<String, Entry, Long> idx;
+    Index<String, Entry, UUID> idx;
     private static SchemaManager schemaManager;
 
 
@@ -296,13 +298,13 @@ public class JdbmIndexTest
         initIndex();
         assertEquals( 0, idx.count() );
 
-        idx.add( "foo", 1234L );
+        idx.add( "foo", Strings.getUUID( 1234L ) );
         assertEquals( 1, idx.count() );
 
-        idx.add( "foo", 333L );
+        idx.add( "foo", Strings.getUUID( 333L ) );
         assertEquals( 2, idx.count() );
 
-        idx.add( "bar", 555L );
+        idx.add( "bar", Strings.getUUID( 555L ) );
         assertEquals( 3, idx.count() );
     }
 
@@ -313,13 +315,13 @@ public class JdbmIndexTest
         initIndex();
         assertEquals( 0, idx.count( "foo" ) );
 
-        idx.add( "bar", 1234L );
+        idx.add( "bar", Strings.getUUID( 1234L ) );
         assertEquals( 0, idx.count( "foo" ) );
 
-        idx.add( "foo", 1234L );
+        idx.add( "foo", Strings.getUUID( 1234L ) );
         assertEquals( 1, idx.count( "foo" ) );
 
-        idx.add( "foo", 333L );
+        idx.add( "foo", Strings.getUUID( 333L ) );
         assertEquals( 2, idx.count( "foo" ) );
     }
 
@@ -332,7 +334,7 @@ public class JdbmIndexTest
 
         for ( char ch = 'a'; ch <= 'z'; ch++ )
         {
-            idx.add( String.valueOf( ch ), ( long ) ch );
+            idx.add( String.valueOf( ch ), Strings.getUUID( ch ) );
         }
 
         assertEquals( 26, idx.greaterThanCount( "a" ) );
@@ -347,7 +349,7 @@ public class JdbmIndexTest
 
         for ( char ch = 'a'; ch <= 'z'; ch++ )
         {
-            idx.add( String.valueOf( ch ), ( long ) ch );
+            idx.add( String.valueOf( ch ), Strings.getUUID( ch ) );
         }
 
         assertEquals( 26, idx.lessThanCount( "z" ) );
@@ -364,53 +366,53 @@ public class JdbmIndexTest
         initIndex();
         assertNull( idx.forwardLookup( "foo" ) );
         assertNull( idx.forwardLookup( "bar" ) );
-        assertFalse( idx.forwardGreaterOrEq( "foo", 0L ) );
-        assertFalse( idx.forwardGreaterOrEq( "foo", -24L ) );
-        assertFalse( idx.forwardGreaterOrEq( "foo", 24L ) );
-        assertFalse( idx.forwardLessOrEq( "foo", 0L ) );
-        assertFalse( idx.forwardLessOrEq( "foo", 24L ) );
-        assertFalse( idx.forwardLessOrEq( "foo", -24L ) );
-
-        idx.add( "foo", 0L );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
-        assertTrue( idx.forward( "foo", 0L ) );
-        assertTrue( idx.forwardGreaterOrEq( "foo", 0L ) );
-        assertTrue( idx.forwardGreaterOrEq( "foo", -1L ) );
-        assertFalse( idx.forwardGreaterOrEq( "foo", 1L ) );
-        assertTrue( idx.forwardLessOrEq( "foo", 0L ) );
-        assertTrue( idx.forwardLessOrEq( "foo", 1L ) );
-        assertFalse( idx.forwardLessOrEq( "foo", -1L ) );
-
-        idx.add( "foo", 1L );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
-        assertTrue( idx.forward( "foo", 0L ) );
-        assertTrue( idx.forward( "foo", 1L ) );
-        assertTrue( idx.forwardGreaterOrEq( "foo", 0L ) );
-        assertTrue( idx.forwardGreaterOrEq( "foo", 1L ) );
-        assertTrue( idx.forwardGreaterOrEq( "foo", -1L ) );
-        assertFalse( idx.forwardGreaterOrEq( "foo", 2L ) );
-        assertTrue( idx.forwardLessOrEq( "foo", 0L ) );
-        assertTrue( idx.forwardLessOrEq( "foo", 1L ) );
-        assertTrue( idx.forwardLessOrEq( "foo", 2L ) );
-        assertFalse( idx.forwardLessOrEq( "foo", -1L ) );
-
-        idx.add( "bar", 0L );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "bar" ) );
-        assertTrue( idx.forward( "bar", 0L ) );
-        assertTrue( idx.forward( "foo", 0L ) );
-        assertTrue( idx.forward( "foo", 1L ) );
-        assertTrue( idx.forwardGreaterOrEq( "bar", 0L ) );
-        assertTrue( idx.forwardGreaterOrEq( "foo", 0L ) );
-        assertTrue( idx.forwardGreaterOrEq( "foo", 1L ) );
-        assertTrue( idx.forwardGreaterOrEq( "foo", -1L ) );
-        assertFalse( idx.forwardGreaterOrEq( "foo", 2L ) );
-        assertFalse( idx.forwardGreaterOrEq( "bar", 1L ) );
-        assertTrue( idx.forwardLessOrEq( "bar", 0L ) );
-        assertTrue( idx.forwardLessOrEq( "foo", 0L ) );
-        assertTrue( idx.forwardLessOrEq( "foo", 1L ) );
-        assertTrue( idx.forwardLessOrEq( "foo", 2L ) );
-        assertFalse( idx.forwardLessOrEq( "foo", -1L ) );
-        assertFalse( idx.forwardLessOrEq( "bar", -1L ) );
+        assertFalse( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 0L ) ) );
+        assertFalse( idx.forwardGreaterOrEq( "foo", Strings.getUUID( -24L ) ) );
+        assertFalse( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 24L ) ) );
+        assertFalse( idx.forwardLessOrEq( "foo", Strings.getUUID( 0L ) ) );
+        assertFalse( idx.forwardLessOrEq( "foo", Strings.getUUID( 24L ) ) );
+        assertFalse( idx.forwardLessOrEq( "foo", Strings.getUUID( -24L ) ) );
+
+        idx.add( "foo", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
+        assertTrue( idx.forward( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "foo", Strings.getUUID( -1L ) ) );
+        assertFalse( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 1L ) ) );
+        assertTrue( idx.forwardLessOrEq( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardLessOrEq( "foo", Strings.getUUID( 1L ) ) );
+        assertFalse( idx.forwardLessOrEq( "foo", Strings.getUUID( -1L ) ) );
+
+        idx.add( "foo", Strings.getUUID( 1L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
+        assertTrue( idx.forward( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forward( "foo", Strings.getUUID( 1L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 1L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "foo", Strings.getUUID( -1L ) ) );
+        assertFalse( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 2L ) ) );
+        assertTrue( idx.forwardLessOrEq( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardLessOrEq( "foo", Strings.getUUID( 1L ) ) );
+        assertTrue( idx.forwardLessOrEq( "foo", Strings.getUUID( 2L ) ) );
+        assertFalse( idx.forwardLessOrEq( "foo", Strings.getUUID( -1L ) ) );
+
+        idx.add( "bar", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "bar" ) );
+        assertTrue( idx.forward( "bar", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forward( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forward( "foo", Strings.getUUID( 1L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "bar", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 1L ) ) );
+        assertTrue( idx.forwardGreaterOrEq( "foo", Strings.getUUID( -1L ) ) );
+        assertFalse( idx.forwardGreaterOrEq( "foo", Strings.getUUID( 2L ) ) );
+        assertFalse( idx.forwardGreaterOrEq( "bar", Strings.getUUID( 1L ) ) );
+        assertTrue( idx.forwardLessOrEq( "bar", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardLessOrEq( "foo", Strings.getUUID( 0L ) ) );
+        assertTrue( idx.forwardLessOrEq( "foo", Strings.getUUID( 1L ) ) );
+        assertTrue( idx.forwardLessOrEq( "foo", Strings.getUUID( 2L ) ) );
+        assertFalse( idx.forwardLessOrEq( "foo", Strings.getUUID( -1L ) ) );
+        assertFalse( idx.forwardLessOrEq( "bar", Strings.getUUID( -1L ) ) );
     }
 
 
@@ -422,26 +424,26 @@ public class JdbmIndexTest
         assertNull( idx.forwardLookup( "bar" ) );
 
         // test add/drop without adding any duplicates
-        idx.add( "foo", 0L );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
+        idx.add( "foo", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
 
-        idx.drop( "foo", 0L );
+        idx.drop( "foo", Strings.getUUID( 0L ) );
         assertNull( idx.forwardLookup( "foo" ) );
 
         // test add/drop with duplicates in bulk
-        idx.add( "foo", 0L );
-        idx.add( "foo", 1L );
-        idx.add( "bar", 0L );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "bar" ) );
-
-        idx.drop( "foo", 0L );
-        idx.drop( "bar", 0L );
-        assertFalse( idx.forward( "bar", 0L ) );
-        assertFalse( idx.forward( "foo", 0L ) );
+        idx.add( "foo", Strings.getUUID( 0L ) );
+        idx.add( "foo", Strings.getUUID( 1L ) );
+        idx.add( "bar", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "bar" ) );
+
+        idx.drop( "foo", Strings.getUUID( 0L ) );
+        idx.drop( "bar", Strings.getUUID( 0L ) );
+        assertFalse( idx.forward( "bar", Strings.getUUID( 0L ) ) );
+        assertFalse( idx.forward( "foo", Strings.getUUID( 0L ) ) );
 
-        idx.drop( "bar", 1L );
-        idx.drop( "foo", 1L );
+        idx.drop( "bar", Strings.getUUID( 1L ) );
+        idx.drop( "foo", Strings.getUUID( 1L ) );
         assertNull( idx.forwardLookup( "foo" ) );
         assertNull( idx.forwardLookup( "bar" ) );
         assertEquals( 0, idx.count() );
@@ -456,28 +458,28 @@ public class JdbmIndexTest
         assertNull( idx.forwardLookup( "bar" ) );
 
         // test add/drop without adding any duplicates
-        idx.add( "foo", 0L );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
+        idx.add( "foo", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
 
-        idx.drop( "foo", 0L );
+        idx.drop( "foo", Strings.getUUID( 0L ) );
         assertNull( idx.forwardLookup( "foo" ) );
 
         // test add/drop with duplicates but one at a time
-        idx.add( "foo", 0L );
-        idx.add( "foo", 1L );
-        idx.add( "bar", 0L );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "bar" ) );
-
-        idx.drop( "bar", 0L );
-        assertEquals( 0L, ( long ) idx.forwardLookup( "foo" ) );
-        assertFalse( idx.forward( "bar", 0L ) );
-
-        idx.drop( "foo", 0L );
-        assertEquals( 1L, ( long ) idx.forwardLookup( "foo" ) );
-        assertFalse( idx.forward( "foo", 0L ) );
+        idx.add( "foo", Strings.getUUID( 0L ) );
+        idx.add( "foo", Strings.getUUID( 1L ) );
+        idx.add( "bar", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "bar" ) );
+
+        idx.drop( "bar", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 0L ), idx.forwardLookup( "foo" ) );
+        assertFalse( idx.forward( "bar", Strings.getUUID( 0L ) ) );
+
+        idx.drop( "foo", Strings.getUUID( 0L ) );
+        assertEquals( Strings.getUUID( 1L ), idx.forwardLookup( "foo" ) );
+        assertFalse( idx.forward( "foo", Strings.getUUID( 0L ) ) );
 
-        idx.drop( "foo", 1L );
+        idx.drop( "foo", Strings.getUUID( 1L ) );
         assertNull( idx.forwardLookup( "foo" ) );
         assertNull( idx.forwardLookup( "bar" ) );
         assertEquals( 0, idx.count() );
@@ -494,32 +496,34 @@ public class JdbmIndexTest
         initIndex();
         assertEquals( 0, idx.count() );
 
-        idx.add( "foo", 1234L );
+        idx.add( "foo", Strings.getUUID( 1234L ) );
         assertEquals( 1, idx.count() );
 
-        idx.add( "foo", 333L );
+        idx.add( "foo", Strings.getUUID( 333L ) );
         assertEquals( 2, idx.count() );
 
-        idx.add( "bar", 555L );
+        idx.add( "bar", Strings.getUUID( 555L ) );
         assertEquals( 3, idx.count() );
 
         // use forward index's cursor
-        Cursor<IndexEntry<String, Long>> cursor = idx.forwardCursor();
+        Cursor<IndexEntry<String, UUID>> cursor = idx.forwardCursor();
         cursor.beforeFirst();
 
+        assertEquals( 3, idx.count() );
+
         cursor.next();
-        IndexEntry<String, Long> e1 = cursor.get();
-        assertEquals( 555L, ( long ) e1.getId() );
+        IndexEntry<String, UUID> e1 = cursor.get();
+        assertEquals( Strings.getUUID( 555L ), e1.getId() );
         assertEquals( "bar", e1.getKey() );
 
         cursor.next();
-        IndexEntry<String, Long> e2 = cursor.get();
-        assertEquals( 333L, ( long ) e2.getId() );
+        IndexEntry<String, UUID> e2 = cursor.get();
+        assertEquals( Strings.getUUID( 333L ), e2.getId() );
         assertEquals( "foo", e2.getKey() );
 
         cursor.next();
-        IndexEntry<String, Long> e3 = cursor.get();
-        assertEquals( 1234L, ( long ) e3.getId() );
+        IndexEntry<String, UUID> e3 = cursor.get();
+        assertEquals( Strings.getUUID( 1234L ), e3.getId() );
         assertEquals( "foo", e3.getKey() );
 
         cursor.close();

Modified: directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java?rev=1378577&r1=1378576&r2=1378577&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java (original)
+++ directory/apacheds/branches/apacheds-mvbt/jdbm-partition/src/test/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTableTest.java Wed Aug 29 14:25:58 2012
@@ -29,11 +29,13 @@ import java.io.File;
 import jdbm.RecordManager;
 import jdbm.recman.BaseRecordManager;
 
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.ldap.schemaextractor.SchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaextractor.impl.DefaultSchemaLdifExtractor;
 import org.apache.directory.shared.ldap.schemaloader.LdifSchemaLoader;
 import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.apache.directory.shared.util.Strings;
 import org.apache.directory.shared.util.exception.Exceptions;
 import org.junit.After;
 import org.junit.Before;
@@ -52,7 +54,7 @@ public class JdbmMasterTableTest
     private static final Logger LOG = LoggerFactory.getLogger( JdbmMasterTableTest.class.getSimpleName() );
     private static final String TEST_OUTPUT_PATH = "test.output.path";
 
-    JdbmMasterTable<Integer> table;
+    JdbmMasterTable<Entry> table;
     File dbFile;
     RecordManager recman;
     SchemaManager schemaManager = null;
@@ -98,10 +100,10 @@ public class JdbmMasterTableTest
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
 
-        table = new JdbmMasterTable<Integer>( recman, schemaManager );
+        table = new JdbmMasterTable<Entry>( recman, schemaManager );
         LOG.debug( "Created new table and populated it with data" );
 
-        JdbmMasterTable<Integer> t2 = new JdbmMasterTable<Integer>( recman, schemaManager );
+        JdbmMasterTable<Entry> t2 = new JdbmMasterTable<Entry>( recman, schemaManager );
         t2.close();
     }
 
@@ -139,12 +141,7 @@ public class JdbmMasterTableTest
     @Test
     public void testAll() throws Exception
     {
-        assertNull( table.get( 0L ) );
+        assertNull( table.get( Strings.getUUID( 0L ) ) );
         assertEquals( 0, table.count() );
-
-        assertEquals( 1, ( long ) table.getNextId( null ) );
-        assertEquals( 0, table.count() );
-
-        assertEquals( 2, ( long ) table.getNextId( null ) );
     }
 }



Mime
View raw message