directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1073365 - in /directory/apacheds/branches/akarasulu: core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/ protocol-ldap/src/main/java/org/apache/directory/server/ldap/ protocol-ldap/src/main/java/org/apache/directory/se...
Date Tue, 22 Feb 2011 15:35:09 GMT
Author: akarasulu
Date: Tue Feb 22 15:35:09 2011
New Revision: 1073365

URL: http://svn.apache.org/viewvc?rev=1073365&view=rev
Log:
DIRSHARED-86: fixed various generics compilation issues

Modified:
    directory/apacheds/branches/akarasulu/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java
    directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java

Modified: directory/apacheds/branches/akarasulu/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
(original)
+++ directory/apacheds/branches/akarasulu/core-integ/src/test/java/org/apache/directory/server/core/authn/ppolicy/PasswordPolicyTest.java
Tue Feb 22 15:35:09 2011
@@ -17,7 +17,6 @@
  *   under the License.
  *
  */
-
 package org.apache.directory.server.core.authn.ppolicy;
 
 

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ExtendedOperationHandler.java
Tue Feb 22 15:35:09 2011
@@ -23,6 +23,7 @@ package org.apache.directory.server.ldap
 import java.util.Set;
 
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 
 
 /**
@@ -32,7 +33,7 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  *
  */
