directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r985686 [1/4] - in /directory: apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/ apacheds/branches/apacheds-codec-merge/core-api/src/test/java/org/apache/directory/server/core/ apacheds/branches...
Date Sun, 15 Aug 2010 14:54:58 GMT
Author: elecharny
Date: Sun Aug 15 14:54:56 2010
New Revision: 985686

URL: http://svn.apache.org/viewvc?rev=985686&view=rev
Log:
o Merged the API BindRequest, BindRequestCodec and BindRequestImpl classes
o Renamed some of the methods (addControl, addAllControls)
o Added a constructor for the BindRequestImpl that does not take any argument 
o Added s setMessageId() method
o Added the handling of SASL bind in the API (DIRAPI-22)
o Using the shared LdapEncoder class in the API
o Removed the BndRequestCodec and the associated authentication classes
o Removed the DelRequestCodec class
o Added the DeleteRequest encoding in LdapEncoder

Removed:
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/BindRequest.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolEncoder.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/bind/
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/del/
Modified:
    directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
    directory/apacheds/branches/apacheds-codec-merge/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java
    directory/apacheds/branches/apacheds-codec-merge/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
    directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
    directory/apacheds/branches/apacheds-codec-merge/server-integ/src/test/java/org/apache/directory/server/operations/bind/SaslBindIT.java
    directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolCodecFactory.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindRequestImpl.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteRequestImpl.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalBindRequest.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalMessage.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/LdapControlTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestPerfTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/bind/BindRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/del/DelRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/unbind/UnBindRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractMessageTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AbstractResultResponseTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/AddRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/BindRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/CompareRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/DeleteRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/LdapResultImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyDnRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ModifyRequestImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseDoneImplTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/SearchResponseReferenceImplTest.java

Modified: directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java Sun Aug 15 14:54:56 2010
@@ -30,7 +30,6 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.message.AbandonRequest;
 import org.apache.directory.ldap.client.api.message.AddRequest;
-import org.apache.directory.ldap.client.api.message.BindRequest;
 import org.apache.directory.ldap.client.api.message.CompareRequest;
 import org.apache.directory.ldap.client.api.message.DeleteRequest;
 import org.apache.directory.ldap.client.api.message.ExtendedRequest;
@@ -55,6 +54,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.AddRequestImpl;
 import org.apache.directory.shared.ldap.message.AddResponseImpl;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
+import org.apache.directory.shared.ldap.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.message.BindResponseImpl;
 import org.apache.directory.shared.ldap.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
@@ -69,23 +69,24 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.message.SearchResultEntryImpl;
 import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
 import org.apache.directory.shared.ldap.message.internal.AddResponse;
 import org.apache.directory.shared.ldap.message.internal.BindResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.CompareResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
-import org.apache.directory.shared.ldap.message.internal.LdapResult;
+import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest;
-import org.apache.directory.shared.ldap.message.internal.ModifyDnResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyRequest;
-import org.apache.directory.shared.ldap.message.internal.ModifyResponse;
-import org.apache.directory.shared.ldap.message.internal.Response;
 import org.apache.directory.shared.ldap.message.internal.InternalResultResponseRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalSearchRequest;
+import org.apache.directory.shared.ldap.message.internal.LdapResult;
+import org.apache.directory.shared.ldap.message.internal.ModifyDnResponse;
+import org.apache.directory.shared.ldap.message.internal.ModifyResponse;
+import org.apache.directory.shared.ldap.message.internal.Response;
 import org.apache.directory.shared.ldap.message.internal.SearchResultEntry;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.name.RDN;
@@ -856,8 +857,7 @@ public class LdapCoreSessionConnection i
      * @param newDn The new Entry DN
      * @param deleteOldRdn Tells if the old RDN must be removed
      */
-    public ModifyDnResponse moveAndRename( String entryDn, String newDn, boolean deleteOldRdn )
-        throws LdapException
+    public ModifyDnResponse moveAndRename( String entryDn, String newDn, boolean deleteOldRdn ) throws LdapException
     {
         return moveAndRename( new DN( entryDn ), new DN( newDn ), deleteOldRdn );
     }
@@ -1026,8 +1026,8 @@ public class LdapCoreSessionConnection i
      */
     public BindResponse bind() throws LdapException, IOException
     {
-        BindRequest bindReq = new BindRequest();
-        bindReq.setName( "" );
+        InternalBindRequest bindReq = new BindRequestImpl();
+        bindReq.setName( DN.EMPTY_DN );
         bindReq.setCredentials( ( byte[] ) null );
 
         return bind( bindReq );
@@ -1037,7 +1037,7 @@ public class LdapCoreSessionConnection i
     /**
      * {@inheritDoc}
      */
-    public BindResponse bind( BindRequest bindRequest ) throws LdapException, IOException
+    public BindResponse bind( InternalBindRequest bindRequest ) throws LdapException, IOException
     {
         int newId = messageId.incrementAndGet();
 
@@ -1060,7 +1060,7 @@ public class LdapCoreSessionConnection i
             operationManager.bind( bindContext );
             session = bindContext.getSession();
 
-            bindResp.addAll( bindContext.getResponseControls() );
+            bindResp.addAllControls( bindContext.getResponseControls() );
         }
         catch ( LdapOperationException e )
         {
@@ -1081,8 +1081,8 @@ public class LdapCoreSessionConnection i
     {
         byte[] credBytes = ( credentials == null ? StringTools.EMPTY_BYTES : StringTools.getBytesUtf8( credentials ) );
 
-        BindRequest bindReq = new BindRequest();
-        bindReq.setName( name.getName() );
+        InternalBindRequest bindReq = new BindRequestImpl();
+        bindReq.setName( name );
         bindReq.setCredentials( credBytes );
 
         return bind( bindReq );
@@ -1104,7 +1104,7 @@ public class LdapCoreSessionConnection i
 
         for ( Control c : ctrlSet )
         {
-            clientResp.add( c );
+            clientResp.addControl( c );
         }
     }
 

Modified: directory/apacheds/branches/apacheds-codec-merge/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-api/src/test/java/org/apache/directory/server/core/MockCoreSession.java Sun Aug 15 14:54:56 2010
@@ -85,15 +85,15 @@ public class MockCoreSession implements 
     private DirectoryService directoryService;
     private final LdapPrincipal authenticatedPrincipal;
     private LdapPrincipal authorizedPrincipal;
-    
-    
+
+
     public MockCoreSession( LdapPrincipal principal, DirectoryService directoryService )
     {
         this.directoryService = directoryService;
         this.authenticatedPrincipal = principal;
     }
 
-    
+
     /**
      * Set the ignoreRefferal flag for the current operationContext.
      *
@@ -111,8 +111,8 @@ public class MockCoreSession implements 
             opContext.throwReferral();
         }
     }
-    
-    
+
+
     /**
      * {@inheritDoc} 
      */
@@ -139,7 +139,7 @@ public class MockCoreSession implements 
         AddOperationContext addContext = new AddOperationContext( this, entry );
 
         addContext.setLogChange( log );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( addContext );
     }
@@ -154,7 +154,7 @@ public class MockCoreSession implements 
 
         addContext.setLogChange( log );
         setReferralHandling( addContext, ignoreReferral );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( addContext );
     }
