directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r760807 - in /directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api: ./ listeners/ messages/ protocol/
Date Wed, 01 Apr 2009 07:50:38 GMT
Author: elecharny
Date: Wed Apr  1 07:50:37 2009
New Revision: 760807

URL: http://svn.apache.org/viewvc?rev=760807&view=rev
Log:
Added the Abandon Request support, plus reflected the change in the codec message classes

Added:
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponseImpl.java
Removed:
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/SearchListener.java
Modified:
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnectionImpl.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/BindListener.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/SearchListener.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolDecoder.java
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolEncoder.java

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java?rev=760807&r1=760806&r2=760807&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
Wed Apr  1 07:50:37 2009
@@ -43,10 +43,11 @@
 import org.apache.directory.shared.ldap.client.api.messages.BindRequestImpl;
 import org.apache.directory.shared.ldap.client.api.protocol.LdapProtocolCodecFactory;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
-import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponse;
+import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
 import org.apache.directory.shared.ldap.codec.abandon.AbandonRequestCodec;
+import org.apache.directory.shared.ldap.codec.bind.BindRequestCodec;
 import org.apache.directory.shared.ldap.codec.bind.LdapAuthentication;
 import org.apache.directory.shared.ldap.codec.bind.SaslCredentials;
 import org.apache.directory.shared.ldap.codec.bind.SimpleAuthentication;
@@ -63,8 +64,7 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.SearchScope;
-import org.apache.directory.shared.ldap.message.AddResponse;
-import org.apache.directory.shared.ldap.message.BindResponse;
+import org.apache.directory.shared.ldap.message.InternalAddResponse;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -139,31 +139,31 @@
     private int messageId;
     
     /** A queue used to store the incoming add responses */
-    private BlockingQueue<LdapMessage> addResponseQueue;
+    private BlockingQueue<LdapMessageCodec> addResponseQueue;
     
     /** A queue used to store the incoming bind responses */
-    private BlockingQueue<LdapMessage> bindResponseQueue;
+    private BlockingQueue<LdapMessageCodec> bindResponseQueue;
     
     /** A queue used to store the incoming compare responses */
-    private BlockingQueue<LdapMessage> compareResponseQueue;
+    private BlockingQueue<LdapMessageCodec> compareResponseQueue;
     
     /** A queue used to store the incoming delete responses */
-    private BlockingQueue<LdapMessage> deleteResponseQueue;
+    private BlockingQueue<LdapMessageCodec> deleteResponseQueue;
     
     /** A queue used to store the incoming extended responses */
-    private BlockingQueue<LdapMessage> extendedResponseQueue;
+    private BlockingQueue<LdapMessageCodec> extendedResponseQueue;
     
     /** A queue used to store the incoming modify responses */
-    private BlockingQueue<LdapMessage> modifyResponseQueue;
+    private BlockingQueue<LdapMessageCodec> modifyResponseQueue;
     
     /** A queue used to store the incoming modifyDN responses */
-    private BlockingQueue<LdapMessage> modifyDNResponseQueue;
+    private BlockingQueue<LdapMessageCodec> modifyDNResponseQueue;
     
     /** A queue used to store the incoming search responses */
-    private BlockingQueue<LdapMessage> searchResponseQueue;
+    private BlockingQueue<LdapMessageCodec> searchResponseQueue;
     
     /** A queue used to store the incoming intermediate responses */
-    private BlockingQueue<LdapMessage> intermediateResponseQueue;
+    private BlockingQueue<LdapMessageCodec> intermediateResponseQueue;
     
     
     /** An operation mutex to guarantee the operation order */
@@ -204,9 +204,9 @@
      *
      * @return The last request response
      */
-    public LdapMessage getResponse()
+    public LdapMessageCodec getResponse()
     {
-        return (LdapMessage)ldapSession.getAttribute( LDAP_RESPONSE );
+        return (LdapMessageCodec)ldapSession.getAttribute( LDAP_RESPONSE );
     }
     
     
@@ -235,15 +235,15 @@
     /**
      * Inject the client Controls into the message
      */
