You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/01/23 19:50:00 UTC

svn commit: r902460 [1/3] - in /directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory: ldap/ ldap/client/ ldap/client/api/ ldap/client/api/exception/ ldap/client/api/future/ ldap/client/api/listener/ ldap/client/api/message/ l...

Author: elecharny
Date: Sat Jan 23 18:49:54 2010
New Revision: 902460

URL: http://svn.apache.org/viewvc?rev=902460&view=rev
Log:
added a lot of missing classes

Added:
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/
      - copied from r902161, directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/InvalidConnectionException.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/LdapException.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/AddListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/BindListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/CompareListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/DeleteListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ExtendedListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/IntermediateResponseListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyDnListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/OperationResponseListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/SearchListener.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonableRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractControl.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractResponseWithResult.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AddRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AddResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/BindRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/BindResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/CompareRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/CompareResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/DeleteRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/DeleteResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/ExtendedRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/ExtendedResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/IntermediateResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/LdapResult.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/Message.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/ModifyDnRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/ModifyDnResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/ModifyRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/ModifyResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/Referral.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/Request.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/RequestWithResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/Response.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/ResponseWithResult.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/SearchRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/SearchResponse.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/SearchResultDone.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/SearchResultEntry.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/SearchResultReference.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/UnbindRequest.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/control/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/control/Control.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/control/ControlImpl.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolCodecFactory.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolDecoder.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/protocol/LdapProtocolEncoder.java
Removed:
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/
Modified:
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionPool.java
    directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/PoolableLdapConnectionFactory.java

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=902460&r1=902161&r2=902460&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java Sat Jan 23 18:49:54 2010
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.client.api;
+package org.apache.directory.ldap.client.api;
 
 import java.io.IOException;
 import java.net.InetSocketAddress;
@@ -37,51 +37,52 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.naming.InvalidNameException;
-import javax.naming.ldap.BasicControl;
-import javax.naming.ldap.Control;
 import javax.net.ssl.SSLContext;
 
+import org.apache.directory.ldap.client.api.exception.InvalidConnectionException;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.future.BindFuture;
+import org.apache.directory.ldap.client.api.future.ResponseFuture;
+import org.apache.directory.ldap.client.api.listener.AddListener;
+import org.apache.directory.ldap.client.api.listener.BindListener;
+import org.apache.directory.ldap.client.api.listener.CompareListener;
+import org.apache.directory.ldap.client.api.listener.DeleteListener;
+import org.apache.directory.ldap.client.api.listener.ExtendedListener;
+import org.apache.directory.ldap.client.api.listener.IntermediateResponseListener;
+import org.apache.directory.ldap.client.api.listener.ModifyDnListener;
+import org.apache.directory.ldap.client.api.listener.ModifyListener;
+import org.apache.directory.ldap.client.api.listener.OperationResponseListener;
+import org.apache.directory.ldap.client.api.listener.SearchListener;
+import org.apache.directory.ldap.client.api.message.AbandonRequest;
+import org.apache.directory.ldap.client.api.message.AbstractMessage;
+import org.apache.directory.ldap.client.api.message.AddRequest;
+import org.apache.directory.ldap.client.api.message.AddResponse;
+import org.apache.directory.ldap.client.api.message.BindRequest;
+import org.apache.directory.ldap.client.api.message.BindResponse;
+import org.apache.directory.ldap.client.api.message.CompareRequest;
+import org.apache.directory.ldap.client.api.message.CompareResponse;
+import org.apache.directory.ldap.client.api.message.Control;
+import org.apache.directory.ldap.client.api.message.DeleteRequest;
+import org.apache.directory.ldap.client.api.message.DeleteResponse;
+import org.apache.directory.ldap.client.api.message.ExtendedRequest;
+import org.apache.directory.ldap.client.api.message.ExtendedResponse;
+import org.apache.directory.ldap.client.api.message.IntermediateResponse;
+import org.apache.directory.ldap.client.api.message.LdapResult;
+import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
+import org.apache.directory.ldap.client.api.message.ModifyDnResponse;
+import org.apache.directory.ldap.client.api.message.ModifyRequest;
+import org.apache.directory.ldap.client.api.message.ModifyResponse;
+import org.apache.directory.ldap.client.api.message.Referral;
+import org.apache.directory.ldap.client.api.message.SearchRequest;
+import org.apache.directory.ldap.client.api.message.SearchResponse;
+import org.apache.directory.ldap.client.api.message.SearchResultDone;
+import org.apache.directory.ldap.client.api.message.SearchResultEntry;
+import org.apache.directory.ldap.client.api.message.SearchResultReference;
+import org.apache.directory.ldap.client.api.message.control.ControlImpl;
+import org.apache.directory.ldap.client.api.protocol.LdapProtocolCodecFactory;
 import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.primitives.OID;