@@ -168,7 +168,7 @@ public class MockCoreSession implements 
         add( addRequest, LogChange.TRUE );
     }
 
-    
+
     /**
      * {@inheritDoc} 
      */
@@ -177,29 +177,29 @@ public class MockCoreSession implements 
         AddOperationContext addContext = new AddOperationContext( this, addRequest );
 
         addContext.setLogChange( log );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( addContext );
-        addRequest.getResultResponse().addAll( addContext.getResponseControls() );
+        addRequest.getResultResponse().addAllControls( addContext.getResponseControls() );
     }
 
-    
+
     private Value<?> convertToValue( String oid, Object value ) throws LdapException
     {
         Value<?> val = null;
-        
+
         AttributeType attributeType = directoryService.getSchemaManager().lookupAttributeTypeRegistry( oid );
-        
+
         // make sure we add the request controls to operation
         if ( attributeType.getSyntax().isHumanReadable() )
         {
             if ( value instanceof String )
             {
-                val = new StringValue( attributeType, (String)value );
+                val = new StringValue( attributeType, ( String ) value );
             }
             else if ( value instanceof byte[] )
             {
-                val = new StringValue( attributeType, StringTools.utf8ToString( (byte[])value ) );
+                val = new StringValue( attributeType, StringTools.utf8ToString( ( byte[] ) value ) );
             }
             else
             {
@@ -210,31 +210,30 @@ public class MockCoreSession implements 
         {
             if ( value instanceof String )
             {
-                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
+                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( ( String ) value ) );
             }
             else if ( value instanceof byte[] )
             {
-                val = new BinaryValue( attributeType, (byte[])value );
+                val = new BinaryValue( attributeType, ( byte[] ) value );
             }
             else
             {
                 throw new LdapException( I18n.err( I18n.ERR_309, oid ) );
             }
         }
-        
+
         return val;
     }
 
+
     /**
      * {@inheritDoc}
      */
     public boolean compare( DN dn, String oid, Object value ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
-        return operationManager.compare( 
-            new CompareOperationContext( this, dn, oid, 
-                convertToValue( oid, value ) ) );
+
+        return operationManager.compare( new CompareOperationContext( this, dn, oid, convertToValue( oid, value ) ) );
     }
 
 
@@ -243,12 +242,11 @@ public class MockCoreSession implements 
      */
     public boolean compare( DN dn, String oid, Object value, boolean ignoreReferral ) throws LdapException
     {
-        CompareOperationContext compareContext =  
-                new CompareOperationContext( this, dn, oid, 
-                    convertToValue( oid, value ) );
-        
+        CompareOperationContext compareContext = new CompareOperationContext( this, dn, oid,
+            convertToValue( oid, value ) );
+
         setReferralHandling( compareContext, ignoreReferral );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         return operationManager.compare( compareContext );
     }
@@ -280,7 +278,7 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void delete( DN dn, boolean ignoreReferral  ) throws LdapException
+    public void delete( DN dn, boolean ignoreReferral ) throws LdapException
     {
         delete( dn, ignoreReferral, LogChange.TRUE );
     }
@@ -292,7 +290,7 @@ public class MockCoreSession implements 
     public void delete( DN dn, boolean ignoreReferral, LogChange log ) throws LdapException
     {
         DeleteOperationContext deleteContext = new DeleteOperationContext( this, dn );
-        
+
         deleteContext.setLogChange( log );
         setReferralHandling( deleteContext, ignoreReferral );
 
@@ -357,7 +355,7 @@ public class MockCoreSession implements 
         {
             return authenticatedPrincipal;
         }
-        
+
         return authorizedPrincipal;
     }
 
@@ -400,8 +398,8 @@ public class MockCoreSession implements 
         // TODO Auto-generated method stub
         return true;
     }
-    
-    
+
+
     /**
      * TODO - perhaps we should just use a flag that is calculated on creation
      * of this session
@@ -410,7 +408,7 @@ public class MockCoreSession implements 
      */
     public boolean isAdministrator()
     {
-        String normName = getEffectivePrincipal().getName(); 
+        String normName = getEffectivePrincipal().getName();
         return normName.equals( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
     }
 
@@ -431,7 +429,7 @@ public class MockCoreSession implements 
         {
             return true;
         }
-        
+
         // TODO fix this so it checks groups
         return false;
     }
@@ -444,10 +442,10 @@ public class MockCoreSession implements 
         Set<AttributeTypeOptions> returningAttributes ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         ListOperationContext listContext = new ListOperationContext( this, dn, returningAttributes );
         listContext.setAliasDerefMode( aliasDerefMode );
