directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1294153 [1/2] - in /directory/apacheds/branches/apacheds-txns: core-api/src/main/java/org/apache/directory/server/core/api/txn/ core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/ core-shared/src/main/java/org/apache/d...
Date Mon, 27 Feb 2012 13:46:12 GMT
Author: elecharny
Date: Mon Feb 27 13:46:11 2012
New Revision: 1294153

URL: http://svn.apache.org/viewvc?rev=1294153&view=rev
Log:
o Added a TxnId for debug purposes
o Added some toString() methods
o Implemented the readExternal/writeExternal method where read/witeObject was used in LogManager
o Some minor refactoring
o COmmented the PagedSearch test which is failing (on purpose atm)

Modified:
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java
    directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/AbstractLogEdit.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/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/logedit/DataChangeContainer.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/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
    directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/suites/StockServerISuite.java
    directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
    directory/apacheds/branches/apacheds-txns/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkRunner.java
    directory/apacheds/branches/apacheds-txns/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/AndCursor.java

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/TxnHandle.java Mon Feb 27 13:46:11 2012
@@ -27,4 +27,5 @@ package org.apache.directory.server.core
  */
 public interface TxnHandle
 {
+    public long getId();
 }

Modified: directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/AbstractLogEdit.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/AbstractLogEdit.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/AbstractLogEdit.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-api/src/main/java/org/apache/directory/server/core/api/txn/logedit/AbstractLogEdit.java Mon Feb 27 13:46:11 2012
@@ -19,8 +19,10 @@
  */
 package org.apache.directory.server.core.api.txn.logedit;
 
+
 import org.apache.directory.server.core.api.log.LogAnchor;
 
+
 /**
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -29,8 +31,17 @@ public abstract class AbstractLogEdit im
 {
     /** position in the wal */
     private transient LogAnchor logAnchor = new LogAnchor();
-    
-    
+
+    /** Transaction under which the change is done */
+    protected long txnID;
+
+
+    protected AbstractLogEdit( long txnID )
+    {
+        this.txnID = txnID;
+    }
+
+
     /**
      * {@inheritDoc}
      */
@@ -38,8 +49,8 @@ public abstract class AbstractLogEdit im
     {
         return logAnchor;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
@@ -47,4 +58,16 @@ public abstract class AbstractLogEdit im
     {
         // do nothing by default
     }
+
+
+    public long getTxnID()
+    {
+        return txnID;
+    }
+
+
+    public void setTxnID( long id )
+    {
+        txnID = id;
+    }
 }

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=1294153&r1=1294152&r2=1294153&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 Mon Feb 27 13:46:11 2012
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
 import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.directory.server.core.api.partition.index.ForwardIndexEntry;
 import org.apache.directory.server.core.api.partition.index.IndexEntry;
@@ -53,6 +54,10 @@ abstract class AbstractTransaction imple
     /** The number of operations using this transaction */
     private int nbRef;
 
+    protected long id;
+
+    private static AtomicLong counter = new AtomicLong( 0 );
+
 
     /**
      * TODO : doco
@@ -61,6 +66,7 @@ abstract class AbstractTransaction imple
     {
         txnState = State.INITIAL;
         nbRef = 0;
+        id = counter.getAndIncrement();
     }
 
 
@@ -70,7 +76,7 @@ abstract class AbstractTransaction imple
     protected void startTxn( long startTime )
     {
         this.startTime = startTime;
-        setState( State.READ );
+        txnState = State.READ;
         nbRef++;
     }
 
@@ -100,7 +106,7 @@ abstract class AbstractTransaction imple
 
         if ( nbRef == 0 )
         {
-            setState( State.COMMIT );
+            txnState = State.COMMIT;
         }
     }
 
@@ -119,7 +125,7 @@ abstract class AbstractTransaction imple
      */
     public void abortTxn()
     {
-        setState( State.ABORT );
+        txnState = State.ABORT;
     }
 
 
@@ -144,15 +150,6 @@ abstract class AbstractTransaction imple
     /**
      * {@inheritDoc}
      */
-    public void setState( State newState )
-    {
-        txnState = newState;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
     public Entry mergeUpdates( Dn partitionDn, UUID entryID, Entry entry )
     {
         Entry prevEntry = entry;
@@ -225,4 +222,10 @@ abstract class AbstractTransaction imple
 
         return currentlyExists;
     }
+
+
+    public long getId()
+    {
+        return id;
+    }
 }
\ No newline at end of file

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=1294153&r1=1294152&r2=1294153&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 Mon Feb 27 13:46:11 2012
@@ -35,6 +35,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.api.txn.logedit.AbstractLogEdit;
 import org.apache.directory.server.core.api.txn.logedit.LogEdit;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
@@ -112,7 +113,7 @@ public class DefaultTxnLogManager implem
         {
             bout = new ByteArrayOutputStream();
             out = new ObjectOutputStream( bout );
-            out.writeObject( logEdit );
+            logEdit.writeExternal( out );
             out.flush();
             data = bout.toByteArray();
         }
@@ -134,6 +135,8 @@ public class DefaultTxnLogManager implem
         log( logRecord, sync );
 
         logEdit.getLogAnchor().resetLogAnchor( logRecord.getLogAnchor() );
+        ( ( AbstractLogEdit ) logEdit ).setTxnID( txn.getId() );
+
         txn.addLogEdit( logEdit );
     }
 

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=1294153&r1=1294152&r2=1294153&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 Mon Feb 27 13:46:11 2012
@@ -177,38 +177,37 @@ class DefaultTxnManager implements TxnMa
     public Transaction beginTransaction( boolean readOnly ) throws Exception
     {
         Transaction curTxn = getCurTxn();
-        Transaction transaction = null;
 
+        // Deal with an existing TXN
         if ( curTxn != null )
         {
+            // If we already have a RO TXN, then we can start another one
             if ( curTxn instanceof ReadOnlyTxn )
             {
                 if ( readOnly )
                 {
-                    transaction = beginReadOnlyTxn();
+                    return beginReadOnlyTxn();
                 }
                 else
                 {
-                    transaction = beginReadWriteTxn();
+                    return beginReadWriteTxn();
                 }
-
-                return transaction;
             }
 
+            // Cannot start a TXN when a RW txn is ongoing 
             throw new IllegalStateException( "Cannot begin a txn when txn is already running: " +
                 curTxn );
         }
 
+        // Normal situation : starts a brand new txn
         if ( readOnly )
         {
-            transaction = beginReadOnlyTxn();
+            return beginReadOnlyTxn();
         }
         else
         {
-            transaction = beginReadWriteTxn();
+            return beginReadWriteTxn();
         }
-
-        return transaction;
     }
 
 
@@ -241,6 +240,8 @@ class DefaultTxnManager implements TxnMa
         }
 
         setCurTxn( null );
+
+        //System.out.println( "TRAN: Committed " + txn );
     }
 
 
@@ -266,6 +267,9 @@ class DefaultTxnManager implements TxnMa
 
         txn.abortTxn();
         setCurTxn( null );
+
+        //System.out.println( "TRAN: Aborted " + txn );
+
     }
 
 
@@ -367,7 +371,6 @@ class DefaultTxnManager implements TxnMa
          * count and changes to txn2 are flushed to partitions. Below we loop until we make sure
          * that the txn for which we bumped up the ref count is indeed the latest committed txn.
          */
-
         do
         {
             if ( lastTxnToCheck != null )
@@ -376,37 +379,22 @@ class DefaultTxnManager implements TxnMa
             }
 
             lastTxnToCheck = latestCommittedTxn.get();
-
-            if ( lastTxnToCheck != null )
-            {
-                lastTxnToCheck.getRefCount().getAndIncrement();
-            }
-
+            lastTxnToCheck.getRefCount().getAndIncrement();
         }
         while ( lastTxnToCheck != latestCommittedTxn.get() );
 
         // Determine start time
         long startTime;
 
-        if ( lastTxnToCheck != null )
-        {
-            startTime = lastTxnToCheck.getCommitTime();
-        }
-        else
-        {
-            startTime = LogAnchor.UNKNOWN_LSN;
-        }
-
+        startTime = lastTxnToCheck.getCommitTime();
         txn.startTxn( startTime );
 
-        //        int refCount = lastTxnToCheck.getRefCount().get();
-        //        System.out.println("start time" + startTime + " " + refCount + 
-        //            " pending " + pending.incrementAndGet() );
-
         buildCheckList( txn, lastTxnToCheck );
 
         setCurTxn( txn );
 
+        //System.out.println( "TRAN: Started " + txn );
+
         return txn;
     }
 
@@ -432,7 +420,7 @@ class DefaultTxnManager implements TxnMa
         {
             bout = new ByteArrayOutputStream();
             out = new ObjectOutputStream( bout );
-            out.writeObject( txnRecord );
+            txnRecord.writeExternal( out );
             out.flush();
             data = bout.toByteArray();
         }
@@ -455,8 +443,8 @@ class DefaultTxnManager implements TxnMa
          * Get the start time and last txn to depend on
          * when mergin data under te writeTxnLock.
          */
