You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by sa...@apache.org on 2011/12/14 09:09:38 UTC

svn commit: r1214091 [1/3] - in /directory/apacheds/branches/apacheds-txns/xdbm-partition/src: main/java/org/apache/directory/server/core/partition/impl/avl/ main/java/org/apache/directory/server/core/partition/impl/btree/ main/java/org/apache/director...

Author: saya
Date: Wed Dec 14 08:09:37 2011
New Revision: 1214091

URL: http://svn.apache.org/viewvc?rev=1214091&view=rev
Log:
make txnmanager and exection manager non static and add refs to these classes for various classes.

Modified:
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LeafEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/PartitionTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/XdbmStoreUtils.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/impl/avl/AvlPartitionTxnTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/AndCursorTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NestedFilterTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/NotCursorTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/OrCursorTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/PresenceTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubstringTest.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/test/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeTest.java

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/avl/AvlPartition.java Wed Dec 14 08:09:37 2011
@@ -26,6 +26,8 @@ import java.util.UUID;
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition;
 import org.apache.directory.server.core.partition.impl.btree.LongComparator;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.UUIDComparator;
 import org.apache.directory.server.xdbm.impl.avl.AvlIndex;
@@ -56,9 +58,10 @@ public class AvlPartition extends Abstra
     /**
      * Creates a store based on AVL Trees.
      */
-    public AvlPartition( SchemaManager schemaManager )
+    public AvlPartition( SchemaManager schemaManager,TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory )
     {
-        super( schemaManager );
+        super( schemaManager, txnManagerFactory, executionManagerFactory );
     }
 
 
@@ -69,7 +72,7 @@ public class AvlPartition extends Abstra
     {
         if ( !initialized )
         {
-            EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( this, schemaManager );
+            EvaluatorBuilder evaluatorBuilder = new EvaluatorBuilder( this, schemaManager, txnManagerFactory, executionManagerFactory );
             CursorBuilder cursorBuilder = new CursorBuilder( this, evaluatorBuilder );
     
             // setup optimizer and registries for parent
@@ -79,7 +82,7 @@ public class AvlPartition extends Abstra
             }
             else
             {
-                optimizer = new DefaultOptimizer( this );
+                optimizer = new DefaultOptimizer( this, txnManagerFactory, executionManagerFactory );
             }
     
             searchEngine = new DefaultSearchEngine( this, cursorBuilder, evaluatorBuilder, optimizer );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/AbstractBTreePartition.java Wed Dec 14 08:09:37 2011
@@ -63,6 +63,8 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.ParentIdAndRdn;
 import org.apache.directory.server.core.api.partition.index.UUIDComparator;
 import org.apache.directory.server.core.shared.partition.EntryCursorAdaptor;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.core.shared.txn.logedit.DataChangeContainer;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Optimizer;
@@ -180,6 +182,10 @@ public abstract class AbstractBTreeParti
     protected AttributeType ENTRY_CSN_AT;
     protected AttributeType ENTRY_UUID_AT;
     protected AttributeType ALIASED_OBJECT_NAME_AT;
+    
+    /** Txn and Operation manager factories */
+    protected TxnManagerFactory txnManagerFactory;
+    protected OperationExecutionManagerFactory executionManagerFactory;
 
     // ------------------------------------------------------------------------
     // C O N S T R U C T O R S
@@ -188,9 +194,12 @@ public abstract class AbstractBTreeParti
     /**
      * Creates a B-tree based context partition.
      */
-    protected AbstractBTreePartition( SchemaManager schemaManager )
+    protected AbstractBTreePartition( SchemaManager schemaManager, TxnManagerFactory txnManagerFactory,
+            OperationExecutionManagerFactory executionManagerFactory )
     {
         this.schemaManager = schemaManager;
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
 
         indexedAttributes = new HashSet<Index<?>>();
 
@@ -819,7 +828,7 @@ public abstract class AbstractBTreeParti
         {
         return new BaseEntryFilteringCursor( 
             new EntryCursorAdaptor( this, 
-                list( getEntryId( listContext.getDn() ) ) ), listContext );
+                list( getEntryId( listContext.getDn() ) ), txnManagerFactory ), listContext );
         }
         catch ( Exception e )
         {
@@ -868,7 +877,7 @@ public abstract class AbstractBTreeParti
 
             underlying = searchEngine.cursor( dn, derefMode, filter, searchCtls );
 
-            return new BaseEntryFilteringCursor( new EntryCursorAdaptor( this, underlying ), searchContext );
+            return new BaseEntryFilteringCursor( new EntryCursorAdaptor( this, underlying, txnManagerFactory ), searchContext );
         }
         catch ( LdapException le )
         {

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTable.java Wed Dec 14 08:09:37 2011
@@ -215,37 +215,20 @@ public class AvlTable<K, V> extends Abst
             return false;
         }
         
-        Map.Entry<K,SingletonOrOrderedSet<V>> entry = map.lastEntry();
-        
-        if ( entry == null )
-        {
-            return false;
-        }
-        
-        K lastKey = entry.getKey();
-        SingletonOrOrderedSet<V> lastSet = entry.getValue();
-        
-        // Null values shouldnt be allowed 
-        if ( lastSet == null )
-        {
-            throw new RuntimeException( "AvlTable: Null value in map for key: " + lastKey );
-        }
+        SingletonOrOrderedSet<V> set = map.get( key );
         
