directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1199875 [1/3] - in /directory/apacheds/branches/apacheds-txns: core-annotations/src/main/java/org/apache/directory/server/core/factory/ core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ core-shared/src/main/java/org/ap...
Date Wed, 09 Nov 2011 17:18:54 GMT
Author: saya
Date: Wed Nov  9 17:18:53 2011
New Revision: 1199875

URL: http://svn.apache.org/viewvc?rev=1199875&view=rev
Log:
changed transactions packge to use UUID instead of generic ID.

Added:
    directory/apacheds/branches/apacheds-txns/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/UUIDSerializer.java
Modified:
    directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
    directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
    directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
    directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/AbstractTransaction.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnLogManager.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexCursorWrapper.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexWrapper.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadOnlyTxn.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadWriteTxn.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/Transaction.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/TxnIndexCursor.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/TxnManagerFactory.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/TxnManagerInternal.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryAddDelete.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/EntryChange.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/TxnStateChange.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/test/java/org/apache/directory/server/core/shared/txn/DefaultTxnManagerTest.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/test/java/org/apache/directory/server/core/shared/txn/EntryUpdateMergeTest.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/test/java/org/apache/directory/server/core/shared/txn/IndexCursorWrapperTest.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/test/java/org/apache/directory/server/core/shared/txn/TxnConflicTest.java
    directory/apacheds/branches/apacheds-txns/core-shared/src/test/java/org/apache/directory/server/core/shared/txn/TxnIndexCursorTest.java
    directory/apacheds/branches/apacheds-txns/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
    directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
    directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
    directory/apacheds/branches/apacheds-txns/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/AttributesTableModel.java
    directory/apacheds/branches/apacheds-txns/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/EntryNode.java
    directory/apacheds/branches/apacheds-txns/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/IndexDialog.java
    directory/apacheds/branches/apacheds-txns/xdbm-tools/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
    directory/apacheds/branches/apacheds-txns/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/IndexDialog.java
    directory/apacheds/branches/apacheds-txns/xdbm-tools/src/main/java/org/apache/directory/server/xdbm/tools/IndexUtils.java

Modified: directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/AvlPartitionFactory.java Wed Nov  9 17:18:53 2011
@@ -66,9 +66,9 @@ public class AvlPartitionFactory impleme
         }
 
         AvlPartition avlPartition = ( AvlPartition ) partition;
-        Set<Index<?, Entry, Long>> indexedAttributes = avlPartition.getIndexedAttributes();
+        Set<Index<?>> indexedAttributes = avlPartition.getIndexedAttributes();
 
-        AvlIndex<Object, Entry> index = new AvlIndex<Object, Entry>( attributeId );
+        AvlIndex<Object> index = new AvlIndex<Object>( attributeId );
         //index.setCacheSize( cacheSize );
 
         indexedAttributes.add( index );

Modified: directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/DSAnnotationProcessor.java Wed Nov  9 17:18:53 2011
@@ -166,9 +166,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-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/JdbmPartitionFactory.java Wed Nov  9 17:18:53 2011
@@ -67,9 +67,9 @@ public class JdbmPartitionFactory implem
         }
 
         JdbmPartition jdbmPartition = ( JdbmPartition ) partition;
-        Set<Index<?, Entry, Long>> indexedAttributes = jdbmPartition.getIndexedAttributes();
+        Set<Index<?>> indexedAttributes = jdbmPartition.getIndexedAttributes();
 
-        JdbmIndex<Object, Entry> index = new JdbmIndex<Object, Entry>( attributeId );
+        JdbmIndex<Object> index = new JdbmIndex<Object>( attributeId );
         index.setCacheSize( cacheSize );
 
         indexedAttributes.add( index );

Modified: directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-annotations/src/main/java/org/apache/directory/server/core/factory/LdifPartitionFactory.java Wed Nov  9 17:18:53 2011
@@ -66,9 +66,9 @@ public class LdifPartitionFactory implem
         }
 
         LdifPartition ldifPartition = ( LdifPartition ) partition;
-        Set<Index<?, Entry, Long>> indexedAttributes = ldifPartition.getIndexedAttributes();
+        Set<Index<?>> indexedAttributes = ldifPartition.getIndexedAttributes();
 
-        AvlIndex<Object, Entry> index = new AvlIndex<Object, Entry>( attributeId );
+        AvlIndex<Object> index = new AvlIndex<Object>( attributeId );
         //index.setCacheSize( cacheSize );
 
         indexedAttributes.add( index );

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/AbstractTransaction.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/AbstractTransaction.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/AbstractTransaction.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/AbstractTransaction.java Wed Nov  9 17:18:53 2011
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.UUID;
 
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -30,7 +31,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-abstract class AbstractTransaction<ID> implements Transaction<ID>
+abstract class AbstractTransaction implements Transaction
 {
     /** Logical time(LSN in the wal) when the txn began */ 
     long startTime;
@@ -42,7 +43,7 @@ abstract class AbstractTransaction<ID> i
     State txnState;
     
     /** List of txns that this txn depends */
-    List<ReadWriteTxn<ID>> txnsToCheck = new ArrayList<ReadWriteTxn<ID>>();
+    List<ReadWriteTxn> txnsToCheck = new ArrayList<ReadWriteTxn>();
  
     
     /**
@@ -104,7 +105,7 @@ abstract class AbstractTransaction<ID> i
     /**
      * {@inheritDoc}
      */  
-    public List<ReadWriteTxn<ID>> getTxnsToCheck()
+    public List<ReadWriteTxn> getTxnsToCheck()
     {
         return txnsToCheck;
     }
@@ -128,14 +129,14 @@ abstract class AbstractTransaction<ID> i
     }
     
     