-public interface ExtendedOperationHandler<R extends ExtendedRequest>
+public interface ExtendedOperationHandler<R extends ExtendedRequest<P>, P extends
ExtendedResponse>
 {
     /**
      * Returns the EXTENSION_OID of the extended request this handler can handle.

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
Tue Feb 22 15:35:09 2011
@@ -22,12 +22,15 @@ package org.apache.directory.server.ldap
 
 import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
 import org.apache.directory.shared.ldap.codec.api.BinaryAttributeDetector;
+import org.apache.directory.shared.ldap.codec.api.ExtendedRequestDecorator;
+import org.apache.directory.shared.ldap.codec.api.LdapCodecServiceFactory;
 import org.apache.directory.shared.ldap.codec.api.MessageDecorator;
 import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
 import org.apache.directory.shared.ldap.model.exception.ResponseCarryingMessageException;
 import org.apache.directory.shared.ldap.model.message.Control;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequestImpl;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 import org.apache.directory.shared.ldap.model.message.Message;
 import org.apache.directory.shared.ldap.model.message.Request;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
@@ -191,14 +194,16 @@ class LdapProtocolHandler extends Demuxi
 
         if ( message == SslFilter.SESSION_SECURED )
         {
-            ExtendedRequest req = new ExtendedRequestImpl( 0 );
+            ExtendedRequestDecorator<ExtendedRequest<ExtendedResponse>, ExtendedResponse>
req = 
+                new ExtendedRequestDecorator( LdapCodecServiceFactory.getSingleton(), new
ExtendedRequestImpl( 0 ) );
             req.setRequestName( "1.3.6.1.4.1.1466.20037" );
             req.setRequestValue( "SECURED".getBytes( "ISO-8859-1" ) );
             message = req;
         }
         else if ( message == SslFilter.SESSION_UNSECURED )
         {
-            ExtendedRequest req = new ExtendedRequestImpl( 0 );
+            ExtendedRequestDecorator<ExtendedRequest<ExtendedResponse>, ExtendedResponse>
req = 
+                new ExtendedRequestDecorator( LdapCodecServiceFactory.getSingleton(), new
ExtendedRequestImpl( 0 ) );
             req.setRequestName( "1.3.6.1.4.1.1466.20037" );
             req.setRequestValue( "UNSECURED".getBytes( "ISO-8859-1" ) );
             message = req;
@@ -207,7 +212,7 @@ class LdapProtocolHandler extends Demuxi
         if ( ( ( Request ) message ).getControls().size() > 0
             && message instanceof ResultResponseRequest )
         {
-            ResultResponseRequest req = ( ResultResponseRequest ) message;
+            ResultResponseRequest<?> req = ( ResultResponseRequest<?> ) message;
 
             for ( Control control : req.getControls().values() )
             {

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
Tue Feb 22 15:35:09 2011
@@ -73,6 +73,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.CompareRequest;
 import org.apache.directory.shared.ldap.model.message.DeleteRequest;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 import org.apache.directory.shared.ldap.model.message.ModifyDnRequest;
 import org.apache.directory.shared.ldap.model.message.ModifyRequest;
 import org.apache.directory.shared.ldap.model.message.SearchRequest;
@@ -184,7 +185,7 @@ public class LdapServer extends Director
     private LdapRequestHandler<BindRequest> bindHandler;
     private LdapRequestHandler<CompareRequest> compareHandler;
     private LdapRequestHandler<DeleteRequest> deleteHandler;
-    private LdapRequestHandler<ExtendedRequest> extendedHandler;
+    private ExtendedHandler<ExtendedRequest<ExtendedResponse>, ExtendedResponse>
extendedHandler;
     private LdapRequestHandler<ModifyRequest> modifyHandler;
     private LdapRequestHandler<ModifyDnRequest> modifyDnHandler;
     private LdapRequestHandler<SearchRequest> searchHandler;
@@ -283,7 +284,7 @@ public class LdapServer extends Director
 
         if ( getExtendedHandler() == null )
         {
-            setExtendedHandler( new ExtendedHandler() );
+            setExtendedHandler( new ExtendedHandler<ExtendedRequest<ExtendedResponse>,
ExtendedResponse>() );
         }
 
         if ( getModifyHandler() == null )
@@ -769,9 +770,10 @@ public class LdapServer extends Director
      * request handler
      * @return the exnteded operation handler
      */
-    public ExtendedOperationHandler<ExtendedRequest> getExtendedOperationHandler( String
oid )
+    public ExtendedOperationHandler<? extends ExtendedRequest<? extends ExtendedResponse>,?
extends ExtendedResponse> 
+        getExtendedOperationHandler( String oid )
     {
-        for ( ExtendedOperationHandler<ExtendedRequest> h : extendedOperationHandlers
)
+        for ( ExtendedOperationHandler<ExtendedRequest<ExtendedResponse>, ExtendedResponse>
h : extendedOperationHandlers )
         {
             if ( h.getOid().equals( oid ) )
             {
@@ -1124,7 +1126,7 @@ public class LdapServer extends Director
     }
 
 
-    public LdapRequestHandler<ExtendedRequest> getExtendedHandler()
+    public LdapRequestHandler<ExtendedRequest<ExtendedResponse>> getExtendedHandler()
     {
         return extendedHandler;
     }
@@ -1133,12 +1135,13 @@ public class LdapServer extends Director
     /**
      * @param extendedHandler The ExtendedRequest handler
      */
-    public void setExtendedHandler( LdapRequestHandler<ExtendedRequest> extendedHandler
)
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    public void setExtendedHandler( ExtendedHandler<ExtendedRequest<ExtendedResponse>,
ExtendedResponse> extendedHandler )
     {
         this.handler.removeReceivedMessageHandler( ExtendedRequest.class );
         this.extendedHandler = extendedHandler;
         this.extendedHandler.setLdapServer( this );
-        this.handler.addReceivedMessageHandler( ExtendedRequest.class, this.extendedHandler
);
+        this.handler.addReceivedMessageHandler( ExtendedRequest.class, ( LdapRequestHandler
) this.extendedHandler );
     }
 
 

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java
Tue Feb 22 15:35:09 2011
@@ -34,12 +34,13 @@ import org.apache.directory.shared.ldap.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ExtendedHandler extends LdapRequestHandler<ExtendedRequest>
+public class ExtendedHandler<Q extends ExtendedRequest<R>, R extends ExtendedResponse>
extends LdapRequestHandler<Q>
 {
-    public void handle( LdapSession session, ExtendedRequest req ) throws Exception
+    public void handle( LdapSession session, Q req ) throws Exception
     {
-        ExtendedOperationHandler<ExtendedRequest> handler = 
-            getLdapServer().getExtendedOperationHandler( req.getRequestName() );
+        @SuppressWarnings("unchecked")
+        ExtendedOperationHandler<Q, R> handler = 
+            ( ExtendedOperationHandler<Q, R> ) getLdapServer().getExtendedOperationHandler(
req.getRequestName() );
 
         if ( handler == null )
         {
@@ -64,9 +65,8 @@ public class ExtendedHandler extends Lda
             result.setErrorMessage( ResultCodeEnum.OTHER
                 + ": Extended operation handler for the specified EXTENSION_OID (" + req.getRequestName()
                 + ") has failed to process your request:\n" + ExceptionUtils.getStackTrace(
e ) );
-            ExtendedResponse resp = ( ExtendedResponse ) req.getResultResponse();
-            resp.setResponseValue( new byte[0] );
-            session.getIoSession().write( req.getResultResponse() );
+            ExtendedResponse resp = req.getResultResponse();
+            session.getIoSession().write( resp );
         }
     }
 }
\ No newline at end of file

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
Tue Feb 22 15:35:09 2011
@@ -164,7 +164,7 @@ public abstract class LdapRequestHandler
             if ( message instanceof ExtendedRequest )
             {
                 // Reject all extended operations except StartTls  
-                ExtendedRequest req = ( ExtendedRequest ) message;
+                ExtendedRequest<?> req = ( ExtendedRequest<?> ) message;
 
                 if ( !req.getRequestName().equals( StartTlsHandler.EXTENSION_OID ) )
                 {
@@ -177,7 +177,7 @@ public abstract class LdapRequestHandler
             else if ( message instanceof ResultResponseRequest )
             {
                 // Reject all other operations that have a result response  
-                rejectWithoutConfidentiality( session, ( ( ResultResponseRequest ) message
)
+                rejectWithoutConfidentiality( session, ( ( ResultResponseRequest<?>
) message )
                     .getResultResponse() );
                 return;
             }
@@ -237,7 +237,7 @@ public abstract class LdapRequestHandler
     /**
      * Handles processing with referrals without ManageDsaIT decorator.
      */
-    public void handleException( LdapSession session, ResultResponseRequest req, Exception
e )
+    public void handleException( LdapSession session, ResultResponseRequest<?> req,
Exception e )
     {
         LdapResult result = req.getResultResponse().getLdapResult();
 

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
Tue Feb 22 15:35:09 2011
@@ -20,7 +20,7 @@
 package org.apache.directory.server.ldap.handlers.extended;
 
 
-import java.util.Collections;
+import java.util.Collections; 
 import java.util.HashSet;
 import java.util.Set;
 
@@ -40,7 +40,8 @@ import org.apache.directory.shared.ldap.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CertGenerationRequestHandler implements ExtendedOperationHandler<CertGenerationRequest>
+public class CertGenerationRequestHandler 
+    implements ExtendedOperationHandler<CertGenerationRequest, CertGenerationResponse>
 {
     private static final Set<String> EXTENSION_OIDS;
 

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/GracefulShutdownHandler.java
Tue Feb 22 15:35:09 2011
@@ -32,7 +32,9 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.LdapSession;
 import org.apache.directory.shared.ldap.model.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.extras.extended.GracefulDisconnect;
+import org.apache.directory.shared.ldap.extras.extended.GracefulDisconnectResponseImpl;
+import org.apache.directory.shared.ldap.extras.extended.GracefulDisconnectResponse;
+import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponseImpl;
 import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownRequest;
 import org.apache.directory.shared.ldap.extras.extended.GracefulShutdownResponse;
 import org.apache.directory.shared.ldap.model.message.extended.NoticeOfDisconnect;
@@ -47,7 +49,7 @@ import org.slf4j.LoggerFactory;
  * @todo : missing Javadoc
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class GracefulShutdownHandler implements ExtendedOperationHandler<GracefulShutdownRequest>
+public class GracefulShutdownHandler implements ExtendedOperationHandler<GracefulShutdownRequest,
GracefulShutdownResponse>
 {
     private static final Logger LOG = LoggerFactory.getLogger( GracefulShutdownHandler.class
);
     public static final Set<String> EXTENSION_OIDS;
@@ -57,7 +59,7 @@ public class GracefulShutdownHandler imp
         Set<String> set = new HashSet<String>( 3 );
         set.add( GracefulShutdownRequest.EXTENSION_OID );
         set.add( GracefulShutdownResponse.EXTENSION_OID );
-        set.add( GracefulDisconnect.EXTENSION_OID );
+        set.add( GracefulDisconnectResponse.EXTENSION_OID );
         EXTENSION_OIDS = Collections.unmodifiableSet( set );
     }
 
@@ -80,7 +82,7 @@ public class GracefulShutdownHandler imp
                     + requestor.getCoreSession().getEffectivePrincipal().getName() );
             }
 
-            requestor.getIoSession().write( new GracefulShutdownResponse( 
+            requestor.getIoSession().write( new GracefulShutdownResponseImpl( 
                 req.getMessageId(), ResultCodeEnum.INSUFFICIENT_ACCESS_RIGHTS ) );
             return;
         }
@@ -94,7 +96,7 @@ public class GracefulShutdownHandler imp
                 acceptor.getManagedSessions().values() );
 
         // build the graceful disconnect message with replicationContexts
-        GracefulDisconnect notice = getGracefulDisconnect( req.getTimeOffline(), req.getDelay()
);
+        GracefulDisconnectResponse notice = getGracefulDisconnect( req.getTimeOffline(),
req.getDelay() );
 
         // send (synch) the GracefulDisconnect to each client before unbinding
         sendGracefulDisconnect( sessions, notice, requestor.getIoSession() );
@@ -139,7 +141,7 @@ public class GracefulShutdownHandler imp
      */
     public static void sendShutdownResponse( IoSession requestor, int messageId )
     {
-        GracefulShutdownResponse msg = new GracefulShutdownResponse( messageId, ResultCodeEnum.SUCCESS
);
+        GracefulShutdownResponse msg = new GracefulShutdownResponseImpl( messageId, ResultCodeEnum.SUCCESS
);
         WriteFuture future = requestor.write( msg );
         future.awaitUninterruptibly();
         if ( future.isWritten() )
@@ -165,7 +167,7 @@ public class GracefulShutdownHandler imp
      * @param requestor the session of the graceful shutdown requestor
      * @param sessions the IoSessions to send disconnect message to
      */
-    public static void sendGracefulDisconnect( List<IoSession> sessions, GracefulDisconnect
msg, IoSession requestor )
+    public static void sendGracefulDisconnect( List<IoSession> sessions, GracefulDisconnectResponse
msg, IoSession requestor )
     {
         List<WriteFuture> writeFutures = new ArrayList<WriteFuture>();
 
@@ -263,10 +265,10 @@ public class GracefulShutdownHandler imp
     }
 
 
-    public static GracefulDisconnect getGracefulDisconnect( int timeOffline, int delay )
+    public static GracefulDisconnectResponse getGracefulDisconnect( int timeOffline, int
delay )
     {
         // build the graceful disconnect message with replicationContexts
-        return new GracefulDisconnect( timeOffline, delay );
+        return new GracefulDisconnectResponseImpl( timeOffline, delay );
     }
 
 

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java
Tue Feb 22 15:35:09 2011
@@ -40,6 +40,8 @@ import org.apache.directory.server.i18n.
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.LdapSession;
+import org.apache.directory.shared.ldap.codec.api.ExtendedResponseDecorator;
+import org.apache.directory.shared.ldap.codec.api.LdapCodecServiceFactory;
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
 import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 import org.apache.directory.shared.ldap.model.message.ExtendedResponseImpl;
@@ -57,7 +59,7 @@ import org.slf4j.LoggerFactory;
  * @see <a href="http://www.ietf.org/rfc/rfc2830.txt">RFC 2830</a>
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StartTlsHandler implements ExtendedOperationHandler<ExtendedRequest>
+public class StartTlsHandler implements ExtendedOperationHandler<ExtendedRequest<ExtendedResponse>,
ExtendedResponse>
 {
     public static final String EXTENSION_OID = "1.3.6.1.4.1.1466.20037";
 
@@ -74,7 +76,7 @@ public class StartTlsHandler implements 
     }
 
 
-    public void handleExtendedOperation( LdapSession session, ExtendedRequest req ) throws
Exception
+    public void handleExtendedOperation( LdapSession session, ExtendedRequest<ExtendedResponse>
req ) throws Exception
     {
         LOG.info( "Handling StartTLS request." );
 
@@ -90,7 +92,8 @@ public class StartTlsHandler implements 
             sslFilter.startSsl( session.getIoSession() );
         }
 
-        ExtendedResponse res = new ExtendedResponseImpl( req.getMessageId() );
+        ExtendedResponseDecorator<ExtendedResponse> res = new ExtendedResponseDecorator<ExtendedResponse>(

+            LdapCodecServiceFactory.getSingleton(), new ExtendedResponseImpl( req.getMessageId()
) );
         LdapResult result = res.getLdapResult();
         result.setResultCode( ResultCodeEnum.SUCCESS );
         res.setResponseName( EXTENSION_OID );

Modified: directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java?rev=1073365&r1=1073364&r2=1073365&view=diff
==============================================================================
--- directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
(original)
+++ directory/apacheds/branches/akarasulu/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
Tue Feb 22 15:35:09 2011
@@ -36,7 +36,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.ldap.LdapSession;
-import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
+import org.apache.directory.shared.ldap.codec.api.LdapCodecServiceFactory;
 import org.apache.directory.shared.ldap.extras.extended.StoredProcedureRequest;
 import org.apache.directory.shared.ldap.extras.extended.StoredProcedureResponse;
 import org.apache.directory.shared.ldap.model.name.Dn;
@@ -47,7 +47,7 @@ import org.apache.directory.shared.ldap.
  * @todo : Missing Javadoc
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class StoredProcedureExtendedOperationHandler implements ExtendedOperationHandler<StoredProcedureRequest>
+public class StoredProcedureExtendedOperationHandler implements ExtendedOperationHandler<StoredProcedureRequest,
StoredProcedureResponse>
 {
     private StoredProcExecutionManager manager;
     private static final Object[] EMPTY_CLASS_ARRAY = new Object[0];
@@ -90,8 +90,9 @@ public class StoredProcedureExtendedOper
         Object[] values = valueList.toArray( EMPTY_CLASS_ARRAY );
         Object response = engine.invokeProcedure( session.getCoreSession(), procedure, values
);
         byte[] serializedResponse = SerializationUtils.serialize( ( Serializable ) response
);
-        ( ( ExtendedResponse ) ( req.getResultResponse() ) ).setResponseValue( serializedResponse
);
-        session.getIoSession().write( req.getResultResponse() );
+        StoredProcedureResponse resp = 
+            LdapCodecServiceFactory.getSingleton().newExtendedResponse( req, serializedResponse
);
+        session.getIoSession().write( resp );
     }
 
     



Mime
View raw message