-import org.apache.directory.shared.ldap.client.api.exception.InvalidConnectionException;
-import org.apache.directory.shared.ldap.client.api.exception.LdapException;
-import org.apache.directory.shared.ldap.client.api.listeners.AddListener;
-import org.apache.directory.shared.ldap.client.api.listeners.BindListener;
-import org.apache.directory.shared.ldap.client.api.listeners.CompareListener;
-import org.apache.directory.shared.ldap.client.api.listeners.DeleteListener;
-import org.apache.directory.shared.ldap.client.api.listeners.ExtendedListener;
-import org.apache.directory.shared.ldap.client.api.listeners.IntermediateResponseListener;
-import org.apache.directory.shared.ldap.client.api.listeners.ModifyDnListener;
-import org.apache.directory.shared.ldap.client.api.listeners.ModifyListener;
-import org.apache.directory.shared.ldap.client.api.listeners.OperationResponseListener;
-import org.apache.directory.shared.ldap.client.api.listeners.SearchListener;
-import org.apache.directory.shared.ldap.client.api.messages.AbandonRequest;
-import org.apache.directory.shared.ldap.client.api.messages.AbstractMessage;
-import org.apache.directory.shared.ldap.client.api.messages.AddRequest;
-import org.apache.directory.shared.ldap.client.api.messages.AddResponse;
-import org.apache.directory.shared.ldap.client.api.messages.BindRequest;
-import org.apache.directory.shared.ldap.client.api.messages.BindResponse;
-import org.apache.directory.shared.ldap.client.api.messages.CompareRequest;
-import org.apache.directory.shared.ldap.client.api.messages.CompareResponse;
-import org.apache.directory.shared.ldap.client.api.messages.DeleteRequest;
-import org.apache.directory.shared.ldap.client.api.messages.DeleteResponse;
-import org.apache.directory.shared.ldap.client.api.messages.ExtendedRequest;
-import org.apache.directory.shared.ldap.client.api.messages.ExtendedResponse;
-import org.apache.directory.shared.ldap.client.api.messages.IntermediateResponse;
-import org.apache.directory.shared.ldap.client.api.messages.LdapResult;
-import org.apache.directory.shared.ldap.client.api.messages.ModifyDnRequest;
-import org.apache.directory.shared.ldap.client.api.messages.ModifyDnResponse;
-import org.apache.directory.shared.ldap.client.api.messages.ModifyRequest;
-import org.apache.directory.shared.ldap.client.api.messages.ModifyResponse;
-import org.apache.directory.shared.ldap.client.api.messages.Referral;
-import org.apache.directory.shared.ldap.client.api.messages.SearchRequest;
-import org.apache.directory.shared.ldap.client.api.messages.SearchResponse;
-import org.apache.directory.shared.ldap.client.api.messages.SearchResultDone;
-import org.apache.directory.shared.ldap.client.api.messages.SearchResultEntry;
-import org.apache.directory.shared.ldap.client.api.messages.SearchResultReference;
-import org.apache.directory.shared.ldap.client.api.messages.future.ResponseFuture;
-import org.apache.directory.shared.ldap.client.api.protocol.LdapProtocolCodecFactory;
 import org.apache.directory.shared.ldap.codec.ControlCodec;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
 import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
@@ -151,7 +152,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public class LdapConnection  extends IoHandlerAdapter
+public class LdapConnection extends IoHandlerAdapter
 {
 
     /** logger for reporting errors that might not be handled properly upstream */
@@ -1080,24 +1081,13 @@
             throw ldapException;
         }
     }
-        
-
+    
+    
     /**
-     * Do a non-blocking bind non-blocking
-     *
-     * @param bindRequest The BindRequest to send
-     * @param listener The listener 
-     * @return ResponseFuture A future
+     * Create a LdapMessage ready to be sent.
      */
