directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r987469 - in /directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap: sp/JavaStoredProcUtils.java util/JndiUtils.java
Date Fri, 20 Aug 2010 12:15:58 GMT
Author: elecharny
Date: Fri Aug 20 12:15:58 2010
New Revision: 987469

URL: http://svn.apache.org/viewvc?rev=987469&view=rev
Log:
Fixed the ADS -> JNDI conversion for extended responses

Modified:
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcUtils.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/JndiUtils.java

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcUtils.java?rev=987469&r1=987468&r2=987469&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcUtils.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/sp/JavaStoredProcUtils.java
Fri Aug 20 12:15:58 2010
@@ -30,12 +30,12 @@ import java.net.URL;
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttributes;
+import javax.naming.ldap.ExtendedResponse;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.commons.lang.SerializationUtils;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureRequest;
-import org.apache.directory.shared.ldap.message.extended.StoredProcedureResponse;
 import org.apache.directory.shared.ldap.util.JndiUtils;
 
 
@@ -141,13 +141,12 @@ public class JavaStoredProcUtils
              * Call the stored procedure via the extended operation
              * and get back its return value.
              */
-            StoredProcedureResponse resp = ( StoredProcedureResponse ) JndiUtils.fromJndiExtendedResponse(
ctx
-                .extendedOperation( JndiUtils.toJndiExtendedRequest( req ) ) );
+            ExtendedResponse resp = ctx.extendedOperation( JndiUtils.toJndiExtendedRequest(
req ) );
 
             /**
              * Restore a Java object from the return value.
              */
-            byte[] responseStream = resp.getResponseValue();
+            byte[] responseStream = resp.getEncodedValue();
             responseObject = SerializationUtils.deserialize( responseStream );
         }
         catch ( Exception e )

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/JndiUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/JndiUtils.java?rev=987469&r1=987468&r2=987469&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/JndiUtils.java
(original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/JndiUtils.java
Fri Aug 20 12:15:58 2010
@@ -77,6 +77,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.exception.LdapServiceUnavailableException;
 import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException;
 import org.apache.directory.shared.ldap.exception.LdapUnwillingToPerformException;
+import org.apache.directory.shared.ldap.message.ExtendedResponseImpl;
 import org.apache.directory.shared.ldap.message.LdapResult;
 import org.apache.directory.shared.ldap.message.MessageException;
 import org.apache.directory.shared.ldap.message.ResultResponse;
@@ -160,19 +161,19 @@ public class JndiUtils
      * @return
      */
     public static ExtendedResponse toJndiExtendedResponse(
-        final org.apache.directory.shared.ldap.message.ExtendedRequest request )
+        final org.apache.directory.shared.ldap.message.ExtendedResponse response )
     {
         class JndiExtendedResponse implements ExtendedResponse
         {
             public byte[] getEncodedValue()
             {
-                return request.getRequestValue();
+                return response.getEncodedValue();
             }
 
 
             public String getID()
             {
-                return request.getRequestName();
+                return response.getResponseName();
             }
         }
 
@@ -185,10 +186,20 @@ public class JndiUtils
     {
         class JndiExtendedRequest implements ExtendedRequest
         {
+            private ExtendedResponse response;
+
+
             public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int
offset, int length )
                 throws NamingException
             {
-                return toJndiExtendedResponse( request );
+                org.apache.directory.shared.ldap.message.ExtendedResponse response = new
ExtendedResponseImpl( request
+                    .getMessageId(), request.getRequestName() );
+                response.setResponseName( id );
+                response.setResponseValue( berValue );
+
+                this.response = JndiUtils.toJndiExtendedResponse( response );
+
+                return this.response;
             }
 
 



Mime
View raw message