-    private void setControls( Map<String, Control> controls, LdapMessage message )
+    private void setControls( Map<String, Control> controls, LdapMessageCodec message
)
     {
         // Add the controls
         if ( controls != null )
         {
             for ( Control control:controls.values() )
             {
-                org.apache.directory.shared.ldap.codec.Control ctrl = 
-                    new org.apache.directory.shared.ldap.codec.Control();
+                org.apache.directory.shared.ldap.codec.ControlCodec ctrl = 
+                    new org.apache.directory.shared.ldap.codec.ControlCodec();
                 
                 ctrl.setControlType( control.getID() );
                 ctrl.setControlValue( control.getEncodedValue() );
@@ -414,15 +414,15 @@
         ldapSession.setAttribute( "LDAP-Container", ldapMessageContainer );
         
         // Create the responses queues
-        addResponseQueue = new LinkedBlockingQueue<LdapMessage>();
-        bindResponseQueue = new LinkedBlockingQueue<LdapMessage>();
-        compareResponseQueue = new LinkedBlockingQueue<LdapMessage>();
-        deleteResponseQueue = new LinkedBlockingQueue<LdapMessage>();
-        extendedResponseQueue = new LinkedBlockingQueue<LdapMessage>();
-        modifyResponseQueue = new LinkedBlockingQueue<LdapMessage>();
-        modifyDNResponseQueue = new LinkedBlockingQueue<LdapMessage>();
-        searchResponseQueue = new LinkedBlockingQueue<LdapMessage>();
-        intermediateResponseQueue = new LinkedBlockingQueue<LdapMessage>();
+        addResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
+        bindResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
+        compareResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
+        deleteResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
+        extendedResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
+        modifyResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
+        modifyDNResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
+        searchResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
+        intermediateResponseQueue = new LinkedBlockingQueue<LdapMessageCodec>();
         
         // And return
         return true;
@@ -576,7 +576,7 @@
     private void abandonInternal( AbandonRequest abandonRequest )
     {
         // Create the new message and update the messageId
-        LdapMessage message = new LdapMessage();
+        LdapMessageCodec message = new LdapMessageCodec();
         message.setMessageId( messageId++ );
 
         // Create the inner abandonRequest
@@ -607,7 +607,7 @@
      *
      * @return The BindResponse LdapResponse 
      */
-    public LdapResponse bind() throws LdapException
+    public LdapResponseCodec bind() throws LdapException
     {
         return bind( (String)null, (byte[])null );
     }
@@ -621,7 +621,7 @@
      * valid DN
      * @return The BindResponse LdapResponse 
      */
-    public LdapResponse bind( String name ) throws Exception
+    public LdapResponseCodec bind( String name ) throws Exception
     {
         return bind( name, (byte[])null );
     }
@@ -635,7 +635,7 @@
      * @param credentials The password. It can't be null 
      * @return The BindResponse LdapResponse 
      */
-    public LdapResponse bind( String name, String credentials ) throws LdapException
+    public LdapResponseCodec bind( String name, String credentials ) throws LdapException
     {
         return bind( name, StringTools.getBytesUtf8( credentials ) );
     }
@@ -649,7 +649,7 @@
      * @param credentials The password.
      * @return The BindResponse LdapResponse 
      */
-    public LdapResponse bind( String name, byte[] credentials )  throws LdapException
+    public LdapResponseCodec bind( String name, byte[] credentials )  throws LdapException
     {
         LOG.debug( "Bind request : {}", name );
 
@@ -658,7 +658,7 @@
         bindRequest.setName( name );
         bindRequest.setCredentials( credentials );
         
-        LdapResponse response = bind( bindRequest );
+        LdapResponseCodec response = bind( bindRequest );
 
         if ( response.getLdapResult().getResultCode() == ResultCodeEnum.SUCCESS )
         {
@@ -680,7 +680,7 @@
      * parameters 
      * @return A LdapResponse containing the result
      */
-    public LdapResponse bind( BindRequest bindRequest ) throws LdapException
+    public LdapResponseCodec bind( BindRequest bindRequest ) throws LdapException
     {
         return bindInternal( bindRequest, null );
     }
@@ -704,7 +704,7 @@
      * @param bindRequest The BindRequest to send
      * @param listener The listener (Can be null) 
      */
-    private LdapResponse bindInternal( BindRequest bindRequest, BindListener bindListener
) throws LdapException 
+    private LdapResponseCodec bindInternal( BindRequest bindRequest, BindListener bindListener
) throws LdapException 
     {
         // If the session has not been establish, or is closed, we get out immediately
         checkSession();
@@ -714,12 +714,11 @@
         lock();
         
         // Create the new message and update the messageId
-        LdapMessage message = new LdapMessage();
+        LdapMessageCodec message = new LdapMessageCodec();
         message.setMessageId( messageId++ );
         
         // Create a new codec BindRequest object
-        org.apache.directory.shared.ldap.codec.bind.BindRequest request = 
-            new org.apache.directory.shared.ldap.codec.bind.BindRequest();
+        BindRequestCodec request =  new BindRequestCodec();
         
         // Set the name
         try
@@ -772,13 +771,13 @@
             // Read the response, waiting for it if not available immediately
             try
             {
-                LdapMessage response = bindResponseQueue.poll( bindRequest.getTimeout(),
TimeUnit.MILLISECONDS );
+                LdapMessageCodec response = bindResponseQueue.poll( bindRequest.getTimeout(),
TimeUnit.MILLISECONDS );
             
                 // Check that we didn't get out because of a timeout
                 if ( response == null )
                 {
-                    // TODO Send an abandon request here
-                    //abandon( message.getBindRequest().getMessageId() );
+                    // Send an abandon request
+                    abandon( message.getBindRequest().getMessageId() );
                     
                     // We didn't received anything : this is an error
                     LOG.error( "Bind failed : timeout occured" );
@@ -789,7 +788,7 @@
                 operationMutex.release();
                 
                 // Everything is fine, return the response
-                LdapResponse resp = response.getBindResponse();
+                LdapResponseCodec resp = response.getBindResponse();
                 
                 LOG.debug( "Bind successful : {}", resp );
                 
@@ -800,7 +799,9 @@
                 LOG.error( "The response queue has been emptied, no response will be find."
);
                 LdapException ldapException = new LdapException();
                 ldapException.initCause( ie );
-                //abandon( message.getBindRequest().getMessageId() );
+                
+                // Send an abandon request
+                abandon( message.getBindRequest().getMessageId() );
                 throw ldapException;
             }
         }
@@ -925,7 +926,7 @@
         lock();
         
         // Encode the request
-        LdapMessage message = new LdapMessage();
+        LdapMessageCodec message = new LdapMessageCodec();
         message.setMessageId( messageId++ );
         message.setProtocolOP( searchRequest );
         message.addControl( searchRequest.getCurrentControl() );
@@ -1018,7 +1019,7 @@
         UnBindRequest unBindRequest = new UnBindRequest();
         
         // Encode the request
-        LdapMessage message = new LdapMessage();
+        LdapMessageCodec message = new LdapMessageCodec();
         message.setMessageId( messageId );
         message.setProtocolOP( unBindRequest );
         
@@ -1081,7 +1082,7 @@
     public void messageReceived( IoSession session, Object message) throws Exception 
     {
         // Feed the response and store it into the session
-        LdapMessage response = (LdapMessage)message;
+        LdapMessageCodec response = (LdapMessageCodec)message;
 
         LOG.debug( "-------> {} Message received <-------", response.getMessageTypeName()
);
         
@@ -1095,7 +1096,7 @@
             case LdapConstants.BIND_RESPONSE: 
                 if ( bindListener != null )
                 {
-                    bindListener.bindCompleted( this, response.getBindResponse() );
+                    //bindListener.bindCompleted( this, response.getBindResponse() );
                 }
                 else
                 {

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnectionImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnectionImpl.java?rev=760807&r1=760806&r2=760807&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnectionImpl.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnectionImpl.java
Wed Apr  1 07:50:37 2009
@@ -19,46 +19,30 @@
  */
 package org.apache.directory.shared.ldap.client.api;
 
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
 import java.text.ParseException;
 import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
 
 import javax.naming.InvalidNameException;
-import javax.net.ssl.SSLContext;
 
-import org.apache.directory.shared.asn1.ber.IAsn1Container;
 import org.apache.directory.shared.ldap.codec.LdapConstants;
-import org.apache.directory.shared.ldap.codec.LdapMessage;
-import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
-import org.apache.directory.shared.ldap.codec.LdapResponse;
+import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.TwixTransformer;
-import org.apache.directory.shared.ldap.codec.bind.BindRequest;
-import org.apache.directory.shared.ldap.codec.bind.SimpleAuthentication;
 import org.apache.directory.shared.ldap.codec.search.Filter;
 import org.apache.directory.shared.ldap.codec.search.SearchRequest;
 import org.apache.directory.shared.ldap.codec.search.SearchResultDone;
 import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
 import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
-import org.apache.directory.shared.ldap.codec.unbind.UnBindRequest;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.SearchScope;
-import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.mina.core.filterchain.IoFilter;
-import org.apache.mina.core.future.ConnectFuture;
 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.ssl.SslFilter;
-import org.apache.mina.transport.socket.nio.NioSocketConnector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -103,7 +87,7 @@
     
     /** The Ldap codec */
     private IoFilter ldapProtocolFilter = new ProtocolCodecFilter(
-            new LdapProtocolCodecFactory() );
+            null );
 
     /**  
      * The created session, created when we open a connection with
@@ -115,13 +99,13 @@
     private int messageId;
     
     /** A queue used to store the incoming responses */
-    private BlockingQueue<LdapMessage> responseQueue;
+    private BlockingQueue<LdapMessageCodec> responseQueue;
     
     /** An operation mutex to guarantee the operation order */
     private Semaphore operationMutex;
     
     /** the agent which created this connection */
-    private ConsumerCallback consumer;
+    //private ConsumerCallback consumer;
 
     
     
@@ -131,7 +115,7 @@
     public void search( String baseObject, String filterString ) throws Exception
     {
         // If the session has not been establish, or is closed, we get out immediately
-        checkSession();
+        //checkSession();
         
         LdapDN baseDN = null;
         Filter filter = null;
@@ -183,17 +167,17 @@
     /**
      * {@inheritDoc}
      */
-    public void search( SearchRequest searchRequest ) throws Exception
+    private void search( SearchRequest searchRequest ) throws Exception
     {
         // First check the session
-        checkSession();
+        //checkSession();
         
         // Guarantee that for this session, we don't have more than one operation
         // running at the same time
         operationMutex.acquire();
         
         // Encode the request
-        LdapMessage message = new LdapMessage();
+        LdapMessageCodec message = new LdapMessageCodec();
         message.setMessageId( messageId++ );
         message.setProtocolOP( searchRequest );
         message.addControl( searchRequest.getCurrentControl() );
@@ -206,6 +190,8 @@
         ldapSession.write( message );
 
         operationMutex.release();
+        
+        // The search request has been sent, we now have to wait for the result to come back.
 //        int i = 0;
 //        
 //        List<SearchResultEntry> searchResults = new ArrayList<SearchResultEntry>();
@@ -298,7 +284,7 @@
     public void sessionClosed(IoSession session) throws Exception 
     {
         LOG.debug( "-------> Session Closed <-------" );
-        consumer.handleSessionClosed();
+        //consumer.handleSessionClosed();
     }
 
     
@@ -308,7 +294,7 @@
     public void messageReceived( IoSession session, Object message) throws Exception 
     {
         // Feed the response and store it into the session
-        LdapMessage response = (LdapMessage)message;
+        LdapMessageCodec response = (LdapMessageCodec)message;
 
         LOG.debug( "-------> {} Message received <-------", response.getMessageTypeName()
);
         
@@ -321,40 +307,31 @@
 
             case LdapConstants.INTERMEDIATE_RESPONSE:
             
-                       consumer.handleSyncInfo( response.getIntermediateResponse().getResponseValue()
);
+                       //consumer.handleSyncInfo( response.getIntermediateResponse().getResponseValue()
);
                        break;
             
             case LdapConstants.SEARCH_RESULT_DONE:
             
                        SearchResultDone resDone = response.getSearchResultDone();
                        resDone.addControl( response.getCurrentControl() );
-                       consumer.handleSearchDone( resDone );
+                       //consumer.handleSearchDone( resDone );
                        break;
             
             case LdapConstants.SEARCH_RESULT_ENTRY:
             
                        SearchResultEntry sre = response.getSearchResultEntry();
                        sre.addControl( response.getCurrentControl() );
-                       consumer.handleSearchResult( sre );
+                       //consumer.handleSearchResult( sre );
                        break;
                        
             case LdapConstants.SEARCH_RESULT_REFERENCE:
             
                        SearchResultReference searchRef = response.getSearchResultReference();
                        searchRef.addControl( response.getCurrentControl() );
-                       consumer.handleSearchReference( searchRef );
+                       //consumer.handleSearchReference( searchRef );
                        break;
                        
              default: LOG.error( "~~~~~~~~~~~~~~~~~~~~~ Unknown message type {} ~~~~~~~~~~~~~~~~~~~~~",
response.getMessageTypeName() );
         }
     }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void addConsumer( ConsumerCallback consumer )
-    {
-        this.consumer = consumer;
-    }
 }

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/BindListener.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/BindListener.java?rev=760807&r1=760806&r2=760807&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/BindListener.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/BindListener.java
Wed Apr  1 07:50:37 2009
@@ -20,7 +20,7 @@
 package org.apache.directory.shared.ldap.client.api.listeners;
 
 import org.apache.directory.shared.ldap.client.api.LdapConnection;
-import org.apache.directory.shared.ldap.codec.bind.BindResponse;
+import org.apache.directory.shared.ldap.client.api.messages.BindResponse;
 
 /**
  * A listener used for asynchronous bind handling. When wanting to handle
@@ -36,7 +36,7 @@
     /**
      * A callback method called when the bind operation completed.
      *
-     * @param BindResponse The bind response
+     * @param BindResponseCodec The bind response
      */
     void bindCompleted( LdapConnection connection, BindResponse bindResponse );
 }

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/SearchListener.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/SearchListener.java?rev=760807&r1=760806&r2=760807&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/SearchListener.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/listeners/SearchListener.java
Wed Apr  1 07:50:37 2009
@@ -20,7 +20,7 @@
 package org.apache.directory.shared.ldap.client.api.listeners;
 
 import org.apache.directory.shared.ldap.client.api.LdapConnection;
-import org.apache.directory.shared.ldap.codec.LdapResponse;
+import org.apache.directory.shared.ldap.codec.LdapResponseCodec;
 import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
 import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
 
@@ -54,5 +54,5 @@
     /**
      * A callback method called when the search is done.
      */
-    void searchDone( LdapConnection connection, LdapResponse searchDone );
+    void searchDone( LdapConnection connection, LdapResponseCodec searchDone );
 }

Added: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java?rev=760807&view=auto
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java
(added)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponse.java
Wed Apr  1 07:50:37 2009
@@ -0,0 +1,41 @@
+/*
+ *  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.shared.ldap.client.api.messages;
+
+
+/**
+ * Bind protocol response message used to confirm the results of a bind request
+ * message. BindResponse consists simply of an indication from the server of the
+ * status of the client's request for authentication.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 760724 $
+ */
+public interface BindResponse extends Message
+{
+    /**
+     * Gets the optional property holding SASL authentication response parameters
+     * that are SASL mechanism specific. Will return null if the authentication
+     * is simple.
+     * 
+     * @return the sasl mech. specific credentials or null of auth. is simple
+     */
+    byte[] getServerSaslCreds();
+}

Added: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponseImpl.java?rev=760807&view=auto
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponseImpl.java
(added)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/BindResponseImpl.java
Wed Apr  1 07:50:37 2009
@@ -0,0 +1,51 @@
+/*
+ *  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.shared.ldap.client.api.messages;
+
+
+/**
+ * A client implementation of the client BindResponse LDAP message.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class BindResponseImpl extends AbstractRequest implements BindResponse
+{
+    /** optional property holding SASL authentication response parameters */
+    private byte[] credentials;
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getServerSaslCreds()
+    {
+        return credentials;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void setServerSaslCreds( byte[] credentials )
+    {
+        this.credentials = credentials;
+    }
+}

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolDecoder.java?rev=760807&r1=760806&r2=760807&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolDecoder.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolDecoder.java
Wed Apr  1 07:50:37 2009
@@ -26,7 +26,7 @@
 import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.ldap.codec.LdapDecoder;
-import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.mina.core.buffer.IoBuffer;
@@ -88,7 +88,7 @@
                 if ( ldapMessageContainer.getState() == TLVStateEnum.PDU_DECODED )
                 {
                     // get back the decoded message
-                    LdapMessage message = ( ( LdapMessageContainer ) ldapMessageContainer
).getLdapMessage();
+                    LdapMessageCodec message = ( ( LdapMessageContainer ) ldapMessageContainer
).getLdapMessage();
                     
                     if ( IS_DEBUG )
                     {

Modified: directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolEncoder.java?rev=760807&r1=760806&r2=760807&view=diff
==============================================================================
--- directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolEncoder.java
(original)
+++ directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/protocol/LdapProtocolEncoder.java
Wed Apr  1 07:50:37 2009
@@ -21,7 +21,7 @@
 
 import java.nio.ByteBuffer;
 
-import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageCodec;
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.codec.ProtocolEncoder;
@@ -45,9 +45,9 @@
      */
     public void encode( IoSession session, Object request, ProtocolEncoderOutput out ) throws
Exception
     {
-        if ( request instanceof LdapMessage )
+        if ( request instanceof LdapMessageCodec )
         {
-            LdapMessage ldapRequest = (LdapMessage)request;
+            LdapMessageCodec ldapRequest = (LdapMessageCodec)request;
             ByteBuffer bb = ldapRequest.encode( null );
             bb.flip();
             



Mime
View raw message