-    public ResponseFuture bind( BindRequest bindRequest, BindListener bindListener ) throws LdapException, IOException 
+    private LdapMessageCodec createBindMessage( BindRequest bindRequest ) throws LdapException
     {
-        // First try to connect, if we aren't already connected.
-        connect();
-        
-        // If the session has not been establish, or is closed, we get out immediately
-        checkSession();
-
-        // Create the new message and update the messageId
         LdapMessageCodec bindMessage = new LdapMessageCodec();
 
         // Creates the messageID and stores it into the 
@@ -1109,12 +1099,6 @@
         bindRequest.setMessageId( newId );
         bindMessage.setMessageId( newId );
         
-        if( bindListener != null )
-        {
-            // This is an asynchronous bind
-            listenerMap.put( newId, bindListener );
-        }
-        
         // Create a new codec BindRequest object
         BindRequestCodec request =  new BindRequestCodec();
         
@@ -1162,13 +1146,43 @@
         
         // Add the controls
         setControls( bindRequest.getControls(), bindMessage );
+        
+        return bindMessage;
+    }
+
+    /**
+     * Do a non-blocking bind
+     *
+     * @param bindRequest The BindRequest to send
+     * @param listener The listener 
+     * @return BindFuture A future
+     */
+    public BindFuture bind( BindRequest bindRequest, BindListener bindListener ) throws LdapException, IOException 
+    {
+        // First try to connect, if we aren't already connected.
+        connect();
+        
+        // If the session has not been establish, or is closed, we get out immediately
+        checkSession();
+
+        // Create the new message and update the messageId
+        LdapMessageCodec bindMessage = createBindMessage( bindRequest );
+
+        int newId = bindMessage.getMessageId();
+        
+        if ( bindListener != null )
+        {
+            // This is an asynchronous bind
+            listenerMap.put( newId, bindListener );
+        }
 
         LOG.debug( "-----------------------------------------------------------------" );
         LOG.debug( "Sending request \n{}", bindMessage );
 
         // Create a future for this Bind opeation
-        ResponseFuture responseFuture = new ResponseFuture( bindResponseQueue );
-        futureMap.put( newId, responseFuture );
+        BindFuture bindFuture = new BindFuture( bindResponseQueue );
+
+        futureMap.put( newId, bindFuture );
 
         if ( bindListener != null )
         {
@@ -1178,9 +1192,11 @@
         }
 
         // Send the request to the server
-        ldapSession.write( bindMessage );
+        WriteFuture writeFuture = ldapSession.write( bindMessage );
         
-        return responseFuture;
+        writeFuture.awaitUninterruptibly( timeOut );
+        
+        return bindFuture;
     }
     
     
@@ -1600,7 +1616,8 @@
                 
                 ExtendedResponse extResponse = convert( extResCodec );
                 ExtendedListener extListener = ( ExtendedListener ) listenerMap.remove( extResCodec.getMessageId() );
-                if( extListener != null )
+                
+                if ( extListener != null )
                 {
                     extListener.extendedOperationCompleted( this, extResponse );
                 }
@@ -2085,7 +2102,7 @@
         if ( isControlSupported( treeDeleteOid ) ) 
         {
             DeleteRequest delRequest = new DeleteRequest( dn );
-            delRequest.add( new BasicControl( treeDeleteOid ) );
+            delRequest.add( new ControlImpl( treeDeleteOid ) );
             return delete( delRequest, null ); 
         }
         else
@@ -2112,7 +2129,7 @@
             if ( isControlSupported( treeDeleteOid ) ) 
             {
                 DeleteRequest delRequest = new DeleteRequest( ldapDn );
-                delRequest.add( new BasicControl( treeDeleteOid ) );
+                delRequest.add( new ControlImpl( treeDeleteOid ) );
                 return delete( delRequest, null ); 
             }
             else
@@ -2730,17 +2747,17 @@
      */
     public boolean isControlSupported( String controlOID ) throws LdapException
     {
-        return getSupportedConrols().contains( controlOID );
+        return getSupportedControls().contains( controlOID );
     }
     
     
     /**
-     * get the Conrols supported by server.
+     * get the Controls supported by server.
      *
      * @return a list of control OIDs supported by server
      * @throws LdapException
      */