-        
+
         return operationManager.list( listContext );
     }
 
@@ -464,7 +462,7 @@ public class MockCoreSession implements 
         listContext.setSizeLimit( sizeLimit );
         listContext.setTimeLimit( timeLimit );
         listContext.setAliasDerefMode( aliasDerefMode );
-     
+
         return operationManager.list( listContext );
     }
 
@@ -485,8 +483,7 @@ public class MockCoreSession implements 
     public Entry lookup( DN dn, String[] attrId ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        return operationManager.lookup( 
-            new LookupOperationContext( this, dn, attrId ) );
+        return operationManager.lookup( new LookupOperationContext( this, dn, attrId ) );
     }
 
 
@@ -508,14 +505,14 @@ public class MockCoreSession implements 
         {
             return;
         }
-        
+
         List<Modification> serverModifications = new ArrayList<Modification>( mods.size() );
-        
-        for ( Modification mod:mods )
+
+        for ( Modification mod : mods )
         {
             serverModifications.add( new DefaultModification( directoryService.getSchemaManager(), mod ) );
         }
-        
+
         ModifyOperationContext modifyContext = new ModifyOperationContext( this, dn, serverModifications );
 
         modifyContext.setLogChange( log );
@@ -543,16 +540,16 @@ public class MockCoreSession implements 
         {
             return;
         }
-        
+
         List<Modification> serverModifications = new ArrayList<Modification>( mods.size() );
-        
-        for ( Modification mod:mods )
+
+        for ( Modification mod : mods )
         {
             serverModifications.add( new DefaultModification( directoryService.getSchemaManager(), mod ) );
         }
 
         ModifyOperationContext modifyContext = new ModifyOperationContext( this, dn, serverModifications );
-        
+
         setReferralHandling( modifyContext, ignoreReferral );
         modifyContext.setLogChange( log );
 
@@ -576,7 +573,7 @@ public class MockCoreSession implements 
     public void move( DN dn, DN newParent, LogChange log ) throws LdapException
     {
         MoveOperationContext moveContext = new MoveOperationContext( this, dn, newParent );
-        
+
         moveContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -600,7 +597,7 @@ public class MockCoreSession implements 
     {
         OperationManager operationManager = directoryService.getOperationManager();
         MoveOperationContext moveContext = new MoveOperationContext( this, dn, newParent );
-        
+
         setReferralHandling( moveContext, ignoreReferral );
         moveContext.setLogChange( log );
 
@@ -620,11 +617,12 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, LogChange log ) throws LdapException
+    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, LogChange log )
+        throws LdapException
     {
-        MoveAndRenameOperationContext moveAndRenameContext = 
-            new MoveAndRenameOperationContext( this, dn, newParent, newRdn, deleteOldRdn );
-        
+        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn, newParent,
+            newRdn, deleteOldRdn );
+
         moveAndRenameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -635,7 +633,8 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral ) throws LdapException
+    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral )
+        throws LdapException
     {
         moveAndRename( dn, newParent, newRdn, deleteOldRdn, ignoreReferral, LogChange.TRUE );
     }
@@ -644,11 +643,13 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log ) throws LdapException
+    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral,
+        LogChange log ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn, newParent, newRdn, deleteOldRdn );
-        
+        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn, newParent,
+            newRdn, deleteOldRdn );
+
         moveAndRenameContext.setLogChange( log );
         setReferralHandling( moveAndRenameContext, ignoreReferral );
 
@@ -671,7 +672,7 @@ public class MockCoreSession implements 
     public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, LogChange log ) throws LdapException
     {
         RenameOperationContext renameContext = new RenameOperationContext( this, dn, newRdn, deleteOldRdn );
-        
+
         renameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -691,11 +692,12 @@ public class MockCoreSession implements 
     /**
      * {@inheritDoc}
      */
-    public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log ) throws LdapException
+    public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log )
+        throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
         RenameOperationContext renameContext = new RenameOperationContext( this, dn, newRdn, deleteOldRdn );
-        
+
         renameContext.setLogChange( log );
         setReferralHandling( renameContext, ignoreReferral );
 
@@ -719,24 +721,24 @@ public class MockCoreSession implements 
     {
         OperationManager operationManager = directoryService.getOperationManager();
         ExprNode filterNode = null;
-        
+
         try
         {
-            FilterParser.parse( directoryService.getSchemaManager(), filter ); 
+            FilterParser.parse( directoryService.getSchemaManager(), filter );
         }
         catch ( ParseException pe )
         {
             throw new LdapInvalidSearchFilterException( pe.getMessage() );
         }
-        
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, 
-            filterNode, null );
+
+        SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, filterNode,
+            null );
         searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
         setReferralHandling( searchContext, ignoreReferrals );
 
         return operationManager.search( searchContext );
     }