-
         ReadWriteTxn lastTxnToCheck = null;
+
         writeTxnsLock.lock();
 
         try
@@ -473,14 +461,10 @@ class DefaultTxnManager implements TxnMa
 
                 lastTxnToCheck = latestVerifiedTxn.get();
 
-                if ( lastTxnToCheck != null )
-                {
-                    lastTxnToCheck.getRefCount().incrementAndGet();
-                }
+                lastTxnToCheck.getRefCount().incrementAndGet();
 
             }
             while ( lastTxnToCheck != latestVerifiedTxn.get() );
-
         }
         finally
         {
@@ -492,6 +476,8 @@ class DefaultTxnManager implements TxnMa
 
         setCurTxn( txn );
 
+        //System.out.println( "TRAN: Started " + txn );
+
         return txn;
     }
 
@@ -507,43 +493,30 @@ class DefaultTxnManager implements TxnMa
      */
     private void buildCheckList( Transaction txn, ReadWriteTxn lastTxnToCheck )
     {
-        if ( lastTxnToCheck != null )
-        {
-            long lastLSN = lastTxnToCheck.getCommitTime();
-            ReadWriteTxn toAdd;
+        long lastLSN = lastTxnToCheck.getCommitTime();
 
-            List<ReadWriteTxn> toCheckList = txn.getTxnsToCheck();
-            Iterator<ReadWriteTxn> it = committedQueue.iterator();
+        List<ReadWriteTxn> toCheckList = txn.getTxnsToCheck();
+        long flushedLSN = latestFlushedTxnLSN.get();
 
-            while ( it.hasNext() )
-            {
-                toAdd = it.next();
-
-                if ( toAdd.getCommitTime() > lastLSN )
-                {
-                    break;
-                }
+        // Get all the txns that has been committed before the new txn
+        for ( ReadWriteTxn toAdd : committedQueue )
+        {
+            long commitTime = toAdd.getCommitTime();
 
-                toCheckList.add( toAdd );
+            if ( commitTime > lastLSN )
+            {
+                break;
             }
 
             /*
              * Get latest flushed lsn and eliminate already flushed txn from the check list.
              */
-            long flushedLSN = latestFlushedTxnLSN.get();
-
-            it = toCheckList.iterator();
-            ReadWriteTxn toCheck;
-
-            while ( it.hasNext() )
+            if ( ( commitTime <= flushedLSN ) && ( toAdd != lastTxnToCheck ) )
             {
-                toCheck = it.next();
-
-                if ( toCheck.commitTime <= flushedLSN && toCheck != lastTxnToCheck )
-                {
-                    it.remove();
-                }
+                continue;
             }
+
+            toCheckList.add( toAdd );
         }
 
         // A read write txn, always has to check its changes
@@ -643,7 +616,7 @@ class DefaultTxnManager implements TxnMa
         {
             bout = new ByteArrayOutputStream();
             out = new ObjectOutputStream( bout );
-            out.writeObject( txnRecord );
+            txnRecord.writeExternal( out );
             out.flush();
             data = bout.toByteArray();
         }

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=1294153&r1=1294152&r2=1294153&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 Mon Feb 27 13:46:11 2012
@@ -46,31 +46,4 @@ class ReadOnlyTxn extends AbstractTransa
     {
         return nbRef > 1;
     }
-
-
-    /**
-     * @see Object#toString()
-     */
-    public String toString()
-    {
-        StringBuilder sb = new StringBuilder();
-
-        sb.append( "ROTxn[" );
-
-        // The state
-        sb.append( "state:" ).append( getState() );
-
-        // The ref count
-        sb.append( ", ref:" ).append( nbRef );
-
-        // The start time
-        sb.append( ", start:" ).append( getStartTime() );
-
-        // The commit time
-        sb.append( ", commit:" ).append( getCommitTime() );
-
-        sb.append( "]\n" );
-
-        return sb.toString();
-    }
 }

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=1294153&r1=1294152&r2=1294153&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 Mon Feb 27 13:46:11 2012
@@ -679,7 +679,7 @@ class ReadWriteTxn extends AbstractTrans
     {
         StringBuilder sb = new StringBuilder();
 
-        sb.append( "RWTxn[" );
+        sb.append( "RWTxn-" ).append( id ).append( "[" );
 
         // The state
         sb.append( "state:" ).append( getState() );
@@ -698,14 +698,14 @@ class ReadWriteTxn extends AbstractTrans
 
         if ( ( edits != null ) && ( edits.size() > 0 ) )
         {
-            sb.append( "{\n" );
+            sb.append( "LogEdits(" ).append( edits.size() ).append( ")\n[\n" );
 
             for ( LogEdit logEdit : edits )
             {
                 sb.append( logEdit ).append( "\n" );
             }
 
-            sb.append( "\n}" );
+            sb.append( "]" );
         }
 
         return sb.toString();

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/DataChangeContainer.java Mon Feb 27 13:46:11 2012
@@ -52,9 +52,6 @@ public class DataChangeContainer extends
     /** id of the entry if the container contains a change for an entry */
     private UUID entryID;
 
-    /** Transaction under which the change is done */
-    private long txnID;
-
     /** Partition stored for fast access */
     private transient Partition partition;
 
@@ -68,28 +65,18 @@ public class DataChangeContainer extends
     //For externalizable
     public DataChangeContainer()
     {
+        super( Long.MIN_VALUE );
     }
 
 
     public DataChangeContainer( Partition partition )
     {
+        super( Long.MIN_VALUE );
         this.partitionDn = partition.getSuffixDn();
         this.partition = partition;
     }
 
 
-    public long getTxnID()
-    {
-        return txnID;
-    }
-
-
-    public void setTxnID( long id )
-    {
-        txnID = id;
-    }
-
-
     public Dn getPartitionDn()
     {
         return partitionDn;
@@ -318,4 +305,35 @@ public class DataChangeContainer extends
             change.writeExternal( out );
         }
     }
+
+
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "DataChangeContainer(" );
+
+        // The partition
+        sb.append( partitionDn ).append( ", " );
+
+        // The entry UUID
+        sb.append( entryID ).append( ", " );
+
+        // The txn ID
+        sb.append( txnID ).append( ")\n{\n" );
+
+        for ( DataChange change : changes )
+        {
+            sb.append( "    " );
+            sb.append( change );
+            sb.append( '\n' );
+        }
+
+        sb.append( "}" );
+
+        return sb.toString();
+    }
 }

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/IndexChange.java Mon Feb 27 13:46:11 2012
@@ -186,7 +186,7 @@ public class IndexChange implements Inde
 
         sb.append( "IndexChange '" );
         // The index's name
-        sb.append( index.getAttribute().getName() ).append( "': " );
+        sb.append( index.getAttributeId() ).append( "': " );
 
         // The change' type
         sb.append( "<" ).append( type ).append( ", " );