-        if (  keyComparator.compare( lastKey, key ) > 0 )
-        {
-            return true;
-        }
-        else if ( keyComparator.compare( lastKey, key ) < 0 )
+        if ( set == null )
         {
             return false;
         }
         
-        if ( lastSet.isOrderedSet() )
+        if ( set.isOrderedSet() )
         {
-            return lastSet.getOrderedSet().hasGreaterOrEqual( val );
+            return set.getOrderedSet().hasGreaterOrEqual( val );
         }
-        
-        return valueComparator.compare( lastSet.getSingleton(), val ) >= 0;
+
+                
+        return valueComparator.compare( set.getSingleton(), val ) >= 0;
     }
 
     
@@ -273,37 +256,20 @@ public class AvlTable<K, V> extends Abst
             return false;
         }
         
-        Map.Entry<K,SingletonOrOrderedSet<V>> entry = map.firstEntry();
-        
-        if ( entry == null )
-        {
-            return false;
-        }
-        
-        K firstKey = entry.getKey();
-        SingletonOrOrderedSet<V> firstSet = entry.getValue();
-        
-        // Null values shouldnt be allowed 
-        if ( firstSet == null )
-        {
-            throw new RuntimeException( "AvlTable: Null value in map for key: " + firstKey );
-        }
+        SingletonOrOrderedSet<V> set = map.get( key );
         
-        if (  keyComparator.compare( firstKey, key ) < 0 )
-        {
-            return true;
-        }
-        else if ( keyComparator.compare( firstKey, key ) > 0 )
+        if ( set == null )
         {
             return false;
         }
         
-        if ( firstSet.isOrderedSet() )
+        if ( set.isOrderedSet() )
         {
-            return firstSet.getOrderedSet().hasLessOrEqual( val );
+            return set.getOrderedSet().hasLessOrEqual( val );
         }
-        
-        return valueComparator.compare( firstSet.getSingleton(), val ) <= 0;
+
+                
+        return valueComparator.compare( set.getSingleton(), val ) <= 0;
     }
 
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlTableDupsCursor.java Wed Dec 14 08:09:37 2011
@@ -115,6 +115,13 @@ public class AvlTableDupsCursor<K,V> ext
         checkNotClosed( "beforeValue()" );
         wrappedCursor.beforeKey( key );
         
+        if ( value == null )
+        {
+            dupsCursor = null;
+            clearValue();
+            return;
+        }
+        
         if ( wrappedCursor.next() )
         {
             wrappedTuple.setBoth( wrappedCursor.get() );
@@ -129,12 +136,6 @@ public class AvlTableDupsCursor<K,V> ext
                 dupsCursor = new SingletonCursor<V>( 
                     wrappedTuple.getValue().getSingleton(), table.getValueComparator() );
             }
-            
-            if ( value == null )
-            {
-                clearValue();
-                return;
-            }
     
             /* 
              * The cursor over the values is only advanced if we're on the 
@@ -196,6 +197,10 @@ public class AvlTableDupsCursor<K,V> ext
         if ( value == null )
         {
             wrappedCursor.afterKey( key );
+                     
+            dupsCursor = null;
+            clearValue();
+            return;
         }
         else
         {
@@ -217,12 +222,6 @@ public class AvlTableDupsCursor<K,V> ext
                 dupsCursor = new SingletonCursor<V>( values.getSingleton(), table.getValueComparator() );
             }
 
-            if ( value == null )
-            {
-                clearValue();
-                return;
-            }
-
             // only advance the dupsCursor if we're on same key
             if ( table.getKeyComparator().compare( wrappedTuple.getKey(), key ) == 0 )
             {

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AllEntriesCursor.java Wed Dec 14 08:09:37 2011
@@ -29,6 +29,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 
@@ -45,6 +46,10 @@ public class AllEntriesCursor extends Ab
     
     /** The cursor on the EntryUUID index */
     private final IndexCursor<String> wrapped;
+     
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     /**
@@ -62,9 +67,13 @@ public class AllEntriesCursor extends Ab
      * @throws Exception
      */
     @SuppressWarnings("unchecked")
-    public AllEntriesCursor( Partition db ) throws Exception
+    public AllEntriesCursor( Partition db, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         Index<?> entryUuidIdx = db.getSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID );
         entryUuidIdx = txnLogManager.wrap( db.getSuffixDn(), entryUuidIdx );
         

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java Wed Dec 14 08:09:37 2011
@@ -28,6 +28,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
 import org.apache.directory.shared.ldap.model.filter.ExprNode;
@@ -48,6 +50,10 @@ public class AndCursor<V> extends Abstra
     
     /** The evaluators used for the members of the And filter */
     private final List<Evaluator<? extends ExprNode>> evaluators;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     /**
@@ -60,6 +66,9 @@ public class AndCursor<V> extends Abstra
     public AndCursor( IndexCursor<V> wrapped,
         List<Evaluator<? extends ExprNode>> evaluators )
     {
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
         this.wrapped = wrapped;
         this.evaluators = optimize( evaluators );
     }

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndEvaluator.java Wed Dec 14 08:09:37 2011
@@ -36,7 +36,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class AndEvaluator implements Evaluator<AndNode>
+public class AndEvaluator extends AbstractEvaluator<AndNode>
 {
     /** The list of evaluators associated with each of the children */
     private final List<Evaluator<? extends ExprNode>> evaluators;

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateCursor.java Wed Dec 14 08:09:37 2011
@@ -29,6 +29,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
@@ -60,6 +61,10 @@ public class ApproximateCursor<V> extend
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
     private final IndexCursor<String> uuidIdxCursor;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
     /**
      * Creates a new instance of ApproximateCursor
@@ -68,9 +73,13 @@ public class ApproximateCursor<V> extend
      * @throws Exception If the creation failed
      */
     @SuppressWarnings("unchecked")
