directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r772108 - /directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
Date Wed, 06 May 2009 09:28:00 GMT
Author: elecharny
Date: Wed May  6 09:27:57 2009
New Revision: 772108

URL: http://svn.apache.org/viewvc?rev=772108&view=rev
Log:
Fixed the controls handling : they were not copied in the created objects.

Modified:
    directory/shared/branches/shared-replication/client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.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=772108&r1=772107&r2=772108&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 May  6 09:27:57 2009
@@ -293,11 +293,11 @@
     /**
      * Convert the controls
      */
-    private void convertControls( Message response, LdapMessageCodec messageCodec ) throws
LdapException
+    private void convertControls( Message response, List<ControlCodec> controls ) throws
LdapException
     {
-        if ( ( messageCodec.getControls() != null ) && ( messageCodec.getControls().size()
!= 0 ) )
+        if ( ( controls != null ) && ( controls.size() != 0 ) )
         {
-            for ( ControlCodec controlCodec:messageCodec.getControls() )
+            for ( ControlCodec controlCodec:controls )
             {
                 Control control = new  BasicControl( 
                     controlCodec.getControlType(),
@@ -308,6 +308,8 @@
             }
         }
     }
+    
+    
     /**
      * Inject the client Controls into the message
      */
@@ -353,7 +355,7 @@
     /**
      * Convert a BindResponseCodec to a BindResponse message
      */
-    private BindResponse convert( BindResponseCodec bindResponseCodec ) throws LdapException
+    private BindResponse convert( BindResponseCodec bindResponseCodec, List<ControlCodec>
controls ) throws LdapException
     {
         BindResponse bindResponse = new BindResponseImpl();
         
@@ -362,7 +364,7 @@
         bindResponse.setLdapResult( convert( bindResponseCodec.getLdapResult() ) );
         
         // Convert the controls
-        convertControls( bindResponse, bindResponseCodec );
+        convertControls( bindResponse, controls );
 
         return bindResponse;
     }
@@ -371,7 +373,7 @@
     /**
      * Convert a IntermediateResponseCodec to a IntermediateResponse message
      */
-    private IntermediateResponse convert( IntermediateResponseCodec intermediateResponseCodec
)
+    private IntermediateResponse convert( IntermediateResponseCodec intermediateResponseCodec,
List<ControlCodec> controls )
         throws LdapException
     {
         IntermediateResponse intermediateResponse = new IntermediateResponseImpl();
@@ -381,7 +383,7 @@
         intermediateResponse.setResponseValue( intermediateResponseCodec.getResponseValue()
);
 
         // Convert the controls
-        convertControls( intermediateResponse, intermediateResponseCodec );
+        convertControls( intermediateResponse, controls );
 
         return intermediateResponse;
     }
@@ -418,7 +420,7 @@
     /**
      * Convert a SearchResultEntryCodec to a SearchResultEntry message
      */
-    private SearchResultEntry convert( SearchResultEntryCodec searchEntryResultCodec )
+    private SearchResultEntry convert( SearchResultEntryCodec searchEntryResultCodec, List<ControlCodec>
controls )
         throws LdapException
     {
         SearchResultEntry searchResultEntry = new SearchResultEntryImpl();
@@ -427,7 +429,7 @@
         searchResultEntry.setEntry( searchEntryResultCodec.getEntry() );
         
         // Convert the controls
-        convertControls( searchResultEntry, searchEntryResultCodec );
+        convertControls( searchResultEntry, controls );
         
         return searchResultEntry;
     }
@@ -436,7 +438,7 @@
     /**
      * Convert a SearchResultDoneCodec to a SearchResultDone message
      */
-    private SearchResultDone convert( SearchResultDoneCodec searchResultDoneCodec )
+    private SearchResultDone convert( SearchResultDoneCodec searchResultDoneCodec, List<ControlCodec>
controls )
         throws LdapException
     {
         SearchResultDone searchResultDone = new SearchResultDoneImpl();
@@ -445,7 +447,7 @@
         searchResultDone.setLdapResult( convert( searchResultDoneCodec.getLdapResult() )
);
         
         // Convert the controls
-        convertControls( searchResultDone, searchResultDoneCodec );
+        convertControls( searchResultDone, controls );
         
         return searchResultDone;
     }
@@ -454,7 +456,7 @@
     /**
      * Convert a SearchResultReferenceCodec to a SearchResultReference message
      */
-    private SearchResultReference convert( SearchResultReferenceCodec searchEntryReferenceCodec
)
+    private SearchResultReference convert( SearchResultReferenceCodec searchEntryReferenceCodec,
List<ControlCodec> controls )
         throws LdapException
     {
         SearchResultReference searchResultReference = new SearchResultReferenceImpl();
@@ -475,7 +477,7 @@
         searchResultReference.setReferral( referral );
         
         // Convert the controls
-        convertControls( searchResultReference, searchEntryReferenceCodec );
+        convertControls( searchResultReference, controls );
 
         return searchResultReference;
     }
@@ -1340,7 +1342,7 @@
         
         try
         {
-            cursor.beforeFirst();
+            cursor.first();
         }
         catch ( Exception e )
         {
@@ -1543,6 +1545,7 @@
         LdapMessageCodec response = (LdapMessageCodec)message;
 
         LOG.debug( "-------> {} Message received <-------", response.getMessageTypeName()
);
+        List<ControlCodec> controls = response.getControls();
         
         switch ( response.getMessageType() )
         {
@@ -1553,9 +1556,12 @@
                 
             case LdapConstants.BIND_RESPONSE: 
                 // Store the response into the responseQueue
+                // TODO : implement the following convert method
+                //BindResponse bindResponse = convert( response );
                 BindResponseCodec bindResponseCodec = response.getBindResponse();
                 bindResponseCodec.setMessageId( response.getMessageId() );
-                BindResponse bindResponse = convert( bindResponseCodec );
+                
+                BindResponse bindResponse = convert( bindResponseCodec, controls );
                 
                 if ( bindListener != null )
                 {
@@ -1593,7 +1599,7 @@
                 if ( intermediateResponseListener != null )
                 {
                     intermediateResponseListener.responseReceived( this, 
-                        convert( intermediateResponseCodec ) );
+                        convert( intermediateResponseCodec, controls ) );
                 }
                 else
                 {
@@ -1623,11 +1629,11 @@
                 
                 if ( searchListener != null )
                 {
-                    searchListener.searchDone( this, convert( searchResultDoneCodec ) );
+                    searchListener.searchDone( this, convert( searchResultDoneCodec, controls
) );
                 }
                 else
                 {
-                    searchResponseQueue.add( convert( searchResultDoneCodec ) );
+                    searchResponseQueue.add( convert( searchResultDoneCodec, controls ) );
                 }
                 
                 break;
@@ -1642,11 +1648,11 @@
                 
                 if ( searchListener != null )
                 {
-                    searchListener.entryFound( this, convert( searchResultEntryCodec ) );
+                    searchListener.entryFound( this, convert( searchResultEntryCodec, controls
) );
                 }
                 else
                 {
-                    SearchResultEntry entry = convert( searchResultEntryCodec );
+                    SearchResultEntry entry = convert( searchResultEntryCodec, controls );
                     searchResponseQueue.add( entry );
                 }
                 
@@ -1662,11 +1668,11 @@
 
                 if ( searchListener != null )
                 {
-                    searchListener.referralFound( this, convert( searchResultReferenceCodec
) );
+                    searchListener.referralFound( this, convert( searchResultReferenceCodec,
controls ) );
                 }
                 else
                 {
-                    searchResponseQueue.add( convert( searchResultReferenceCodec ) );
+                    searchResponseQueue.add( convert( searchResultReferenceCodec, controls
) );
                 }
 
                 break;



Mime
View raw message