Modified: directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/TxnStateChange.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/TxnStateChange.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/TxnStateChange.java (original)
+++ directory/apacheds/branches/apacheds-txns/core-shared/src/main/java/org/apache/directory/server/core/shared/txn/logedit/TxnStateChange.java Mon Feb 27 13:46:11 2012
@@ -33,9 +33,6 @@ import org.apache.directory.server.core.
  */
 public class TxnStateChange extends AbstractLogEdit
 {
-    /** ID of the txn associated with this change */
-    long txnID;
-
     /** State to record for the txn */
     ChangeState txnState;
 
@@ -45,22 +42,17 @@ public class TxnStateChange extends Abst
     // For deserialization
     public TxnStateChange()
     {
+        super( Long.MIN_VALUE );
     }
 
 
     public TxnStateChange( long txnID, ChangeState txnState )
     {
-        this.txnID = txnID;
+        super( txnID );
         this.txnState = txnState;
     }
 
 
-    public long getTxnID()
-    {
-        return txnID;
-    }
-
-
     public ChangeState getTxnState()
     {
         return txnState;

Modified: directory/apacheds/branches/apacheds-txns/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java (original)
+++ directory/apacheds/branches/apacheds-txns/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/search/ClientSearchRequestTest.java Mon Feb 27 13:46:11 2012
@@ -45,6 +45,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.SearchRequest;
 import org.apache.directory.shared.ldap.model.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.model.message.SearchResultDone;
+import org.apache.directory.shared.ldap.model.message.SearchResultEntry;
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaITImpl;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -63,7 +64,11 @@ import org.junit.runner.RunWith;
 @CreateLdapServer(transports =
     { @CreateTransport(protocol = "LDAP"), @CreateTransport(protocol = "LDAPS") })
 @ApplyLdifs(
-    { "dn: cn=user1,ou=users,ou=system", "objectClass: person", "objectClass: top", "sn: user1 sn",
+    {
+        "dn: cn=user1,ou=users,ou=system",
+        "objectClass: person",
+        "objectClass: top",
+        "sn: user1 sn",
         "cn: user1",
 
         // alias to the above entry
@@ -81,204 +86,222 @@ import org.junit.runner.RunWith;
         "sn:: RW1tYW51ZWwgTMOpY2hhcm55",
         "cn: elecharny"
 
-    })
+})
 public class ClientSearchRequestTest extends AbstractLdapTestUnit
 {
-    private LdapNetworkConnection connection;
-
-
-    @Before
-    public void setup() throws Exception
-    {
-        connection = LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() );
-    }
-
-
-    @After
-    public void shutdown() throws Exception
-    {
-        LdapApiIntegrationUtils.releasePooledAdminConnection( connection, getLdapServer() );
-    }
-
-
-    @Test
-    public void testSimpleSearch() throws Exception
-    {
-        EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL );
-        int count = 0;
-        
-        while ( cursor.next() )
-        {
-            Entry entry = cursor.get();
-            assertNotNull( entry );
-            count++;
-        }
-
-        SearchResultDone done = cursor.getSearchResultDone();
-
-        assertNotNull( done );
-        assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
-        assertEquals( 5, count );
-        cursor.close();
-    }
-
-
-    @Test
-    public void testSimpleSearchWithControl() throws Exception
-    {
-        SearchRequest searchRequest = new SearchRequestImpl().setBase( new Dn( "ou=system" ) ).setFilter( "(objectclass=*)" )
-        .setScope( SearchScope.ONELEVEL ).addControl( new ManageDsaITImpl() );
-        EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL );
-        int count = 0;
-        
-        while ( cursor.next() )
-        {
-            Entry entry = cursor.get();
-            assertNotNull( entry );
-            count++;
-        }
-
-        SearchResultDone done = cursor.getSearchResultDone();
-
-        assertNotNull( done );
-        assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
-        assertEquals( 5, count );
-        cursor.close();
-    }
-
-
-    @Test
-    public void testSearch() throws Exception
-    {
-        EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)",
-            SearchScope.ONELEVEL,
-            "*", "+" );
-        int count = 0;
-        
-        while ( cursor.next() )
-        {
-            assertNotNull( cursor.get() );
-            count++;
-        }
-
-        SearchResultDone done = cursor.getSearchResultDone();
-
-        assertNotNull( done );
-        assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
-        assertEquals( 5, count );
-        cursor.close();
-    }
-
-
-    @Test
-    public void testSearchEquality() throws Exception
-    {
-        EntryCursor cursor = connection.search( "ou=system", "(objectclass=organizationalUnit)",
-            SearchScope.ONELEVEL, "*", "+" );
-        int count = 0;
-        
-        while ( cursor.next() )
-        {
-            Entry entry = cursor.get();
-            assertNotNull( entry );
-            count++;
-        }
-
-        assertEquals( 4, count );
-        cursor.close();
-    }
-
-
-    @Test
-    public void testAsyncSearch() throws Exception
-    {
-        SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL, "*",
-            "+" );
-        int count = 0;
-        Response searchResponse = null;
-
-        do
-        {
-            searchResponse = ( Response ) searchFuture.get( 1000, TimeUnit.MILLISECONDS );
-            assertNotNull( searchResponse );
-            if ( !( searchResponse instanceof SearchResultDone ) )
-            {
-                count++;
-            }
-        }
-        while ( !( searchResponse instanceof SearchResultDone ) );
-
-        assertEquals( 5, count );
-    }
-
-
-    /**
-     * Test a search with a Substring filter
-     * @throws Exception
-     */
-    @Test
-    public void testSearchPersonSubstring() throws Exception
-    {
-        SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*ers*)", SearchScope.SUBTREE,
-            "*", "+" );
-        int count = 0;
-        Response searchResponse = null;
-
-        do
-        {
-            searchResponse = ( Response ) searchFuture.get( 100000, TimeUnit.MILLISECONDS );
-            assertNotNull( searchResponse );
-
-            if ( !( searchResponse instanceof SearchResultDone ) )
-            {
-                count++;
-            }
-        }
-        while ( !( searchResponse instanceof SearchResultDone ) );
-
-        assertEquals( 3, count );
-    }
-
-
-    @Test
-    public void testSearchWithDerefAlias() throws Exception
-    {
-        SearchRequest searchRequest = new SearchRequestImpl();
-        searchRequest.setBase( new Dn( "ou=users,ou=system" ) );
-        searchRequest.setFilter( "(objectClass=*)" );
-        searchRequest.setScope( SearchScope.ONELEVEL );
-        searchRequest.addAttributes( "*" );
-
-        int count = 0;
-        Cursor<Response> cursor = connection.search( searchRequest );
-
-        while ( cursor.next() )
-        {
-            count++;
-        }
-        cursor.close();
-
-        // due to dereferencing of aliases we get only one entry
-        assertEquals( 2, count );
-
-        count = 0;
-        searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
-        cursor = connection.search( searchRequest );
-
-        while ( cursor.next() )
-        {
-            count++;
-        }
-        cursor.close();
-
-        assertEquals( 3, count );
-    }
-
-
-    @Test(expected = LdapException.class)
-    public void testSearchUTF8() throws Exception
-    {
-        connection.search( "ou=system", "(sn=Emmanuel L\u00e9charny)", SearchScope.ONELEVEL, "*", "+" );
-        fail();
-    }
+	private LdapNetworkConnection connection;
+	
+	
+	@Before
+	public void setup() throws Exception
+	{
+	    connection = LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() );
+	}
+	
+	
+	@After
+	public void shutdown() throws Exception
+	{
+	    LdapApiIntegrationUtils.releasePooledAdminConnection( connection, getLdapServer() );
+	}
+	
+	
+	@Test
+	public void testSimpleSearch() throws Exception
+	{
+	    EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL );
+	    int count = 0;
+	
+	    while ( cursor.next() )
+	    {
+	        Entry entry = cursor.get();
+	        assertNotNull( entry );
+	        count++;
+	    }
+	
+	    SearchResultDone done = cursor.getSearchResultDone();
+	
+	    assertNotNull( done );
+	    assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
+	    assertEquals( 5, count );
+	    cursor.close();
+	}
+	
+	
+	@Test
+	public void testSimpleSearchWithControl() throws Exception
+	{
+	    SearchRequest searchRequest = new SearchRequestImpl().setBase( new Dn( "ou=system" ) )
+	        .setFilter( "(objectclass=*)" )
+	        .setScope( SearchScope.ONELEVEL ).addControl( new ManageDsaITImpl() );
+	    EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL );
+	    int count = 0;
+	
+	    while ( cursor.next() )
+	    {
+	        Entry entry = cursor.get();
+	        assertNotNull( entry );
+	        count++;
+	    }
+	
+	    SearchResultDone done = cursor.getSearchResultDone();
+	
+	    assertNotNull( done );
+	    assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
+	    assertEquals( 5, count );
+	    cursor.close();
+	}
+	
+	
+	@Test
+	public void testSearch() throws Exception
+	{
+	    EntryCursor cursor = connection.search( "ou=system", "(objectclass=*)",
+	        SearchScope.ONELEVEL,
+	        "*", "+" );
+	    int count = 0;
+	
+	    while ( cursor.next() )
+	    {
+	        assertNotNull( cursor.get() );
+	        count++;
+	    }
+	
+	    SearchResultDone done = cursor.getSearchResultDone();
+	
+	    assertNotNull( done );
+	    assertEquals( ResultCodeEnum.SUCCESS, done.getLdapResult().getResultCode() );
+	    assertEquals( 5, count );
+	    cursor.close();
+	}
+	
+	
+	@Test
+	public void testSearchEquality() throws Exception
+	{
+	    EntryCursor cursor = connection.search( "ou=system", "(objectclass=organizationalUnit)",
+	        SearchScope.ONELEVEL, "*", "+" );
+	    int count = 0;
+	
+	    while ( cursor.next() )
+	    {
+	        Entry entry = cursor.get();
+	        assertNotNull( entry );
+	        count++;
+	    }
+	
+	    assertEquals( 4, count );
+	    cursor.close();
+	}
+	
+	
+	@Test
+	public void testAsyncSearch() throws Exception
+	{
+	    SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*)", SearchScope.ONELEVEL, "*",
+	        "+" );
+	    int count = 0;
+	    Response searchResponse = null;
+	
+	    do
+	    {
+	        searchResponse = ( Response ) searchFuture.get( 1000, TimeUnit.MILLISECONDS );
+	        assertNotNull( searchResponse );
+	        if ( !( searchResponse instanceof SearchResultDone ) )
+	        {
+	            count++;
+	        }
+	    }
+	    while ( !( searchResponse instanceof SearchResultDone ) );
+	
+	    assertEquals( 5, count );
+	}
+	
+	
+	/**
+	 * Test a search with a Substring filter
+	 * @throws Exception
+	 */
+	@Test
+	public void testSearchPersonSubstring() throws Exception
+	{
+	    SearchFuture searchFuture = connection.searchAsync( "ou=system", "(objectclass=*)", SearchScope.SUBTREE, "*", "+" );
+	
+	    Response searchResponse = null;
+	
+	    do
+	    {
+	        searchResponse = ( Response ) searchFuture.get( 100000, TimeUnit.MILLISECONDS );
+	
+	        if ( !( searchResponse instanceof SearchResultDone ) )
+	        {
+	            System.out.println( ( ( SearchResultEntry ) searchResponse ).getEntry() );
+	        }
+	
+	    }
+	    while ( !( searchResponse instanceof SearchResultDone ) );
+	
+	    searchFuture = connection.searchAsync( "ou=system", "(objectclass=*ers*)", SearchScope.SUBTREE,
+	        "*", "+" );
+	
+	    int count = 0;
+	
+	    do
+	    {
+	        searchResponse = ( Response ) searchFuture.get( 100000, TimeUnit.MILLISECONDS );
+	        assertNotNull( searchResponse );
+	
+	        if ( !( searchResponse instanceof SearchResultDone ) )
+	        {
+	            count++;
+	            System.out.println( ( ( SearchResultEntry ) searchResponse ).getEntry().get( "objectClass" ) );
+	        }
+	    }
+	    while ( !( searchResponse instanceof SearchResultDone ) );
+	
+	    assertEquals( 3, count );
+	}
+	
+	
+	@Test
+	public void testSearchWithDerefAlias() throws Exception
+	{
+	    SearchRequest searchRequest = new SearchRequestImpl();
+	    searchRequest.setBase( new Dn( "ou=users,ou=system" ) );
+	    searchRequest.setFilter( "(objectClass=*)" );
+	    searchRequest.setScope( SearchScope.ONELEVEL );
+	    searchRequest.addAttributes( "*" );
+	
+	    int count = 0;
+	    Cursor<Response> cursor = connection.search( searchRequest );
+	
+	    while ( cursor.next() )
+	    {
+	        count++;
+	    }
+	    cursor.close();
+	
+	    // due to dereferencing of aliases we get only one entry
+	    assertEquals( 2, count );
+	
+	    count = 0;
+	    searchRequest.setDerefAliases( AliasDerefMode.NEVER_DEREF_ALIASES );
+	    cursor = connection.search( searchRequest );
+	
+	    while ( cursor.next() )
+	    {
+	        count++;
+	    }
+	    cursor.close();
+	
+	    assertEquals( 3, count );
+	}
+	
+	
+	@Test(expected = LdapException.class)
+	public void testSearchUTF8() throws Exception
+	{
+	    connection.search( "ou=system", "(sn=Emmanuel L\u00e9charny)", SearchScope.ONELEVEL, "*", "+" );
+	    fail();
+	}
 }