-    public List<String> getSupportedConrols() throws LdapException
+    public List<String> getSupportedControls() throws LdapException
     {
         if( supportedControls != null )
         {
@@ -2823,7 +2840,7 @@
         {
             for( ControlCodec cc : ccList )
             {
-                Control control = new BasicControl( cc.getControlType(), cc.getCriticality(), cc.getEncodedValue() );
+                Control control = new ControlImpl( cc.getControlType(), cc.getCriticality(), cc.getEncodedValue() );
                 message.add( control );
             }
         }

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java?rev=902460&r1=902161&r2=902460&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionConfig.java Sat Jan 23 18:49:54 2010
@@ -18,7 +18,7 @@
  *
  */
 
-package org.apache.directory.shared.ldap.client.api;
+package org.apache.directory.ldap.client.api;
 
 import java.security.SecureRandom;
 

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionPool.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionPool.java?rev=902460&r1=902161&r2=902460&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionPool.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnectionPool.java Sat Jan 23 18:49:54 2010
@@ -18,7 +18,7 @@
  *
  */
 
-package org.apache.directory.shared.ldap.client.api;
+package org.apache.directory.ldap.client.api;
 
 
 import org.apache.commons.pool.impl.GenericObjectPool;

Modified: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/PoolableLdapConnectionFactory.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/PoolableLdapConnectionFactory.java?rev=902460&r1=902161&r2=902460&view=diff
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/PoolableLdapConnectionFactory.java (original)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/PoolableLdapConnectionFactory.java Sat Jan 23 18:49:54 2010
@@ -18,7 +18,7 @@
  *
  */
 
-package org.apache.directory.shared.ldap.client.api;
+package org.apache.directory.ldap.client.api;
 
 
 import org.apache.commons.pool.PoolableObjectFactory;

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/InvalidConnectionException.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/InvalidConnectionException.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/InvalidConnectionException.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/InvalidConnectionException.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,43 @@
+/*
+ *  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.exception;
+
+
+/**
+ * A InvalidConnectionException is thrown if one tries to apply an operation
+ * on a closed connection
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class InvalidConnectionException extends LdapException
+{
+    static final long serialVersionUID = 1L;
+
+
+    public InvalidConnectionException()
+    {
+        super();
+    }
+
+
+    public InvalidConnectionException(String explanation)
+    {
+        super( explanation );
+    }
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/LdapException.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/LdapException.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/LdapException.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/exception/LdapException.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,55 @@
+/*
+ *  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.exception;
+
+
+/**
+ * A InvalidConnectionException is thrown if one tries to apply an operation
+ * on a closed connection
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class LdapException extends Exception
+{
+    static final long serialVersionUID = 1L;
+
+
+    public LdapException()
+    {
+        super();
+    }
+
+
+    public LdapException( String explanation )
+    {
+        super( explanation );
+    }
+
+
+    public LdapException( Throwable cause )
+    {
+        super( cause );
+    }
+
+
+    public LdapException( String explanation, Throwable cause )
+    {
+        super( explanation, cause );
+    }
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/AddFuture.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,100 @@
+/*
+ * 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.future;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.directory.ldap.client.api.message.AddResponse;
+
+/**
+ * A Future to manage AddRequests
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AddFuture extends ResponseFuture<AddResponse>
+{
+    /**
+     * 
+     * Creates a new instance of AddFuture.
+     *
+     * @param addResponseQueue The associated AddResponse queue
+     */
+    public AddFuture( BlockingQueue<AddResponse> addResponseQueue )
+    {
+        super( addResponseQueue );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean cancel( boolean mayInterruptIfRunning )
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+
+    
+    /**
+     * Get the AddResponse, blocking until one is received.
+     * 
+     * @return The AddResponse
+     */
+    public AddResponse get() throws InterruptedException, ExecutionException
+    {
+        return responseQueue.poll();
+    }
+
+    
+    /**
+     * Get the AddResponse, blocking until one is received, or until the
+     * given timeout is reached.
+     * 
+     * @param timeout Number of TimeUnit to wait
+     * @param unit The TimeUnit
+     * @return The AddResponse The AddResponse found
+     */
+    public AddResponse get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException,
+        TimeoutException
+    {
+        return responseQueue.poll( timeout, unit );        
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCancelled()
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDone()
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/BindFuture.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,100 @@
+/*
+ * 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.future;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.directory.ldap.client.api.message.BindResponse;
+
+/**
+ * A Future to manage BindRequests
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BindFuture extends ResponseFuture<BindResponse>
+{
+    /**
+     * 
+     * Creates a new instance of BindFuture.
+     *
+     * @param bindResponseQueue The associated BindResponse queue
+     */
+    public BindFuture( BlockingQueue<BindResponse> bindResponseQueue )
+    {
+        super( bindResponseQueue );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean cancel( boolean mayInterruptIfRunning )
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+
+    
+    /**
+     * Get the BindResponse, blocking until one is received.
+     * 
+     * @return The BindResponse
+     */
+    public BindResponse get() throws InterruptedException, ExecutionException
+    {
+        return responseQueue.poll();
+    }
+
+    
+    /**
+     * Get the BindResponse, blocking until one is received, or until the
+     * given timeout is reached.
+     * 
+     * @param timeout Number of TimeUnit to wait
+     * @param unit The TimeUnit
+     * @return The BindResponse The BindResponse found
+     */
+    public BindResponse get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException,
+        TimeoutException
+    {
+        return responseQueue.poll( timeout, unit );        
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCancelled()
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDone()
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/ResponseFuture.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,137 @@
+/*
+ *   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.future;
+
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.directory.ldap.client.api.message.AbstractResponseWithResult;
+
+
+/**
+ * A Future implementation used in LdapConnection operations.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ResponseFuture<R> implements Future<R>
+{
+    /** the blocking queue holding LDAP responses */
+    protected BlockingQueue<R> responseQueue;
+
+    /** flag to determine if this future is cancelled */
+    private boolean cancelled = false;
+
+    /** an object to indicate a cancelled/abandoned operation */
+    // 'poison pill shutdown' refer p. 155-156 Java Concurrency in Practice - Brian Goetz
+    private static AbstractResponseWithResult CANCEL_POISON = new AbstractResponseWithResult(){};
+
+
+    /**
+     * Creates a new instance of ResponseFuture.
+     *
+     * @param responseQueue a non-null blocking queue
+     */
+    public ResponseFuture( BlockingQueue<R> responseQueue )
+    {
+        if ( responseQueue == null )
+        {
+            throw new NullPointerException( "response queue cannot be null" );
+        }
+
+        this.responseQueue = responseQueue;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean cancel( boolean mayInterruptIfRunning )
+    {
+        if( cancelled )
+        {
+            return cancelled;
+        }
+        
+        cancelled = true;
+        //responseQueue.add( (Response)CANCEL_POISON );
+        
+        return cancelled;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * @throws InterruptedException if the operation has been cancelled by client
+     */
+    public R get() throws InterruptedException, ExecutionException
+    {
+        R resp = responseQueue.poll();
+        
+        if ( resp == CANCEL_POISON )
+        {
+            throw new InterruptedException( "cancelled" );
+        }
+        
+        return resp;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * @throws InterruptedException if the operation has been cancelled by client
+     */
+    public R get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException,
+        TimeoutException
+    {
+        R resp = (R)responseQueue.poll( timeout, unit );
+        
+        if( resp == CANCEL_POISON )
+        {
+            throw new InterruptedException( "cancelled" );
+        }
+        
+        return resp;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCancelled()
+    {
+        return cancelled;
+    }
+
+
+    /**
+     * This operation is not supported in this implementation of Future
+     */
+    public boolean isDone()
+    {
+        throw new UnsupportedOperationException( "Operation not supported" );
+    }
+
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/future/SearchFuture.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,102 @@
+/*
+ * 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.future;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.apache.directory.ldap.client.api.message.SearchResponse;
+
+/**
+ * A Future to manage SerachRequest
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class SearchFuture extends ResponseFuture<SearchResponse>
+{
+    /**
+     * 
+     * Creates a new instance of SearchFuture.
+     *
+     * @param searchResponseQueue The associated SearchResponse queue
+     */
+    public SearchFuture( BlockingQueue<SearchResponse> searchResponseQueue )
+    {
+        super( searchResponseQueue );
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean cancel( boolean mayInterruptIfRunning )
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+
+    
+    /**
+     * Get the SearchResponse, blocking until one is received.
+     * It can be either a SearchResultEntry, a SearchResultReference
+     * or a SearchResultDone, the last of all the SearchResponse.
+     * 
+     * @return The SearchResponse
+     */
+    public SearchResponse get() throws InterruptedException, ExecutionException
+    {
+        return responseQueue.poll();
+    }
+
+    
+    /**
+     * Get the SearchResponse, blocking until one is received, or until the
+     * given timeout is reached.
+     * 
+     * @param timeout Number of TimeUnit to wait
+     * @param unit The TimeUnit
+     * @return The SearchResponse The SearchResponse found
+     */
+    public SearchResponse get( long timeout, TimeUnit unit ) throws InterruptedException, ExecutionException,
+        TimeoutException
+    {
+        return responseQueue.poll( timeout, unit );        
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCancelled()
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isDone()
+    {
+        throw new RuntimeException( "Not Yet Implemented" );
+    }
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/AddListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/AddListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/AddListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/AddListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,43 @@
+/*
+ *   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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.AddResponse;
+
+/**
+ * interface used for invoking the callback after completing the add operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface AddListener extends OperationResponseListener
+{
+    /**
+     * callback method called after completing the add operation.
+     *
+     * @param connection the LdapConnection
+     * @param response the add operation's response
+     * @throws LdapException
+     */
+    public void entryAdded( LdapConnection connection, AddResponse response ) throws LdapException;
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/BindListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/BindListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/BindListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/BindListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,44 @@
+/*
+ *  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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.BindResponse;
+
+/**
+ * A listener used for asynchronous bind handling. When wanting to handle
+ * bind as a non-blocking operation, simply associate a BindListener
+ * to the bind operation : When the bind as been completed this listener
+ * will be called. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface BindListener extends OperationResponseListener
+{
+    /**
+     * A callback method called when the bind operation completed.
+     *
+     * @param connection
+     * @param BindResponseCodec The bind response
+     */
+    void bindCompleted( LdapConnection connection, BindResponse bindResponse ) throws LdapException;
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/CompareListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/CompareListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/CompareListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/CompareListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,43 @@
+/*
+ *   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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.CompareResponse;
+
+/**
+ * interface used for invoking the callback after completing the compare operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface CompareListener extends OperationResponseListener
+{
+    /**
+     * callback method called after completing the compare operation.
+     *
+     * @param connection the LdapConnection
+     * @param response the compare operation's response
+     * @throws LdapException
+     */
+    public void attributeCompared( LdapConnection connection, CompareResponse response ) throws LdapException;
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/DeleteListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/DeleteListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/DeleteListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/DeleteListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,43 @@
+/*
+ *   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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.DeleteResponse;
+
+/**
+ * interface used for invoking the callback after completing the delete operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface DeleteListener extends OperationResponseListener
+{
+    /**
+     * callback method called after completing the delete operation.
+     *
+     * @param connection the LdapConnection
+     * @param response the delete operation's response
+     * @throws LdapException
+     */
+    public void entryDeleted( LdapConnection connection, DeleteResponse response ) throws LdapException;
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ExtendedListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ExtendedListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ExtendedListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ExtendedListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,43 @@
+/*
+ *   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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.ExtendedResponse;
+
+/**
+ * interface used for invoking the callback after completing the extended operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ExtendedListener extends OperationResponseListener
+{
+    /**
+     * callback method called after completing the extended operation.
+     *
+     * @param connection the LdapConnection
+     * @param response the extended operation's response
+     * @throws LdapException
+     */
+    public void extendedOperationCompleted( LdapConnection connection, ExtendedResponse response ) throws LdapException;
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/IntermediateResponseListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/IntermediateResponseListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/IntermediateResponseListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/IntermediateResponseListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,40 @@
+/*
+ *  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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.message.IntermediateResponse;
+
+/**
+ * A listener used for asynchronous IntermediateResponse handling. 
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IntermediateResponseListener
+{
+    /**
+     * A callback method for each entry returned by a intermediateResponse response.
+     *
+     * @param connection The current connection
+     * @param IntermediateResponse The intermediate response
+     */
+    void responseReceived( LdapConnection connection, IntermediateResponse intermediateResponse );
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyDnListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyDnListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyDnListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyDnListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,44 @@
+/*
+ *   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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.ModifyDnResponse;
+
+/**
+ * interface used for invoking the callback after completing the modifyDN operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ModifyDnListener extends OperationResponseListener
+{
+    /**
+     * 
+     * callback method called after completing the modifyDn operation.
+     *
+     * @param connection the LdapConnection
+     * @param response the modifyDn operation's response
+     * @throws LdapException
+     */
+    public void modifyDnCompleted( LdapConnection connection, ModifyDnResponse response ) throws LdapException;
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/ModifyListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,44 @@
+/*
+ *   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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.ModifyResponse;
+
+/**
+ * interface used for invoking the callback after completing the modify operation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ModifyListener extends OperationResponseListener
+{
+    /**
+     * 
+     * callback method called after completing the modify operation.
+     *
+     * @param connection the LdapConnection
+     * @param response the modify operation's response
+     * @throws LdapException
+     */
+    public void modifyCompleted( LdapConnection connection, ModifyResponse response ) throws LdapException;
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/OperationResponseListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/OperationResponseListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/OperationResponseListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/OperationResponseListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,32 @@
+/*
+ *   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.listener;
+
+
+/**
+ * A marker listener for all response value listener interfaces.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface OperationResponseListener
+{
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/SearchListener.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/SearchListener.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/SearchListener.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/listener/SearchListener.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,65 @@
+/*
+ *  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.listener;
+
+import org.apache.directory.ldap.client.api.LdapConnection;
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.SearchResultDone;
+import org.apache.directory.ldap.client.api.message.SearchResultEntry;
+import org.apache.directory.ldap.client.api.message.SearchResultReference;
+
+
+/**
+ * A listener used for asynchronous search handling. When wanting to handle
+ * searches as a non-blocking operation, simply associate a SearchListener
+ * to the search operation : for each entry found, the listener will be
+ * called back, and so will it when the search will be done.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface SearchListener extends OperationResponseListener
+{
+    /**
+     * A callback method for each entry returned by a search operation.
+     *
+     * @param connection The LdapConnection
+     * @param searchResultEntry The found entry
+     */
+    void entryFound( LdapConnection connection, SearchResultEntry searchResultEntry ) throws LdapException;
+    
+    
+    /**
+     * A callback method for each referral returned by a search operation.
+     *
+     * @param connection The LdapConnection
+     * @param searchResultReference The referral message
+     */
+    void referralFound( LdapConnection connection, SearchResultReference searchResultReference ) throws LdapException;
+
+    
+    /**
+     * A callback method called when the search is done.
+     * 
+     * @param connection The LdapConnection
+     * @param searchResultDone The searchResultDone response
+     */
+    void searchDone( LdapConnection connection, SearchResultDone searchResultDone ) throws LdapException;
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonRequest.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonRequest.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonRequest.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonRequest.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,90 @@
+/*
+ *  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.message;
+
+/**
+ * Abandon protocol operation request message. It abandons the given message. 
+ * 
+ * Its syntax is : 
+ * AbandonRequest ::= [APPLICATION 16] MessageID 
+ * 
+ * MessageID ::= INTEGER (0 .. maxInt) 
+ * 
+ * maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AbandonRequest extends AbstractRequest
+{
+    /** The abandoned message ID */
+    private int abandonedMessageId;
+    
+    
+    /**
+     * 
+     * Creates a new instance of AbandonRequestImpl.
+     */
+    public AbandonRequest()
+    {
+        super();
+    }
+    
+    
+    /**
+     * Get the abandoned message ID
+     * 
+     * @return Returns the abandoned MessageId.
+     */
+    public int getAbandonedMessageId()
+    {
+        return abandonedMessageId;
+    }
+
+
+    /**
+     * Set the abandoned message ID
+     * 
+     * @param abandonedMessageId The abandoned messageID to set.
+     */
+    public AbandonRequest setAbandonedMessageId( int abandonedMessageId )
+    {
+        this.abandonedMessageId = abandonedMessageId;
+        
+        return this;
+    }
+    
+    
+    /**
+     * Return a String representing an AbandonRequest
+     * 
+     * @return A String representing the AbandonRequest
+     */
+    public String toString()
+    {
+
+        StringBuffer sb = new StringBuffer();
+
+        sb.append(  super.toString() );
+        sb.append( "    Abandon Request :\n" );
+        sb.append( "        Message Id : " ).append( abandonedMessageId ).append( '\n' );
+
+        return sb.toString();
+    }
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonableRequest.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonableRequest.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonableRequest.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbandonableRequest.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,30 @@
+/*
+ * 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.message;
+
+
+/**
+ * A request which can be abandoned.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public interface AbandonableRequest extends Request
+{
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractControl.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractControl.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractControl.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractControl.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,156 @@
+/*
+ *  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.message;
+
+import javax.naming.ldap.Control;
+
+import org.apache.directory.shared.ldap.util.StringTools;
+
+
+/**
+ * Control implementation.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 762512 $
+ */
+public abstract class AbstractControl implements Control
+{
+    /** Unique object identifier for this control */
+    private String oid;
+
+    /** Flag for control criticality */
+    private boolean isCritical;
+    
+    /** The encoded value */
+    private byte[] encodedValue;
+
+
+    /**
+     * Creates a new instance of AbstractControl.
+     *
+     * @param oid The control's OID
+     */
+    public AbstractControl( String oid )
+    {
+        this.oid = oid;
+        encodedValue = StringTools.EMPTY_BYTES;
+        isCritical = false;
+    }
+    
+    
+    /**
+     * Creates a new instance of AbstractControl.
+     *
+     * @param oid The control's OID
+     * @param encodedValue The encoded value
+     */
+    public AbstractControl( String oid, byte[] encodedValue )
+    {
+        this.oid = oid;
+        this.encodedValue = encodedValue;
+        this.isCritical = false;
+    }
+    
+    
+    /**
+     * Creates a new instance of AbstractControl.
+     *
+     * @param oid The control's OID
+     * @param isCritical A flag telling if the control is critical or not
+     */
+    public AbstractControl( String oid, boolean isCritical )
+    {
+        this.oid = oid;
+        encodedValue = StringTools.EMPTY_BYTES;
+        this.isCritical = isCritical;
+    }
+    
+    
+    /**
+     * Creates a new instance of AbstractControl.
+     *
+     * @param oid The control's OID
+     * @param encodedValue The encoded value
+     * @param isCritical A flag telling if the control is critical or not
+     */
+    public AbstractControl( String oid, byte[] encodedValue, boolean isCritical )
+    {
+        this.oid = oid;
+        this.encodedValue = encodedValue;
+        this.isCritical = isCritical;
+    }
+    
+    
+    // ------------------------------------------------------------------------
+    // Control Interface Method Implementations
+    // ------------------------------------------------------------------------
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isCritical()
+    {
+        return this.isCritical;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setCritical( boolean isCritical )
+    {
+        this.isCritical = isCritical;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setID( String oid )
+    {
+        this.oid = oid;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getID()
+    {
+        return this.oid;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getEncodedValue()
+    {
+        return encodedValue;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void getEncodedValue( byte[] encodedValue )
+    {
+        this.encodedValue = encodedValue;
+    }
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractMessage.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,178 @@
+/*
+ *  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.message;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.ldap.client.api.exception.LdapException;
+import org.apache.directory.ldap.client.api.message.control.Control;
+
+
+/**
+ * Abstract message base class.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 760984 $
+ */
+public abstract class AbstractMessage implements Message
+{
+    /** Map of message controls using OID Strings for keys and Control values */
+    private Map<String, Control> controls;
+
+    /** The session unique message sequence identifier */
+    private int messageId = -1;
+
+    /**
+     * Completes the instanciation of a Message.
+     * 
+     * @param messageId the seq id of the message
+     */
+    protected AbstractMessage()
+    {
+        controls = new HashMap<String, Control>();
+    }
+
+
+    /**
+     * Gets the session unique message sequence id for this message. Requests
+     * and their responses if any have the same message id. Clients at the
+     * initialization of a session start with the first message's id set to 1
+     * and increment it with each transaction.
+     * 
+     * @return the session unique message id.
+     */
+    public int getMessageId()
+    {
+        return messageId;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     *
+     * @param messageId
+     */
+    public void setMessageId( int messageId )
+    {
+        this.messageId = messageId;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Message add( Control... controls )
+    {
+        if ( this.controls == null )
+        {
+            this.controls = new HashMap<String, Control>();
+        }
+        
+        if ( controls != null )
+        {
+            for ( Control control:controls )
+            {
+                this.controls.put( control.getId(), control );
+            }
+        }
+        
+        return this;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Map<String, Control> getControls()
+    {
+        return controls;
+    }
+
+
+    /**
+     * Gets the control with a specific OID.
+     * 
+     * @return The Control with the specified OID
+     */
+    public Control getControl( String oid )
+    {
+        return controls.get( oid );
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasControl( String oid )
+    {
+        return ( controls != null ) && ( controls.size() > 0 );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Message remove( Control... controls ) throws LdapException
+    {
+        if ( this.controls == null )
+        {
+            // We don't have any controls, so we can just exit
+            return this;
+        }
+        
+        if ( controls != null )
+        {
+            for ( Control ctrl:controls )
+            {
+                this.controls.remove( ctrl.getId() );
+            }
+        }
+        
+        return this;
+    }
+    
+    
+    /**
+     * Get a String representation of a LdapMessage
+     * 
+     * @return A LdapMessage String
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "LdapMessage\n" );
+        sb.append( "    message Id : " ).append( messageId ).append( '\n' );
+
+        if ( controls != null )
+        {
+            sb.append( "    controls :\n" );
+            
+            for ( Control control:controls.values() )
+            {
+                sb.append( "        " ).append( control.getClass().getSimpleName() );
+                sb.append( ":" ).append( control.getId() ).append( "\n" );
+            }
+        }
+
+        return sb.toString();
+    }
+}

Added: directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractRequest.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractRequest.java?rev=902460&view=auto
==============================================================================
--- directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractRequest.java (added)
+++ directory/clients/ldap/trunk/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/AbstractRequest.java Sat Jan 23 18:49:54 2010
@@ -0,0 +1,61 @@
+/*
+ *  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.message;
+
+/**
+ * An abstract class containing the Controls and timeout for all the requests.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AbstractRequest extends AbstractMessage implements Request
+{
+    /** The client request timeout */
+    private long timeout = 0;
+    
+    
+    /**
+     * Creates a new instance of AbstractRequest.
+     */
+    protected AbstractRequest()
+    {
+        super();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public long getTimeout()
+    {
+        return timeout;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public Message setTimeout( long timeout )
+    {
+        this.timeout = timeout;
+        
+        return this;
+    }
+}