-    
+
 
     /* (non-Javadoc)
      * @see org.apache.directory.server.core.CoreSession#search(org.apache.directory.shared.ldap.name.DN, org.apache.directory.shared.ldap.filter.SearchScope, org.apache.directory.shared.ldap.filter.ExprNode, org.apache.directory.shared.ldap.message.AliasDerefMode, java.util.Set)
@@ -745,9 +747,8 @@ public class MockCoreSession implements 
         Set<AttributeTypeOptions> returningAttributes ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, 
-            filter, returningAttributes );
+
+        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
         searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
 
         return operationManager.search( searchContext );
@@ -761,7 +762,7 @@ public class MockCoreSession implements 
         Set<AttributeTypeOptions> returningAttributes, long sizeLimit, int timeLimit ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
         searchContext.setSizeLimit( sizeLimit );
         searchContext.setTimeLimit( timeLimit );
@@ -785,7 +786,7 @@ public class MockCoreSession implements 
         CompareOperationContext compareContext = new CompareOperationContext( this, compareRequest );
         OperationManager operationManager = directoryService.getOperationManager();
         boolean result = operationManager.compare( compareContext );
-        compareRequest.getResultResponse().addAll( compareContext.getResponseControls() );
+        compareRequest.getResultResponse().addAllControls( compareContext.getResponseControls() );
         return result;
     }
 
@@ -805,12 +806,12 @@ public class MockCoreSession implements 
     public void delete( InternalDeleteRequest deleteRequest, LogChange log ) throws LdapException
     {
         DeleteOperationContext deleteContext = new DeleteOperationContext( this, deleteRequest );
-        
+
         deleteContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.delete( deleteContext );
-        deleteRequest.getResultResponse().addAll( deleteContext.getResponseControls() );
+        deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
     }
 
 
@@ -842,7 +843,7 @@ public class MockCoreSession implements 
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.modify( modifyContext );
-        modifyRequest.getResultResponse().addAll( modifyContext.getResponseControls() );
+        modifyRequest.getResultResponse().addAllControls( modifyContext.getResponseControls() );
     }
 
 
@@ -861,12 +862,12 @@ public class MockCoreSession implements 
     public void move( InternalModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
     {
         MoveOperationContext moveContext = new MoveOperationContext( this, modifyDnRequest );
-        
+
         moveContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.move( moveContext );
-        modifyDnRequest.getResultResponse().addAll( moveContext.getResponseControls() );
+        modifyDnRequest.getResultResponse().addAllControls( moveContext.getResponseControls() );
     }
 
 
@@ -890,7 +891,7 @@ public class MockCoreSession implements 
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.moveAndRename( moveAndRenameContext );
-        modifyDnRequest.getResultResponse().addAll( moveAndRenameContext.getResponseControls() );
+        modifyDnRequest.getResultResponse().addAllControls( moveAndRenameContext.getResponseControls() );
     }
 
 
@@ -914,7 +915,7 @@ public class MockCoreSession implements 
 
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.rename( renameContext );
-        modifyDnRequest.getResultResponse().addAll( renameContext.getResponseControls() );
+        modifyDnRequest.getResultResponse().addAllControls( renameContext.getResponseControls() );
     }
 
 
@@ -923,8 +924,8 @@ public class MockCoreSession implements 
         SearchOperationContext searchContext = new SearchOperationContext( this, searchRequest );
         OperationManager operationManager = directoryService.getOperationManager();
         EntryFilteringCursor cursor = operationManager.search( searchContext );
-        searchRequest.getResultResponse().addAll( searchContext.getResponseControls() );
-        
+        searchRequest.getResultResponse().addAllControls( searchContext.getResponseControls() );
+
         return cursor;
     }
 
@@ -939,7 +940,7 @@ public class MockCoreSession implements 
     public void unbind( InternalUnbindRequest unbindRequest )
     {
         // TODO Auto-generated method stub
-        
+
     }
 
 

Modified: directory/apacheds/branches/apacheds-codec-merge/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java Sun Aug 15 14:54:56 2010
@@ -85,15 +85,15 @@ public class DefaultCoreSession implemen
     private final DirectoryService directoryService;
     private final LdapPrincipal authenticatedPrincipal;
     private LdapPrincipal authorizedPrincipal;
-    
-    
+
+
     public DefaultCoreSession( LdapPrincipal principal, DirectoryService directoryService )
     {
         this.directoryService = directoryService;
         this.authenticatedPrincipal = principal;
     }
 
-    
+
     /**
      * Set the ignoreRefferal flag for the current operationContext.
      *
@@ -111,8 +111,8 @@ public class DefaultCoreSession implemen
             opContext.throwReferral();
         }
     }
-    
-    
+
+
     /**
      * {@inheritDoc} 
      */
@@ -139,7 +139,7 @@ public class DefaultCoreSession implemen
         AddOperationContext addContext = new AddOperationContext( this, entry );
 
         addContext.setLogChange( log );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( addContext );
     }
@@ -154,7 +154,7 @@ public class DefaultCoreSession implemen
 
         addContext.setLogChange( log );
         setReferralHandling( addContext, ignoreReferral );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         operationManager.add( addContext );
     }
@@ -168,7 +168,7 @@ public class DefaultCoreSession implemen
         add( addRequest, LogChange.TRUE );
     }
 
-    
+
     /**
      * {@inheritDoc} 
      */
@@ -177,37 +177,37 @@ public class DefaultCoreSession implemen
         AddOperationContext addContext = new AddOperationContext( this, addRequest );
 
         addContext.setLogChange( log );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         try
         {
             operationManager.add( addContext );
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
-            addRequest.getResultResponse().addAll( addContext.getResponseControls() );
+            addRequest.getResultResponse().addAllControls( addContext.getResponseControls() );
             throw e;
         }
-        addRequest.getResultResponse().addAll( addContext.getResponseControls() );
+        addRequest.getResultResponse().addAllControls( addContext.getResponseControls() );
     }
 