-    public Entry mergeUpdates( Dn partitionDn, ID entryID, Entry entry )
+    public Entry mergeUpdates( Dn partitionDn, UUID entryID, Entry entry )
     {
         Entry prevEntry  = entry;
         Entry curEntry = entry;
-        ReadWriteTxn<ID> curTxn;
+        ReadWriteTxn curTxn;
         boolean cloneOnChange = true;
         
-        Iterator<ReadWriteTxn<ID>> it = txnsToCheck.iterator();
+        Iterator<ReadWriteTxn> it = txnsToCheck.iterator();
         
         while ( it.hasNext() )
         {

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnLogManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnLogManager.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnLogManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnLogManager.java Wed Nov  9 17:18:53 2011
@@ -22,6 +22,7 @@ package org.apache.directory.server.core
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.log.UserLogRecord;
 import org.apache.directory.server.core.api.log.Log;
@@ -41,13 +42,13 @@ import org.apache.directory.server.core.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DefaultTxnLogManager<ID> implements TxnLogManager<ID>
+public class DefaultTxnLogManager implements TxnLogManager
 {
     /** Write ahead log */
     private Log wal;
     
     /** Txn Manager */
-    private TxnManagerInternal<ID> txnManager;
+    private TxnManagerInternal txnManager;
     
     
     /**
@@ -56,7 +57,7 @@ public class DefaultTxnLogManager<ID> im
      * @param logger write ahead logger
      * @param txnManager txn Manager
      */
-    public void init( Log logger, TxnManagerInternal<ID> txnManager )
+    public void init( Log logger, TxnManagerInternal txnManager )
     {
         wal = logger;
         this.txnManager = txnManager;
@@ -66,16 +67,16 @@ public class DefaultTxnLogManager<ID> im
     /**
      * {@inheritDoc}
      */
-    public void log( LogEdit<ID> logEdit, boolean sync ) throws IOException
+    public void log( LogEdit logEdit, boolean sync ) throws IOException
     {
-        Transaction<ID> curTxn = txnManager.getCurTxn();
+        Transaction curTxn = txnManager.getCurTxn();
        
         if ( ( curTxn == null ) || ( ! ( curTxn instanceof ReadWriteTxn ) ) )
         {
             throw new IllegalStateException( "Trying to log logedit without ReadWriteTxn" );
         }
        
-        ReadWriteTxn<ID> txn = (ReadWriteTxn<ID>)curTxn;
+        ReadWriteTxn txn = (ReadWriteTxn)curTxn;
         UserLogRecord logRecord = txn.getUserLogRecord();
        
         ObjectOutputStream out = null;
@@ -131,9 +132,9 @@ public class DefaultTxnLogManager<ID> im
     /**
      * {@inheritDoc}
      */
-    public Entry mergeUpdates(Dn partitionDn, ID entryID,  Entry entry )
+    public Entry mergeUpdates(Dn partitionDn, UUID entryID,  Entry entry )
     {
-         Transaction<ID> curTxn = txnManager.getCurTxn();
+         Transaction curTxn = txnManager.getCurTxn();
          
          if ( ( curTxn == null ) )
          {
@@ -147,9 +148,9 @@ public class DefaultTxnLogManager<ID> im
     /**
      * {@inheritDoc}
      */
-    public IndexCursor<Object, Entry, ID> wrap( Dn partitionDn, IndexCursor<Object, Entry, ID> wrappedCursor, IndexComparator<Object,ID> comparator, String attributeOid, boolean forwardIndex, Object onlyValueKey, ID onlyIDKey ) throws Exception
+    public IndexCursor<Object> wrap( Dn partitionDn, IndexCursor<Object> wrappedCursor, IndexComparator<Object> comparator, String attributeOid, boolean forwardIndex, Object onlyValueKey, UUID onlyIDKey ) throws Exception
     {
-        return new IndexCursorWrapper<ID>( partitionDn, wrappedCursor, comparator, attributeOid, forwardIndex, onlyValueKey, onlyIDKey );
+        return new IndexCursorWrapper( partitionDn, wrappedCursor, comparator, attributeOid, forwardIndex, onlyValueKey, onlyIDKey );
     }
     
 
@@ -173,7 +174,7 @@ public class DefaultTxnLogManager<ID> im
 
     private void addDnSet( Dn baseDn, SearchScope scope, boolean read )
     {
-        Transaction<ID> curTxn = txnManager.getCurTxn();
+        Transaction curTxn = txnManager.getCurTxn();
 
         if ( ( curTxn == null ) )
         {

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/DefaultTxnManager.java Wed Nov  9 17:18:53 2011
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.server.core.shared.txn;
 
+
 import org.apache.directory.server.core.api.partition.index.Serializer;
 import org.apache.directory.server.core.api.txn.TxnConflictException;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
@@ -32,7 +33,6 @@ import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 
-
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -49,91 +49,67 @@ import java.io.IOException;
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-/** Package protected */ class DefaultTxnManager<ID> implements  TxnManagerInternal<ID>
+/** Package protected */
+class DefaultTxnManager implements TxnManagerInternal
 {
     /** wal log manager */
-    private TxnLogManager<ID> txnLogManager;
-    
+    private TxnLogManager txnLogManager;
+
     /** List of committed txns in commit LSN order */
-    private ConcurrentLinkedQueue<ReadWriteTxn<ID>> committedQueue = new ConcurrentLinkedQueue<ReadWriteTxn<ID>>();
-    
+    private ConcurrentLinkedQueue<ReadWriteTxn> committedQueue = new ConcurrentLinkedQueue<ReadWriteTxn>();
+
     /** Verify lock under which txn verification is done */
     private Lock verifyLock = new ReentrantLock();
-    
+
     /** Used to assign start and commit version numbers to writeTxns */
     private Lock writeTxnsLock = new ReentrantLock();
-    
+
     /** Latest committed txn on which read only txns can depend */
-    private AtomicReference<ReadWriteTxn<ID>> latestCommittedTxn = new AtomicReference<ReadWriteTxn<ID>>();
-    
+    private AtomicReference<ReadWriteTxn> latestCommittedTxn = new AtomicReference<ReadWriteTxn>();
+
     /** Latest verified write txn */
-    private AtomicReference<ReadWriteTxn<ID>> latestVerifiedTxn = new AtomicReference<ReadWriteTxn<ID>>();
-    
+    private AtomicReference<ReadWriteTxn> latestVerifiedTxn = new AtomicReference<ReadWriteTxn>();
+
     /** Latest flushed txn's logical commit time */
     private AtomicLong latestFlushedTxnLSN = new AtomicLong( LogAnchor.UNKNOWN_LSN );
-    
-    /** ID comparator */
-    private Comparator<ID> idComparator;
-    
-    /** ID serializer */
-    private Serializer idSerializer ;
-    
+
     /** Per thread txn context */
-    static final ThreadLocal < Transaction > txnVar = 
-         new ThreadLocal < Transaction > () 
-         {
-             @Override 
-             protected Transaction initialValue()
-             {
-                 return null;
-             }
+    static final ThreadLocal<Transaction> txnVar =
+        new ThreadLocal<Transaction>()
+        {
+            @Override
+            protected Transaction initialValue()
+            {
+                return null;
+            }
         };
-    
+
+
     /**
      * TODO : doco
      * @param txnLogManager
      * @param idComparator
      * @param idSerializer
      */
-    public void init( TxnLogManager<ID> txnLogManager, Comparator<ID> idComparator, Serializer idSerializer )
+    public void init( TxnLogManager txnLogManager )
     {
         this.txnLogManager = txnLogManager;
-        this.idComparator = idComparator;
-        this.idSerializer = idSerializer;
     }
-    
-    
-    /**
-     * {@inheritDoc}
-     */
-    public Comparator<ID> getIDComparator()
-    {
-        return idComparator;
-    }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
-    public Serializer getIDSerializer()
-    {
-        return idSerializer;
-    }
-    
-    
-    /**
-     * {@inheritDoc}
-     */  
     public void beginTransaction( boolean readOnly ) throws IOException
     {
-        Transaction<ID> curTxn = getCurTxn();
-        
+        Transaction curTxn = getCurTxn();
+
         if ( curTxn != null )
         {
-            throw new IllegalStateException("Cannot begin a txn when txn is already running: " + 
-                curTxn);
+            throw new IllegalStateException( "Cannot begin a txn when txn is already running: " +
+                curTxn );
         }
-        
+
         if ( readOnly )
         {
             beginReadOnlyTxn();
@@ -144,77 +120,77 @@ import java.io.IOException;
         }
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
     public void commitTransaction() throws IOException, TxnConflictException
     {
-        Transaction<ID> txn = getCurTxn();
-        
+        Transaction txn = getCurTxn();
+
         if ( txn == null )
         {
-            throw new IllegalStateException(" trying to commit non existent txn ");
+            throw new IllegalStateException( " trying to commit non existent txn " );
         }
-        
+
         prepareForEndingTxn( txn );
-        
+
         if ( txn instanceof ReadOnlyTxn )
         {
             txn.commitTxn( txn.getStartTime() );
         }
         else
         {
-            commitReadWriteTxn( (ReadWriteTxn<ID>)txn );
+            commitReadWriteTxn( ( ReadWriteTxn ) txn );
         }
-        
+
         txnVar.set( null );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public void abortTransaction() throws IOException
     {
-        Transaction<ID> txn = getCurTxn();
-        
+        Transaction txn = getCurTxn();
+
         if ( txn == null )
         {
             // this is acceptable
             return;
         }
-        
+
         prepareForEndingTxn( txn );
-        
+
         if ( txn instanceof ReadWriteTxn )
         {
-            abortReadWriteTxn( (ReadWriteTxn<ID>)txn );
+            abortReadWriteTxn( ( ReadWriteTxn ) txn );
         }
-        
+
         txn.abortTxn();
         txnVar.set( null );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     @SuppressWarnings("unchecked")
-    public Transaction<ID> getCurTxn()
+    public Transaction getCurTxn()
     {
-       return (Transaction<ID>)txnVar.get(); 
+        return ( Transaction ) txnVar.get();
     }
-    
-    
+
+
     /**
      * Begins a read only txn. A read only txn does not put any log edits
      * to the txn log.Its start time is the latest committed txn's commit time. 
      */
     private void beginReadOnlyTxn()
     {
-        ReadOnlyTxn<ID> txn = new ReadOnlyTxn<ID>();
-        ReadWriteTxn<ID> lastTxnToCheck = null;
+        ReadOnlyTxn txn = new ReadOnlyTxn();
+        ReadWriteTxn lastTxnToCheck = null;
 
         /*
          * Set the start time as the latest committed txn's commit time. We need to make sure that
@@ -259,7 +235,7 @@ import java.io.IOException;
         buildCheckList( txn, lastTxnToCheck );
         txnVar.set( txn );
     }
-    
+
 
     /**
      * Begins a read write txn. A start txn marker is inserted
@@ -269,10 +245,10 @@ import java.io.IOException;
     private void beginReadWriteTxn() throws IOException
     {
 
-        ReadWriteTxn<ID> txn = new ReadWriteTxn<ID>();
+        ReadWriteTxn txn = new ReadWriteTxn();
         UserLogRecord logRecord = txn.getUserLogRecord();
 
-        TxnStateChange<ID> txnRecord = new TxnStateChange<ID>( LogAnchor.UNKNOWN_LSN,
+        TxnStateChange txnRecord = new TxnStateChange( LogAnchor.UNKNOWN_LSN,
             TxnStateChange.State.TXN_BEGIN );
         ObjectOutputStream out = null;
         ByteArrayOutputStream bout = null;
@@ -306,7 +282,7 @@ import java.io.IOException;
          * when mergin data under te writeTxnLock.
          */
 
-        ReadWriteTxn<ID> lastTxnToCheck = null;
+        ReadWriteTxn lastTxnToCheck = null;
         writeTxnsLock.lock();
 
         try
@@ -342,7 +318,7 @@ import java.io.IOException;
 
         txnVar.set( txn );
     }
-    
+
 
     /**
      * Builds the list of txns which the given txn should check while mergin what it read from
@@ -353,15 +329,15 @@ import java.io.IOException;
      * @param txn txn for which we will build the check list
      * @param lastTxnToCheck latest txn to check
      */
-    private void buildCheckList( Transaction<ID> txn, ReadWriteTxn<ID> lastTxnToCheck )
+    private void buildCheckList( Transaction txn, ReadWriteTxn lastTxnToCheck )
     {
         if ( lastTxnToCheck != null )
         {
             long lastLSN = lastTxnToCheck.getCommitTime();
-            ReadWriteTxn<ID> toAdd;
+            ReadWriteTxn toAdd;
 
-            List<ReadWriteTxn<ID>> toCheckList = txn.getTxnsToCheck();
-            Iterator<ReadWriteTxn<ID>> it = committedQueue.iterator();
+            List<ReadWriteTxn> toCheckList = txn.getTxnsToCheck();
+            Iterator<ReadWriteTxn> it = committedQueue.iterator();
 
             while ( it.hasNext() )
             {
@@ -381,7 +357,7 @@ import java.io.IOException;
             long flushedLSN = latestFlushedTxnLSN.get();
 
             it = toCheckList.iterator();
-            ReadWriteTxn<ID> toCheck;
+            ReadWriteTxn toCheck;
 
             while ( it.hasNext() )
             {
@@ -397,21 +373,21 @@ import java.io.IOException;
         // A read write txn, always has to check its changes
         if ( txn instanceof ReadWriteTxn )
         {
-            txn.getTxnsToCheck().add( ( ReadWriteTxn<ID> ) txn );
+            txn.getTxnsToCheck().add( ( ReadWriteTxn ) txn );
         }
     }
-    
-    
+
+
     /**
      * Called before ending a txn. Txn for which this txn bumped 
      * up the ref count is gotten and its ref count is decreased.
      *
      * @param txn txn which is about to commit or abort
      */
-    private void prepareForEndingTxn( Transaction<ID> txn )
+    private void prepareForEndingTxn( Transaction txn )
     {
-        List<ReadWriteTxn<ID>> toCheck = txn.getTxnsToCheck();
-        
+        List<ReadWriteTxn> toCheck = txn.getTxnsToCheck();
+
         // A read write txn, always has to check its changes
         if ( txn instanceof ReadWriteTxn )
         {
@@ -422,30 +398,30 @@ import java.io.IOException;
                     " prepareForEndingTxn: a read write txn should at least depend on itself:" + txn );
             }
 
-            txn.getTxnsToCheck().remove( ( ReadWriteTxn<ID> ) txn );
+            txn.getTxnsToCheck().remove( ( ReadWriteTxn ) txn );
         }
-        
+
         if ( toCheck.size() > 0 )
         {
-            ReadWriteTxn<ID> lastTxnToCheck = toCheck.get( toCheck.size() - 1 );
-            
+            ReadWriteTxn lastTxnToCheck = toCheck.get( toCheck.size() - 1 );
+
             if ( lastTxnToCheck.commitTime > txn.getStartTime() )
             {
-                throw new IllegalStateException( " prepareForEndingTxn: txn has unpexptected start time " + 
+                throw new IllegalStateException( " prepareForEndingTxn: txn has unpexptected start time " +
                     txn + " expected: " + lastTxnToCheck );
             }
-            
+
             if ( lastTxnToCheck.getRefCount().get() <= 0 )
             {
-                throw new IllegalStateException( " prepareForEndingTxn: lastTxnToCheck has unexpected ref cnt " + 
+                throw new IllegalStateException( " prepareForEndingTxn: lastTxnToCheck has unexpected ref cnt " +
                     txn + " expected: " + lastTxnToCheck );
             }
-            
+
             lastTxnToCheck.getRefCount().decrementAndGet();
         }
     }
-    
-    
+
+
     /**
      * Tries to commit the given read write txn. Before a read write txn can commit, it is
      * verified against the txns that committed after this txn started. If a conflicting change is
@@ -470,11 +446,11 @@ import java.io.IOException;
      * @throws IOException
      * @throws TxnConflictException
      */
-    private void commitReadWriteTxn( ReadWriteTxn<ID> txn ) throws IOException, TxnConflictException
+    private void commitReadWriteTxn( ReadWriteTxn txn ) throws IOException, TxnConflictException
     {
         UserLogRecord logRecord = txn.getUserLogRecord();
 
-        TxnStateChange<ID> txnRecord = new TxnStateChange<ID>( txn.getStartTime(),
+        TxnStateChange txnRecord = new TxnStateChange( txn.getStartTime(),
             TxnStateChange.State.TXN_COMMIT );
         ObjectOutputStream out = null;
         ByteArrayOutputStream bout = null;
@@ -502,14 +478,14 @@ import java.io.IOException;
         }
 
         logRecord.setData( data, data.length );
-        
+
         verifyLock.lock();
-       
+
         //Verify txn and throw conflict exception if necessary
-        Iterator<ReadWriteTxn<ID>> it = committedQueue.iterator();
-        ReadWriteTxn<ID> toCheckTxn;
+        Iterator<ReadWriteTxn> it = committedQueue.iterator();
+        ReadWriteTxn toCheckTxn;
         long startTime = txn.getStartTime();
-        
+
         while ( it.hasNext() )
         {
             toCheckTxn = it.next();
@@ -526,20 +502,20 @@ import java.io.IOException;
                 throw new TxnConflictException();
             }
         }
-        
+
         writeTxnsLock.lock();
-        
+
         try
         {
-           // TODO sync of log can be done outside the locks. 
-           txnLogManager.log( logRecord, true );
-           txn.commitTxn( logRecord.getLogAnchor().getLogLSN() );
-           
-           latestVerifiedTxn.set( txn );
-           committedQueue.offer( txn );
-           
-           // TODO when sync is done outside the locks, advance latest commit outside the locks
-           latestCommittedTxn.set( txn );
+            // TODO sync of log can be done outside the locks. 
+            txnLogManager.log( logRecord, true );
+            txn.commitTxn( logRecord.getLogAnchor().getLogLSN() );
+
+            latestVerifiedTxn.set( txn );
+            committedQueue.offer( txn );
+
+            // TODO when sync is done outside the locks, advance latest commit outside the locks
+            latestCommittedTxn.set( txn );
         }
         finally
         {
@@ -547,7 +523,7 @@ import java.io.IOException;
             verifyLock.unlock();
         }
     }
-    
+
 
     /**
      * Aborts a read write txn. An abort record is inserted into the txn log.
@@ -555,11 +531,11 @@ import java.io.IOException;
      * @param txn txn to abort
      * @throws IOException
      */
-    private void abortReadWriteTxn( ReadWriteTxn<ID> txn ) throws IOException
+    private void abortReadWriteTxn( ReadWriteTxn txn ) throws IOException
     {
         UserLogRecord logRecord = txn.getUserLogRecord();
 
-        TxnStateChange<ID> txnRecord = new TxnStateChange<ID>( txn.getStartTime(),
+        TxnStateChange txnRecord = new TxnStateChange( txn.getStartTime(),
             TxnStateChange.State.TXN_ABORT );
         ObjectOutputStream out = null;
         ByteArrayOutputStream bout = null;

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexCursorWrapper.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexCursorWrapper.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexCursorWrapper.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexCursorWrapper.java Wed Nov  9 17:18:53 2011
@@ -21,6 +21,7 @@ package org.apache.directory.server.core
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
@@ -49,13 +50,13 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class IndexCursorWrapper<ID> extends AbstractIndexCursor<Object, Entry, ID>
+public class IndexCursorWrapper extends AbstractIndexCursor<Object>
 {
     /** Cursors to merge */
-    private ArrayList<IndexCursor<Object, Entry, ID>> cursors;
+    private ArrayList<IndexCursor<Object>> cursors;
     
     /** list of values available per cursor */
-    private ArrayList<IndexEntry<Object,ID>> values;
+    private ArrayList<IndexEntry<Object>> values;
     
     /** index get should get the value from */
     private int getIndex = -1;
@@ -70,7 +71,7 @@ public class IndexCursorWrapper<ID> exte
     private boolean forwardIndex;
     
     /** List of txns that this cursor depends on */
-    private ArrayList<ReadWriteTxn<ID>> txns;
+    private ArrayList<ReadWriteTxn> txns;
     
     /** True if cursor is positioned */
     private boolean positioned;
@@ -79,32 +80,32 @@ public class IndexCursorWrapper<ID> exte
     boolean movingNext = true;
     
     /** Comparator used to order the index entries */
-    private IndexComparator<Object,ID> comparator;
+    private IndexComparator<Object> comparator;
     
     /** unsupported operation message */
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_722 );
     
-    public IndexCursorWrapper( Dn partitionDn, IndexCursor<Object, Entry, ID> wrappedCursor, IndexComparator<Object,ID> comparator, String attributeOid, boolean forwardIndex, Object onlyValueKey, ID onlyIDKey )
+    public IndexCursorWrapper( Dn partitionDn, IndexCursor<Object> wrappedCursor, IndexComparator<Object> comparator, String attributeOid, boolean forwardIndex, Object onlyValueKey, UUID onlyIDKey )
     {
         this.partitionDn = partitionDn;
         this.forwardIndex = forwardIndex;
         this.attributeOid = attributeOid;
         this.comparator = comparator;
         
-        TxnManagerInternal<ID> txnManager = TxnManagerFactory.<ID>txnManagerInternalInstance();      
-        Transaction<ID> curTxn = txnManager.getCurTxn();  
-        List<ReadWriteTxn<ID>> toCheck = curTxn.getTxnsToCheck(); 
-        
-        cursors = new ArrayList<IndexCursor<Object, Entry, ID>>( toCheck.size() + 1 );
-        values = new ArrayList<IndexEntry<Object,ID>>( toCheck.size() + 1 );
-        cursors.add( ( IndexCursor<Object, Entry, ID> )wrappedCursor );
+        TxnManagerInternal txnManager = TxnManagerFactory.txnManagerInternalInstance();      
+        Transaction curTxn = txnManager.getCurTxn();  
+        List<ReadWriteTxn> toCheck = curTxn.getTxnsToCheck(); 
+        
+        cursors = new ArrayList<IndexCursor<Object>>( toCheck.size() + 1 );
+        values = new ArrayList<IndexEntry<Object>>( toCheck.size() + 1 );
+        cursors.add( ( IndexCursor<Object> )wrappedCursor );
         values.add( null );
         
         if ( toCheck.size() > 0 )
         {
-            txns = new ArrayList<ReadWriteTxn<ID>>( toCheck.size() );
+            txns = new ArrayList<ReadWriteTxn>( toCheck.size() );
             
-            ReadWriteTxn<ID> dependentTxn;
+            ReadWriteTxn dependentTxn;
             
             for ( int idx = 0; idx < toCheck.size(); idx++ )
             {
@@ -131,12 +132,12 @@ public class IndexCursorWrapper<ID> exte
     /**
      * {@inheritDoc}
      */
-    public void after( IndexEntry<Object, ID> element ) throws Exception
+    public void after( IndexEntry<Object> element ) throws Exception
     {
         int idx;
         positioned = true;
         movingNext = true;
-        IndexCursor<Object,Entry,ID> cursor;
+        IndexCursor<Object> cursor;
         
         checkNotClosed( "after()" );
         
@@ -157,12 +158,12 @@ public class IndexCursorWrapper<ID> exte
     /**
      * {@inheritDoc}
      */
-    public void before( IndexEntry<Object, ID> element ) throws Exception
+    public void before( IndexEntry<Object> element ) throws Exception
     {
         int idx;
         positioned = true;
         movingNext = true;
-        IndexCursor<Object,Entry,ID> cursor;
+        IndexCursor<Object> cursor;
         
         checkNotClosed( "before()" );
         
@@ -184,12 +185,12 @@ public class IndexCursorWrapper<ID> exte
     /**
      * {@inheritDoc}
      */
-    public void afterValue( ID id, Object value ) throws Exception
+    public void afterValue( UUID id, Object value ) throws Exception
     {
         int idx;
         positioned = true;
         movingNext = true;
-        IndexCursor<Object,Entry,ID> cursor;
+        IndexCursor<Object> cursor;
         
         checkNotClosed( "afterValue()" );
         
@@ -211,12 +212,12 @@ public class IndexCursorWrapper<ID> exte
     /**
      * {@inheritDoc}
      */
-    public void beforeValue( ID id, Object value ) throws Exception
+    public void beforeValue( UUID id, Object value ) throws Exception
     {
         int idx;
         positioned = true;
         movingNext = true;
-        IndexCursor<Object,Entry,ID> cursor;
+        IndexCursor<Object> cursor;
         
         checkNotClosed( "beforeValue()" );
         
@@ -243,7 +244,7 @@ public class IndexCursorWrapper<ID> exte
         int idx;
         positioned = true;
         movingNext = true;
-        IndexCursor<Object,Entry,ID> cursor;
+        IndexCursor<Object> cursor;
         
         checkNotClosed( "beforeFirst()" );
         
@@ -270,7 +271,7 @@ public class IndexCursorWrapper<ID> exte
         int idx;
         positioned = true;
         movingNext = false;
-        IndexCursor<Object,Entry,ID> cursor;
+        IndexCursor<Object> cursor;
         
         checkNotClosed( "afterLast()" );
         
@@ -317,13 +318,13 @@ public class IndexCursorWrapper<ID> exte
      */
     public boolean next() throws Exception
     {
-        IndexCursor<Object,Entry,ID> cursor;
-        IndexEntry<Object,ID> minValue;
-        IndexEntry<Object,ID> value;
+        IndexCursor<Object> cursor;
+        IndexEntry<Object> minValue;
+        IndexEntry<Object> value;
         
         checkNotClosed( "next()" );
         
-        IndexEntry<Object,ID> lastValue = null;
+        IndexEntry<Object> lastValue = null;
         
         if ( getIndex >= 0 )
         {
@@ -376,7 +377,7 @@ public class IndexCursorWrapper<ID> exte
         }
         
         int txnIdx;
-        ReadWriteTxn<ID> curTxn;
+        ReadWriteTxn curTxn;
         boolean valueDeleted;
         
         do
@@ -428,13 +429,13 @@ public class IndexCursorWrapper<ID> exte
      */
     public boolean previous() throws Exception
     {
-        IndexCursor<Object,Entry,ID> cursor;
-        IndexEntry<Object,ID> maxValue;
-        IndexEntry<Object,ID> value;
+        IndexCursor<Object> cursor;
+        IndexEntry<Object> maxValue;
+        IndexEntry<Object> value;
         
         checkNotClosed( "previous()" );
         
-        IndexEntry<Object,ID> lastValue = null;
+        IndexEntry<Object> lastValue = null;
         
         if ( getIndex >= 0 )
         {
@@ -488,7 +489,7 @@ public class IndexCursorWrapper<ID> exte
         }
         
         int txnIdx;
-        ReadWriteTxn<ID> curTxn;
+        ReadWriteTxn curTxn;
         boolean valueDeleted;
         
         do
@@ -538,13 +539,13 @@ public class IndexCursorWrapper<ID> exte
     /**
      * {@inheritDoc}
      */
-    public IndexEntry<Object, ID> get() throws Exception
+    public IndexEntry<Object> get() throws Exception
     {
         checkNotClosed( "get()" );
         
         if ( getIndex >= 0 )
         {
-            IndexEntry<Object,ID> value = values.get( getIndex );
+            IndexEntry<Object> value = values.get( getIndex );
             
             if ( value == null )
             {
@@ -566,7 +567,7 @@ public class IndexCursorWrapper<ID> exte
     {
         super.close();
         
-        IndexCursor<Object,Entry,ID> cursor;
+        IndexCursor<Object> cursor;
         int idx;
         
         for ( idx = 0; idx < cursors.size(); idx++ )
@@ -589,7 +590,7 @@ public class IndexCursorWrapper<ID> exte
     {
         super.close( cause );
         
-        IndexCursor<Object,Entry,ID> cursor;
+        IndexCursor<Object> cursor;
         int idx;
         
         for ( idx = 0; idx < cursors.size(); idx++ )
@@ -620,9 +621,9 @@ public class IndexCursorWrapper<ID> exte
      */
     private void recomputeMinimum() throws Exception
     {
-        IndexCursor<Object,Entry,ID> cursor;
-        IndexEntry<Object,ID> minValue;
-        IndexEntry<Object,ID> value;
+        IndexCursor<Object> cursor;
+        IndexEntry<Object> minValue;
+        IndexEntry<Object> value;
         int idx;
         
         cursor = cursors.get( getIndex );
@@ -662,9 +663,9 @@ public class IndexCursorWrapper<ID> exte
      */
     private void recomputeMaximum() throws Exception
     {
-        IndexCursor<Object,Entry,ID> cursor;
-        IndexEntry<Object,ID> maxValue;
-        IndexEntry<Object,ID> value;
+        IndexCursor<Object> cursor;
+        IndexEntry<Object> maxValue;
+        IndexEntry<Object> value;
         int idx;
         
         cursor = cursors.get( getIndex );

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexWrapper.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexWrapper.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexWrapper.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/IndexWrapper.java Wed Nov  9 17:18:53 2011
@@ -22,11 +22,13 @@ package org.apache.directory.server.core
 
 import java.net.URI;
 import java.util.Comparator;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.index.ForwardIndexComparator;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.ReverseIndexComparator;
+import org.apache.directory.server.core.api.partition.index.UUIDComparator;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
 
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
@@ -38,10 +40,10 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class IndexWrapper<ID> implements Index<Object, Entry, ID>
+public class IndexWrapper implements Index<Object>
 {
     /** wrapped index */ 
-    Index<Object,Entry,ID> wrappedIndex;
+    Index<Object> wrappedIndex;
     
     /** partition the table belongs to */
     private Dn partitionDn;
@@ -156,9 +158,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public ID forwardLookup( Object attrVal ) throws Exception
+    public UUID forwardLookup( Object attrVal ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = forwardCursor( attrVal );
+        IndexCursor<Object> cursor = forwardCursor( attrVal );
         
         try
         {
@@ -181,9 +183,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public Object reverseLookup( ID id ) throws Exception
+    public Object reverseLookup( UUID id ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = reverseCursor( id );
+        IndexCursor<Object> cursor = reverseCursor( id );
         
         try
         {
@@ -206,7 +208,7 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public void add( Object attrVal, ID id ) throws Exception
+    public void add( Object attrVal, UUID id ) throws Exception
     {
         wrappedIndex.add( attrVal, id );
     }
@@ -215,7 +217,7 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public void drop( ID entryId ) throws Exception
+    public void drop( UUID entryId ) throws Exception
     {
         wrappedIndex.drop( entryId );
     }
@@ -224,7 +226,7 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public void drop( Object attrVal, ID id ) throws Exception
+    public void drop( Object attrVal, UUID id ) throws Exception
     {
         wrappedIndex.drop( attrVal, id );
     }
@@ -233,11 +235,11 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public IndexCursor<Object, Entry, ID> reverseCursor() throws Exception
+    public IndexCursor<Object> reverseCursor() throws Exception
     {
-        IndexCursor<Object, Entry, ID> wrappedCursor;
-        IndexCursor<Object, Entry, ID> cursor = wrappedIndex.reverseCursor();
-        TxnLogManager<ID> logManager = TxnManagerFactory.<ID>txnLogManagerInstance();
+        IndexCursor<Object> wrappedCursor;
+        IndexCursor<Object> cursor = wrappedIndex.reverseCursor();
+        TxnLogManager logManager = TxnManagerFactory.txnLogManagerInstance();
         
         try
         {
@@ -257,11 +259,11 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public IndexCursor<Object, Entry, ID> forwardCursor() throws Exception
+    public IndexCursor<Object> forwardCursor() throws Exception
     {
-        IndexCursor<Object, Entry, ID> wrappedCursor;
-        IndexCursor<Object, Entry, ID> cursor = wrappedIndex.reverseCursor();
-        TxnLogManager<ID> logManager = TxnManagerFactory.<ID>txnLogManagerInstance();
+        IndexCursor<Object> wrappedCursor;
+        IndexCursor<Object> cursor = wrappedIndex.reverseCursor();
+        TxnLogManager logManager = TxnManagerFactory.txnLogManagerInstance();
         
         try
         {
@@ -281,11 +283,11 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public IndexCursor<Object, Entry, ID> reverseCursor( ID id ) throws Exception
+    public IndexCursor<Object> reverseCursor( UUID id ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> wrappedCursor;
-        IndexCursor<Object, Entry, ID> cursor = wrappedIndex.reverseCursor();
-        TxnLogManager<ID> logManager = TxnManagerFactory.<ID>txnLogManagerInstance();
+        IndexCursor<Object> wrappedCursor;
+        IndexCursor<Object> cursor = wrappedIndex.reverseCursor();
+        TxnLogManager logManager = TxnManagerFactory.txnLogManagerInstance();
         
         try
         {
@@ -305,11 +307,11 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public IndexCursor<Object, Entry, ID> forwardCursor( Object key ) throws Exception
+    public IndexCursor<Object> forwardCursor( Object key ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> wrappedCursor;
-        IndexCursor<Object, Entry, ID> cursor = wrappedIndex.reverseCursor();
-        TxnLogManager<ID> logManager = TxnManagerFactory.<ID>txnLogManagerInstance();
+        IndexCursor<Object> wrappedCursor;
+        IndexCursor<Object> cursor = wrappedIndex.reverseCursor();
+        TxnLogManager logManager = TxnManagerFactory.txnLogManagerInstance();
         
         try
         {
@@ -329,7 +331,7 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public Cursor<Object> reverseValueCursor( ID id ) throws Exception
+    public Cursor<Object> reverseValueCursor( UUID id ) throws Exception
     {
         throw new UnsupportedOperationException();
     }
@@ -338,7 +340,7 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public Cursor<ID> forwardValueCursor( Object key ) throws Exception
+    public Cursor<UUID> forwardValueCursor( Object key ) throws Exception
     {
         throw new UnsupportedOperationException();
     }
@@ -349,7 +351,7 @@ public class IndexWrapper<ID> implements
      */
     public boolean forward( Object attrVal ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = forwardCursor( attrVal );
+        IndexCursor<Object> cursor = forwardCursor( attrVal );
         
         try
         {
@@ -370,10 +372,10 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean forward( Object attrVal, ID id ) throws Exception
+    public boolean forward( Object attrVal, UUID id ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = forwardCursor( attrVal );
-        Comparator<ID> idComp = wrappedIndex.getForwardIndexEntryComparator().getIDComparator();
+        IndexCursor<Object> cursor = forwardCursor( attrVal );
+        Comparator<UUID> idComp = UUIDComparator.INSTANCE;
         
         try
         {
@@ -396,9 +398,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean reverse( ID id ) throws Exception
+    public boolean reverse( UUID id ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = reverseCursor( id );
+        IndexCursor<Object> cursor = reverseCursor( id );
         
         try
         {
@@ -419,9 +421,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean reverse( ID id, Object attrVal ) throws Exception
+    public boolean reverse( UUID id, Object attrVal ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = reverseCursor( id );
+        IndexCursor<Object> cursor = reverseCursor( id );
         Comparator<Object> valueComp = wrappedIndex.getForwardIndexEntryComparator().getValueComparator();
         
         try
@@ -447,7 +449,7 @@ public class IndexWrapper<ID> implements
      */
     public boolean forwardGreaterOrEq( Object attrVal ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = forwardCursor();
+        IndexCursor<Object> cursor = forwardCursor();
         
         try
         {
@@ -470,9 +472,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean forwardGreaterOrEq( Object attrVal, ID id ) throws Exception
+    public boolean forwardGreaterOrEq( Object attrVal, UUID id ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = forwardCursor();
+        IndexCursor<Object> cursor = forwardCursor();
         
         try
         {
@@ -495,9 +497,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean reverseGreaterOrEq( ID id ) throws Exception
+    public boolean reverseGreaterOrEq( UUID id ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = reverseCursor();
+        IndexCursor<Object> cursor = reverseCursor();
         
         try
         {
@@ -520,9 +522,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean reverseGreaterOrEq( ID id, Object attrVal ) throws Exception
+    public boolean reverseGreaterOrEq( UUID id, Object attrVal ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = reverseCursor();
+        IndexCursor<Object> cursor = reverseCursor();
         
         try
         {
@@ -547,7 +549,7 @@ public class IndexWrapper<ID> implements
      */
     public boolean forwardLessOrEq( Object attrVal ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = forwardCursor();
+        IndexCursor<Object> cursor = forwardCursor();
         
         try
         {
@@ -570,9 +572,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean forwardLessOrEq( Object attrVal, ID id ) throws Exception
+    public boolean forwardLessOrEq( Object attrVal, UUID id ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = forwardCursor();
+        IndexCursor<Object> cursor = forwardCursor();
         
         try
         {
@@ -595,9 +597,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean reverseLessOrEq( ID id ) throws Exception
+    public boolean reverseLessOrEq( UUID id ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = reverseCursor();
+        IndexCursor<Object> cursor = reverseCursor();
         
         try
         {
@@ -620,9 +622,9 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public boolean reverseLessOrEq( ID id, Object attrVal ) throws Exception
+    public boolean reverseLessOrEq( UUID id, Object attrVal ) throws Exception
     {
-        IndexCursor<Object, Entry, ID> cursor = reverseCursor();
+        IndexCursor<Object> cursor = reverseCursor();
         
         try
         {
@@ -645,7 +647,7 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public ForwardIndexComparator<Object,ID> getForwardIndexEntryComparator()
+    public ForwardIndexComparator<Object> getForwardIndexEntryComparator()
     {
         return wrappedIndex.getForwardIndexEntryComparator();
     }
@@ -654,7 +656,7 @@ public class IndexWrapper<ID> implements
     /**
      * {@inheritDoc}
      */
-    public ReverseIndexComparator<Object,ID> getReverseIndexEntryComparator()
+    public ReverseIndexComparator<Object> getReverseIndexEntryComparator()
     {
         return wrappedIndex.getReverseIndexEntryComparator();
     }

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/MasterTableWrapper.java Wed Nov  9 17:18:53 2011
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.shared.txn;
 
 import java.util.Comparator;
+import java.util.UUID;
 
 import org.apache.directory.server.core.api.partition.index.MasterTable;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
@@ -33,10 +34,10 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class MasterTableWrapper<ID> implements MasterTable<ID, Entry>
+public class MasterTableWrapper implements MasterTable
 {
     /** Wrapped master table */
-    private MasterTable<ID, Entry> wrappedTable;
+    private MasterTable wrappedTable;
     
     /** partition the table belongs to */
     private Dn partitionDn;
@@ -44,7 +45,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public ID getNextId( Entry entry ) throws Exception
+    public UUID getNextId( Entry entry ) throws Exception
     {
         return wrappedTable.getNextId( entry );
     }
@@ -62,7 +63,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public Comparator<ID> getKeyComparator()
+    public Comparator<UUID> getKeyComparator()
     {
         return wrappedTable.getKeyComparator();
     }
@@ -98,7 +99,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public boolean has( ID key ) throws Exception
+    public boolean has( UUID key ) throws Exception
     {
         return ( get( key ) != null );
     }
@@ -107,7 +108,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public boolean has( ID key, Entry value ) throws Exception
+    public boolean has( UUID key, Entry value ) throws Exception
     {
         Entry stored = get( key );
         
@@ -118,7 +119,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public boolean hasGreaterOrEqual( ID key ) throws Exception
+    public boolean hasGreaterOrEqual( UUID key ) throws Exception
     {
         return wrappedTable.hasGreaterOrEqual( key );
     }
@@ -127,7 +128,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public boolean hasLessOrEqual( ID key ) throws Exception
+    public boolean hasLessOrEqual( UUID key ) throws Exception
     {
         return wrappedTable.hasLessOrEqual( key );
     }
@@ -136,7 +137,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public boolean hasGreaterOrEqual( ID key, Entry val ) throws Exception
+    public boolean hasGreaterOrEqual( UUID key, Entry val ) throws Exception
     {
         return wrappedTable.hasGreaterOrEqual( key, val );
     }
@@ -145,7 +146,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public boolean hasLessOrEqual( ID key, Entry val ) throws Exception
+    public boolean hasLessOrEqual( UUID key, Entry val ) throws Exception
     {
         return wrappedTable.hasLessOrEqual( key, val );
     }
@@ -154,14 +155,14 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public Entry get( ID key ) throws Exception
+    public Entry get( UUID key ) throws Exception
     {
         if ( key == null )
         {
             return null;
         }
         
-        TxnLogManager<ID> logManager = TxnManagerFactory.<ID>txnLogManagerInstance();
+        TxnLogManager logManager = TxnManagerFactory.txnLogManagerInstance();
         Entry entry = wrappedTable.get( key );
         entry = logManager.mergeUpdates( partitionDn, key, entry );
         
@@ -172,7 +173,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public void put( ID key, Entry value ) throws Exception
+    public void put( UUID key, Entry value ) throws Exception
     {
         wrappedTable.put( key, value ); 
     }
@@ -181,7 +182,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public void remove( ID key ) throws Exception
+    public void remove( UUID key ) throws Exception
     {
         wrappedTable.remove( key ); 
     }
@@ -190,7 +191,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public void remove( ID key, Entry value ) throws Exception
+    public void remove( UUID key, Entry value ) throws Exception
     {
         wrappedTable.remove( key, value );
     }
@@ -199,7 +200,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public Cursor<Tuple<ID, Entry>> cursor() throws Exception
+    public Cursor<Tuple<UUID, Entry>> cursor() throws Exception
     {
         return wrappedTable.cursor();
     }
@@ -208,7 +209,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public Cursor<Tuple<ID, Entry>> cursor( ID key ) throws Exception
+    public Cursor<Tuple<UUID, Entry>> cursor( UUID key ) throws Exception
     {
         return wrappedTable.cursor( key );
     }
@@ -217,7 +218,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public Cursor<Entry> valueCursor( ID key ) throws Exception
+    public Cursor<Entry> valueCursor( UUID key ) throws Exception
     {
         return wrappedTable.valueCursor( key );
     }
@@ -235,7 +236,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public int count( ID key ) throws Exception
+    public int count( UUID key ) throws Exception
     {
         return wrappedTable.count( key );
     }
@@ -244,7 +245,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public int greaterThanCount( ID key ) throws Exception
+    public int greaterThanCount( UUID key ) throws Exception
     {
         return wrappedTable.greaterThanCount( key );
     }
@@ -253,7 +254,7 @@ public class MasterTableWrapper<ID> impl
     /**
      * {@inheritDoc}
      */
-    public int lessThanCount( ID key ) throws Exception
+    public int lessThanCount( UUID key ) throws Exception
     {
         return wrappedTable.lessThanCount( key );
     }

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadOnlyTxn.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadOnlyTxn.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadOnlyTxn.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadOnlyTxn.java Wed Nov  9 17:18:53 2011
@@ -23,7 +23,7 @@ package org.apache.directory.server.core
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-/** Package protected */ class ReadOnlyTxn<ID> extends AbstractTransaction<ID>
+/** Package protected */ class ReadOnlyTxn extends AbstractTransaction
 {
 
 }

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadWriteTxn.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadWriteTxn.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadWriteTxn.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/ReadWriteTxn.java Wed Nov  9 17:18:53 2011
@@ -25,6 +25,7 @@ import java.util.Iterator;
 import java.util.TreeSet;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.UUID;
 
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.Comparator;
@@ -44,6 +45,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
+import org.apache.directory.server.core.api.partition.index.UUIDComparator;
 
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.entry.AttributeUtils;
@@ -57,10 +59,10 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-/** Package protected */ class ReadWriteTxn<ID> extends AbstractTransaction<ID>
+/** Package protected */ class ReadWriteTxn extends AbstractTransaction
 {  
     /** list of log edits by the txn */
-    private List<LogEdit<ID>> logEdits = new LinkedList<LogEdit<ID>>();
+    private List<LogEdit> logEdits = new LinkedList<LogEdit>();
     
     /*
      * Number of txns that depend on this txn and previous committed
@@ -75,16 +77,16 @@ import org.apache.directory.shared.ldap.
     private UserLogRecord logRecord = new UserLogRecord();
     
     /** A summary of forward index adds */
-    private Map<Dn, Map<String, TreeSet< IndexEntry<Object,ID> >>> forwardIndexAdds  = 
-        new HashMap<Dn,  Map<String, TreeSet< IndexEntry<Object,ID> >>>();
+    private Map<Dn, Map<String, TreeSet< IndexEntry<Object> >>> forwardIndexAdds  = 
+        new HashMap<Dn,  Map<String, TreeSet< IndexEntry<Object> >>>();
     
     /** A summary of reverse index adds */
-    private Map<Dn, Map<String, TreeSet< IndexEntry<Object,ID> >>> reverseIndexAdds  = 
-        new HashMap<Dn,  Map<String, TreeSet< IndexEntry<Object,ID> >>>();
+    private Map<Dn, Map<String, TreeSet< IndexEntry<Object> >>> reverseIndexAdds  = 
+        new HashMap<Dn,  Map<String, TreeSet< IndexEntry<Object> >>>();
     
     /** A summary of index deletes */
-    private Map<Dn, Map<String, TreeSet< IndexEntry<Object,ID> >>> indexDeletes  = 
-        new HashMap<Dn,  Map<String, TreeSet< IndexEntry<Object,ID> >>>();
+    private Map<Dn, Map<String, TreeSet< IndexEntry<Object> >>> indexDeletes  = 
+        new HashMap<Dn,  Map<String, TreeSet< IndexEntry<Object> >>>();
     
     
     /** List of Dn sets this txn depends */
@@ -106,7 +108,7 @@ import org.apache.directory.shared.ldap.
     }
     
     
-    public List<LogEdit<ID>> getEdits()
+    public List<LogEdit> getEdits()
     {
         return logEdits;
     }
@@ -121,7 +123,7 @@ import org.apache.directory.shared.ldap.
      * @param edit txn log edit to be logged
      */
     @SuppressWarnings("unchecked")
-    public void addLogEdit( LogEdit<ID> edit )
+    public void addLogEdit( LogEdit edit )
     {
         logEdits.add( edit );
 
@@ -130,26 +132,26 @@ import org.apache.directory.shared.ldap.
          */
         if ( edit instanceof DataChangeContainer )
         {
-            DataChangeContainer<ID> dEdit = ( DataChangeContainer<ID> ) edit;
-            List<DataChange<ID>> dataChanges = dEdit.getChanges();
-            Iterator<DataChange<ID>> it = dataChanges.iterator();
+            DataChangeContainer dEdit = ( DataChangeContainer ) edit;
+            List<DataChange> dataChanges = dEdit.getChanges();
+            Iterator<DataChange> it = dataChanges.iterator();
             Dn partitionDn = dEdit.getPartitionDn();
 
-            DataChange<ID> nextChange;
-            IndexChange<ID> indexChange;
+            DataChange nextChange;
+            IndexChange indexChange;
             IndexChange.Type indexChangeType;
-            ForwardIndexEntry<Object, ID> indexEntry;
-            ReverseIndexEntry<Object, ID> reverseIndexEntry;
+            ForwardIndexEntry<Object> indexEntry;
+            ReverseIndexEntry<Object> reverseIndexEntry;
 
-            Map<String, TreeSet<IndexEntry<Object, ID>>> forwardIndices =
+            Map<String, TreeSet<IndexEntry<Object>>> forwardIndices =
                 forwardIndexAdds.get( partitionDn );
 
-            Map<String, TreeSet<IndexEntry<Object, ID>>> reverseIndices =
+            Map<String, TreeSet<IndexEntry<Object>>> reverseIndices =
                 reverseIndexAdds.get( partitionDn );
 
             if ( forwardIndices == null )
             {
-                forwardIndices = new HashMap<String, TreeSet<IndexEntry<Object, ID>>>();
+                forwardIndices = new HashMap<String, TreeSet<IndexEntry<Object>>>();
 
                 // Reverse index changes should be null too
                 if ( reverseIndices != null )
@@ -159,18 +161,18 @@ import org.apache.directory.shared.ldap.
                             + partitionDn );
                 }
 
-                reverseIndices = new HashMap<String, TreeSet<IndexEntry<Object, ID>>>();
+                reverseIndices = new HashMap<String, TreeSet<IndexEntry<Object>>>();
 
                 forwardIndexAdds.put( partitionDn, forwardIndices );
                 reverseIndexAdds.put( partitionDn, reverseIndices );
             }
 
-            Map<String, TreeSet<IndexEntry<Object, ID>>> deletedIndices =
+            Map<String, TreeSet<IndexEntry<Object>>> deletedIndices =
                 indexDeletes.get( partitionDn );
 
             if ( deletedIndices == null )
             {
-                deletedIndices = new HashMap<String, TreeSet<IndexEntry<Object, ID>>>();
+                deletedIndices = new HashMap<String, TreeSet<IndexEntry<Object>>>();
                 indexDeletes.put( partitionDn, deletedIndices );
             }
 
@@ -180,20 +182,20 @@ import org.apache.directory.shared.ldap.
 
                 if ( nextChange instanceof IndexChange )
                 {
-                    indexChange = ( IndexChange<ID> ) nextChange;
+                    indexChange = ( IndexChange ) nextChange;
                     indexChangeType = indexChange.getType();
-                    Index<Object, ?, ID> index = ( Index<Object, ?, ID> ) indexChange.getIndex();
+                    Index<Object> index = ( Index<Object> ) indexChange.getIndex();
 
-                    TreeSet<IndexEntry<Object, ID>> forwardAdds =
+                    TreeSet<IndexEntry<Object>> forwardAdds =
                         forwardIndices.get( indexChange.getOID() );
 
-                    TreeSet<IndexEntry<Object, ID>> reverseAdds =
+                    TreeSet<IndexEntry<Object>> reverseAdds =
                         reverseIndices.get( indexChange.getOID() );
 
                     if ( forwardAdds == null )
                     {
                         forwardAdds =
-                            new TreeSet<IndexEntry<Object, ID>>( index.getForwardIndexEntryComparator() );
+                            new TreeSet<IndexEntry<Object>>( index.getForwardIndexEntryComparator() );
 
                         // Reverse index changes should be null too
                         if ( reverseAdds != null )
@@ -204,25 +206,25 @@ import org.apache.directory.shared.ldap.
                         }
 
                         reverseAdds =
-                            new TreeSet<IndexEntry<Object, ID>>( index.getReverseIndexEntryComparator() );
+                            new TreeSet<IndexEntry<Object>>( index.getReverseIndexEntryComparator() );
 
                         forwardIndices.put( indexChange.getOID(), forwardAdds );
                         reverseIndices.put( indexChange.getOID(), forwardAdds );
                     }
 
-                    TreeSet<IndexEntry<Object, ID>> deletes = deletedIndices.get( indexChange.getOID() );
+                    TreeSet<IndexEntry<Object>> deletes = deletedIndices.get( indexChange.getOID() );
 
                     if ( deletes == null )
                     {
-                        deletes = new TreeSet<IndexEntry<Object, ID>>( index.getForwardIndexEntryComparator() );
+                        deletes = new TreeSet<IndexEntry<Object>>( index.getForwardIndexEntryComparator() );
                         deletedIndices.put( indexChange.getOID(), deletes );
                     }
 
-                    indexEntry = new ForwardIndexEntry<Object, ID>();
+                    indexEntry = new ForwardIndexEntry<Object>();
                     indexEntry.setValue( indexChange.getKey() );
                     indexEntry.setId( indexChange.getID() );
 
-                    reverseIndexEntry = new ReverseIndexEntry<Object, ID>();
+                    reverseIndexEntry = new ReverseIndexEntry<Object>();
                     reverseIndexEntry.setValue( indexChange.getKey() );
                     reverseIndexEntry.setId( indexChange.getID() );
 
@@ -252,13 +254,13 @@ import org.apache.directory.shared.ldap.
      * @param cloneOnChange true if entry should be cloned while applying a change.
      * @return entry after it is merged with the updates in the txn.
      */
-    public Entry applyUpdatesToEntry( Dn partitionDn, ID entryID, Entry curEntry, boolean cloneOnChange )
+    public Entry applyUpdatesToEntry( Dn partitionDn, UUID entryID, Entry curEntry, boolean cloneOnChange )
     {
         boolean needToCloneOnChange = cloneOnChange;
-        LogEdit<ID> edit;
-        DataChangeContainer<ID> container;
+        LogEdit edit;
+        DataChangeContainer container;
 
-        Iterator<LogEdit<ID>> it = logEdits.iterator();
+        Iterator<LogEdit> it = logEdits.iterator();
 
         while ( it.hasNext() )
         {
@@ -266,14 +268,14 @@ import org.apache.directory.shared.ldap.
 
             if ( edit instanceof DataChangeContainer )
             {
-                container = ( DataChangeContainer<ID> ) edit;
+                container = ( DataChangeContainer ) edit;
 
                 /**
                  * Check if the container has changes for the entry
                  * and the version says we need to apply this change
                  */
                 //TODO check version and id here. 
-                ID entryId = container.getEntryID();
+                UUID entryId = container.getEntryID();
                 boolean applyChanges = false;
 
                 if ( entryId != null )
@@ -283,7 +285,7 @@ import org.apache.directory.shared.ldap.
                      * affects out entry by comparing id and partitionDn.
                      */
 
-                    Comparator<ID> idComp = TxnManagerFactory.<ID> txnManagerInstance().getIDComparator();
+                    Comparator<UUID> idComp = UUIDComparator.INSTANCE;
 
                     if ( partitionDn.equals( container.getPartitionDn() )
                         && ( idComp.compare( entryID, container.getEntryID() ) == 0 ) )
@@ -295,9 +297,9 @@ import org.apache.directory.shared.ldap.
 
                 if ( applyChanges )
                 {
-                    List<DataChange<ID>> dataChanges = container.getChanges();
-                    Iterator<DataChange<ID>> dit = dataChanges.iterator();
-                    DataChange<ID> nextChange;
+                    List<DataChange> dataChanges = container.getChanges();
+                    Iterator<DataChange> dit = dataChanges.iterator();
+                    DataChange nextChange;
 
                     while ( dit.hasNext() )
                     {
@@ -305,7 +307,7 @@ import org.apache.directory.shared.ldap.
 
                         if ( ( nextChange instanceof EntryChange ) && ( curEntry != null ) )
                         {
-                            EntryChange<ID> entryChange = ( EntryChange<ID> ) nextChange;
+                            EntryChange entryChange = ( EntryChange ) nextChange;
 
                             if ( needToCloneOnChange )
                             {
@@ -324,7 +326,7 @@ import org.apache.directory.shared.ldap.
                         }
                         else if ( nextChange instanceof EntryAddDelete )
                         {
-                            EntryAddDelete<ID> addDelete = ( EntryAddDelete<ID> ) nextChange;
+                            EntryAddDelete addDelete = ( EntryAddDelete ) nextChange;
                             needToCloneOnChange = false;
 
                             if ( addDelete.getType() == EntryAddDelete.Type.ADD )
@@ -355,7 +357,7 @@ import org.apache.directory.shared.ldap.
      */
     public boolean hasDeletesFor( Dn partitionDn, String attributeOid )
     {
-        Map<String, TreeSet<IndexEntry<Object, ID>>> deletedIndices =
+        Map<String, TreeSet<IndexEntry<Object>>> deletedIndices =
             indexDeletes.get( partitionDn );
 
         if ( deletedIndices != null )
@@ -378,21 +380,21 @@ import org.apache.directory.shared.ldap.
      * @param comparator comparator that will be used to order index entries.
      * @return
      */
-    public IndexCursor<Object, Entry, ID> getCursorFor( Dn partitionDn, String attributeOid, boolean forwardIndex,
-        Object onlyValueKey, ID onlyIDKey, IndexComparator<Object, ID> comparator )
+    public IndexCursor<Object> getCursorFor( Dn partitionDn, String attributeOid, boolean forwardIndex,
+        Object onlyValueKey, UUID onlyIDKey, IndexComparator<Object> comparator )
     {
-        TxnIndexCursor<ID> txnIndexCursor = null;
+        TxnIndexCursor txnIndexCursor = null;
 
-        Map<String, TreeSet<IndexEntry<Object, ID>>> forwardIndices =
+        Map<String, TreeSet<IndexEntry<Object>>> forwardIndices =
             forwardIndexAdds.get( partitionDn );
 
         if ( forwardIndices != null )
         {
-            TreeSet<IndexEntry<Object, ID>> sortedSet = forwardIndices.get( attributeOid );
+            TreeSet<IndexEntry<Object>> sortedSet = forwardIndices.get( attributeOid );
 
             if ( sortedSet != null )
             {
-                txnIndexCursor = new TxnIndexCursor<ID>( sortedSet, forwardIndex, onlyValueKey, onlyIDKey, comparator );
+                txnIndexCursor = new TxnIndexCursor( sortedSet, forwardIndex, onlyValueKey, onlyIDKey, comparator );
             }
         }
 
@@ -409,9 +411,9 @@ import org.apache.directory.shared.ldap.
      * @param indexEntry value to be checked
      * @return true if the given value is deleted.
      */
-    public boolean isIndexEntryDeleted( Dn partitionDn, String attributeOid, IndexEntry<Object, ID> indexEntry )
+    public boolean isIndexEntryDeleted( Dn partitionDn, String attributeOid, IndexEntry<Object> indexEntry )
     {
-        Map<String, TreeSet<IndexEntry<Object, ID>>> deletedIndices =
+        Map<String, TreeSet<IndexEntry<Object>>> deletedIndices =
             indexDeletes.get( partitionDn );
 
         if ( deletedIndices == null )
@@ -419,7 +421,7 @@ import org.apache.directory.shared.ldap.
             return false;
         }
 
-        TreeSet<IndexEntry<Object, ID>> deletedEntries = deletedIndices.get( attributeOid );
+        TreeSet<IndexEntry<Object>> deletedEntries = deletedIndices.get( attributeOid );
 
         if ( deletedEntries == null )
         {

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/Transaction.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/Transaction.java?rev=1199875&r1=1199874&r2=1199875&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/Transaction.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/Transaction.java Wed Nov  9 17:18:53 2011
@@ -20,6 +20,7 @@
 package org.apache.directory.server.core.shared.txn;
 
 import java.util.List;
+import java.util.UUID;
 
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -29,29 +30,82 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-/** Package protected */ interface Transaction<ID>
+/** Package protected */ interface Transaction
 {
-    List<ReadWriteTxn<ID>> getTxnsToCheck();
-    
+
+    /**
+     * Get the list of txns that this txn should check when mergin
+     * its view from the partitions with the data in txn logs.
+     *
+     * @return list of txns this txn depends.
+     */
+    List<ReadWriteTxn> getTxnsToCheck();
+
+
+    /**
+     * Returns the start time of the txn
+     *
+     * @return start time of the txn
+     */
     long getStartTime();
-    
+
+
+    /**
+     * Called to notify the txn of the txn start. Txn state
+     * is updated accordingly.
+     *
+     * @param startTime start time of the txn
+     */
     void startTxn( long startTime );
-    
+
+
+    /**
+     * Called when txn commits. Txn state is updated
+     * accordingly.
+     *
+     * @param commitTime commit time of the txn.
+     */
     void commitTxn( long commitTime );
-    
+
+
+    /**
+     * Gets the commit time of the txn
+     *
+     * @return commit time of the txn
+     */
     long getCommitTime();
-    
+
+
+    /**
+     * Called when txn aborts. Txn state is updated accordingly.
+     *
+     */
     void abortTxn();
-    
+
+
+    /**
+     * Returns the current state of the txn
+     *
+     * @return
+     */
     State getState();
-    
-    Entry mergeUpdates( Dn partitionDn, ID entryID, Entry entry );
-    
+
+
+    /**
+     * Provides a transactionally consistent view of the entry.
+     *
+     * @param partitionDn dn of the partition the entry lives in.
+     * @param entryID id of the entry
+     * @param entry version of the entry the caller has.
+     * @return
+     */
+    Entry mergeUpdates( Dn partitionDn, UUID entryID, Entry entry );
+
     enum State
     {
         INITIAL,
         READ,
         COMMIT,
-        ABORT   
+        ABORT
     }
 }



Mime
View raw message