directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1299681 - in /directory: apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/ apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/ shared/trunk/ldap/client/api/src/mai...
Date Mon, 12 Mar 2012 14:23:19 GMT
Author: elecharny
Date: Mon Mar 12 14:23:18 2012
New Revision: 1299681

URL: http://svn.apache.org/viewvc?rev=1299681&view=rev
Log:
o Added a AbstractLdapConnection class to gather the common properties and method for the
LdapConnection implementations

Added:
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/AbstractLdapConnection.java
Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
    directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
    directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java?rev=1299681&r1=1299680&r2=1299681&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/api/LdapCoreSessionConnection.java
Mon Mar 12 14:23:18 2012
@@ -26,16 +26,13 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
+import org.apache.directory.ldap.client.api.AbstractLdapConnection;
 import org.apache.directory.ldap.client.api.EntryCursorImpl;
-import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.server.core.api.filtering.EntryFilteringCursor;
 import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
 import org.apache.directory.shared.asn1.util.Oid;
 import org.apache.directory.shared.ldap.codec.api.BinaryAttributeDetector;
 import org.apache.directory.shared.ldap.codec.api.LdapApiService;
-import org.apache.directory.shared.ldap.codec.api.LdapApiServiceFactory;
 import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.cursor.EmptyCursor;
 import org.apache.directory.shared.ldap.model.cursor.EntryCursor;