-    
+
     private Value<?> convertToValue( String oid, Object value ) throws LdapException
     {
         Value<?> val = null;
-        
+
         AttributeType attributeType = directoryService.getSchemaManager().lookupAttributeTypeRegistry( oid );
-        
+
         // make sure we add the request controls to operation
         if ( attributeType.getSyntax().isHumanReadable() )
         {
             if ( value instanceof String )
             {
-                val = new StringValue( attributeType, (String)value );
+                val = new StringValue( attributeType, ( String ) value );
             }
             else if ( value instanceof byte[] )
             {
-                val = new StringValue( attributeType, StringTools.utf8ToString( (byte[])value ) );
+                val = new StringValue( attributeType, StringTools.utf8ToString( ( byte[] ) value ) );
             }
             else
             {
@@ -218,31 +218,30 @@ public class DefaultCoreSession implemen
         {
             if ( value instanceof String )
             {
-                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( (String)value ) );
+                val = new BinaryValue( attributeType, StringTools.getBytesUtf8( ( String ) value ) );
             }
             else if ( value instanceof byte[] )
             {
-                val = new BinaryValue( attributeType, (byte[])value );
+                val = new BinaryValue( attributeType, ( byte[] ) value );
             }
             else
             {
                 throw new LdapException( I18n.err( I18n.ERR_309, oid ) );
             }
         }
-        
+
         return val;
     }
 
+
     /**
      * {@inheritDoc}
      */
     public boolean compare( DN dn, String oid, Object value ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        
-        return operationManager.compare( 
-            new CompareOperationContext( this, dn, oid, 
-                convertToValue( oid, value ) ) );
+
+        return operationManager.compare( new CompareOperationContext( this, dn, oid, convertToValue( oid, value ) ) );
     }
 
 
@@ -251,12 +250,11 @@ public class DefaultCoreSession implemen
      */
     public boolean compare( DN dn, String oid, Object value, boolean ignoreReferral ) throws LdapException
     {
-        CompareOperationContext compareContext =  
-                new CompareOperationContext( this, dn, oid, 
-                    convertToValue( oid, value ) );
-        
+        CompareOperationContext compareContext = new CompareOperationContext( this, dn, oid,
+            convertToValue( oid, value ) );
+
         setReferralHandling( compareContext, ignoreReferral );
-        
+
         OperationManager operationManager = directoryService.getOperationManager();
         return operationManager.compare( compareContext );
     }
@@ -288,7 +286,7 @@ public class DefaultCoreSession implemen
     /**
      * {@inheritDoc}
      */
-    public void delete( DN dn, boolean ignoreReferral  ) throws LdapException
+    public void delete( DN dn, boolean ignoreReferral ) throws LdapException
     {
         delete( dn, ignoreReferral, LogChange.TRUE );
     }
@@ -300,7 +298,7 @@ public class DefaultCoreSession implemen
     public void delete( DN dn, boolean ignoreReferral, LogChange log ) throws LdapException
     {
         DeleteOperationContext deleteContext = new DeleteOperationContext( this, dn );
-        
+
         deleteContext.setLogChange( log );
         setReferralHandling( deleteContext, ignoreReferral );
 
@@ -365,7 +363,7 @@ public class DefaultCoreSession implemen
         {
             return authenticatedPrincipal;
         }
-        
+
         return authorizedPrincipal;
     }
 
@@ -408,8 +406,8 @@ public class DefaultCoreSession implemen
         // TODO Auto-generated method stub
         return true;
     }
-    
-    
+
+
     /**
      * TODO - perhaps we should just use a flag that is calculated on creation
      * of this session
@@ -418,7 +416,7 @@ public class DefaultCoreSession implemen
      */
     public boolean isAdministrator()
     {
-        String normName = getEffectivePrincipal().getName(); 
+        String normName = getEffectivePrincipal().getName();
         return normName.equals( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
     }
 
@@ -439,7 +437,7 @@ public class DefaultCoreSession implemen
         {
             return true;
         }
-        
+
         // TODO fix this so it checks groups
         return false;
     }
@@ -455,7 +453,7 @@ public class DefaultCoreSession implemen
 
         ListOperationContext listContext = new ListOperationContext( this, dn, returningAttributes );
         listContext.setAliasDerefMode( aliasDerefMode );
-        
+
         return operationManager.list( listContext );
     }
 
@@ -472,7 +470,7 @@ public class DefaultCoreSession implemen
         listContext.setSizeLimit( sizeLimit );
         listContext.setTimeLimit( timeLimit );
         listContext.setAliasDerefMode( aliasDerefMode );
-        
+
         return operationManager.list( listContext );
     }
 
@@ -496,7 +494,7 @@ public class DefaultCoreSession implemen
         LookupOperationContext lookupContext = new LookupOperationContext( this, dn, attrId );
 
         Entry entry = operationManager.lookup( lookupContext );
-        
+
         return entry;
     }
 
@@ -519,14 +517,14 @@ public class DefaultCoreSession implemen
         {
             return;
         }
-        
+
         List<Modification> serverModifications = new ArrayList<Modification>( mods.size() );
-        
-        for ( Modification mod:mods )
+
+        for ( Modification mod : mods )
         {
             serverModifications.add( new DefaultModification( directoryService.getSchemaManager(), mod ) );
         }
-        
+
         ModifyOperationContext modifyContext = new ModifyOperationContext( this, dn, serverModifications );
 
         modifyContext.setLogChange( log );
@@ -554,16 +552,16 @@ public class DefaultCoreSession implemen
         {
             return;
         }
-        
+
         List<Modification> serverModifications = new ArrayList<Modification>( mods.size() );
-        
-        for ( Modification mod:mods )
+
+        for ( Modification mod : mods )
         {
             serverModifications.add( new DefaultModification( directoryService.getSchemaManager(), mod ) );
         }
 
         ModifyOperationContext modifyContext = new ModifyOperationContext( this, dn, serverModifications );
-        
+
         setReferralHandling( modifyContext, ignoreReferral );
         modifyContext.setLogChange( log );
 
@@ -610,7 +608,7 @@ public class DefaultCoreSession implemen
     {
         OperationManager operationManager = directoryService.getOperationManager();
         MoveOperationContext moveContext = new MoveOperationContext( this, dn, newParent );
-        
+
         setReferralHandling( moveContext, ignoreReferral );
         moveContext.setLogChange( log );
 
@@ -630,11 +628,12 @@ public class DefaultCoreSession implemen
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newSuperiorDn, RDN newRdn, boolean deleteOldRdn, LogChange log ) throws LdapException
+    public void moveAndRename( DN dn, DN newSuperiorDn, RDN newRdn, boolean deleteOldRdn, LogChange log )
+        throws LdapException
     {
-        MoveAndRenameOperationContext moveAndRenameContext = 
-            new MoveAndRenameOperationContext( this, dn, newSuperiorDn, newRdn, deleteOldRdn );
-        
+        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn,
+            newSuperiorDn, newRdn, deleteOldRdn );
+
         moveAndRenameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -645,7 +644,8 @@ public class DefaultCoreSession implemen
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral ) throws LdapException
+    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral )
+        throws LdapException
     {
         moveAndRename( dn, newParent, newRdn, deleteOldRdn, ignoreReferral, LogChange.TRUE );
     }