Modified: directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/branches/apacheds-txns/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Mon Feb 27 13:46:11 2012
@@ -441,7 +441,8 @@ public class SearchHandler extends LdapR
             }
 
             Entry entry = cursor.get();
-            session.getIoSession().write( generateResponse( session, req, entry ) );
+            Response response = generateResponse( session, req, entry );
+            session.getIoSession().write( response );
             LOG.debug( "Sending {}", entry.getDn() );
             count++;
         }

Modified: directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/suites/StockServerISuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/suites/StockServerISuite.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/suites/StockServerISuite.java (original)
+++ directory/apacheds/branches/apacheds-txns/server-integ/src/test/java/org/apache/directory/server/suites/StockServerISuite.java Mon Feb 27 13:46:11 2012
@@ -52,7 +52,6 @@ import org.apache.directory.server.opera
 import org.apache.directory.server.operations.modifydn.MoveIT;
 import org.apache.directory.server.operations.search.IndexedNegationSearchIT;
 import org.apache.directory.server.operations.search.NegationSearchIT;
-import org.apache.directory.server.operations.search.PagedSearchIT;
 import org.apache.directory.server.operations.search.PersistentSearchIT;
 import org.apache.directory.server.operations.search.ReferralSearchIT;
 import org.apache.directory.server.operations.search.ReferralSearchNoRevertIT;
@@ -73,8 +72,9 @@ import org.junit.runners.Suite;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-@RunWith ( FrameworkSuite.class )
-@Suite.SuiteClasses ( {
+@RunWith(FrameworkSuite.class)
+@Suite.SuiteClasses(
+    {
         // kerberos
         KeyDerivationServiceIT.class,
         PasswordPolicyServiceIT.class,
@@ -120,7 +120,7 @@ import org.junit.runners.Suite;
         // operations.search
         IndexedNegationSearchIT.class,
         NegationSearchIT.class,
-        PagedSearchIT.class,
+        //PagedSearchIT.class,
         PersistentSearchIT.class,
         ReferralSearchIT.class,
         ReferralSearchNoRevertIT.class,
@@ -136,33 +136,33 @@ import org.junit.runners.Suite;
         StartTlsConfidentialityIT.class,
         StartTlsIT.class,
         StartTlsUpdateCertificateIT.class
-        } )
-@CreateDS( 
-    name = "SuiteDS",
-    partitions =
+})
+@CreateDS(
+name = "SuiteDS",
+partitions =
     {
         @CreatePartition(
             name = "example",
             suffix = "dc=example,dc=com",
-            contextEntry = @ContextEntry( 
+            contextEntry = @ContextEntry(
                 entryLdif =
-                    "dn: dc=example,dc=com\n" +
+                "dn: dc=example,dc=com\n" +
                     "dc: example\n" +
                     "objectClass: top\n" +
-                    "objectClass: domain\n\n" ),
-            indexes = 
-            {
-                @CreateIndex( attribute = "objectClass" ),
-                @CreateIndex( attribute = "dc" ),
-                @CreateIndex( attribute = "ou" )
-            } )
-    } )
-@CreateLdapServer ( 
-    transports = 
+                    "objectClass: domain\n\n"),
+            indexes =
+                {
+                    @CreateIndex(attribute = "objectClass"),
+                    @CreateIndex(attribute = "dc"),
+                    @CreateIndex(attribute = "ou")
+            })
+})
+@CreateLdapServer(
+transports =
     {
-        @CreateTransport( protocol = "LDAP" ), 
-        @CreateTransport( protocol = "LDAPS" ) 
-    })
+        @CreateTransport(protocol = "LDAP"),
+        @CreateTransport(protocol = "LDAPS")
+})
 public class StockServerISuite
 {
 }

Modified: directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java?rev=1294153&r1=1294152&r2=1294153&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java (original)
+++ directory/apacheds/branches/apacheds-txns/service-builder/src/main/java/org/apache/directory/server/config/builder/ServiceBuilder.java Mon Feb 27 13:46:11 2012
@@ -61,6 +61,7 @@ import org.apache.directory.server.confi
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.api.DirectoryService;
 import org.apache.directory.server.core.api.InstanceLayout;
+import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.server.core.api.changelog.ChangeLog;
 import org.apache.directory.server.core.api.interceptor.Interceptor;
 import org.apache.directory.server.core.api.journal.Journal;
@@ -70,7 +71,6 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authn.Authenticator;
 import org.apache.directory.server.core.authn.DelegatingAuthenticator;
-import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
 import org.apache.directory.server.core.authn.ppolicy.PpolicyConfigContainer;
 import org.apache.directory.server.core.changelog.DefaultChangeLog;
 import org.apache.directory.server.core.journal.DefaultJournal;
@@ -135,7 +135,7 @@ public class ServiceBuilder
             return Strings.toLowerCase( file.getName() ).endsWith( ".ldif" );
         }
     };