@@ -88,8 +85,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
-import org.apache.directory.shared.util.StringConstants;
-import org.apache.directory.shared.util.Strings;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -99,7 +94,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdapCoreSessionConnection implements LdapConnection
+public class LdapCoreSessionConnection extends AbstractLdapConnection
 {
     /** The logger for this class */
     private static final Logger LOG = LoggerFactory.getLogger( LdapCoreSessionConnection.class
);
@@ -107,31 +102,26 @@ public class LdapCoreSessionConnection i
     /** the CoreSession object */
     private CoreSession session;
 
-    /** the SchemaManager */
-    private SchemaManager schemaManager;
-
     /** the session's DirectoryService */
     private DirectoryService directoryService;
 
-    /** The MessageId counter */
-    private AtomicInteger messageId = new AtomicInteger( 0 );
-
-    private LdapApiService codec = LdapApiServiceFactory.getSingleton();
-
 
     public LdapCoreSessionConnection()
     {
+        super();
     }
 
 
     public LdapCoreSessionConnection( DirectoryService directoryService )
     {
+        super();
         setDirectoryService( directoryService );
     }
 
 
     public LdapCoreSessionConnection( CoreSession session )
     {
+        super();
         this.session = session;
         setDirectoryService( session.getDirectoryService() );
 
@@ -1232,58 +1222,6 @@ public class LdapCoreSessionConnection i
     }
 
 
-    /**
-     * {@inheritDoc}
-     */
-    public void bind( Dn name ) throws LdapException, IOException
-    {
-        byte[] credBytes = StringConstants.EMPTY_BYTES;
-
-        BindRequest bindRequest = new BindRequestImpl();
-        bindRequest.setDn( name );
-        bindRequest.setCredentials( credBytes );
-
-        BindResponse bindResponse = bind( bindRequest );
-
-        processResponse( bindResponse );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void bind( Dn name, String credentials ) throws LdapException, IOException
-    {
-        byte[] credBytes = ( credentials == null ? StringConstants.EMPTY_BYTES : Strings.getBytesUtf8(
credentials ) );
-
-        BindRequest bindRequest = new BindRequestImpl();
-        bindRequest.setDn( name );
-        bindRequest.setCredentials( credBytes );
-
-        BindResponse bindResponse = bind( bindRequest );
-
-        processResponse( bindResponse );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void bind( String name ) throws LdapException, IOException
-    {
-        bind( new Dn( schemaManager, name ), null );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void bind( String name, String credentials ) throws LdapException, IOException
-    {
-        bind( new Dn( schemaManager, name ), credentials );
-    }
-
-
     private void addResponseControls( ResultResponseRequest iReq, Message clientResp )
     {
         Collection<Control> ctrlSet = iReq.getResultResponse().getControls().values();

Modified: directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java?rev=1299681&r1=1299680&r2=1299681&view=diff
==============================================================================
--- directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
(original)
+++ directory/apacheds/trunk/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/bind/SimpleBindRequestTest.java
Mon Mar 12 14:23:18 2012
@@ -6,16 +6,16 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- *  
+ * 
  *    http://www.apache.org/licenses/LICENSE-2.0
- *  
+ * 
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  *  KIND, either express or implied.  See the License for the
  *  specific language governing permissions and limitations
- *  under the License. 
- *  
+ *  under the License.
+ * 
  */
 package org.apache.directory.shared.client.api.operations.bind;
 
@@ -254,7 +254,7 @@ public class SimpleBindRequestTest exten
 
 
     /**
-     * Test for DIRAPI-49 (LdapNetworkConnection.anonymousBind() uses name and credentials

+     * Test for DIRAPI-49 (LdapNetworkConnection.anonymousBind() uses name and credentials
      * from configuration instead of empty values).
      */
     @Test
@@ -342,7 +342,7 @@ public class SimpleBindRequestTest exten
     /**
      * Test an bind with no password
      */
-    @Test(expected = LdapAuthenticationException.class)
+    @Test(expected = LdapUnwillingToPerformException.class)
     public void testSimpleBindNoPassword() throws Exception
     {
         connection.bind( "uid=admin,ou=system", ( String ) null );
@@ -432,7 +432,7 @@ public class SimpleBindRequestTest exten
         assertFalse( connection.isAuthenticated() );
         assertFalse( connection.isConnected() );
 
-        // And Bind again. The messageId should be 1 
+        // And Bind again. The messageId should be 1
         BindRequest br3 = new BindRequestImpl();
         br3.setDn( new Dn( "uid=admin,ou=system" ) );
         br3.setCredentials( Strings.getBytesUtf8( "secret" ) );
@@ -452,7 +452,7 @@ public class SimpleBindRequestTest exten
     {
         try
         {
-            // Inject the interceptor that waits 1 second when binding 
+            // Inject the interceptor that waits 1 second when binding
             // in order to be able to send a request before we get the response
             Interceptor interceptor = new BaseInterceptor( "test" )
             {

Added: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/AbstractLdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/AbstractLdapConnection.java?rev=1299681&view=auto
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/AbstractLdapConnection.java
(added)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/AbstractLdapConnection.java
Mon Mar 12 14:23:18 2012
@@ -0,0 +1,164 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.ldap.client.api;
+
+import static org.apache.directory.shared.ldap.model.message.ResultCodeEnum.processResponse;
+
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.directory.shared.ldap.codec.api.LdapApiService;
+import org.apache.directory.shared.ldap.codec.api.LdapApiServiceFactory;
+import org.apache.directory.shared.ldap.model.exception.LdapException;
+import org.apache.directory.shared.ldap.model.message.BindRequest;
+import org.apache.directory.shared.ldap.model.message.BindRequestImpl;
+import org.apache.directory.shared.ldap.model.message.BindResponse;
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.util.StringConstants;
+import org.apache.directory.shared.util.Strings;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An abstract LdapConnection class gathering the common behavior of LdapConnection
+ * concrete classes.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public abstract class AbstractLdapConnection extends IoHandlerAdapter implements LdapConnection
+{
+    /** logger for reporting errors that might not be handled properly upstream */
+    private static final Logger LOG = LoggerFactory.getLogger( AbstractLdapConnection.class
);
+
+    /** the schema manager */
+    protected SchemaManager schemaManager;
+
+    /** A Message ID which is incremented for each operation */
+    protected AtomicInteger messageId;
+
+    /** the ldap codec service */
+    protected LdapApiService codec = LdapApiServiceFactory.getSingleton();
+
+    
+    /**
+     * Creates a new instance of an AbstractLdapConnection
+     */
+    protected AbstractLdapConnection()
+    {
+        messageId = new AtomicInteger( 0 );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void bind( Dn name ) throws LdapException, IOException
+    {
+        byte[] credBytes = StringConstants.EMPTY_BYTES;
+
+        BindRequest bindRequest = new BindRequestImpl();
+        bindRequest.setDn( name );
+        bindRequest.setCredentials( credBytes );
+
+        BindResponse bindResponse = bind( bindRequest );
+
+        processResponse( bindResponse );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void bind( String name ) throws LdapException, IOException
+    {
+        LOG.debug( "Bind request : {}", name );
+
+        bind( new Dn( schemaManager, name ), null );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void bind( String name, String credentials ) throws LdapException, IOException
+    {
+        bind( new Dn( schemaManager, name ), credentials );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void bind( Dn name, String credentials ) throws LdapException, IOException
+    {
+        byte[] credBytes = ( credentials == null ? StringConstants.EMPTY_BYTES : Strings.getBytesUtf8(
credentials ) );
+
+        BindRequest bindRequest = new BindRequestImpl();
+        bindRequest.setDn( name );
+        bindRequest.setCredentials( credBytes );
+
+        BindResponse bindResponse = bind( bindRequest );
+
+        processResponse( bindResponse );
+    }
+
+
+    /**
+     * Create a complete BindRequest ready to be sent.
+     */
+    protected BindRequest createBindRequest( String name, byte[] credentials, String saslMechanism,
Control... controls )
+        throws LdapException
+    {
+        // Set the new messageId
+        BindRequest bindRequest = new BindRequestImpl();
+
+        // Set the version
+        bindRequest.setVersion3( true );
+
+        // Set the name
+        bindRequest.setName( name );
+
+        // Set the credentials
+        if ( Strings.isEmpty( saslMechanism ) )
+        {
+            // Simple bind
+            bindRequest.setSimple( true );
+            bindRequest.setCredentials( credentials );
+        }
+        else
+        {
+            // SASL bind
+            bindRequest.setSimple( false );
+            bindRequest.setCredentials( credentials );
+            bindRequest.setSaslMechanism( saslMechanism );
+        }
+
+        // Add the controls
+        if ( ( controls != null ) && ( controls.length != 0 ) )
+        {
+            bindRequest.addAllControls( controls );
+        }
+
+        return bindRequest;
+    }
+}

Modified: directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=1299681&r1=1299680&r2=1299681&view=diff
==============================================================================
--- directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
(original)
+++ directory/shared/trunk/ldap/client/api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
Mon Mar 12 14:23:18 2012
@@ -39,7 +39,6 @@ import java.util.concurrent.ExecutionExc
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.ReentrantLock;
 
 import javax.net.ssl.SSLContext;
@@ -154,7 +153,6 @@ import org.apache.mina.core.future.IoFut
 import org.apache.mina.core.future.IoFutureListener;
 import org.apache.mina.core.future.WriteFuture;
 import org.apache.mina.core.service.IoConnector;
-import org.apache.mina.core.service.IoHandlerAdapter;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolCodecFilter;
 import org.apache.mina.filter.codec.ProtocolEncoderException;
@@ -174,7 +172,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class LdapNetworkConnection extends IoHandlerAdapter implements LdapAsyncConnection
+public class LdapNetworkConnection extends AbstractLdapConnection implements LdapAsyncConnection
 {
     /** logger for reporting errors that might not be handled properly upstream */
     private static final Logger LOG = LoggerFactory.getLogger( LdapNetworkConnection.class
);
@@ -197,9 +195,6 @@ public class LdapNetworkConnection exten
      */
     private IoSession ldapSession;
 
-    /** A Message ID which is incremented for each operation */
-    private AtomicInteger messageId;
-
     /** a map to hold the ResponseFutures for all operations */
     private Map<Integer, ResponseFuture<? extends Response>> futureMap = new
ConcurrentHashMap<Integer, ResponseFuture<? extends Response>>();
 
@@ -220,12 +215,6 @@ public class LdapNetworkConnection exten
      */
     private List<ConnectionClosedEventListener> conCloseListeners;
 
-    /** the schema manager */
-    private SchemaManager schemaManager;
-
-    /** the ldap codec service */
-    LdapApiService codec = LdapApiServiceFactory.getSingleton();
-
     /** The Ldap codec protocol filter */
     private IoFilter ldapProtocolFilter = new ProtocolCodecFilter( codec.getProtocolCodecFactory()
);
 
@@ -346,12 +335,12 @@ public class LdapNetworkConnection exten
      */
     public LdapNetworkConnection()
     {
+        super();
         config = new LdapConnectionConfig();
         config.setUseSsl( false );
         config.setLdapPort( config.getDefaultLdapPort() );
         config.setLdapHost( config.getDefaultLdapHost() );
         config.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector( null ) );
-        messageId = new AtomicInteger( 0 );
     }
 
 
@@ -363,14 +352,13 @@ public class LdapNetworkConnection exten
      */
     public LdapNetworkConnection( LdapConnectionConfig config )
     {
+        super();
         this.config = config;
         
         if ( config.getBinaryAttributeDetector() == null )
         {
             config.setBinaryAttributeDetector( new DefaultConfigurableBinaryAttributeDetector()
);
         }
-        
-        messageId = new AtomicInteger( 0 );
     }
 
 
@@ -382,12 +370,12 @@ public class LdapNetworkConnection exten
      */
     public LdapNetworkConnection( boolean useSsl )
     {
+        super();
         config = new LdapConnectionConfig();
         config.setUseSsl( useSsl );
         config.setLdapPort( useSsl ? config.getDefaultLdapsPort() : config.getDefaultLdapPort()
);
         config.setLdapHost( config.getDefaultLdapHost() );
         config.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector( null ) );
-        messageId = new AtomicInteger( 0 );
     }
 
 
@@ -400,6 +388,7 @@ public class LdapNetworkConnection exten
      */
     public LdapNetworkConnection( String server )
     {
+        super();
         config = new LdapConnectionConfig();
         config.setUseSsl( false );
         config.setLdapPort( config.getDefaultLdapPort() );
@@ -415,8 +404,6 @@ public class LdapNetworkConnection exten
         }
 
         config.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector( null ) );
-
-        messageId = new AtomicInteger( 0 );
     }
 
 
@@ -431,6 +418,7 @@ public class LdapNetworkConnection exten
      */
     public LdapNetworkConnection( String server, boolean useSsl )
     {
+        super();
         config = new LdapConnectionConfig();
         config.setUseSsl( useSsl );
         config.setLdapPort( useSsl ? config.getDefaultLdapsPort() : config.getDefaultLdapPort()
);
@@ -446,8 +434,6 @@ public class LdapNetworkConnection exten
         }
 
         config.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector( null ) );
-
-        messageId = new AtomicInteger( 0 );
     }
 
 
@@ -476,6 +462,7 @@ public class LdapNetworkConnection exten
      */
     public LdapNetworkConnection( String server, int port, boolean useSsl )
     {
+        super();
         config = new LdapConnectionConfig();
         config.setUseSsl( useSsl );
         config.setLdapPort( port );
@@ -491,7 +478,6 @@ public class LdapNetworkConnection exten
         }
 
         config.setBinaryAttributeDetector( new SchemaBinaryAttributeDetector( null ) );
-        messageId = new AtomicInteger();
     }
 
 
@@ -992,45 +978,6 @@ public class LdapNetworkConnection exten
 
 
     /**
-     * {@inheritDoc}
-     */
-    public void bind( String name ) throws LdapException, IOException
-    {
-        LOG.debug( "Bind request : {}", name );
-
-        // Create the BindRequest
-        BindRequest bindRequest = createBindRequest( name, StringConstants.EMPTY_BYTES );
-
-        BindResponse bindResponse = bind( bindRequest );
-
-        processResponse( bindResponse );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void bind( String name, String credentials ) throws LdapException, IOException
-    {
-        LOG.debug( "Bind request : {}", name );
-
-        // The password must not be empty or null
-        if ( Strings.isEmpty( credentials ) && Strings.isNotEmpty( name ) )
-        {
-            LOG.debug( "The password is missing" );
-            throw new LdapAuthenticationException( "The password is missing" );
-        }
-
-        // Create the BindRequest
-        BindRequest bindRequest = createBindRequest( name, Strings.getBytesUtf8( credentials
) );
-
-        BindResponse bindResponse = bind( bindRequest );
-
-        processResponse( bindResponse );
-    }
-
-
-    /**
      * Asynchronous unauthenticated authentication bind
      *
      * @param name The name we use to authenticate the user. It must be a
@@ -1072,45 +1019,6 @@ public class LdapNetworkConnection exten
 
 
     /**
-     * {@inheritDoc}
-     */
-    public void bind( Dn name ) throws LdapException, IOException
-    {
-        LOG.debug( "Unauthenticated authentication Bind request : {}", name );
-
-        // Create the BindRequest
-        BindRequest bindRequest = createBindRequest( name.getName(), StringConstants.EMPTY_BYTES,
null );
-
-        BindResponse bindResponse = bind( bindRequest );
-
-        processResponse( bindResponse );
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void bind( Dn name, String credentials ) throws LdapException, IOException
-    {
-        LOG.debug( "Bind request : {}", name );
-
-        // The password must not be empty or null
-        if ( Strings.isEmpty( credentials ) && ( !Dn.EMPTY_DN.equals( name ) ) )
-        {
-            LOG.debug( "The password is missing" );
-            throw new LdapAuthenticationException( "The password is missing" );
-        }
-
-        // Create the BindRequest
-        BindRequest bindRequest = createBindRequest( name.getName(), Strings.getBytesUtf8(
credentials ), null );
-
-        BindResponse bindResponse = bind( bindRequest );
-
-        processResponse( bindResponse );
-    }
-
-
-    /**
      * Asynchronous unauthenticated authentication Bind on a server.
      *
      * @param name The name we use to authenticate the user. It must be a
@@ -1225,48 +1133,6 @@ public class LdapNetworkConnection exten
     {
         return createBindRequest( name.getName(), credentials, null, ( Control[] ) null );
     }
-
-
-    /**
-     * Create a complete BindRequest ready to be sent.
-     */
-    private BindRequest createBindRequest( String name, byte[] credentials, String saslMechanism,
Control... controls )
-        throws LdapException
-    {
-        // Set the new messageId
-        BindRequest bindRequest = new BindRequestImpl();
-
-        // Set the version
-        bindRequest.setVersion3( true );
-
-        // Set the name
-        bindRequest.setName( name );
-
-        // Set the credentials
-        if ( Strings.isEmpty( saslMechanism ) )
-        {
-            // Simple bind
-            bindRequest.setSimple( true );
-            bindRequest.setCredentials( credentials );
-        }
-        else
-        {
-            // SASL bind
-            bindRequest.setSimple( false );
-            bindRequest.setCredentials( credentials );
-            bindRequest.setSaslMechanism( saslMechanism );
-        }
-
-        // Add the controls
-        if ( ( controls != null ) && ( controls.length != 0 ) )
-        {
-            bindRequest.addAllControls( controls );
-        }
-
-        return bindRequest;
-    }
-
-
     /**
      * {@inheritDoc}
      */



Mime
View raw message