@@ -654,11 +654,13 @@ public class DefaultCoreSession implemen
     /**
      * {@inheritDoc} 
      */
-    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log ) throws LdapException
+    public void moveAndRename( DN dn, DN newParent, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral,
+        LogChange log ) throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
-        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn, newParent, newRdn, deleteOldRdn );
-        
+        MoveAndRenameOperationContext moveAndRenameContext = new MoveAndRenameOperationContext( this, dn, newParent,
+            newRdn, deleteOldRdn );
+
         moveAndRenameContext.setLogChange( log );
         setReferralHandling( moveAndRenameContext, ignoreReferral );
 
@@ -681,11 +683,11 @@ public class DefaultCoreSession implemen
     public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, LogChange log ) throws LdapException
     {
         RenameOperationContext renameContext = new RenameOperationContext( this, dn, newRdn, deleteOldRdn );
-        
+
         renameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         operationManager.rename( renameContext );
     }
 
@@ -702,11 +704,12 @@ public class DefaultCoreSession implemen
     /**
      * {@inheritDoc}
      */
-    public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log ) throws LdapException
+    public void rename( DN dn, RDN newRdn, boolean deleteOldRdn, boolean ignoreReferral, LogChange log )
+        throws LdapException
     {
         OperationManager operationManager = directoryService.getOperationManager();
         RenameOperationContext renameContext = new RenameOperationContext( this, dn, newRdn, deleteOldRdn );
-        
+
         renameContext.setLogChange( log );
         setReferralHandling( renameContext, ignoreReferral );
 
@@ -730,24 +733,24 @@ public class DefaultCoreSession implemen
     {
         OperationManager operationManager = directoryService.getOperationManager();
         ExprNode filterNode = null;
-        
+
         try
-        { 
-            filterNode = (ExprNode)FilterParser.parse( directoryService.getSchemaManager(), filter ); 
+        {
+            filterNode = ( ExprNode ) FilterParser.parse( directoryService.getSchemaManager(), filter );
         }
         catch ( ParseException pe )
         {
             throw new LdapInvalidSearchFilterException( pe.getMessage() );
         }
-        
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, 
-            filterNode, null );
-        searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS ); 
+
+        SearchOperationContext searchContext = new SearchOperationContext( this, dn, SearchScope.OBJECT, filterNode,
+            null );
+        searchContext.setAliasDerefMode( AliasDerefMode.DEREF_ALWAYS );
         setReferralHandling( searchContext, ignoreReferrals );
 
         return operationManager.search( searchContext );
     }