-    
+
 
     /**
      * Creates the Interceptor instances from the configuration
@@ -147,7 +147,7 @@ public class ServiceBuilder
     public static List<Interceptor> createInterceptors( List<InterceptorBean> interceptorBeans ) throws LdapException
     {
         List<Interceptor> interceptors = new ArrayList<Interceptor>( interceptorBeans.size() );
-        
+
         // First order the interceptorBeans
         Set<InterceptorBean> orderedInterceptorBeans = new TreeSet<InterceptorBean>();
 
@@ -164,22 +164,27 @@ public class ServiceBuilder
         {
             try
             {
-                LOG.debug( "loading the interceptor class {} and instantiating", interceptorBean.getInterceptorClassName() );
-                Interceptor interceptor = ( Interceptor ) Class.forName( interceptorBean.getInterceptorClassName() ).newInstance();
-                
-                if (interceptorBean instanceof AuthenticationInterceptorBean) {
+                LOG.debug( "loading the interceptor class {} and instantiating",
+                    interceptorBean.getInterceptorClassName() );
+                Interceptor interceptor = ( Interceptor ) Class.forName( interceptorBean.getInterceptorClassName() )
+                    .newInstance();
+
+                if ( interceptorBean instanceof AuthenticationInterceptorBean )
+                {
                     // Transports
-                    Authenticator[] authenticators = createAuthenticators( ((AuthenticationInterceptorBean)interceptorBean).getAuthenticators() );
-                    ((AuthenticationInterceptor) interceptor).setAuthenticators( authenticators );
-                    
+                    Authenticator[] authenticators = createAuthenticators( ( ( AuthenticationInterceptorBean ) interceptorBean )
+                        .getAuthenticators() );
+                    ( ( AuthenticationInterceptor ) interceptor ).setAuthenticators( authenticators );
+
                     // password policies
-                    List<PasswordPolicyBean> ppolicyBeans = ((AuthenticationInterceptorBean)interceptorBean).getPasswordPolicies();
-                    PpolicyConfigContainer ppolicyContainer = new  PpolicyConfigContainer();
+                    List<PasswordPolicyBean> ppolicyBeans = ( ( AuthenticationInterceptorBean ) interceptorBean )
+                        .getPasswordPolicies();
+                    PpolicyConfigContainer ppolicyContainer = new PpolicyConfigContainer();
 
                     for ( PasswordPolicyBean ppolicyBean : ppolicyBeans )
                     {
                         PasswordPolicyConfiguration ppolicyConfig = createPwdPolicyConfig( ppolicyBean );
-                        
+
                         if ( ppolicyConfig != null )
                         {
                             // the name should be strictly 'default', the default policy can't be enforced by defining a new AT
@@ -193,25 +198,26 @@ public class ServiceBuilder
                             }
                         }
                     }
-                    
+
                     ( ( AuthenticationInterceptor ) interceptor ).setPwdPolicies( ppolicyContainer );
                 }
-                
+
                 interceptors.add( interceptor );
             }
             catch ( Exception e )
             {
                 e.printStackTrace();
-                String message = "Cannot initialize the " + interceptorBean.getInterceptorClassName() + ", error : " + e;
+                String message = "Cannot initialize the " + interceptorBean.getInterceptorClassName() + ", error : "
+                    + e;
                 LOG.error( message );
                 throw new ConfigurationException( message );
             }
         }
-        
+
         return interceptors;
     }
-    
-    
+
+
     /**
      * creates the PassworddPolicyConfiguration object after reading the config entry containing pwdpolicy OC
      *
@@ -224,9 +230,9 @@ public class ServiceBuilder
         {
             return null;
         }
-        
+
         PasswordPolicyConfiguration passwordPolicy = new PasswordPolicyConfiguration();
-        
+
         passwordPolicy.setPwdAllowUserChange( passwordPolicyBean.isPwdAllowUserChange() );
         passwordPolicy.setPwdAttribute( passwordPolicyBean.getPwdAttribute() );
         passwordPolicy.setPwdCheckQuality( passwordPolicyBean.getPwdCheckQuality() );
@@ -247,11 +253,11 @@ public class ServiceBuilder
         passwordPolicy.setPwdMinLength( passwordPolicyBean.getPwdMinLength() );
         passwordPolicy.setPwdMustChange( passwordPolicyBean.isPwdMustChange() );
         passwordPolicy.setPwdSafeModify( passwordPolicyBean.isPwdSafeModify() );
-        
+
         return passwordPolicy;
     }
 
-    
+
     /**
      * Read the configuration for the ChangeLog system
      * 
@@ -264,16 +270,16 @@ public class ServiceBuilder
         {
             return null;
         }
-        
+
         ChangeLog changeLog = new DefaultChangeLog();
-        
+
         changeLog.setEnabled( changeLogBean.isEnabled() );
         changeLog.setExposed( changeLogBean.isChangeLogExposed() );
 
         return changeLog;
     }
-    
-    
+
+
     /**
      * Instantiate the Journal object from the stored configuration
      * 
@@ -286,7 +292,7 @@ public class ServiceBuilder
         {
             return null;
         }
-        
+
         Journal journal = new DefaultJournal();
 
         journal.setRotation( journalBean.getJournalRotation() );
@@ -298,7 +304,7 @@ public class ServiceBuilder
         store.setWorkingDirectory( journalBean.getJournalWorkingDir() );
 
         journal.setJournalStore( store );
-        
+
         return journal;
     }
 
@@ -323,7 +329,7 @@ public class ServiceBuilder
         else
         {
             LOG.debug( "parsing the LDIF file(s) present at the path {}", entryFilePath );
-            
+
             try
             {
                 loadEntries( file, entries );
@@ -344,7 +350,7 @@ public class ServiceBuilder
 
         return entries;
     }
-    
+
 
     /**
      * Load the entries from a Ldif file recursively
@@ -365,7 +371,7 @@ public class ServiceBuilder
         else
         {
             LdifReader reader = new LdifReader();
-            
+
             try
             {
                 entries.addAll( reader.parseLdifFile( ldifFile.getAbsolutePath() ) );
@@ -385,17 +391,18 @@ public class ServiceBuilder
      * @return an instance of the MechanismHandler type
      * @throws ConfigurationException if the SASL mechanism handler cannot be created
      */
-    public static MechanismHandler createSaslMechHandler( SaslMechHandlerBean saslMechHandlerBean ) throws ConfigurationException
+    public static MechanismHandler createSaslMechHandler( SaslMechHandlerBean saslMechHandlerBean )
+        throws ConfigurationException
     {
         if ( ( saslMechHandlerBean == null ) || saslMechHandlerBean.isDisabled() )
         {
             return null;
         }
-        
+
         String mechClassName = saslMechHandlerBean.getSaslMechClassName();
-        
+
         Class<?> mechClass = null;
-        
+
         try
         {
             mechClass = Class.forName( mechClassName );
@@ -406,9 +413,9 @@ public class ServiceBuilder
             LOG.error( message );
             throw new ConfigurationException( message );
         }
-        
+
         MechanismHandler handler = null;
-        
+
         try
         {
             handler = ( MechanismHandler ) mechClass.newInstance();
@@ -425,57 +432,63 @@ public class ServiceBuilder
             LOG.error( message );
             throw new ConfigurationException( message );
         }
-        
+
         if ( mechClass == NtlmMechanismHandler.class )
         {
             NtlmMechanismHandler ntlmHandler = ( NtlmMechanismHandler ) handler;
             ntlmHandler.setNtlmProviderFqcn( saslMechHandlerBean.getNtlmMechProvider() );
         }
-        
+
         return handler;
     }
-    
+
+
     /**
      * Creates a Authenticator from the configuration
      * 
      * @param authenticatorBean The created instance of authenticator
      * @return An instance of authenticator if the given authenticatorBean is not disabled
      */
-    public static Authenticator createAuthenticator( AuthenticatorBean authenticatorBean ) throws ConfigurationException
+    public static Authenticator createAuthenticator( AuthenticatorBean authenticatorBean )
+        throws ConfigurationException
     {
         if ( authenticatorBean.isDisabled() )
         {
             return null;
         }
-        
+
         Authenticator authenticator = null;
-        
-        if (authenticatorBean instanceof DelegatingAuthenticatorBean)
+
+        if ( authenticatorBean instanceof DelegatingAuthenticatorBean )
         {
             authenticator = new DelegatingAuthenticator();
-            ((DelegatingAuthenticator)authenticator).setDelegateHost( ((DelegatingAuthenticatorBean) authenticatorBean).getDelegateHost() );
-            ((DelegatingAuthenticator)authenticator).setDelegatePort( ((DelegatingAuthenticatorBean) authenticatorBean).getDelegatePort() );
+            ( ( DelegatingAuthenticator ) authenticator )
+                .setDelegateHost( ( ( DelegatingAuthenticatorBean ) authenticatorBean ).getDelegateHost() );
+            ( ( DelegatingAuthenticator ) authenticator )
+                .setDelegatePort( ( ( DelegatingAuthenticatorBean ) authenticatorBean ).getDelegatePort() );
         }
         else if ( authenticatorBean instanceof AuthenticatorImplBean )
         {
             String fqcn = ( ( AuthenticatorImplBean ) authenticatorBean ).getAuthenticatorClass();
-            
+
             try
             {
                 Class<?> authnImplClass = Class.forName( fqcn );
                 authenticator = ( Authenticator ) authnImplClass.newInstance();
             }
-            catch( Exception e )
+            catch ( Exception e )
             {
-                String errorMsg = "Failed to instantiate the configured authenticator " + authenticatorBean.getAuthenticatorId();
+                String errorMsg = "Failed to instantiate the configured authenticator "
+                    + authenticatorBean.getAuthenticatorId();
                 LOG.warn( errorMsg );
                 throw new ConfigurationException( errorMsg, e );
             }
         }
-        
+
         return authenticator;
     }
 
+
     /**
      * Creates a Transport from the configuration
      * 
@@ -488,7 +501,7 @@ public class ServiceBuilder
         {
             return null;
         }
-        
+
         Transport transport = null;
 
         if ( transportBean instanceof TcpTransportBean )
@@ -509,7 +522,7 @@ public class ServiceBuilder
         return transport;
     }
 
-    
+
     /**
      * Creates the array of transports read from the DIT
      * 
@@ -518,17 +531,18 @@ public class ServiceBuilder
      */
     public static Authenticator[] createAuthenticators( List<AuthenticatorBean> list ) throws ConfigurationException
     {
-        Authenticator[] authenticators = new Authenticator[ list.size() ];
+        Authenticator[] authenticators = new Authenticator[list.size()];
         int i = 0;
-        
+
         for ( AuthenticatorBean authenticatorBean : list )
         {
             authenticators[i++] = createAuthenticator( authenticatorBean );
         }
-        
+
         return authenticators;
     }
 