-    public ApproximateCursor( Partition db, ApproximateEvaluator<V> approximateEvaluator ) throws Exception
+    public ApproximateCursor( Partition db, ApproximateEvaluator<V> approximateEvaluator, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         this.approximateEvaluator = approximateEvaluator;
 
         AttributeType attributeType = approximateEvaluator.getExpression().getAttributeType();

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/ApproximateEvaluator.java Wed Dec 14 08:09:37 2011
@@ -26,6 +26,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Value;
@@ -51,10 +53,11 @@ public class ApproximateEvaluator<T> ext
      * @throws Exception If the creation failed
      */
     @SuppressWarnings("unchecked")
-    public ApproximateEvaluator( ApproximateNode<T> node, Partition db, SchemaManager schemaManager )
+    public ApproximateEvaluator( ApproximateNode<T> node, Partition db, SchemaManager schemaManager, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory )
         throws Exception
     {
-        super( node, db, schemaManager );
+        super( node, db, schemaManager, txnManagerFactory, executionManagerFactory );
         
         if ( db.hasIndexOn( attributeType ) )
         {
@@ -147,7 +150,7 @@ public class ApproximateEvaluator<T> ext
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
-            entry = masterTable.get( indexEntry.getId() );
+            entry = getEntry( indexEntry.getId() );
             indexEntry.setEntry( entry );
         }
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/CursorBuilder.java Wed Dec 14 08:09:37 2011
@@ -27,6 +27,8 @@ import java.util.UUID;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.filter.AndNode;
@@ -50,6 +52,9 @@ public class CursorBuilder
 
     /** Evaluator dependency on a EvaluatorBuilder */
     private EvaluatorBuilder evaluatorBuilder;
+    
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     /**
@@ -62,6 +67,8 @@ public class CursorBuilder
     {
         this.db = db;
         this.evaluatorBuilder = evaluatorBuilder;
+        this.txnManagerFactory = evaluatorBuilder.getTxnManagerFactory();
+        this.executionManagerFactory = evaluatorBuilder.getExecutionManagerFactory();
     }
 
 
@@ -72,34 +79,41 @@ public class CursorBuilder
             /* ---------- LEAF NODE HANDLING ---------- */
 
             case APPROXIMATE:
-                return new ApproximateCursor<T>( db, ( ApproximateEvaluator<T> ) evaluatorBuilder.build( node ) );
+                return new ApproximateCursor<T>( db, ( ApproximateEvaluator<T> ) evaluatorBuilder.build( node ), 
+                    txnManagerFactory, executionManagerFactory );
 
             case EQUALITY:
-                return new EqualityCursor<T>( db, ( EqualityEvaluator<T> ) evaluatorBuilder.build( node ) );
+                return new EqualityCursor<T>( db, ( EqualityEvaluator<T> ) evaluatorBuilder.build( node ), 
+                    txnManagerFactory, executionManagerFactory );
 
             case GREATEREQ:
-                return new GreaterEqCursor<T>( db, ( GreaterEqEvaluator<T> ) evaluatorBuilder.build( node ) );
+                return new GreaterEqCursor<T>( db, ( GreaterEqEvaluator<T> ) evaluatorBuilder.build( node ), 
+                    txnManagerFactory, executionManagerFactory );
 
             case LESSEQ:
-                return new LessEqCursor<T>( db, ( LessEqEvaluator<T> ) evaluatorBuilder.build( node ) );
+                return new LessEqCursor<T>( db, ( LessEqEvaluator<T> ) evaluatorBuilder.build( node ), 
+                    txnManagerFactory, executionManagerFactory );
 
             case PRESENCE:
-                return new PresenceCursor( db, ( PresenceEvaluator ) evaluatorBuilder.build( node ) );
+                return new PresenceCursor( db, ( PresenceEvaluator ) evaluatorBuilder.build( node ),
+                    txnManagerFactory, executionManagerFactory );
 
             case SCOPE:
                 if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
                 {
                     return new OneLevelScopeCursor( db,
-                        ( OneLevelScopeEvaluator ) evaluatorBuilder.build( node ) );
+                        ( OneLevelScopeEvaluator ) evaluatorBuilder.build( node ), 
+                        txnManagerFactory, executionManagerFactory );
                 }
                 else
                 {
                     return new SubtreeScopeCursor( db, ( SubtreeScopeEvaluator ) evaluatorBuilder
-                        .build( node ) );
+                        .build( node ), txnManagerFactory, executionManagerFactory );
                 }
 
             case SUBSTRING:
-                return new SubstringCursor( db, ( SubstringEvaluator ) evaluatorBuilder.build( node ) );
+                return new SubstringCursor( db, ( SubstringEvaluator ) evaluatorBuilder.build( node ), 
+                    txnManagerFactory, executionManagerFactory );
 
                 /* ---------- LOGICAL OPERATORS ---------- */
 