-    
+
 
     /* (non-Javadoc)
      * @see org.apache.directory.server.core.CoreSession#search(org.apache.directory.shared.ldap.name.DN, org.apache.directory.shared.ldap.filter.SearchScope, org.apache.directory.shared.ldap.filter.ExprNode, org.apache.directory.shared.ldap.message.AliasDerefMode, java.util.Set)
@@ -757,8 +760,7 @@ public class DefaultCoreSession implemen
     {
         OperationManager operationManager = directoryService.getOperationManager();
 
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, 
-            returningAttributes );
+        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
         searchContext.setAliasDerefMode( aliasDerefMode );
 
         return operationManager.search( searchContext );
@@ -773,12 +775,11 @@ public class DefaultCoreSession implemen
     {
         OperationManager operationManager = directoryService.getOperationManager();
 
-        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, 
-            returningAttributes );
+        SearchOperationContext searchContext = new SearchOperationContext( this, dn, scope, filter, returningAttributes );
         searchContext.setAliasDerefMode( aliasDerefMode );
         searchContext.setSizeLimit( sizeLimit );
         searchContext.setTimeLimit( timeLimit );
-        
+
         return operationManager.search( searchContext );
     }
 
@@ -801,13 +802,13 @@ public class DefaultCoreSession implemen
         {
             result = operationManager.compare( compareContext );
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
-            compareRequest.getResultResponse().addAll( compareContext.getResponseControls() );
+            compareRequest.getResultResponse().addAllControls( compareContext.getResponseControls() );
             throw e;
         }
-        
-        compareRequest.getResultResponse().addAll( compareContext.getResponseControls() );
+
+        compareRequest.getResultResponse().addAllControls( compareContext.getResponseControls() );
         return result;
     }
 
@@ -827,7 +828,7 @@ public class DefaultCoreSession implemen
     public void delete( InternalDeleteRequest deleteRequest, LogChange log ) throws LdapException
     {
         DeleteOperationContext deleteContext = new DeleteOperationContext( this, deleteRequest );
-        
+
         deleteContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
@@ -835,13 +836,13 @@ public class DefaultCoreSession implemen
         {
             operationManager.delete( deleteContext );
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
-            deleteRequest.getResultResponse().addAll( deleteContext.getResponseControls() );
+            deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
             throw e;
         }
-        
-        deleteRequest.getResultResponse().addAll( deleteContext.getResponseControls() );
+
+        deleteRequest.getResultResponse().addAllControls( deleteContext.getResponseControls() );
     }
 
 
@@ -872,18 +873,18 @@ public class DefaultCoreSession implemen
         modifyContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         try
         {
             operationManager.modify( modifyContext );
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
-            modifyRequest.getResultResponse().addAll( modifyContext.getResponseControls() );
+            modifyRequest.getResultResponse().addAllControls( modifyContext.getResponseControls() );
             throw e;
         }
-        
-        modifyRequest.getResultResponse().addAll( modifyContext.getResponseControls() );
+
+        modifyRequest.getResultResponse().addAllControls( modifyContext.getResponseControls() );
     }
 
 
@@ -902,22 +903,22 @@ public class DefaultCoreSession implemen
     public void move( InternalModifyDnRequest modifyDnRequest, LogChange log ) throws LdapException
     {
         MoveOperationContext moveContext = new MoveOperationContext( this, modifyDnRequest );
-        
+
         moveContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         try
         {
             operationManager.move( moveContext );
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
-            modifyDnRequest.getResultResponse().addAll( moveContext.getResponseControls() );
+            modifyDnRequest.getResultResponse().addAllControls( moveContext.getResponseControls() );
             throw e;
         }
-        
-        modifyDnRequest.getResultResponse().addAll( moveContext.getResponseControls() );
+
+        modifyDnRequest.getResultResponse().addAllControls( moveContext.getResponseControls() );
     }
 
 
@@ -940,18 +941,18 @@ public class DefaultCoreSession implemen
         moveAndRenameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         try
         {
             operationManager.moveAndRename( moveAndRenameContext );
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
-            modifyDnRequest.getResultResponse().addAll( moveAndRenameContext.getResponseControls() );
+            modifyDnRequest.getResultResponse().addAllControls( moveAndRenameContext.getResponseControls() );
             throw e;
         }
-        
-        modifyDnRequest.getResultResponse().addAll( moveAndRenameContext.getResponseControls() );
+
+        modifyDnRequest.getResultResponse().addAllControls( moveAndRenameContext.getResponseControls() );
     }
 
 
@@ -974,18 +975,18 @@ public class DefaultCoreSession implemen
         renameContext.setLogChange( log );
 
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         try
         {
             operationManager.rename( renameContext );
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
-            modifyDnRequest.getResultResponse().addAll( renameContext.getResponseControls() );
+            modifyDnRequest.getResultResponse().addAllControls( renameContext.getResponseControls() );
             throw e;
         }
-        
-        modifyDnRequest.getResultResponse().addAll( renameContext.getResponseControls() );
+
+        modifyDnRequest.getResultResponse().addAllControls( renameContext.getResponseControls() );
     }
 
 
@@ -993,21 +994,21 @@ public class DefaultCoreSession implemen
     {
         SearchOperationContext searchContext = new SearchOperationContext( this, searchRequest );
         OperationManager operationManager = directoryService.getOperationManager();
-        
+
         EntryFilteringCursor cursor = null;
-        
+
         try
         {
             cursor = operationManager.search( searchContext );
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
-            searchRequest.getResultResponse().addAll( searchContext.getResponseControls() );
+            searchRequest.getResultResponse().addAllControls( searchContext.getResponseControls() );
             throw e;
         }
-        
-        searchRequest.getResultResponse().addAll( searchContext.getResponseControls() );
-        
+
+        searchRequest.getResultResponse().addAllControls( searchContext.getResponseControls() );
+
         return cursor;
     }
 

Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java Sun Aug 15 14:54:56 2010
@@ -33,7 +33,6 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.ldap.client.api.future.BindFuture;
-import org.apache.directory.ldap.client.api.message.BindRequest;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.annotations.ApplyLdifs;
@@ -43,9 +42,12 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.BindOperationContext;
 import org.apache.directory.shared.ldap.exception.LdapException;
+import org.apache.directory.shared.ldap.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.internal.BindResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.LdapResult;
+import org.apache.directory.shared.ldap.name.DN;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -128,8 +130,8 @@ public class SimpleBindRequestTest exten
 
         for ( ; i < nbLoop; i++ )
         {
-            BindRequest bindRequest = new BindRequest();
-            bindRequest.setName( "uid=admin,ou=system" );
+            InternalBindRequest bindRequest = new BindRequestImpl();
+            bindRequest.setName( new DN( "uid=admin,ou=system" ) );
             bindRequest.setCredentials( "secret" );
 
             BindFuture bindFuture = connection.bindAsync( bindRequest );
@@ -351,8 +353,8 @@ public class SimpleBindRequestTest exten
             } );
 
             // Send another BindRequest
-            BindRequest bindRequest = new BindRequest();
-            bindRequest.setName( "uid=admin,ou=system" );
+            InternalBindRequest bindRequest = new BindRequestImpl();
+            bindRequest.setName( new DN( "uid=admin,ou=system" ) );
             bindRequest.setCredentials( "secret" );
 
             BindFuture bindFuture = connection.bindAsync( bindRequest );

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java Sun Aug 15 14:54:56 2010
@@ -43,7 +43,7 @@ public class LdapProtocolUtils implement
     {
         if ( request.getControls() != null )
         {
-            request.addAll( request.getControls().values().toArray( EMPTY_CONTROLS ) );
+            request.addAllControls( request.getControls().values().toArray( EMPTY_CONTROLS ) );
         }
     }
 

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java Sun Aug 15 14:54:56 2010
@@ -43,8 +43,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.BindResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -105,7 +105,7 @@ public class BindHandler extends LdapReq
         // create a new Bind context, with a null session, as we don't have 
         // any context yet.
         BindOperationContext bindContext = new BindOperationContext( null );
-        
+
         // Stores the DN of the user to check, and its password
         bindContext.setDn( bindRequest.getName() );
         bindContext.setCredentials( bindRequest.getCredentials() );
@@ -153,7 +153,7 @@ public class BindHandler extends LdapReq
                 return;
             }
 
-            if ( ((ClonedServerEntry)principalEntry).getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT,
+            if ( ( ( ClonedServerEntry ) principalEntry ).getOriginalEntry().contains( SchemaConstants.OBJECT_CLASS_AT,
                 SchemaConstants.REFERRAL_OC ) )
             {
                 LOG.info( "Bind principalDn points to referral." );
@@ -186,9 +186,9 @@ public class BindHandler extends LdapReq
             {
                 ldapSession.setAnonymous();
             }
-            
+
             // Return the successful response
-            bindRequest.getResultResponse().addAll( bindContext.getResponseControls() ); 
+            bindRequest.getResultResponse().addAllControls( bindContext.getResponseControls() );
             sendBindSuccess( ldapSession, bindRequest, null );
         }
         catch ( Exception e )
@@ -209,7 +209,7 @@ public class BindHandler extends LdapReq
                 code = ResultCodeEnum.INVALID_DN_SYNTAX;
                 result.setResultCode( code );
             }
-            else 
+            else
             {
                 code = ResultCodeEnum.INVALID_CREDENTIALS;
                 result.setResultCode( code );
@@ -238,7 +238,7 @@ public class BindHandler extends LdapReq
             }
 
             result.setErrorMessage( msg );
-            bindRequest.getResultResponse().addAll( bindContext.getResponseControls() );
+            bindRequest.getResultResponse().addAllControls( bindContext.getResponseControls() );
             ldapSession.getIoSession().write( bindRequest.getResultResponse() );
         }
     }
@@ -306,8 +306,8 @@ public class BindHandler extends LdapReq
                 {
                     DirectoryService ds = ldapSession.getLdapServer().getDirectoryService();
                     String saslMechanism = bindRequest.getSaslMechanism();
-                    CoreSession userSession = ds.getSession( ldapPrincipal.getDN(), ldapPrincipal
-                        .getUserPassword(), saslMechanism, null );
+                    CoreSession userSession = ds.getSession( ldapPrincipal.getDN(), ldapPrincipal.getUserPassword(),
+                        saslMechanism, null );
 
                     // Set the user session into the ldap session 
                     ldapSession.setCoreSession( userSession );
@@ -439,8 +439,7 @@ public class BindHandler extends LdapReq
     }
 
 
-    private void handleSaslAuthPending( LdapSession ldapSession, InternalBindRequest bindRequest )
-        throws Exception
+    private void handleSaslAuthPending( LdapSession ldapSession, InternalBindRequest bindRequest ) throws Exception
     {
         // First, check that we have the same mechanism
         String saslMechanism = bindRequest.getSaslMechanism();

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java?rev=985686&r1=985685&r2=985686&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/PersistentSearchListener.java Sun Aug 15 14:54:56 2010
@@ -91,7 +91,7 @@ public class PersistentSearchListener im
          */
     }
 