+
     /**
      * Creates the array of transports read from the DIT
      * 
@@ -538,7 +552,7 @@ public class ServiceBuilder
     public static Transport[] createTransports( TransportBean[] transportBeans )
     {
         List<Transport> transports = new ArrayList<Transport>();
-        
+
         for ( TransportBean transportBean : transportBeans )
         {
             if ( transportBean.isEnabled() )
@@ -546,9 +560,11 @@ public class ServiceBuilder
                 transports.add( createTransport( transportBean ) );
             }
         }
-        
+
         return transports.toArray( new Transport[transports.size()] );
     }
+
+
     /**
      * Helper method to create an Array of EncryptionTypes from an array of Strings
      */
@@ -558,18 +574,19 @@ public class ServiceBuilder
         {
             return new EncryptionType[0];
         }
-        
+
         EncryptionType[] types = new EncryptionType[encryptionTypes.size()];
         int pos = 0;
-        
+
         for ( String encryptionType : encryptionTypes )
         {
             types[pos++] = EncryptionType.getByName( encryptionType );
         }
-        
+
         return types;
     }
 
+
     /**
      * Instantiates a NtpServer based on the configuration present in the partition
      *
@@ -577,7 +594,8 @@ public class ServiceBuilder
      * @return Instance of NtpServer
      * @throws org.apache.directory.shared.ldap.model.exception.LdapException
      */
-    public static NtpServer createNtpServer( NtpServerBean ntpServerBean, DirectoryService directoryService ) throws LdapException
+    public static NtpServer createNtpServer( NtpServerBean ntpServerBean, DirectoryService directoryService )
+        throws LdapException
     {
         // Fist, do nothing if the NtpServer is disabled
         if ( ( ntpServerBean == null ) || ntpServerBean.isDisabled() )
@@ -586,14 +604,14 @@ public class ServiceBuilder
         }
 
         NtpServer ntpServer = new NtpServer();
-        
+
         // The service ID
         ntpServer.setServiceId( ntpServerBean.getServerId() );
-        
+
         // The transports
         Transport[] transports = createTransports( ntpServerBean.getTransports() );
         ntpServer.setTransports( transports );
-        
+
         return ntpServer;
     }
 
@@ -633,7 +651,8 @@ public class ServiceBuilder
      * @return Instance of KdcServer
      * @throws org.apache.directory.shared.ldap.model.exception.LdapException
      */
-    public static KdcServer createKdcServer( KdcServerBean kdcServerBean, DirectoryService directoryService ) throws LdapException
+    public static KdcServer createKdcServer( KdcServerBean kdcServerBean, DirectoryService directoryService )
+        throws LdapException
     {
         // Fist, do nothing if the KdcServer is disabled
         if ( ( kdcServerBean == null ) || kdcServerBean.isDisabled() )
@@ -642,69 +661,69 @@ public class ServiceBuilder
         }
 
         KdcServer kdcServer = new KdcServer();
-        
+
         kdcServer.setDirectoryService( directoryService );
         kdcServer.setEnabled( true );
-        
+
         kdcServer.setDirectoryService( directoryService );
-        
+
         // The ID
         kdcServer.setServiceId( kdcServerBean.getServerId() );
-        
+
         // AllowableClockSkew
         kdcServer.setAllowableClockSkew( kdcServerBean.getKrbAllowableClockSkew() );
-        
+
         // BodyChecksumVerified
         kdcServer.setBodyChecksumVerified( kdcServerBean.isKrbBodyChecksumVerified() );
-        
+
         // CatalogBased
         //kdcServer.setCatelogBased( kdcServerBean.is );
-        
+
         // EmptyAddressesAllowed
         kdcServer.setEmptyAddressesAllowed( kdcServerBean.isKrbEmptyAddressesAllowed() );
-        
+
         // EncryptionType
         EncryptionType[] encryptionTypes = createEncryptionTypes( kdcServerBean.getKrbEncryptionTypes() );
         kdcServer.setEncryptionTypes( encryptionTypes );
-        
+
         // ForwardableAllowed
         kdcServer.setForwardableAllowed( kdcServerBean.isKrbForwardableAllowed() );
-        
+
         // KdcPrincipal
         kdcServer.setKdcPrincipal( kdcServerBean.getKrbKdcPrincipal().toString() );
-        
+
         // MaximumRenewableLifetime
         kdcServer.setMaximumRenewableLifetime( kdcServerBean.getKrbMaximumRenewableLifetime() );
-        
+
         // MaximumTicketLifetime
         kdcServer.setMaximumTicketLifetime( kdcServerBean.getKrbMaximumTicketLifetime() );
-        
+
         // PaEncTimestampRequired
         kdcServer.setPaEncTimestampRequired( kdcServerBean.isKrbPaEncTimestampRequired() );
-        
+
         // PostdatedAllowed
         kdcServer.setPostdatedAllowed( kdcServerBean.isKrbPostdatedAllowed() );
-        
+
         // PrimaryRealm
         kdcServer.setPrimaryRealm( kdcServerBean.getKrbPrimaryRealm() );
-        
+
         // ProxiableAllowed
         kdcServer.setProxiableAllowed( kdcServerBean.isKrbProxiableAllowed() );
 
         // RenewableAllowed
         kdcServer.setRenewableAllowed( kdcServerBean.isKrbRenewableAllowed() );
-        
+
         // searchBaseDn
         kdcServer.setSearchBaseDn( kdcServerBean.getSearchBaseDn().getName() );
-        
+
         // The transports
         Transport[] transports = createTransports( kdcServerBean.getTransports() );
         kdcServer.setTransports( transports );
-        
+
         return kdcServer;
     }
-    
-    
+
+
     /**
      * Instantiates the HttpWebApps based on the configuration present in the partition
      *
@@ -712,7 +731,8 @@ public class ServiceBuilder
      * @return Instances of HttpWebAppBean
      * @throws LdapException
      */
-    public static Set<WebApp> createHttpWebApps( List<HttpWebAppBean> httpWebAppBeans, DirectoryService directoryService ) throws LdapException
+    public static Set<WebApp> createHttpWebApps( List<HttpWebAppBean> httpWebAppBeans, DirectoryService directoryService )
+        throws LdapException
     {
         Set<WebApp> webApps = new HashSet<WebApp>();
 
@@ -727,22 +747,22 @@ public class ServiceBuilder
             {
                 continue;
             }
-            
+
             WebApp webApp = new WebApp();
-            
+
             // HttpAppCtxPath
             webApp.setContextPath( httpWebAppBean.getHttpAppCtxPath() );
-            
+
             // HttpWarFile
             webApp.setWarFile( httpWebAppBean.getHttpWarFile() );
-            
+
             webApps.add( webApp );
         }
-        
+
         return webApps;
     }
-    
-    
+
+
     /**
      * Instantiates a HttpServer based on the configuration present in the partition
      *
@@ -750,7 +770,8 @@ public class ServiceBuilder
      * @return Instance of LdapServer
      * @throws LdapException
      */
-    public static HttpServer createHttpServer( HttpServerBean httpServerBean, DirectoryService directoryService ) throws LdapException
+    public static HttpServer createHttpServer( HttpServerBean httpServerBean, DirectoryService directoryService )
+        throws LdapException
     {
         // Fist, do nothing if the HttpServer is disabled
         if ( ( httpServerBean == null ) || httpServerBean.isDisabled() )
@@ -759,25 +780,25 @@ public class ServiceBuilder
         }
 
         HttpServer httpServer = new HttpServer();
-        
+
         // HttpConfFile
         httpServer.setConfFile( httpServerBean.getHttpConfFile() );
-        
+
         // The transports
         TransportBean[] transports = httpServerBean.getTransports();
-        
+
         for ( TransportBean transportBean : transports )
         {
             if ( transportBean.isDisabled() )
             {
                 continue;
             }
-            
+
             if ( transportBean instanceof TcpTransportBean )
             {
                 TcpTransport transport = new TcpTransport( transportBean.getSystemPort() );
                 transport.setAddress( transportBean.getTransportAddress() );
-                
+
                 if ( transportBean.getTransportId().equalsIgnoreCase( HttpServer.HTTP_TRANSPORT_ID ) )
                 {
                     httpServer.setHttpTransport( transport );
@@ -792,14 +813,14 @@ public class ServiceBuilder
                 }
             }
         }
-        
+
         // The webApps
         httpServer.setWebApps( createHttpWebApps( httpServerBean.getHttpWebApps(), directoryService ) );
-        
+
         return httpServer;
     }
-    
-    
+
+
     /**
      * Instantiates a ChangePasswordServer based on the configuration present in the partition
      *
@@ -861,7 +882,7 @@ public class ServiceBuilder
         return changePasswordServer;
     }
     */
-    
+
     /**
      * Instantiates a LdapServer based on the configuration present in the partition
      *
@@ -869,7 +890,8 @@ public class ServiceBuilder
      * @return Instance of LdapServer
      * @throws LdapException
      */
-    public static LdapServer createLdapServer( LdapServerBean ldapServerBean, DirectoryService directoryService ) throws LdapException
+    public static LdapServer createLdapServer( LdapServerBean ldapServerBean, DirectoryService directoryService )
+        throws LdapException
     {
         // Fist, do nothing if the LdapServer is disabled
         if ( ( ldapServerBean == null ) || ldapServerBean.isDisabled() )
@@ -878,10 +900,10 @@ public class ServiceBuilder
         }
 
         LdapServer ldapServer = new LdapServer();
