directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r414849 - in /directory/trunks: apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ shared/ldap/src/main/java/org/apache/directory/shared/ldap/mess...
Date Fri, 16 Jun 2006 15:21:34 GMT
Author: akarasulu
Date: Fri Jun 16 08:21:34 2006
New Revision: 414849

URL: http://svn.apache.org/viewvc?rev=414849&view=rev
Log:
Fixed responses to stored procedure requests which failed with exceptions.  What
was happening is that a response was not returning an OID and this was causing 
the CommunicationExcpetion with the JNDI LDAP provider.  Now the request that
is produced by the TwixTransformer is an instance of StoredProcedureRequest and
it returns a StoredProcedureResponse when we invoke getResultResponse() on it.

The result response object now is an instdance of StoredProcedureResponse as 
opposed to a normal ExtendedResponseImpl instance.  This allows us to infer the
OID and add that automatically.


Modified:
    directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java

Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java?rev=414849&r1=414848&r2=414849&view=diff
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
(original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
Fri Jun 16 08:21:34 2006
@@ -1,4 +1,4 @@
-/*
+    /*
  *   Copyright 2004 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
@@ -100,9 +100,10 @@
                 result.setResultCode( ResultCodeEnum.OTHER );
                 result.setErrorMessage( "Extended operation handler for the specified EXTENSION_OID
(" + req.getOid()
                     + ") has failed to process your request:\n" + ExceptionUtils.getStackTrace(
e ) );
-                ( ( ExtendedResponse ) req.getResultResponse() ).setResponse( new byte[0]
);
+                ExtendedResponse resp = ( ExtendedResponse ) req.getResultResponse();
+                resp.setResponse( new byte[0] );
                 session.write( req.getResultResponse() );
-            }
+            } 
         }
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java?rev=414849&r1=414848&r2=414849&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/TwixTransformer.java
Fri Jun 16 08:21:34 2006
@@ -104,6 +104,7 @@
 import org.apache.directory.shared.ldap.message.SearchResponseReferenceImpl;
 import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
 import org.apache.directory.shared.ldap.message.extended.GracefulShutdownRequest;
+import org.apache.directory.shared.ldap.message.extended.StoredProcedureRequest;
 import org.apache.directory.shared.ldap.message.spi.Provider;
 import org.apache.directory.shared.ldap.message.spi.TransformerSpi;
 import org.slf4j.Logger;
@@ -310,6 +311,10 @@
         if ( extendedRequest.getRequestName().equals( GracefulShutdownRequest.EXTENSION_OID
) )
         {
             snickersMessage = new GracefulShutdownRequest( messageId );
+        }
+        else if ( extendedRequest.getRequestName().equals( StoredProcedureRequest.EXTENSION_OID
) )
+        {
+            snickersMessage = new StoredProcedureRequest( messageId );
         }
         else
         {

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java?rev=414849&r1=414848&r2=414849&view=diff
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java
Fri Jun 16 08:21:34 2006
@@ -50,13 +50,21 @@
     private StoredProcedure procedure;
 
     
+    public StoredProcedureRequest( int messageId )
+    {
+        super( messageId );
+        this.setOid( EXTENSION_OID );
+        this.procedure = new StoredProcedure();
+    }
+
+
     public StoredProcedureRequest( int messageId, String procedure, String language )
     {
         super( messageId );
         this.setOid( EXTENSION_OID );
         this.procedure = new StoredProcedure();
-        this.procedure.setLanguage( language );
-        this.procedure.setProcedure( StringTools.getBytesUtf8( procedure ) );
+        this.setLanguage( language );
+        this.setProcedure( procedure );
     }
 
 
@@ -121,6 +129,7 @@
         if ( response == null )
         {
             StoredProcedureResponse spr = new StoredProcedureResponse( getMessageId() );
+            spr.setOid( EXTENSION_OID );
             response = spr;
         }
 
@@ -138,6 +147,18 @@
         return procedure.getLanguage();
     }
     
+    
+    public void setLanguage( String language )
+    {
+        this.procedure.setLanguage( language );
+    }
+
+    
+    public void setProcedure( String procedure )
+    {
+        this.procedure.setProcedure( StringTools.getBytesUtf8( procedure ) );
+    }
+
     
     public String getProcedureSpecification()
     {



Mime
View raw message