directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r901536 - in /directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api: LdapConnection.java messages/AbstractMessage.java messages/Message.java
Date Thu, 21 Jan 2010 05:34:18 GMT
Author: kayyagari
Date: Thu Jan 21 05:34:09 2010
New Revision: 901536

URL: http://svn.apache.org/viewvc?rev=901536&view=rev
Log:
o updated the definition of add(Control...) method to not throw LdapException
o added a new method in LdapConnection to add controls to the message from codec

Modified:
    directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
    directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java
    directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java

Modified: directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java?rev=901536&r1=901535&r2=901536&view=diff
==============================================================================
--- directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
(original)
+++ directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/LdapConnection.java
Thu Jan 21 05:34:09 2010
@@ -57,6 +57,7 @@
 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;
@@ -384,18 +385,8 @@
         
         searchResultEntry.setMessageId( searchEntryResultCodec.getMessageId() );
         searchResultEntry.setEntry( searchEntryResultCodec.getEntry() );
-        
-        ControlCodec cc = searchEntryResultCodec.getCurrentControl();
-        Control control = new BasicControl( cc.getControlType(), cc.getCriticality(), cc.getEncodedValue()
);
-        try
-        {
-            searchResultEntry.add( control );
-        }
-        catch( Exception e )
-        {
-            //shouldn't happen
-        }
-        
+        addControls( searchEntryResultCodec, searchResultEntry );
+
         return searchResultEntry;
     }
 
@@ -409,7 +400,8 @@
         
         searchResultDone.setMessageId( searchResultDoneCodec.getMessageId() );
         searchResultDone.setLdapResult( convert( searchResultDoneCodec.getLdapResult() )
);
-        
+        addControls( searchResultDoneCodec, searchResultDone );
+
         return searchResultDone;
     }
 
@@ -435,7 +427,8 @@
         }
         
         searchResultReference.setReferral( referral );
-
+        addControls( searchEntryReferenceCodec, searchResultReference );
+        
         return searchResultReference;
     }
 
@@ -2820,5 +2813,19 @@
     {
         return config;
     }
+
     
+    private void addControls( LdapMessageCodec codec, AbstractMessage message )
+    {
+        List<ControlCodec> ccList = codec.getControls();
+     
+        if( ccList != null )
+        {
+            for( ControlCodec cc : ccList )
+            {
+                Control control = new BasicControl( cc.getControlType(), cc.getCriticality(),
cc.getEncodedValue() );
+                message.add( control );
+            }
+        }
+    }
 }

Modified: directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java?rev=901536&r1=901535&r2=901536&view=diff
==============================================================================
--- directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java
(original)
+++ directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/AbstractMessage.java
Thu Jan 21 05:34:09 2010
@@ -79,7 +79,7 @@
     /**
      * {@inheritDoc}
      */
-    public Message add( Control... controls ) throws LdapException
+    public Message add( Control... controls )
     {
         if ( this.controls == null )
         {

Modified: directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java?rev=901536&r1=901535&r2=901536&view=diff
==============================================================================
--- directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java
(original)
+++ directory/shared/trunk/ldap-client-api/src/main/java/org/apache/directory/shared/ldap/client/api/messages/Message.java
Thu Jan 21 05:34:09 2010
@@ -80,10 +80,8 @@
      * Adds controls to this Message.
      * 
      * @param controls the controls to add.
-     * @throws MessageException if controls cannot be added to this Message 
-     * or the control is not known etc.
      */
-    Message add( Control... controls ) throws LdapException;
+    Message add( Control... controls );
 
 
     /**



Mime
View raw message