-        
+
         ldapServer.setDirectoryService( directoryService );
         ldapServer.setEnabled( true );
-        
+
         // The ID
         ldapServer.setServiceId( ldapServerBean.getServerId() );
 
@@ -890,10 +912,10 @@ public class ServiceBuilder
 
         // KeyStore
         ldapServer.setKeystoreFile( ldapServerBean.getLdapServerKeystoreFile() );
-            
+
         // Certificate password
         ldapServer.setCertificatePassword( ldapServerBean.getLdapServerCertificatePassword() );
-        
+
         // ConfidentialityRequired
         ldapServer.setConfidentialityRequired( ldapServerBean.isLdapServerConfidentialityRequired() );
 
@@ -902,16 +924,16 @@ public class ServiceBuilder
 
         // Max time limit
         ldapServer.setMaxTimeLimit( ldapServerBean.getLdapServerMaxTimeLimit() );
-        
+
         // Sasl Host
         ldapServer.setSaslHost( ldapServerBean.getLdapServerSaslHost() );
-        
+
         // Sasl Principal
         ldapServer.setSaslPrincipal( ldapServerBean.getLdapServerSaslPrincipal() );
-        
+
         // Sasl realm
         ldapServer.setSaslRealms( ldapServerBean.getLdapServerSaslRealms() );
-        
+
         // The transports
         Transport[] transports = createTransports( ldapServerBean.getTransports() );
         ldapServer.setTransports( transports );
@@ -925,7 +947,7 @@ public class ServiceBuilder
                 ldapServer.addSaslMechanismHandler( mechanism, createSaslMechHandler( saslMechHandlerBean ) );
             }
         }
-        
+
         // ExtendedOpHandlers
         for ( ExtendedOpHandlerBean extendedpHandlerBean : ldapServerBean.getExtendedOps() )
         {
@@ -949,7 +971,7 @@ public class ServiceBuilder
 
         // ReplReqHandler
         String fqcn = ldapServerBean.getReplReqHandler();
-        
+
         if ( fqcn != null )
         {
             try
@@ -958,21 +980,21 @@ public class ServiceBuilder
                 ReplicationRequestHandler rp = ( ReplicationRequestHandler ) replProvImplClz.newInstance();
                 ldapServer.setReplicationReqHandler( rp );
             }
-            catch( Exception e )
+            catch ( Exception e )
             {
                 String message = "Failed to load and instantiate ReplicationRequestHandler implementation : " + fqcn;
                 LOG.error( message );
                 throw new ConfigurationException( message );
             }
-            
+
         }
-        
+
         ldapServer.setReplConsumers( createReplConsumers( ldapServerBean.getReplConsumers() ) );
-        
+
         return ldapServer;
     }
-    
-    
+
+
     /**
      * instantiate the ReplicationConsumers based on the configuration present in ReplConsumerBeans
      * 
@@ -980,26 +1002,27 @@ public class ServiceBuilder
      * @return a list of ReplicationConsumer instances
      * @throws ConfigurationException
      */
-    public static List<ReplicationConsumer> createReplConsumers( List<ReplConsumerBean> replConsumerBeans ) throws ConfigurationException
+    public static List<ReplicationConsumer> createReplConsumers( List<ReplConsumerBean> replConsumerBeans )
+        throws ConfigurationException
     {
         List<ReplicationConsumer> lst = new ArrayList<ReplicationConsumer>();
 
-        if( replConsumerBeans == null )
+        if ( replConsumerBeans == null )
         {
             return lst;
         }
-        
+
         for ( ReplConsumerBean replBean : replConsumerBeans )
         {
             String className = replBean.getReplConsumerImpl();
-            
+
             ReplicationConsumer consumer = null;
             Class<?> consumerClass = null;
             SyncreplConfiguration config = null;
-            
+
             try
             {
-                if( className == null )
+                if ( className == null )
                 {
                     consumerClass = ReplicationConsumerImpl.class;
                 }
@@ -1007,9 +1030,9 @@ public class ServiceBuilder
                 {
                     consumerClass = Class.forName( className );
                 }
-                
+
                 consumer = ( ReplicationConsumer ) consumerClass.newInstance();
-                
+
                 // we don't support any other configuration impls atm, but this configuration should suffice for many needs
                 config = new SyncreplConfiguration();
 
@@ -1020,39 +1043,40 @@ public class ServiceBuilder
                 config.setAttributes( replBean.getReplAttributes().toArray( new String[0] ) );
                 config.setRefreshInterval( replBean.getReplRefreshInterval() );
                 config.setRefreshNPersist( replBean.isReplRefreshNPersist() );
-                
+
                 int scope = SearchScope.getSearchScope( replBean.getReplSearchScope() );
                 config.setSearchScope( SearchScope.getSearchScope( scope ) );
-                
+
                 config.setFilter( replBean.getReplSearchFilter() );
                 config.setSearchTimeout( replBean.getReplSearchTimeOut() );
                 config.setReplUserDn( replBean.getReplUserDn() );
                 config.setReplUserPassword( replBean.getReplUserPassword() );
-                
+
                 config.setUseTls( replBean.isReplUseTls() );
                 config.setStrictCertVerification( replBean.isReplStrictCertValidation() );
-                
+
                 config.setConfigEntryDn( replBean.getDn() );
-                
+
                 if ( replBean.getReplPeerCertificate() != null )
                 {
-                    ReplicationTrustManager.addCertificate( replBean.getReplConsumerId(), replBean.getReplPeerCertificate() );
+                    ReplicationTrustManager.addCertificate( replBean.getReplConsumerId(),
+                        replBean.getReplPeerCertificate() );
                 }
-                
+
                 consumer.setConfig( config );
-                
+
                 lst.add( consumer );
             }
-            catch( Exception e )
+            catch ( Exception e )
             {
                 throw new ConfigurationException( "cannot configure the replication consumer with FQCN " + className, e );
             }
         }
-        
+
         return lst;
     }
-    
-    
+
+
     /**
      * Create a new instance of a JdbmIndex from an instance of JdbmIndexBean
      * 
@@ -1060,29 +1084,30 @@ public class ServiceBuilder
      * @return An JdbmIndex instance
      * @throws Exception If the instance cannot be created
      */
