directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r985918 [1/2] - in /directory: apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/ apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/oper...
Date Mon, 16 Aug 2010 13:23:29 GMT
Author: elecharny
Date: Mon Aug 16 13:23:28 2010
New Revision: 985918

URL: http://svn.apache.org/viewvc?rev=985918&view=rev
Log:
Merged the ExtendedRequest message

Removed:
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/message/ExtendedRequest.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestCodec.java
Modified:
    directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
    directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
    directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
    directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CancelRequest.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CertGenerationRequest.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiRequest.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedRequest.java
    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/AttributeUtils.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/codec/extended/ExtendedRequestTest.java
    directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedRequestImplTest.java

Modified: directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/core-api/src/main/java/org/apache/directory/server/core/LdapCoreSessionConnection.java Mon Aug 16 13:23:28 2010
@@ -28,7 +28,6 @@ import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.directory.ldap.client.api.LdapConnection;
-import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
 import org.apache.directory.ldap.client.api.message.ModifyRequest;
 import org.apache.directory.ldap.client.api.message.SearchRequest;
@@ -74,6 +73,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyDnRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyRequest;
@@ -923,7 +923,7 @@ public class LdapCoreSessionConnection i
     /**
      * {@inheritDoc}
      */
-    public ExtendedResponse extended( ExtendedRequest extendedRequest ) throws LdapException
+    public ExtendedResponse extended( InternalExtendedRequest extendedRequest ) throws LdapException
     {
         return extended( ( String ) null );
 

Modified: directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/ldap-client-test/src/test/java/org/apache/directory/shared/client/api/operations/ClientExtendedRequestTest.java Mon Aug 16 13:23:28 2010
@@ -33,15 +33,16 @@ import javax.naming.ldap.StartTlsRequest
 import org.apache.directory.ldap.client.api.LdapAsyncConnection;
 import org.apache.directory.ldap.client.api.LdapNetworkConnection;
 import org.apache.directory.ldap.client.api.future.ExtendedFuture;
-import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.server.annotations.CreateLdapServer;
 import org.apache.directory.server.annotations.CreateTransport;
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.server.core.integ.AbstractLdapTestUnit;
 import org.apache.directory.server.core.integ.FrameworkRunner;
 import org.apache.directory.server.ldap.handlers.extended.StartTlsHandler;
+import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.junit.After;
 import org.junit.Before;
@@ -107,14 +108,14 @@ public class ClientExtendedRequestTest e
     @Test
     public void testExtendedAsync() throws Exception
     {
-        ExtendedRequest extendedRequest = new ExtendedRequest( StartTlsRequest.OID );
+        InternalExtendedRequest extendedRequest = new ExtendedRequestImpl();
+        extendedRequest.setRequestName( StartTlsRequest.OID );
 
         ExtendedFuture extendedFuture = connection.extendedAsync( extendedRequest );
 
         try
         {
-            ExtendedResponse extendedResponse = ( ExtendedResponse ) extendedFuture.get( 1000,
-                TimeUnit.MILLISECONDS );
+            ExtendedResponse extendedResponse = ( ExtendedResponse ) extendedFuture.get( 1000, TimeUnit.MILLISECONDS );
 
             assertNotNull( extendedResponse );
             assertEquals( ResultCodeEnum.SUCCESS, extendedResponse.getLdapResult().getResultCode() );

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolHandler.java Mon Aug 16 13:23:28 2010
@@ -27,8 +27,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalRequest;
-import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalResultResponseRequest;
+import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.mina.core.service.IoHandler;
 import org.apache.mina.core.session.IoSession;
 import org.apache.mina.filter.ssl.SslFilter;
@@ -160,15 +160,15 @@ class LdapProtocolHandler extends Demuxi
         if ( message == SslFilter.SESSION_SECURED )
         {
             InternalExtendedRequest req = new ExtendedRequestImpl( 0 );
-            req.setID( "1.3.6.1.4.1.1466.20037" );
-            req.setEncodedValue( "SECURED".getBytes( "ISO-8859-1" ) );
+            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 )
         {
             InternalExtendedRequest req = new ExtendedRequestImpl( 0 );
-            req.setID( "1.3.6.1.4.1.1466.20037" );
-            req.setEncodedValue( "UNSECURED".getBytes( "ISO-8859-1" ) );
+            req.setRequestName( "1.3.6.1.4.1.1466.20037" );
+            req.setRequestValue( "UNSECURED".getBytes( "ISO-8859-1" ) );
             message = req;
         }
 

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/ExtendedHandler.java Mon Aug 16 13:23:28 2010
@@ -24,8 +24,8 @@ import org.apache.commons.lang.exception
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
 import org.apache.directory.server.ldap.LdapSession;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
-import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.LdapResult;
 
 
@@ -38,13 +38,13 @@ public class ExtendedHandler extends Lda
 {
     public void handle( LdapSession session, InternalExtendedRequest req ) throws Exception
     {
-        ExtendedOperationHandler handler = getLdapServer().getExtendedOperationHandler( req.getID() );
+        ExtendedOperationHandler handler = getLdapServer().getExtendedOperationHandler( req.getRequestName() );
 
         if ( handler == null )
         {
             // As long as no extended operations are implemented, send appropriate
             // error back to the client.
-            String msg = "Unrecognized extended operation EXTENSION_OID: " + req.getID();
+            String msg = "Unrecognized extended operation EXTENSION_OID: " + req.getRequestName();
             LdapResult result = req.getResultResponse().getLdapResult();
             result.setResultCode( ResultCodeEnum.PROTOCOL_ERROR );
             result.setErrorMessage( msg );
@@ -61,7 +61,7 @@ public class ExtendedHandler extends Lda
             LdapResult result = req.getResultResponse().getLdapResult();
             result.setResultCode( ResultCodeEnum.OTHER );
             result.setErrorMessage( ResultCodeEnum.OTHER
-                + ": Extended operation handler for the specified EXTENSION_OID (" + req.getID()
+                + ": 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] );

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/LdapRequestHandler.java Mon Aug 16 13:23:28 2010
@@ -32,15 +32,15 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.BindResponseImpl;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.message.internal.BindResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
-import org.apache.directory.shared.ldap.message.internal.BindResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
-import org.apache.directory.shared.ldap.message.internal.LdapResult;
 import org.apache.directory.shared.ldap.message.internal.InternalReferral;
 import org.apache.directory.shared.ldap.message.internal.InternalRequest;
-import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalResultResponseRequest;
+import org.apache.directory.shared.ldap.message.internal.LdapResult;
+import org.apache.directory.shared.ldap.message.internal.ResultResponse;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.mina.core.filterchain.IoFilterChain;
 import org.apache.mina.core.session.IoSession;
@@ -167,7 +167,7 @@ public abstract class LdapRequestHandler
                 // Reject all extended operations except StartTls  
                 InternalExtendedRequest req = ( InternalExtendedRequest ) message;
 
-                if ( !req.getID().equals( StartTlsHandler.EXTENSION_OID ) )
+                if ( !req.getRequestName().equals( StartTlsHandler.EXTENSION_OID ) )
                 {
                     rejectWithoutConfidentiality( session, req.getResultResponse() );
                     return;

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/CertGenerationRequestHandler.java Mon Aug 16 13:23:28 2010
@@ -75,7 +75,7 @@ public class CertGenerationRequestHandle
 
     public void handleExtendedOperation( LdapSession session, InternalExtendedRequest req ) throws Exception
     {
-        ByteBuffer bb = ByteBuffer.wrap( req.getEncodedValue() );
+        ByteBuffer bb = ByteBuffer.wrap( req.getRequestValue() );
         Asn1Decoder decoder = new CertGenerationDecoder();
         CertGenerationContainer container = new CertGenerationContainer();
 

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.java Mon Aug 16 13:23:28 2010
@@ -45,8 +45,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.extended.operations.storedProcedure.StoredProcedure.StoredProcedureParameter;
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureRequest;
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureResponse;
-import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.name.DN;
 import org.apache.directory.shared.ldap.sp.LdapContextParameter;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -77,7 +77,7 @@ public class StoredProcedureExtendedOper
 
     public void handleExtendedOperation( LdapSession session, InternalExtendedRequest req ) throws Exception
     {
-        StoredProcedure spBean = decodeBean( req.getEncodedValue() );
+        StoredProcedure spBean = decodeBean( req.getRequestValue() );
 
         String procedure = StringTools.utf8ToString( spBean.getProcedure() );
         ClonedServerEntry spUnit = manager.findStoredProcUnit( session.getCoreSession(), procedure );

Modified: directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/server-tools/src/main/java/org/apache/directory/server/tools/GracefulShutdownCommand.java Mon Aug 16 13:23:28 2010
@@ -32,6 +32,7 @@ import org.apache.commons.cli.Options;
 import org.apache.directory.daemon.AvailablePortFinder;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.message.extended.GracefulShutdownRequest;
+import org.apache.directory.shared.ldap.util.AttributeUtils;
 
 
 /**
@@ -101,7 +102,8 @@ public class GracefulShutdownCommand ext
         }
         try
         {
-            ctx.extendedOperation( new GracefulShutdownRequest( 0, timeOffline, delay ) );
+            ctx.extendedOperation( AttributeUtils.toJndiExtendedRequest( new GracefulShutdownRequest( 0, timeOffline,
+                delay ) ) );
             isSuccess = true;
         }
         catch ( Throwable t )

Modified: directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java (original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapAsyncConnection.java Mon Aug 16 13:23:28 2010
@@ -11,7 +11,6 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.future.ModifyDnFuture;
 import org.apache.directory.ldap.client.api.future.ModifyFuture;
 import org.apache.directory.ldap.client.api.future.SearchFuture;
-import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
 import org.apache.directory.ldap.client.api.message.ModifyRequest;
 import org.apache.directory.ldap.client.api.message.SearchRequest;
@@ -22,6 +21,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.name.DN;
 
 
@@ -175,7 +175,7 @@ public interface LdapAsyncConnection ext
      * @return extended operation's Future
      * @throws LdapException
      */
-    ExtendedFuture extendedAsync( ExtendedRequest extendedRequest ) throws LdapException;
+    ExtendedFuture extendedAsync( InternalExtendedRequest extendedRequest ) throws LdapException;
 
 
     /**

Modified: directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java (original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapConnection.java Mon Aug 16 13:23:28 2010
@@ -4,7 +4,6 @@ package org.apache.directory.ldap.client
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
 import org.apache.directory.ldap.client.api.message.ModifyRequest;
 import org.apache.directory.ldap.client.api.message.SearchRequest;
@@ -26,6 +25,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.ModifyDnResponse;
 import org.apache.directory.shared.ldap.message.internal.ModifyResponse;
 import org.apache.directory.shared.ldap.message.internal.Response;
@@ -525,7 +525,7 @@ public interface LdapConnection
      * @return Extended operation's response
      * @throws LdapException If the DN is not valid or if the extended operation failed
      */
-    public abstract ExtendedResponse extended( ExtendedRequest extendedRequest ) throws LdapException;
+    public abstract ExtendedResponse extended( InternalExtendedRequest extendedRequest ) throws LdapException;
 
 
     /**

Modified: directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java
URL: http://svn.apache.org/viewvc/directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java (original)
+++ directory/clients/ldap/branches/ldap-client-codec-merge/ldap-client-api/src/main/java/org/apache/directory/ldap/client/api/LdapNetworkConnection.java Mon Aug 16 13:23:28 2010
@@ -51,7 +51,6 @@ import org.apache.directory.ldap.client.
 import org.apache.directory.ldap.client.api.future.ResponseFuture;
 import org.apache.directory.ldap.client.api.future.SearchFuture;
 import org.apache.directory.ldap.client.api.listener.DeleteListener;
-import org.apache.directory.ldap.client.api.message.ExtendedRequest;
 import org.apache.directory.ldap.client.api.message.ModifyDnRequest;
 import org.apache.directory.ldap.client.api.message.ModifyRequest;
 import org.apache.directory.ldap.client.api.message.SearchRequest;
@@ -64,7 +63,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.LdapTransformer;
 import org.apache.directory.shared.ldap.codec.MessageEncoderException;
 import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
-import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
 import org.apache.directory.shared.ldap.codec.modify.ModifyRequestCodec;
 import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.Filter;
@@ -88,6 +86,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.message.CompareRequestImpl;
 import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
+import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
 import org.apache.directory.shared.ldap.message.IntermediateResponseImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.message.UnbindRequestImpl;
@@ -97,12 +96,13 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.CompareResponse;
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
-import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
 import org.apache.directory.shared.ldap.message.internal.ModifyDnResponse;
@@ -1592,8 +1592,7 @@ public class LdapNetworkConnection exten
                 }
 
                 intermediateResponse.setResponseName( ( ( IntermediateResponse ) response ).getResponseName() );
-                intermediateResponse
-                    .setResponseValue( ( ( IntermediateResponse ) response ).getResponseValue() );
+                intermediateResponse.setResponseValue( ( ( IntermediateResponse ) response ).getResponseValue() );
 
                 break;
 
@@ -2660,17 +2659,18 @@ public class LdapNetworkConnection exten
      */
     public ExtendedResponse extended( OID oid, byte[] value ) throws LdapException
     {
-        ExtendedRequest extRequest = new ExtendedRequest( oid );
-        extRequest.setValue( value );
+        InternalExtendedRequest extendedRequest = new ExtendedRequestImpl();
+        extendedRequest.setRequestName( oid.toString() );
+        extendedRequest.setRequestValue( value );
 
-        return extended( extRequest );
+        return extended( extendedRequest );
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public ExtendedResponse extended( ExtendedRequest extendedRequest ) throws LdapException
+    public ExtendedResponse extended( InternalExtendedRequest extendedRequest ) throws LdapException
     {
         ExtendedFuture extendedFuture = extendedAsync( extendedRequest );
 
@@ -2678,11 +2678,9 @@ public class LdapNetworkConnection exten
         try
         {
             // Read the response, waiting for it if not available immediately
-            long timeout = getTimeout( extendedRequest.getTimeout() );
-
             // Get the response, blocking
             ExtendedResponse extendedResponse = ( ExtendedResponse ) extendedFuture
-                .get( timeout, TimeUnit.MILLISECONDS );
+                .get( timeOut, TimeUnit.MILLISECONDS );
 
             if ( extendedResponse == null )
             {
@@ -2737,26 +2735,18 @@ public class LdapNetworkConnection exten
     /**
      * {@inheritDoc}
      */
-    public ExtendedFuture extendedAsync( ExtendedRequest extendedRequest ) throws LdapException
+    public ExtendedFuture extendedAsync( InternalExtendedRequest extendedRequest ) throws LdapException
     {
         checkSession();
 
-        ExtendedRequestCodec extReqCodec = new ExtendedRequestCodec();
-
         int newId = messageId.incrementAndGet();
 
-        extReqCodec.setMessageId( newId );
-        extReqCodec.setMessageId( newId );
-
-        extReqCodec.setRequestName( extendedRequest.getOid() );
-        extReqCodec.setRequestValue( extendedRequest.getValue() );
-        setControls( extendedRequest.getControls(), extReqCodec );
-
+        extendedRequest.setMessageId( newId );
         ExtendedFuture extendedFuture = new ExtendedFuture( this, newId );
         addToFutureMap( newId, extendedFuture );
 
         // Send the request to the server
-        WriteFuture writeFuture = ldapSession.write( extReqCodec );
+        WriteFuture writeFuture = ldapSession.write( extendedRequest );
 
         // Wait for the message to be sent to the server
         if ( !writeFuture.awaitUninterruptibly( getTimeout( 0 ) ) )

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java Mon Aug 16 13:23:28 2010
@@ -22,7 +22,6 @@ package org.apache.directory.shared.ldap
 
 import org.apache.directory.shared.asn1.ber.AbstractContainer;
 import org.apache.directory.shared.ldap.codec.controls.AbstractControl;
-import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
 import org.apache.directory.shared.ldap.codec.modify.ModifyRequestCodec;
 import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.SearchRequestCodec;
@@ -31,12 +30,13 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.CompareResponse;
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
-import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
 import org.apache.directory.shared.ldap.message.internal.ModifyDnResponse;
@@ -223,9 +223,9 @@ public class LdapMessageContainer extend
     /**
      * @return Returns the ExtendedRequest stored in the container
      */
-    public ExtendedRequestCodec getExtendedRequest()
+    public InternalExtendedRequest getExtendedRequest()
     {
-        return ( ExtendedRequestCodec ) ldapMessage;
+        return ( InternalExtendedRequest ) internalMessage;
     }
 
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java Mon Aug 16 13:23:28 2010
@@ -72,7 +72,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.actions.ValueAction;
 import org.apache.directory.shared.ldap.codec.controls.ControlEnum;
 import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
-import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
 import org.apache.directory.shared.ldap.codec.modify.ModifyRequestCodec;
 import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.ExtensibleMatchFilter;
@@ -90,6 +89,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
+import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
 import org.apache.directory.shared.ldap.message.ExtendedResponseImpl;
 import org.apache.directory.shared.ldap.message.IntermediateResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyDnResponseImpl;
@@ -106,12 +106,13 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.CompareResponse;
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
-import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalReferral;
 import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
@@ -2831,9 +2832,9 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the ExtendedRequest Object
-                    ExtendedRequestCodec extendedRequest = new ExtendedRequestCodec();
-                    extendedRequest.setMessageId( ldapMessageContainer.getMessageId() );
-                    ldapMessageContainer.setLdapMessage( extendedRequest );
+                    InternalExtendedRequest extendedRequest = new ExtendedRequestImpl( ldapMessageContainer
+                        .getMessageId() );
+                    ldapMessageContainer.setInternalMessage( extendedRequest );
 
                     log.debug( "Extended request" );
                 }
@@ -2856,7 +2857,7 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // We can allocate the ExtendedRequest Object
-                    ExtendedRequestCodec extendedRequest = ldapMessageContainer.getExtendedRequest();
+                    InternalExtendedRequest extendedRequest = ldapMessageContainer.getExtendedRequest();
 
                     // Get the Value and store it in the ExtendedRequest
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -2876,8 +2877,21 @@ public class LdapMessageGrammar extends 
 
                         try
                         {
-                            OID oid = new OID( StringTools.utf8ToString( requestNameBytes ) );
-                            extendedRequest.setRequestName( oid );
+                            String requestName = StringTools.utf8ToString( requestNameBytes );
+
+                            if ( !OID.isOID( requestName ) )
+                            {
+
+                                String msg = "The Request name is not a valid OID : "
+                                    + StringTools.utf8ToString( requestNameBytes ) + " ("
+                                    + StringTools.dumpBytes( requestNameBytes ) + ") is invalid";
+                                log.error( msg );
+
+                                // throw an exception, we will get a PROTOCOL_ERROR
+                                throw new DecoderException( msg );
+                            }
+
+                            extendedRequest.setRequestName( requestName );
                         }
                         catch ( DecoderException de )
                         {
@@ -2918,7 +2932,7 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // We can allocate the ExtendedRequest Object
-                    ExtendedRequestCodec extendedRequest = ldapMessageContainer.getExtendedRequest();
+                    InternalExtendedRequest extendedRequest = ldapMessageContainer.getExtendedRequest();
 
                     // Get the Value and store it in the ExtendedRequest
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -3194,8 +3208,8 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the IntermediateResponse Object
-                    IntermediateResponse intermediateResponse = new IntermediateResponseImpl(
-                        ldapMessageContainer.getMessageId() );
+                    IntermediateResponse intermediateResponse = new IntermediateResponseImpl( ldapMessageContainer
+                        .getMessageId() );
                     ldapMessageContainer.setInternalMessage( intermediateResponse );
 
                     log.debug( "Intermediate Response" );

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapTransformer.java Mon Aug 16 13:23:28 2010
@@ -25,7 +25,6 @@ import java.util.List;
 
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
 import org.apache.directory.shared.ldap.codec.modify.ModifyRequestCodec;
 import org.apache.directory.shared.ldap.codec.modifyDn.ModifyDNRequestCodec;
 import org.apache.directory.shared.ldap.codec.search.AndFilter;
@@ -56,12 +55,10 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
-import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
 import org.apache.directory.shared.ldap.message.ModifyDnRequestImpl;
 import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
 import org.apache.directory.shared.ldap.message.SearchRequestImpl;
 import org.apache.directory.shared.ldap.message.control.Control;
-import org.apache.directory.shared.ldap.message.extended.GracefulShutdownRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 import org.slf4j.Logger;
@@ -83,37 +80,6 @@ public class LdapTransformer
 
 
     /**
-     * Transform an ExtendedRequest message from a CodecMessage to a
-     * InternalMessage
-     * 
-     * @param extendedRequest The message to transform
-     * @param messageId The message Id
-     * @return A Internal ExtendedRequestImpl
-     */
-    private static InternalMessage transformExtendedRequest( ExtendedRequestCodec extendedRequest, int messageId )
-    {
-        ExtendedRequestImpl internalMessage;
-
-        if ( extendedRequest.getRequestName().equals( GracefulShutdownRequest.EXTENSION_OID ) )
-        {
-            internalMessage = new GracefulShutdownRequest( messageId );
-        }
-        else
-        {
-            internalMessage = new ExtendedRequestImpl( messageId );
-        }
-
-        // Codec : OID requestName -> Internal : String oid
-        internalMessage.setID( extendedRequest.getRequestName() );
-
-        // Codec : OctetString requestValue -> Internal : byte [] payload
-        internalMessage.setEncodedValue( extendedRequest.getRequestValue() );
-
-        return internalMessage;
-    }
-
-
-    /**
      * Transform a ModifyDNRequest message from a CodecMessage to a
      * InternalMessage
      * 
@@ -571,9 +537,6 @@ public class LdapTransformer
                 break;
 
             case EXTENDED_REQUEST:
-                internalMessage = transformExtendedRequest( ( ExtendedRequestCodec ) codecMessage, messageId );
-                break;
-
             case SEARCH_RESULT_ENTRY:
             case SEARCH_RESULT_DONE:
             case SEARCH_RESULT_REFERENCE:

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedRequestImpl.java Mon Aug 16 13:23:28 2010
@@ -44,22 +44,38 @@ public class ExtendedRequestImpl extends
     /** Extended request's Object Identifier or <b>requestName</b> */
     private String oid;
 
-    /** Extended request's payload or <b>requestValue</b> */
-    protected byte[] payload;
+    /** Extended request's value */
+    protected byte[] requestValue;
 
+    /** The associated response */
     protected ResultResponse response;
 
+    /** The extended request length */
+    private int extendedRequestLength;
+
+    /** The OID length */
+    private byte[] requestNameBytes;
+
 
     // -----------------------------------------------------------------------
     // Constructors
     // -----------------------------------------------------------------------
 
     /**
-     * Creates a Lockable ExtendedRequest implementing object used to perform
+     * Creates an ExtendedRequest implementing object used to perform
+     * extended protocol operation on the server.
+     */
+    public ExtendedRequestImpl()
+    {
+        super( -1, TYPE, true );
+    }
+
+
+    /**
+     * Creates an ExtendedRequest implementing object used to perform
      * extended protocol operation on the server.
      * 
-     * @param id
-     *            the sequential message identifier
+     * @param id the sequential message identifier
      */
     public ExtendedRequestImpl( final int id )
     {
@@ -72,11 +88,11 @@ public class ExtendedRequestImpl extends
     // -----------------------------------------------------------------------
 
     /**
-     * Sets the Object Idendifier corresponding to the extended request type.
+     * Sets the Object Identifier corresponding to the extended request type.
      * 
      * @param oid the dotted-decimal representation as a String of the OID
      */
-    public void setID( String oid )
+    public void setRequestName( String oid )
     {
         this.oid = oid;
     }
@@ -89,15 +105,15 @@ public class ExtendedRequestImpl extends
      * 
      * @return byte array of data
      */
-    public byte[] getEncodedValue()
+    public byte[] getRequestValue()
     {
-        if ( payload == null )
+        if ( requestValue == null )
         {
             return null;
         }
 
-        final byte[] copy = new byte[payload.length];
-        System.arraycopy( payload, 0, copy, 0, payload.length );
+        final byte[] copy = new byte[requestValue.length];
+        System.arraycopy( requestValue, 0, copy, 0, requestValue.length );
         return copy;
     }
 
@@ -107,16 +123,16 @@ public class ExtendedRequestImpl extends
      * 
      * @param payload byte array of data encapsulating ext. req. parameters
      */
-    public void setEncodedValue( byte[] payload )
+    public void setRequestValue( byte[] payload )
     {
         if ( payload != null )
         {
-            this.payload = new byte[payload.length];
-            System.arraycopy( payload, 0, this.payload, 0, payload.length );
+            this.requestValue = new byte[payload.length];
+            System.arraycopy( payload, 0, this.requestValue, 0, payload.length );
         }
         else
         {
-            this.payload = null;
+            this.requestValue = null;
         }
     }
 
@@ -164,9 +180,9 @@ public class ExtendedRequestImpl extends
         {
             hash = hash * 17 + oid.hashCode();
         }
-        if ( payload != null )
+        if ( requestValue != null )
         {
-            hash = hash * 17 + Arrays.hashCode( payload );
+            hash = hash * 17 + Arrays.hashCode( requestValue );
         }
         hash = hash * 17 + super.hashCode();
 
@@ -177,8 +193,7 @@ public class ExtendedRequestImpl extends
     /**
      * Checks to see if an object equals this ExtendedRequest.
      * 
-     * @param obj
-     *            the object to be checked for equality
+     * @param obj the object to be checked for equality
      * @return true if the obj equals this ExtendedRequest, false otherwise
      */
     public boolean equals( Object obj )
@@ -200,33 +215,33 @@ public class ExtendedRequestImpl extends
 
         InternalExtendedRequest req = ( InternalExtendedRequest ) obj;
 
-        if ( ( oid != null ) && ( req.getID() == null ) )
+        if ( ( oid != null ) && ( req.getRequestName() == null ) )
         {
             return false;
         }
 
-        if ( ( oid == null ) && ( req.getID() != null ) )
+        if ( ( oid == null ) && ( req.getRequestName() != null ) )
         {
             return false;
         }
 
-        if ( ( oid != null ) && ( req.getID() != null ) && !oid.equals( req.getID() ) )
+        if ( ( oid != null ) && ( req.getRequestName() != null ) && !oid.equals( req.getRequestName() ) )
         {
             return false;
         }
 
-        if ( ( payload != null ) && ( req.getEncodedValue() == null ) )
+        if ( ( requestValue != null ) && ( req.getRequestValue() == null ) )
         {
             return false;
         }
 
-        if ( ( payload == null ) && ( req.getEncodedValue() != null ) )
+        if ( ( requestValue == null ) && ( req.getRequestValue() != null ) )
         {
             return false;
         }
 
-        if ( ( payload != null ) && ( req.getEncodedValue() != null )
-            && !Arrays.equals( payload, req.getEncodedValue() ) )
+        if ( ( requestValue != null ) && ( req.getRequestValue() != null )
+            && !Arrays.equals( requestValue, req.getRequestValue() ) )
         {
             return false;
         }
@@ -236,42 +251,87 @@ public class ExtendedRequestImpl extends
 
 
     /**
-     * Get a String representation of an Extended Request
+     * Gets the Object Idendifier corresponding to the extended request type.
+     * This is the <b>requestName</b> portion of the ext. req. PDU.
      * 
-     * @return an Extended Request String
+     * @return the dotted-decimal representation as a String of the OID
      */
-    public String toString()
+    public String getRequestName()
     {
-        StringBuffer sb = new StringBuffer();
+        return oid;
+    }
 
-        sb.append( "    Extended request\n" );
-        sb.append( "        Request name : '" ).append( oid ).append( "'\n" );
 
-        if ( oid != null )
-        {
-            sb.append( "        Request value : '" ).append( StringTools.utf8ToString( payload ) ).append( '/' )
-                .append( StringTools.dumpBytes( payload ) ).append( "'\n" );
-        }
+    public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length )
+        throws NamingException
+    {
+        return null;
+    }
 
-        return sb.toString();
+
+    /**
+     * Stores the encoded length for the ExtendedRequest
+     * 
+     * @param extendedRequestLength The encoded length
+     */
+    /* No qualifier*/void setExtendedRequestLength( int extendedRequestLength )
+    {
+        this.extendedRequestLength = extendedRequestLength;
     }
 
 
     /**
-     * Gets the Object Idendifier corresponding to the extended request type.
-     * This is the <b>requestName</b> portion of the ext. req. PDU.
+     * @return The encoded ExtendedRequest's length
+     */
+    /* No qualifier*/int getExtendedRequestLength()
+    {
+        return extendedRequestLength;
+    }
+
+
+    /**
+     * Gets the requestName bytes.
      * 
-     * @return the dotted-decimal representation as a String of the OID
+     * @return the requestName bytes of the extended request type.
      */
-    public String getID()
+    /* No qualifier*/byte[] getRequestNameBytes()
     {
-        return oid;
+        return requestNameBytes;
     }
 
 
-    public ExtendedResponse createExtendedResponse( String id, byte[] berValue, int offset, int length )
-        throws NamingException
+    /**
+     * Sets the requestName bytes.
+     * 
+     * @param requestNameBytes the OID bytes of the extended request type.
+     */
+    /* No qualifier*/void setRequestNameBytes( byte[] requestNameBytes )
     {
-        return null;
+        this.requestNameBytes = requestNameBytes;
+    }
+
+
+    /**
+     * Get a String representation of an Extended Request
+     * 
+     * @return an Extended Request String
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "    Extended request\n" );
+        sb.append( "        Request name : '" ).append( oid ).append( "'\n" );
+
+        if ( oid != null )
+        {
+            sb.append( "        Request value : '" ).append( StringTools.utf8ToString( requestValue ) ).append( '/' )
+                .append( StringTools.dumpBytes( requestValue ) ).append( "'\n" );
+        }
+
+        // The controls
+        sb.append( super.toString() );
+
+        return sb.toString();
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/ExtendedResponseImpl.java Mon Aug 16 13:23:28 2010
@@ -22,8 +22,8 @@ package org.apache.directory.shared.ldap
 
 import java.util.Arrays;
 
-import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -100,25 +100,25 @@ public class ExtendedResponseImpl extend
 
 
     /**
-     * Gets the responseName bytes.
+     * Sets the OID uniquely identifying this extended response (a.k.a. its
+     * name).
      * 
-     * @return the responseName bytes of the extended response type.
+     * @param responseName the OID of the extended response type.
      */
-    /* No qualifier*/byte[] getResponseNameBytes()
+    public void setResponseName( String responseName )
     {
-        return responseNameBytes;
+        this.responseName = responseName;
     }
 
 
     /**
-     * Sets the OID uniquely identifying this extended response (a.k.a. its
-     * name).
+     * Gets the responseName bytes.
      * 
-     * @param responseName the OID of the extended response type.
+     * @return the responseName bytes of the extended response type.
      */
-    public void setResponseName( String responseName )
+    /* No qualifier*/byte[] getResponseNameBytes()
     {
-        this.responseName = responseName;
+        return responseNameBytes;
     }
 
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/LdapProtocolEncoder.java Mon Aug 16 13:23:28 2010
@@ -47,12 +47,13 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.CompareResponse;
 import org.apache.directory.shared.ldap.message.internal.DeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.ExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalAbandonRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalAddRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalBindRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalCompareRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
-import org.apache.directory.shared.ldap.message.internal.IntermediateResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalReferral;
 import org.apache.directory.shared.ldap.message.internal.InternalUnbindRequest;
@@ -131,7 +132,7 @@ public class LdapProtocolEncoder extends
             || ( message instanceof SearchResultReference ) || ( message instanceof InternalAbandonRequest )
             || ( message instanceof InternalDeleteRequest ) || ( message instanceof InternalUnbindRequest )
             || ( message instanceof InternalBindRequest ) || ( message instanceof InternalAddRequest )
-            || ( message instanceof InternalCompareRequest ) )
+            || ( message instanceof InternalCompareRequest ) || ( message instanceof InternalExtendedRequest ) )
         {
             try
             {
@@ -756,6 +757,41 @@ public class LdapProtocolEncoder extends
 
 
     /**
+     * Compute the ExtendedRequest length
+     * 
+     * ExtendedRequest :
+     * 
+     * 0x77 L1
+     *  |
+     *  +--> 0x80 L2 name
+     *  [+--> 0x81 L3 value]
+     * 
+     * L1 = Length(0x80) + Length(L2) + L2
+     *      [+ Length(0x81) + Length(L3) + L3]
+     * 
+     * Length(ExtendedRequest) = Length(0x77) + Length(L1) + L1
+     */
+    private int computeExtendedRequestLength( ExtendedRequestImpl extendedRequest )
+    {
+        byte[] requestNameBytes = StringTools.getBytesUtf8( extendedRequest.getRequestName() );
+
+        extendedRequest.setRequestNameBytes( requestNameBytes );
+
+        int extendedRequestLength = 1 + TLV.getNbBytes( requestNameBytes.length ) + requestNameBytes.length;
+
+        if ( extendedRequest.getRequestValue() != null )
+        {
+            extendedRequestLength += 1 + TLV.getNbBytes( extendedRequest.getRequestValue().length )
+                + extendedRequest.getRequestValue().length;
+        }
+
+        extendedRequest.setExtendedRequestLength( extendedRequestLength );
+
+        return 1 + TLV.getNbBytes( extendedRequestLength ) + extendedRequestLength;
+    }
+
+
+    /**
      * Compute the ExtendedResponse length
      * 
      * ExtendedResponse :
@@ -1521,6 +1557,61 @@ public class LdapProtocolEncoder extends
 
 
     /**
+     * Encode the ExtendedRequest message to a PDU. 
+     * 
+     * ExtendedRequest :
+     * 
+     * 0x80 LL resquest name
+     * [0x81 LL request value]
+     * 
+     * @param buffer The buffer where to put the PDU
+     * @return The PDU.
+     */
+    private void encodeExtendedRequest( ByteBuffer buffer, ExtendedRequestImpl extendedRequest )
+        throws EncoderException
+    {
+        try
+        {
+            // The BindResponse Tag
+            buffer.put( LdapConstants.EXTENDED_REQUEST_TAG );
+            buffer.put( TLV.getBytes( extendedRequest.getExtendedRequestLength() ) );
+
+            // The requestName, if any
+            if ( extendedRequest.getRequestNameBytes() == null )
+            {
+                throw new EncoderException( I18n.err( I18n.ERR_04043 ) );
+            }
+
+            buffer.put( ( byte ) LdapConstants.EXTENDED_REQUEST_NAME_TAG );
+            buffer.put( TLV.getBytes( extendedRequest.getRequestNameBytes().length ) );
+
+            if ( extendedRequest.getRequestNameBytes().length != 0 )
+            {
+                buffer.put( extendedRequest.getRequestNameBytes() );
+            }
+
+            // The requestValue, if any
+            if ( extendedRequest.getRequestValue() != null )
+            {
+                buffer.put( ( byte ) LdapConstants.EXTENDED_REQUEST_VALUE_TAG );
+
+                buffer.put( TLV.getBytes( extendedRequest.getRequestValue().length ) );
+
+                if ( extendedRequest.getRequestValue().length != 0 )
+                {
+                    buffer.put( extendedRequest.getRequestValue() );
+                }
+            }
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
+        }
+
+    }
+
+
+    /**
      * Encode the ExtendedResponse message to a PDU. 
      * ExtendedResponse :
      * LdapResult.encode()
@@ -1886,6 +1977,9 @@ public class LdapProtocolEncoder extends
             case DEL_RESPONSE:
                 return computeDeleteResponseLength( ( DeleteResponseImpl ) message );
 
+            case EXTENDED_REQUEST:
+                return computeExtendedRequestLength( ( ExtendedRequestImpl ) message );
+
             case EXTENDED_RESPONSE:
                 return computeExtendedResponseLength( ( ExtendedResponseImpl ) message );
 
@@ -1956,6 +2050,10 @@ public class LdapProtocolEncoder extends
                 encodeDeleteResponse( bb, ( DeleteResponseImpl ) message );
                 break;
 
+            case EXTENDED_REQUEST:
+                encodeExtendedRequest( bb, ( ExtendedRequestImpl ) message );
+                break;
+
             case EXTENDED_RESPONSE:
                 encodeExtendedResponse( bb, ( ExtendedResponseImpl ) message );
                 break;

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CancelRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CancelRequest.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CancelRequest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CancelRequest.java Mon Aug 16 13:23:28 2010
@@ -71,72 +71,35 @@ public class CancelRequest extends Exten
     public CancelRequest( int messageId, int cancelId )
     {
         super( messageId );
-        setID( EXTENSION_OID );
+        setRequestName( EXTENSION_OID );
 
         this.cancelId = cancelId;
     }
 
 
     /**
-     * Encode the request
-     */
-    private void encodePayload() throws EncoderException
-    {
-        Cancel cancel = new Cancel();
-        cancel.setCancelId( this.cancelId );
-
-        payload = cancel.encode().array();
-    }
-
-
-    /**
-     * Gets the extended request's <b>requestValue</b> portion of the PDU. The
-     * form of the data is request specific and is determined by the extended
-     * request OID.
-     * 
-     * @return byte array of data
-     */
-    public byte[] getPayload()
-    {
-        if ( payload == null )
-        {
-            try
-            {
-                encodePayload();
-            }
-            catch ( EncoderException e )
-            {
-                LOG.error( I18n.err( I18n.ERR_04164 ), e );
-                throw new RuntimeException( e );
-            }
-        }
-
-        return super.getEncodedValue();
-    }
-
-
-    /**
      * Sets the extended request's <b>requestValue</b> portion of the PDU.
      * 
      * @param payload byte array of data encapsulating ext. req. parameters
      */
-    public void setPayload( byte[] payload )
+    public void setRequestValue( byte[] requestValue )
     {
         CancelDecoder decoder = new CancelDecoder();
 
         try
         {
-            Cancel cancel = ( Cancel ) decoder.decode( payload );
+            Cancel cancel = ( Cancel ) decoder.decode( requestValue );
 
-            if ( payload != null )
+            if ( requestValue != null )
             {
-                this.payload = new byte[payload.length];
-                System.arraycopy( payload, 0, this.payload, 0, payload.length );
+                this.requestValue = new byte[requestValue.length];
+                System.arraycopy( requestValue, 0, this.requestValue, 0, requestValue.length );
             }
             else
             {
-                this.payload = null;
+                this.requestValue = null;
             }
+
             this.cancelId = cancel.getCancelId();
         }
         catch ( DecoderException e )
@@ -154,9 +117,28 @@ public class CancelRequest extends Exten
     }
 
 
-    public byte[] getEncodedValue()
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getRequestValue()
     {
-        return getPayload();
+        if ( requestValue == null )
+        {
+            try
+            {
+                Cancel cancel = new Cancel();
+                cancel.setCancelId( this.cancelId );
+
+                requestValue = cancel.encode().array();
+            }
+            catch ( EncoderException e )
+            {
+                LOG.error( I18n.err( I18n.ERR_04164 ), e );
+                throw new RuntimeException( e );
+            }
+        }
+
+        return requestValue;
     }
 
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CertGenerationRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CertGenerationRequest.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CertGenerationRequest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/CertGenerationRequest.java Mon Aug 16 13:23:28 2010
@@ -66,7 +66,7 @@ public class CertGenerationRequest exten
     public CertGenerationRequest( int messageId, String targerDN, String issuerDN, String subjectDN, String keyAlgorithm )
     {
         super( messageId );
-        setID( EXTENSION_OID );
+        setRequestName( EXTENSION_OID );
 
         this.certGenObj = new CertGenerationObject();
         certGenObj.setTargetDN( targerDN );
@@ -76,26 +76,22 @@ public class CertGenerationRequest exten
     }
 
 
-    private void encodePayload() throws EncoderException
-    {
-        payload = certGenObj.encode().array();
-    }
-
-
-    public void setPayload( byte[] payload )
+    public void setequestValue( byte[] requestValue )
     {
         CertGenerationDecoder decoder = new CertGenerationDecoder();
+
         try
         {
-            certGenObj = ( CertGenerationObject ) decoder.decode( payload );
-            if ( payload != null )
+            certGenObj = ( CertGenerationObject ) decoder.decode( requestValue );
+
+            if ( requestValue != null )
             {
-                this.payload = new byte[payload.length];
-                System.arraycopy( payload, 0, this.payload, 0, payload.length );
+                this.requestValue = new byte[requestValue.length];
+                System.arraycopy( requestValue, 0, this.requestValue, 0, requestValue.length );
             }
             else
             {
-                this.payload = null;
+                this.requestValue = null;
             }
         }
         catch ( DecoderException e )
@@ -113,19 +109,16 @@ public class CertGenerationRequest exten
     }
 
 
-    public byte[] getEncodedValue()
-    {
-        return getPayload();
-    }
-
-
-    public byte[] getPayload()
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getRequestValue()
     {
-        if ( payload == null )
+        if ( requestValue == null )
         {
             try
             {
-                encodePayload();
+                requestValue = certGenObj.encode().array();
             }
             catch ( EncoderException e )
             {
@@ -134,13 +127,13 @@ public class CertGenerationRequest exten
             }
         }
 
-        if ( payload == null )
+        if ( requestValue == null )
         {
             return null;
         }
 
-        final byte[] copy = new byte[payload.length];
-        System.arraycopy( payload, 0, copy, 0, payload.length );
+        final byte[] copy = new byte[requestValue.length];
+        System.arraycopy( requestValue, 0, copy, 0, requestValue.length );
         return copy;
     }
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulShutdownRequest.java Mon Aug 16 13:23:28 2010
@@ -73,36 +73,30 @@ public class GracefulShutdownRequest ext
     public GracefulShutdownRequest( int messageId, int timeOffline, int delay )
     {
         super( messageId );
-        setID( EXTENSION_OID );
+        setRequestName( EXTENSION_OID );
         this.timeOffline = timeOffline;
         this.delay = delay;
     }
 
 
-    private void encodePayload() throws EncoderException
-    {
-        GracefulShutdown gs = new GracefulShutdown();
-        gs.setDelay( this.delay );
-        gs.setTimeOffline( this.timeOffline );
-        payload = gs.encode().array();
-    }
-
-
-    public void setPayload( byte[] payload )
+    public void setRequestValue( byte[] requestValue )
     {
         GracefulShutdownDecoder decoder = new GracefulShutdownDecoder();
+
         try
         {
-            GracefulShutdown gs = ( GracefulShutdown ) decoder.decode( payload );
-            if ( payload != null )
+            GracefulShutdown gs = ( GracefulShutdown ) decoder.decode( requestValue );
+
+            if ( requestValue != null )
             {
-                this.payload = new byte[payload.length];
-                System.arraycopy( payload, 0, this.payload, 0, payload.length );
+                this.requestValue = new byte[requestValue.length];
+                System.arraycopy( requestValue, 0, this.requestValue, 0, requestValue.length );
             }
             else
             {
-                this.payload = null;
+                this.requestValue = null;
             }
+
             this.timeOffline = gs.getTimeOffline();
             this.delay = gs.getDelay();
         }
@@ -121,19 +115,19 @@ public class GracefulShutdownRequest ext
     }
 
 
-    public byte[] getEncodedValue()
-    {
-        return getPayload();
-    }
-
-
-    public byte[] getPayload()
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getRequestValue()
     {
-        if ( payload == null )
+        if ( requestValue == null )
         {
             try
             {
-                encodePayload();
+                GracefulShutdown gs = new GracefulShutdown();
+                gs.setDelay( this.delay );
+                gs.setTimeOffline( this.timeOffline );
+                requestValue = gs.encode().array();
             }
             catch ( EncoderException e )
             {
@@ -142,7 +136,7 @@ public class GracefulShutdownRequest ext
             }
         }
 
-        return super.getEncodedValue();
+        return requestValue;
     }
 
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiRequest.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiRequest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/LaunchDiagnosticUiRequest.java Mon Aug 16 13:23:28 2010
@@ -45,8 +45,8 @@ public class LaunchDiagnosticUiRequest e
     public LaunchDiagnosticUiRequest( int messageId )
     {
         super( messageId );
-        setID( EXTENSION_OID );
-        setEncodedValue( EMPTY_PAYLOAD );
+        setRequestName( EXTENSION_OID );
+        setRequestValue( EMPTY_PAYLOAD );
     }
 
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureRequest.java Mon Aug 16 13:23:28 2010
@@ -56,7 +56,7 @@ public class StoredProcedureRequest exte
     public StoredProcedureRequest( int messageId )
     {
         super( messageId );
-        this.setID( EXTENSION_OID );
+        this.setRequestName( EXTENSION_OID );
         this.procedure = new StoredProcedure();
     }
 
@@ -64,20 +64,14 @@ public class StoredProcedureRequest exte
     public StoredProcedureRequest( int messageId, String procedure, String language )
     {
         super( messageId );
-        this.setID( EXTENSION_OID );
+        this.setRequestName( EXTENSION_OID );
         this.procedure = new StoredProcedure();
         this.setLanguage( language );
         this.setProcedure( procedure );
     }
 
 
-    private void encodePayload() throws EncoderException
-    {
-        payload = procedure.encode().array();
-    }
-
-
-    public void setPayload( byte[] payload )
+    public void setRequestValue( byte[] payload )
     {
         StoredProcedureDecoder decoder = new StoredProcedureDecoder();
         StoredProcedureContainer container = new StoredProcedureContainer();
@@ -105,19 +99,16 @@ public class StoredProcedureRequest exte
     }
 
 
-    public byte[] getEncodedValue()
-    {
-        return getPayload();
-    }
-
-
-    public byte[] getPayload()
+    /**
+     * {@inheritDoc}
+     */
+    public byte[] getRequestValue()
     {
-        if ( payload == null )
+        if ( requestValue == null )
         {
             try
             {
-                encodePayload();
+                requestValue = procedure.encode().array();
             }
             catch ( EncoderException e )
             {
@@ -126,7 +117,7 @@ public class StoredProcedureRequest exte
             }
         }
 
-        return payload;
+        return requestValue;
     }
 
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedRequest.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedRequest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedRequest.java Mon Aug 16 13:23:28 2010
@@ -56,7 +56,7 @@ import org.apache.directory.shared.ldap.
  *  @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * 
  */
-public interface InternalExtendedRequest extends SingleReplyRequest, javax.naming.ldap.ExtendedRequest
+public interface InternalExtendedRequest extends SingleReplyRequest
 {
     /** Extended request message type enumeration value */
     MessageTypeEnum TYPE = MessageTypeEnum.EXTENDED_REQUEST;
@@ -71,7 +71,7 @@ public interface InternalExtendedRequest
      * 
      * @return the dotted-decimal representation as a String of the OID
      */
-    String getID();
+    String getRequestName();
 
 
     /**
@@ -79,7 +79,7 @@ public interface InternalExtendedRequest
      * 
      * @param oid the dotted-decimal representation as a String of the OID
      */
-    void setID( String oid );
+    void setRequestName( String oid );
 
 
     /**
@@ -89,13 +89,13 @@ public interface InternalExtendedRequest
      * 
      * @return byte array of data
      */
-    byte[] getEncodedValue();
+    byte[] getRequestValue();
 
 
     /**
      * Sets the extended request's <b>requestValue</b> portion of the PDU.
      * 
-     * @param payload byte array of data encapsulating ext. req. parameters
+     * @param requestValue byte array of data encapsulating ext. req. parameters
      */
-    void setEncodedValue( byte[] payload );
+    void setRequestValue( byte[] requestValue );
 }

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=985918&r1=985917&r2=985918&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 Mon Aug 16 13:23:28 2010
@@ -36,6 +36,7 @@ import org.apache.commons.lang.Serializa
 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.AttributeUtils;
 
 
 /**
@@ -140,7 +141,8 @@ public class JavaStoredProcUtils
              * Call the stored procedure via the extended operation
              * and get back its return value.
              */
-            StoredProcedureResponse resp = ( StoredProcedureResponse ) ctx.extendedOperation( req );
+            StoredProcedureResponse resp = ( StoredProcedureResponse ) ctx.extendedOperation( AttributeUtils
+                .toJndiExtendedRequest( req ) );
 
             /**
              * Restore a Java object from the return value.

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java?rev=985918&r1=985917&r2=985918&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/util/AttributeUtils.java Mon Aug 16 13:23:28 2010
@@ -1341,13 +1341,13 @@ public class AttributeUtils
 
             public byte[] getEncodedValue()
             {
-                return request.getEncodedValue();
+                return request.getRequestValue();
             }
 
 
             public String getID()
             {
-                return request.getID();
+                return request.getRequestName();
             }
 
         }
@@ -1368,13 +1368,13 @@ public class AttributeUtils
         {
             public byte[] getEncodedValue()
             {
-                return request.getEncodedValue();
+                return request.getRequestValue();
             }
 
 
             public String getID()
             {
-                return request.getID();
+                return request.getRequestName();
             }
         }
 



Mime
View raw message