-    
+
     public void requestAbandoned( InternalAbandonableRequest req )
     {
         try
@@ -103,37 +103,37 @@ public class PersistentSearchListener im
             LOG.error( I18n.err( I18n.ERR_164 ), e );
         }
     }
-    
-    
+
+
     private void setECResponseControl( SearchResultEntry response, ChangeOperationContext opContext, ChangeType type )
     {
         if ( control.isReturnECs() )
         {
             EntryChangeControl ecControl = new EntryChangeControl();
             ecControl.setChangeType( type );
-            
+
             if ( opContext.getChangeLogEvent() != null )
             {
                 ecControl.setChangeNumber( opContext.getChangeLogEvent().getRevision() );
             }
-         
+
             if ( opContext instanceof RenameOperationContext || opContext instanceof MoveOperationContext )
             {
-                ecControl.setPreviousDn( opContext.getDn() ); 
+                ecControl.setPreviousDn( opContext.getDn() );
             }
-            
-            response.add( ecControl );
+
+            response.addControl( ecControl );
         }
     }
 
 
     public void entryAdded( AddOperationContext addContext )
     {
-        if ( ! control.isNotificationEnabled( ChangeType.ADD ) )
+        if ( !control.isNotificationEnabled( ChangeType.ADD ) )
         {
             return;
         }
-    
+
         SearchResultEntry respEntry = new SearchResultEntryImpl( req.getMessageId() );
         respEntry.setObjectName( addContext.getDn() );
         respEntry.setEntry( addContext.getEntry() );
@@ -144,11 +144,11 @@ public class PersistentSearchListener im
 
     public void entryDeleted( DeleteOperationContext deleteContext )
     {
-        if ( ! control.isNotificationEnabled( ChangeType.DELETE ) )
+        if ( !control.isNotificationEnabled( ChangeType.DELETE ) )
         {
             return;
         }
-    
+
         SearchResultEntry respEntry = new SearchResultEntryImpl( req.getMessageId() );
         respEntry.setObjectName( deleteContext.getDn() );
         respEntry.setEntry( deleteContext.getEntry() );
@@ -159,11 +159,11 @@ public class PersistentSearchListener im
 
     public void entryModified( ModifyOperationContext modifyContext )
     {
-        if ( ! control.isNotificationEnabled( ChangeType.MODIFY ) )
+        if ( !control.isNotificationEnabled( ChangeType.MODIFY ) )
         {
             return;
         }
-    
+
         SearchResultEntry respEntry = new SearchResultEntryImpl( req.getMessageId() );
         respEntry.setObjectName( modifyContext.getDn() );
         respEntry.setEntry( modifyContext.getAlteredEntry() );
@@ -174,11 +174,11 @@ public class PersistentSearchListener im
 
     public void entryMoved( MoveOperationContext moveContext )
     {
-        if ( ! control.isNotificationEnabled( ChangeType.MODDN ) )
+        if ( !control.isNotificationEnabled( ChangeType.MODDN ) )
         {
             return;
         }
-    
+
         SearchResultEntry respEntry = new SearchResultEntryImpl( req.getMessageId() );
         respEntry.setObjectName( moveContext.getDn() );
         respEntry.setEntry( moveContext.getEntry() );
@@ -195,11 +195,11 @@ public class PersistentSearchListener im
 
     public void entryRenamed( RenameOperationContext renameContext )
     {
-        if ( ! control.isNotificationEnabled( ChangeType.MODDN ) )
+        if ( !control.isNotificationEnabled( ChangeType.MODDN ) )
         {
             return;
         }
-    
+
         SearchResultEntry respEntry = new SearchResultEntryImpl( req.getMessageId() );
         respEntry.setObjectName( renameContext.getModifiedEntry().getDn() );
         respEntry.setEntry( renameContext.getModifiedEntry() );



Mime
View raw message