-    public static JdbmIndex<?> createJdbmIndex( JdbmPartition partition, JdbmIndexBean<String, Entry> jdbmIndexBean, DirectoryService directoryService )
+    public static JdbmIndex<?> createJdbmIndex( JdbmPartition partition, JdbmIndexBean<String, Entry> jdbmIndexBean,
+        DirectoryService directoryService )
     {
         if ( ( jdbmIndexBean == null ) || jdbmIndexBean.isDisabled() )
         {
             return null;
         }
-        
+
         JdbmIndex<String> index = new JdbmIndex<String>();
-        
+
         index.setAttributeId( jdbmIndexBean.getIndexAttributeId() );
         index.setCacheSize( jdbmIndexBean.getIndexCacheSize() );
         index.setNumDupLimit( jdbmIndexBean.getIndexNumDupLimit() );
-        
+
         String indexFileName = jdbmIndexBean.getIndexFileName();
-        
+
         if ( indexFileName == null )
         {
             indexFileName = jdbmIndexBean.getIndexAttributeId();
         }
-            
+
         // Find the OID for this index
         SchemaManager schemaManager = directoryService.getSchemaManager();
-        
+
         try
         {
             AttributeType indexAT = schemaManager.lookupAttributeTypeRegistry( indexFileName );
@@ -1092,7 +1117,7 @@ public class ServiceBuilder
         {
             // Not found ? We will use the index file name
         }
-        
+
         if ( jdbmIndexBean.getIndexWorkingDir() != null )
         {
             index.setWkDirPath( new File( jdbmIndexBean.getIndexWorkingDir() ).toURI() );
@@ -1102,15 +1127,16 @@ public class ServiceBuilder
             // Set the Partition working dir as a default
             index.setWkDirPath( partition.getPartitionPath() );
         }
-                
+
         return index;
     }
 
-    
+
     /**
      * Create the list of Index from the configuration
      */
-    private static Set<Index<?>> createJdbmIndexes( JdbmPartition partition, List<IndexBean> indexesBeans, DirectoryService directoryService ) //throws Exception
+    private static Set<Index<?>> createJdbmIndexes( JdbmPartition partition, List<IndexBean> indexesBeans,
+        DirectoryService directoryService ) //throws Exception
     {
         Set<Index<?>> indexes = new HashSet<Index<?>>();
 
@@ -1118,7 +1144,7 @@ public class ServiceBuilder
         {
             if ( indexBean.isEnabled() && ( indexBean instanceof JdbmIndexBean ) )
             {
-                indexes.add( createJdbmIndex( partition, (JdbmIndexBean)indexBean, directoryService ) );
+                indexes.add( createJdbmIndex( partition, ( JdbmIndexBean ) indexBean, directoryService ) );
             }
         }
 
@@ -1134,21 +1160,25 @@ public class ServiceBuilder
      * @throws LdapInvalidDnException
      * @throws Exception If the instance cannot be created
      */
-    public static JdbmPartition createJdbmPartition( DirectoryService directoryService, JdbmPartitionBean jdbmPartitionBean, TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory ) throws ConfigurationException
+    public static JdbmPartition createJdbmPartition( DirectoryService directoryService,
+        JdbmPartitionBean jdbmPartitionBean, TxnManagerFactory txnManagerFactory,
+        OperationExecutionManagerFactory executionManagerFactory ) throws ConfigurationException
     {
         if ( ( jdbmPartitionBean == null ) || jdbmPartitionBean.isDisabled() )
         {
             return null;
         }
-        
-        JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager(), txnManagerFactory, executionManagerFactory );
-        
+
+        JdbmPartition jdbmPartition = new JdbmPartition( directoryService.getSchemaManager(), txnManagerFactory,
+            executionManagerFactory );
+
         jdbmPartition.setCacheSize( jdbmPartitionBean.getPartitionCacheSize() );
         jdbmPartition.setId( jdbmPartitionBean.getPartitionId() );
         jdbmPartition.setOptimizerEnabled( jdbmPartitionBean.isJdbmPartitionOptimizerEnabled() );
-        File partitionPath = new File( directoryService.getInstanceLayout().getPartitionsDirectory(), jdbmPartitionBean.getPartitionId() );
+        File partitionPath = new File( directoryService.getInstanceLayout().getPartitionsDirectory(),
+            jdbmPartitionBean.getPartitionId() );
         jdbmPartition.setPartitionPath( partitionPath.toURI() );
-        
+
         try
         {
             jdbmPartition.setSuffixDn( jdbmPartitionBean.getPartitionSuffix() );
@@ -1159,23 +1189,24 @@ public class ServiceBuilder
             LOG.error( message );
             throw new ConfigurationException( message );
         }
-        
+
         jdbmPartition.setSyncOnWrite( jdbmPartitionBean.isPartitionSyncOnWrite() );
-        jdbmPartition.setIndexedAttributes( createJdbmIndexes( jdbmPartition, jdbmPartitionBean.getIndexes(), directoryService ) );
-        
+        jdbmPartition.setIndexedAttributes( createJdbmIndexes( jdbmPartition, jdbmPartitionBean.getIndexes(),
+            directoryService ) );
+
         String contextEntry = jdbmPartitionBean.getContextEntry();
-        
+
         if ( contextEntry != null )
         {
             try
             {
                 // Replace '\n' to real LF
                 String entryStr = contextEntry.replaceAll( "\\\\n", "\n" );
-                
+
                 LdifReader ldifReader = new LdifReader();
-                
+
                 List<LdifEntry> entries = ldifReader.parseLdif( entryStr );
-                
+
                 if ( ( entries != null ) && ( entries.size() > 0 ) )
                 {
                     entries.get( 0 );
@@ -1188,11 +1219,11 @@ public class ServiceBuilder
                 throw new ConfigurationException( message );
             }
         }
-        
+
         return jdbmPartition;
     }
-    
-    
+
+
     /**
      * Create the a Partition instantiated from the configuration
      * 
@@ -1200,24 +1231,27 @@ public class ServiceBuilder
      * @return The instantiated Partition
      * @throws ConfigurationException If we cannot process the Partition
      */
-    public static Partition createPartition( DirectoryService directoryService, PartitionBean partitionBean, 
-        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory ) throws ConfigurationException
+    public static Partition createPartition( DirectoryService directoryService, PartitionBean partitionBean,
+        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory )
+        throws ConfigurationException
     {
         if ( ( partitionBean == null ) || partitionBean.isDisabled() )
         {
             return null;
         }
-        
+
         if ( partitionBean instanceof JdbmPartitionBean )
         {
-            return createJdbmPartition( directoryService, (JdbmPartitionBean)partitionBean, txnManagerFactory, executionManagerFactory );
+            return createJdbmPartition( directoryService, ( JdbmPartitionBean ) partitionBean, txnManagerFactory,
+                executionManagerFactory );
         }
         else
         {
             return null;
         }
     }
-    
+
+
     /**
      * Create the set of Partitions instantiated from the configuration
      * 
@@ -1225,30 +1259,33 @@ public class ServiceBuilder
      * @return A Map of all the instantiated partitions
      * @throws ConfigurationException If we cannot process some Partition
      */
-    public static Map<String, Partition> createPartitions( DirectoryService directoryService, List<PartitionBean> partitionBeans, 
-        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory ) throws ConfigurationException
+    public static Map<String, Partition> createPartitions( DirectoryService directoryService,
+        List<PartitionBean> partitionBeans,
+        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory )
+        throws ConfigurationException
     {
         Map<String, Partition> partitions = new HashMap<String, Partition>( partitionBeans.size() );
-        
+
         for ( PartitionBean partitionBean : partitionBeans )
         {
             if ( partitionBean.isDisabled() )
             {
                 continue;
             }
-            
-            Partition partition = createPartition( directoryService, partitionBean, txnManagerFactory, executionManagerFactory );
-            
+
+            Partition partition = createPartition( directoryService, partitionBean, txnManagerFactory,
+                executionManagerFactory );
+
             if ( partition != null )
             {
                 partitions.put( partitionBean.getPartitionId(), partition );
             }
         }
-        
+
         return partitions;
     }
 
-    
+
     /**
      * Instantiates a DirectoryService based on the configuration present in the partition
      *
@@ -1257,20 +1294,22 @@ public class ServiceBuilder
      * @return An instance of DirectoryService
      * @throws Exception
      */
-    public static DirectoryService createDirectoryService( DirectoryServiceBean directoryServiceBean, InstanceLayout instanceLayout, SchemaManager schemaManager,
-        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory ) throws Exception
+    public static DirectoryService createDirectoryService( DirectoryServiceBean directoryServiceBean,
+        InstanceLayout instanceLayout, SchemaManager schemaManager,
+        TxnManagerFactory txnManagerFactory, OperationExecutionManagerFactory executionManagerFactory )
+        throws Exception
     {
         DirectoryService directoryService = new DefaultDirectoryService();
         ( ( DefaultDirectoryService ) directoryService ).setTxnManagerFactory( txnManagerFactory );
         ( ( DefaultDirectoryService ) directoryService ).setExecutionManagerFactory( executionManagerFactory );
-        
+
         // The schemaManager
         directoryService.setSchemaManager( schemaManager );
 
         // MUST attributes
         // DirectoryService ID
         directoryService.setInstanceId( directoryServiceBean.getDirectoryServiceId() );
-        
+
         // Replica ID
         directoryService.setReplicaId( directoryServiceBean.getDsReplicaId() );
 
@@ -1280,9 +1319,10 @@ public class ServiceBuilder
         // Interceptors
         List<Interceptor> interceptors = createInterceptors( directoryServiceBean.getInterceptors() );
         directoryService.setInterceptors( interceptors );
-        
+
         // Partitions
-        Map<String, Partition> partitions = createPartitions( directoryService, directoryServiceBean.getPartitions(), txnManagerFactory, executionManagerFactory );
+        Map<String, Partition> partitions = createPartitions( directoryService, directoryServiceBean.getPartitions(),
+            txnManagerFactory, executionManagerFactory );
 
         Partition systemPartition = partitions.remove( "system" );
 
@@ -1297,32 +1337,32 @@ public class ServiceBuilder
         // MAY attributes
         // AccessControlEnabled
         directoryService.setAccessControlEnabled( directoryServiceBean.isDsAccessControlEnabled() );
-        
+
         // AllowAnonymousAccess
         directoryService.setAllowAnonymousAccess( directoryServiceBean.isDsAllowAnonymousAccess() );
-        
+
         // ChangeLog
         ChangeLog cl = createChangeLog( directoryServiceBean.getChangeLog() );
-        
+
         if ( cl != null )
         {
             directoryService.setChangeLog( cl );
         }
-        
+
         // DenormalizedOpAttrsEnabled
         directoryService.setDenormalizeOpAttrsEnabled( directoryServiceBean.isDsDenormalizeOpAttrsEnabled() );
-        
+
         // Journal
         Journal journal = createJournal( directoryServiceBean.getJournal() );
-        
+
         if ( journal != null )
         {
             directoryService.setJournal( journal );
         }
-        
+
         // MaxPDUSize
         directoryService.setMaxPDUSize( directoryServiceBean.getDsMaxPDUSize() );
-        
+
         // PasswordHidden
         directoryService.setPasswordHidden( directoryServiceBean.isDsPasswordHidden() );
 
@@ -1331,12 +1371,12 @@ public class ServiceBuilder
 
         // testEntries
         String entryFilePath = directoryServiceBean.getDsTestEntries();
-        
+
         if ( entryFilePath != null )
         {
             directoryService.setTestEntries( readTestEntries( entryFilePath ) );
         }
-        
+
         // Enabled
         if ( !directoryServiceBean.isEnabled() )
         {



Mime
View raw message