@@ -107,7 +121,8 @@ public class CursorBuilder
                 return buildAndCursor( ( AndNode ) node );
 
             case NOT:
-                return new NotCursor<UUID>( db, evaluatorBuilder.build( ( ( NotNode ) node ).getFirstChild() ) );
+                return new NotCursor<UUID>( db, evaluatorBuilder.build( ( ( NotNode ) node ).getFirstChild() ), 
+                    txnManagerFactory, executionManagerFactory );
 
             case OR:
                 return buildOrCursor( ( OrNode ) node );

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java Wed Dec 14 08:09:37 2011
@@ -28,6 +28,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Optimizer;
 import org.apache.directory.shared.ldap.model.filter.AndNode;
@@ -58,6 +59,9 @@ public class DefaultOptimizer implements
     /** the database this optimizer operates on */
     private final Partition db;
     private UUID contextEntryId;
+    
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     /**
@@ -65,8 +69,11 @@ public class DefaultOptimizer implements
      *
      * @param db the database this optimizer works for.
      */
-    public DefaultOptimizer( Partition db ) throws Exception
+    public DefaultOptimizer( Partition db, 
+        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
         this.db = db;
     }
 
@@ -79,7 +86,7 @@ public class DefaultOptimizer implements
         {
             try
             {
-                this.contextEntryId = OperationExecutionManagerFactory.instance().getEntryId( db, db.getSuffixDn() );
+                this.contextEntryId = executionManagerFactory.instance().getEntryId( db, db.getSuffixDn() );
             }
             catch ( Exception e )
             {
@@ -378,7 +385,7 @@ public class DefaultOptimizer implements
     {
         Index<?> idx;
         idx = db.getSystemIndex( ApacheSchemaConstants.APACHE_PRESENCE_AT_OID );
-        UUID id = OperationExecutionManagerFactory.instance().getEntryId( db, node.getBaseDn() );
+        UUID id = executionManagerFactory.instance().getEntryId( db, node.getBaseDn() );
         switch ( node.getScope() )
         {
             case OBJECT:

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Wed Dec 14 08:09:37 2011
@@ -98,8 +98,8 @@ public class DefaultSearchEngine impleme
         this.optimizer = optimizer;
         this.cursorBuilder = cursorBuilder;
         this.evaluatorBuilder = evaluatorBuilder;
-        txnLogManager = TxnManagerFactory.txnLogManagerInstance();
-        executionManager = OperationExecutionManagerFactory.instance();
+        txnLogManager = evaluatorBuilder.getTxnManagerFactory().txnLogManagerInstance();       
+        executionManager = evaluatorBuilder.getExecutionManagerFactory().instance();
     }
 
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityCursor.java Wed Dec 14 08:09:37 2011
@@ -29,6 +29,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
@@ -58,6 +59,10 @@ public class EqualityCursor<V> extends A
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
     private final IndexCursor<String> uuidIdxCursor;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     /**
@@ -67,9 +72,13 @@ public class EqualityCursor<V> extends A
      * @throws Exception If the creation failed
      */
     @SuppressWarnings("unchecked")
-    public EqualityCursor( Partition db, EqualityEvaluator<V> equalityEvaluator ) throws Exception
+    public EqualityCursor( Partition db, EqualityEvaluator<V> equalityEvaluator, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         this.equalityEvaluator = equalityEvaluator;
 
         AttributeType attributeType = equalityEvaluator.getExpression().getAttributeType();

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EqualityEvaluator.java Wed Dec 14 08:09:37 2011
@@ -27,6 +27,8 @@ import java.util.UUID;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.entry.Value;
@@ -56,10 +58,12 @@ public class EqualityEvaluator<T> extend
 
 
     @SuppressWarnings("unchecked")
-    public EqualityEvaluator( EqualityNode<T> node, Partition db, SchemaManager schemaManager )
+    public EqualityEvaluator( EqualityNode<T> node, Partition db, SchemaManager schemaManager,
+            TxnManagerFactory txnManagerFactory,
+            OperationExecutionManagerFactory executionManagerFactory )
         throws Exception
     {
-        super( node, db, schemaManager );
+        super( node, db, schemaManager, txnManagerFactory, executionManagerFactory );
 
         if ( db.hasIndexOn( attributeType ) )
         {
@@ -107,7 +111,7 @@ public class EqualityEvaluator<T> extend
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
-            entry = masterTable.get( indexEntry.getId() );
+            entry = getEntry( indexEntry.getId() );
             indexEntry.setEntry( entry );
         }
 
@@ -161,7 +165,7 @@ public class EqualityEvaluator<T> extend
             return idx.reverse( id );
         }
 
-        return evaluateEntry( masterTable.get( id ) );
+        return evaluateEntry( getEntry( id ) );
     }
 
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/EvaluatorBuilder.java Wed Dec 14 08:09:37 2011
@@ -24,6 +24,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.directory.server.core.api.partition.Partition;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.shared.ldap.model.filter.AndNode;
@@ -51,6 +53,9 @@ public class EvaluatorBuilder
 {
     private final Partition db;
     private final SchemaManager schemaManager;
+    
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     /**
@@ -59,12 +64,17 @@ public class EvaluatorBuilder
      *
      * @param db the database this evaluator operates upon
      * @param schemaManager the schema manager
+     * @param txnManagerFactory txn manager factory
+     * @param executionManagerFactory execution manager factory
      * @throws Exception failure to access db or lookup schema in registries
      */
-    public EvaluatorBuilder( Partition db, SchemaManager schemaManager ) throws Exception
+    public EvaluatorBuilder( Partition db, SchemaManager schemaManager, TxnManagerFactory txnManagerFactory,
+            OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
         this.db = db;
         this.schemaManager = schemaManager;
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
     }
 
 
@@ -75,32 +85,40 @@ public class EvaluatorBuilder
             /* ---------- LEAF NODE HANDLING ---------- */
 
             case APPROXIMATE:
-                return new ApproximateEvaluator<T>( ( ApproximateNode<T> ) node, db, schemaManager );
+                return new ApproximateEvaluator<T>( ( ApproximateNode<T> ) node, db, schemaManager, 
+                    txnManagerFactory, executionManagerFactory );
 
             case EQUALITY:
-                return new EqualityEvaluator<T>( ( EqualityNode<T> ) node, db, schemaManager );
+                return new EqualityEvaluator<T>( ( EqualityNode<T> ) node, db, schemaManager, 
+                    txnManagerFactory, executionManagerFactory );
 
             case GREATEREQ:
-                return new GreaterEqEvaluator<T>( ( GreaterEqNode<T> ) node, db, schemaManager );
+                return new GreaterEqEvaluator<T>( ( GreaterEqNode<T> ) node, db, schemaManager, 
+                    txnManagerFactory, executionManagerFactory );
 
             case LESSEQ:
-                return new LessEqEvaluator<T>( ( LessEqNode<T> ) node, db, schemaManager );
+                return new LessEqEvaluator<T>( ( LessEqNode<T> ) node, db, schemaManager, 
+                    txnManagerFactory, executionManagerFactory );
 
             case PRESENCE:
-                return new PresenceEvaluator( ( PresenceNode ) node, db, schemaManager );
+                return new PresenceEvaluator( ( PresenceNode ) node, db, schemaManager, 
+                    txnManagerFactory, executionManagerFactory );
 
             case SCOPE:
                 if ( ( ( ScopeNode ) node ).getScope() == SearchScope.ONELEVEL )
                 {
-                    return new OneLevelScopeEvaluator( db, ( ScopeNode ) node );
+                    return new OneLevelScopeEvaluator( db, ( ScopeNode ) node, 
+                        txnManagerFactory, executionManagerFactory );
                 }
                 else
                 {
-                    return new SubtreeScopeEvaluator( db, ( ScopeNode ) node );
+                    return new SubtreeScopeEvaluator( db, ( ScopeNode ) node, 
+                        txnManagerFactory, executionManagerFactory );
                 }
 
             case SUBSTRING:
-                return new SubstringEvaluator( ( SubstringNode ) node, db, schemaManager );
+                return new SubstringEvaluator( ( SubstringNode ) node, db, schemaManager, 
+                    txnManagerFactory, executionManagerFactory );
 
                 /* ---------- LOGICAL OPERATORS ---------- */
 
@@ -149,4 +167,16 @@ public class EvaluatorBuilder
         }
         return new OrEvaluator( node, evaluators );
     }
+    
+    
+    TxnManagerFactory getTxnManagerFactory()
+    {
+        return txnManagerFactory;
+    }
+    
+    
+    OperationExecutionManagerFactory getExecutionManagerFactory()
+    {
+        return executionManagerFactory;
+    }
 }

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqCursor.java Wed Dec 14 08:09:37 2011
@@ -30,6 +30,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
@@ -57,6 +58,10 @@ public class GreaterEqCursor<V> extends 
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
     private final IndexCursor<String> ndnIdxCursor;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
     /**
      * Used to store indexEntry from ndnCandidate so it can be saved after
@@ -73,9 +78,13 @@ public class GreaterEqCursor<V> extends 
      * @throws Exception If the creation failed
      */
     @SuppressWarnings("unchecked")
-    public GreaterEqCursor( Partition db, GreaterEqEvaluator<V> greaterEqEvaluator ) throws Exception
+    public GreaterEqCursor( Partition db, GreaterEqEvaluator<V> greaterEqEvaluator, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         this.greaterEqEvaluator = greaterEqEvaluator;
 
         AttributeType attributeType = greaterEqEvaluator.getExpression().getAttributeType();

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/GreaterEqEvaluator.java Wed Dec 14 08:09:37 2011
@@ -27,6 +27,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -46,10 +48,12 @@ import org.apache.directory.shared.ldap.
 public class GreaterEqEvaluator<T> extends LeafEvaluator<T>
 {
     @SuppressWarnings("unchecked")
-    public GreaterEqEvaluator( GreaterEqNode<T> node, Partition db, SchemaManager schemaManager )
+    public GreaterEqEvaluator( GreaterEqNode<T> node, Partition db, SchemaManager schemaManager,
+            TxnManagerFactory txnManagerFactory,
+            OperationExecutionManagerFactory executionManagerFactory )
         throws Exception
     {
-        super( node, db, schemaManager );
+        super( node, db, schemaManager, txnManagerFactory, executionManagerFactory );
 
         if ( db.hasIndexOn( node.getAttributeType() ) )
         {
@@ -102,7 +106,7 @@ public class GreaterEqEvaluator<T> exten
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
-            entry = masterTable.get( indexEntry.getId() );
+            entry = getEntry( indexEntry.getId() );
             indexEntry.setEntry( entry );
         }
 
@@ -160,7 +164,7 @@ public class GreaterEqEvaluator<T> exten
             return idx.reverseGreaterOrEq( id, node.getValue().getValue() );
         }
 
-        return evaluateEntry( masterTable.get( id ) );
+        return evaluateEntry( getEntry( id ) );
     }
 
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LeafEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LeafEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LeafEvaluator.java Wed Dec 14 08:09:37 2011
@@ -19,6 +19,8 @@
  */
 package org.apache.directory.server.xdbm.search.impl;
 
+import java.util.UUID;
+
 import org.apache.directory.server.core.api.partition.OperationExecutionManager;
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.index.Index;
@@ -27,7 +29,9 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.search.Evaluator;
+import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.filter.SimpleNode;
+import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.LdapComparator;
 import org.apache.directory.shared.ldap.model.schema.Normalizer;
@@ -40,13 +44,10 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public abstract class LeafEvaluator<T> implements Evaluator<SimpleNode<T>>
+public abstract class LeafEvaluator<T> extends AbstractEvaluator<SimpleNode<T>>
 {
     /** The ExprNode to evaluate */
     protected final SimpleNode<T> node;
-
-    /** The backend */
-    protected final Partition db;
     
     /** The SchemaManager instance */
     protected final SchemaManager schemaManager;
@@ -62,23 +63,17 @@ public abstract class LeafEvaluator<T> i
     
     /** The index to use if any */
     protected Index<T> idx;
-    
-    /** Txn log manager */
-    protected TxnLogManager txnLogManager;
-    
-    /** Master table */
-    protected MasterTable masterTable;
 
     @SuppressWarnings("unchecked")
-    public LeafEvaluator( SimpleNode<T> node, Partition db, SchemaManager schemaManager )
+    public LeafEvaluator( SimpleNode<T> node, Partition db, SchemaManager schemaManager, 
+        TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory )
     throws Exception
     {
-        this.db = db;
+        super(db, txnManagerFactory, executionManagerFactory );      
         this.node = node;
         this.schemaManager = schemaManager;
         this.attributeType = node.getAttributeType();
-        txnLogManager = TxnManagerFactory.txnLogManagerInstance();
-        masterTable = txnLogManager.wrap( db.getSuffixDn(), db.getMasterTable() );
     }
 
     
@@ -107,4 +102,5 @@ public abstract class LeafEvaluator<T> i
     {
         return ldapComparator;
     }
+    
 }

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqCursor.java Wed Dec 14 08:09:37 2011
@@ -30,6 +30,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
@@ -57,6 +58,10 @@ public class LessEqCursor<V> extends Abs
 
     /** NDN Cursor on all entries in  (set when no index on user attribute) */
     private final IndexCursor<String> uuidIdxCursor;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
     /**
      * Used to store indexEntry from ndnCandidate so it can be saved after
@@ -67,9 +72,13 @@ public class LessEqCursor<V> extends Abs
 
 
     @SuppressWarnings("unchecked")
-    public LessEqCursor( Partition db, LessEqEvaluator<V> lessEqEvaluator ) throws Exception
+    public LessEqCursor( Partition db, LessEqEvaluator<V> lessEqEvaluator, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         this.lessEqEvaluator = lessEqEvaluator;
 
         AttributeType attributeType = lessEqEvaluator.getExpression().getAttributeType();

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/LessEqEvaluator.java Wed Dec 14 08:09:37 2011
@@ -27,6 +27,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -46,10 +48,12 @@ import org.apache.directory.shared.ldap.
 public class LessEqEvaluator<T> extends LeafEvaluator<T>
 {
     @SuppressWarnings("unchecked")
-    public LessEqEvaluator( LessEqNode<T> node, Partition db, SchemaManager schemaManager )
+    public LessEqEvaluator( LessEqNode<T> node, Partition db, SchemaManager schemaManager,
+            TxnManagerFactory txnManagerFactory,
+            OperationExecutionManagerFactory executionManagerFactory    )
         throws Exception
     {
-        super( node, db, schemaManager );
+        super( node, db, schemaManager, txnManagerFactory, executionManagerFactory );
 
         if ( db.hasIndexOn( attributeType ) )
         {
@@ -97,7 +101,7 @@ public class LessEqEvaluator<T> extends 
             return idx.reverseLessOrEq( id, node.getValue().getValue() );
         }
 
-        return evaluateEntry( masterTable.get( id ) );
+        return evaluateEntry( getEntry( id ) );
     }
 
 
@@ -113,7 +117,7 @@ public class LessEqEvaluator<T> extends 
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
-            entry = masterTable.get( indexEntry.getId() );
+            entry = getEntry( indexEntry.getId() );
             indexEntry.setEntry( entry );
         }
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotCursor.java Wed Dec 14 08:09:37 2011
@@ -27,6 +27,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -45,15 +46,23 @@ public class NotCursor<V> extends Abstra
     private static final String UNSUPPORTED_MSG = I18n.err( I18n.ERR_718 );
     private final IndexCursor<String> uuidCursor;
     private final Evaluator<? extends ExprNode> childEvaluator;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     @SuppressWarnings("unchecked")
-    public NotCursor( Partition store, Evaluator<? extends ExprNode> childEvaluator )
+    public NotCursor( Partition store, Evaluator<? extends ExprNode> childEvaluator, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory )
         throws Exception
     {
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
         this.childEvaluator = childEvaluator;
  
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         Index<?> entryUuidIdx = store.getSystemIndex( SchemaConstants.ENTRY_UUID_AT_OID );
         entryUuidIdx = txnLogManager.wrap( store.getSuffixDn(), entryUuidIdx );
         uuidCursor = ( ( Index<String> )entryUuidIdx ).forwardCursor();

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/NotEvaluator.java Wed Dec 14 08:09:37 2011
@@ -32,7 +32,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class NotEvaluator implements Evaluator<NotNode>
+public class NotEvaluator extends AbstractEvaluator<NotNode>
 {
     /** The ExprNode to evaluate */
     private final NotNode node;

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeCursor.java Wed Dec 14 08:09:37 2011
@@ -69,6 +69,10 @@ public class OneLevelScopeCursor extends
     
     /** Alias idx set if dereferencing aliases */
     private Index<String> aliasIdx;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
  
 
     /**
@@ -79,10 +83,14 @@ public class OneLevelScopeCursor extends
      * @throws Exception on db access failures
      */
     @SuppressWarnings("unchecked")
-    public OneLevelScopeCursor( Partition db, OneLevelScopeEvaluator evaluator )
+    public OneLevelScopeCursor( Partition db, OneLevelScopeEvaluator evaluator, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory )
         throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         this.db = db;
         this.evaluator = evaluator;
         
@@ -303,8 +311,8 @@ public class OneLevelScopeCursor extends
             
             if ( cursor == dereferencedCursor )
             {
-                Dn aliasTargetDn = OperationExecutionManagerFactory.instance().buildEntryDn( db, indexEntry.getId() );
-                TxnManagerFactory.txnLogManagerInstance().addRead( aliasTargetDn, SearchScope.OBJECT );
+                Dn aliasTargetDn = executionManagerFactory.instance().buildEntryDn( db, indexEntry.getId() );
+                txnManagerFactory.txnLogManagerInstance().addRead( aliasTargetDn, SearchScope.OBJECT );
             }
             
             return indexEntry;

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OneLevelScopeEvaluator.java Wed Dec 14 08:09:37 2011
@@ -27,11 +27,8 @@ import org.apache.directory.server.const
 import org.apache.directory.server.core.api.partition.Partition;
 import org.apache.directory.server.core.api.partition.index.Index;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
-import org.apache.directory.server.core.api.txn.TxnLogManager;
 import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
-import org.apache.directory.server.xdbm.Store;
-import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.filter.ScopeNode;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
@@ -42,7 +39,7 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class OneLevelScopeEvaluator implements Evaluator<ScopeNode>
+public class OneLevelScopeEvaluator extends AbstractEvaluator<ScopeNode>
 {
     /** The ScopeNode containing initial search scope constraints */
     private final ScopeNode node;
@@ -52,9 +49,6 @@ public class OneLevelScopeEvaluator impl
 
     /** True if the scope requires alias dereferencing while searching */
     private final boolean dereferencing;
-
-    /** the entry db storing entries */
-    private final Partition db;
     
     /** One level idx */
     private Index<UUID> oneLevelIdx;
@@ -73,8 +67,11 @@ public class OneLevelScopeEvaluator impl
      * @throws Exception on db access failure
      */
     @SuppressWarnings("unchecked")
-    public OneLevelScopeEvaluator( Partition db, ScopeNode node ) throws Exception
+    public OneLevelScopeEvaluator( Partition db, ScopeNode node, TxnManagerFactory txnManagerFactory,
+            OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
+        super(db, txnManagerFactory, executionManagerFactory );
+        
         this.node = node;
 
         if ( node.getScope() != SearchScope.ONELEVEL )
@@ -82,11 +79,9 @@ public class OneLevelScopeEvaluator impl
             throw new IllegalStateException( I18n.err( I18n.ERR_720 ) );
         }
 
-        this.db = db;
-        baseId = OperationExecutionManagerFactory.instance().getEntryId( db, node.getBaseDn() );
+        baseId = executionManager.getEntryId( db, node.getBaseDn() );
         dereferencing = node.getDerefAliases().isDerefInSearching() || node.getDerefAliases().isDerefAlways();
         
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
         oneLevelIdx = ( Index<UUID> )db.getSystemIndex( ApacheSchemaConstants.APACHE_ONE_LEVEL_AT_OID );
         oneLevelIdx = ( Index<UUID> )txnLogManager.wrap( db.getSuffixDn(), oneLevelIdx );
         

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrCursor.java Wed Dec 14 08:09:37 2011
@@ -30,6 +30,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.core.api.partition.index.AbstractIndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
+import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.search.Evaluator;
 import org.apache.directory.shared.ldap.model.cursor.Cursor;
 import org.apache.directory.shared.ldap.model.cursor.InvalidCursorPositionException;
@@ -49,16 +51,24 @@ public class OrCursor<V> extends Abstrac
     private final List<Evaluator<? extends ExprNode>> evaluators;
     private final List<Set<UUID>> blacklists;
     private int cursorIndex = -1;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     // TODO - do same evaluator fail fast optimization that we do in AndCursor
     public OrCursor( List<IndexCursor<V>> cursors,
         List<Evaluator<? extends ExprNode>> evaluators )
     {
+      
         if ( cursors.size() <= 1 )
         {
             throw new IllegalArgumentException( I18n.err( I18n.ERR_723 ) );
         }
+        
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
 
         this.cursors = cursors;
         this.evaluators = evaluators;

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/OrEvaluator.java Wed Dec 14 08:09:37 2011
@@ -37,7 +37,7 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class OrEvaluator implements Evaluator<OrNode>
+public class OrEvaluator extends AbstractEvaluator<OrNode>
 {
     /** The list of evaluators associated with each of the children */
     private final List<Evaluator<? extends ExprNode>> evaluators;

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceCursor.java Wed Dec 14 08:09:37 2011
@@ -30,6 +30,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -49,11 +50,19 @@ public class PresenceCursor extends Abst
     private final IndexCursor<String> uuidCursor;
     private final IndexCursor<String> presenceCursor;
     private final PresenceEvaluator presenceEvaluator;
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
     @SuppressWarnings("unchecked")
-    public PresenceCursor( Partition store, PresenceEvaluator presenceEvaluator ) throws Exception
+    public PresenceCursor( Partition store, PresenceEvaluator presenceEvaluator, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory ) throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         this.presenceEvaluator = presenceEvaluator;
         AttributeType type = presenceEvaluator.getAttributeType();
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/PresenceEvaluator.java Wed Dec 14 08:09:37 2011
@@ -29,6 +29,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.MasterTable;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.server.xdbm.search.Evaluator;
@@ -45,13 +46,11 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class PresenceEvaluator implements Evaluator<PresenceNode>
+public class PresenceEvaluator extends AbstractEvaluator<PresenceNode>
 {
     /** The ExprNode to evaluate */
     private final PresenceNode node;
 
-    /** The backend */
-    private final Partition db;
 
     /** The AttributeType we will use for the evaluation */
     private final AttributeType attributeType;
@@ -61,16 +60,14 @@ public class PresenceEvaluator implement
 
     /** The index to use if any */
     private final Index<String> idx;
-    
-    /** Master table */
-    private final MasterTable masterTable;
 
     @SuppressWarnings("unchecked")
-    public PresenceEvaluator( PresenceNode node, Partition db, SchemaManager schemaManager )
+    public PresenceEvaluator( PresenceNode node, Partition db, SchemaManager schemaManager,
+            TxnManagerFactory txnManagerFactory,
+            OperationExecutionManagerFactory executionManagerFactory )
         throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
-        this.db = db;
+        super(db, txnManagerFactory, executionManagerFactory );
         this.node = node;
         this.schemaManager = schemaManager;
         this.attributeType = node.getAttributeType();
@@ -84,8 +81,6 @@ public class PresenceEvaluator implement
         {
             idx = null;
         }
-        
-        masterTable = txnLogManager.wrap( db.getSuffixDn(), db.getMasterTable() );
     }
 
 
@@ -115,7 +110,7 @@ public class PresenceEvaluator implement
         // resuscitate the entry if it has not been and set entry in IndexEntry
         if ( null == entry )
         {
-            entry = masterTable.get( indexEntry.getId() );
+            entry = getEntry( indexEntry.getId() );
             indexEntry.setEntry( entry );
         }
 
@@ -132,7 +127,7 @@ public class PresenceEvaluator implement
             return idx.forward( attributeType.getOid(), id );
         }
 
-        return evaluateEntry( masterTable.get( id ) );
+        return evaluateEntry( getEntry( id ) );
     }
 
 

Modified: directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java?rev=1214091&r1=1214090&r2=1214091&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java (original)
+++ directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/SubstringCursor.java Wed Dec 14 08:09:37 2011
@@ -28,6 +28,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.api.partition.index.IndexCursor;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
 import org.apache.directory.server.core.api.txn.TxnLogManager;
+import org.apache.directory.server.core.shared.partition.OperationExecutionManagerFactory;
 import org.apache.directory.server.core.shared.txn.TxnManagerFactory;
 import org.apache.directory.server.xdbm.Store;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -47,13 +48,21 @@ public class SubstringCursor extends Abs
     private final IndexCursor<String> wrapped;
     private final SubstringEvaluator evaluator;
     private final ForwardIndexEntry<String> indexEntry = new ForwardIndexEntry<String>();
+    
+    /** Txn and Operation Execution Factories */
+    private TxnManagerFactory txnManagerFactory;
+    private OperationExecutionManagerFactory executionManagerFactory;
 
 
     @SuppressWarnings("unchecked")
-    public SubstringCursor( Partition store, final SubstringEvaluator substringEvaluator )
+    public SubstringCursor( Partition store, final SubstringEvaluator substringEvaluator, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory )
         throws Exception
     {
-        TxnLogManager txnLogManager = TxnManagerFactory.txnLogManagerInstance();
+        this.txnManagerFactory = txnManagerFactory;
+        this.executionManagerFactory = executionManagerFactory;
+        
+        TxnLogManager txnLogManager = txnManagerFactory.txnLogManagerInstance();
         evaluator = substringEvaluator;
         hasIndex = store.hasIndexOn( evaluator.getExpression().getAttributeType() );