directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r984812 [1/2] - in /directory: apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/ apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers...
Date Thu, 12 Aug 2010 14:55:51 GMT
Author: elecharny
Date: Thu Aug 12 14:55:50 2010
New Revision: 984812

URL: http://svn.apache.org/viewvc?rev=984812&view=rev
Log:
o Removed the IntermediateResponseCodec class
o renamed some ExtendedRequest/Response methods 

Removed:
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/intermediate/
Modified:
    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/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/LdapProtocolEncoder.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/IntermediateResponseImpl.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/message/internal/InternalIntermediateResponse.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/intermediate/IntermediateResponseTest.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/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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -50,7 +50,7 @@ class LdapProtocolHandler extends Demuxi
 {
     /** The logger */
     private static final Logger LOG = LoggerFactory.getLogger( LdapProtocolHandler.class );
-    
+
     /** the {@link LdapServer} this handler is associated with */
     private final LdapServer ldapServer;
 
@@ -87,12 +87,12 @@ class LdapProtocolHandler extends Demuxi
     {
         // Get the associated LdapSession
         LdapSession ldapSession = ldapServer.getLdapSessionManager().removeLdapSession( session );
-        
+
         // Clean it up !
         cleanUpSession( ldapSession );
     }
 
-    
+
     /**
      * Explicitly handles {@link LdapSession} and {@link IoSession} cleanup tasks.
      *
@@ -106,16 +106,16 @@ class LdapProtocolHandler extends Demuxi
             LOG.warn( "Null LdapSession given to cleanUpSession." );
             return;
         }
-        
+
         LOG.debug( "Cleaning the {} session", ldapSession );
-        
+
         if ( ldapSession != null )
         {
             // Abandon all the requests
             ldapSession.abandonAllOutstandingRequests();
         }
-        
-        if ( ! ldapSession.getIoSession().isClosing() || ldapSession.getIoSession().isConnected() )
+
+        if ( !ldapSession.getIoSession().isClosing() || ldapSession.getIoSession().isConnected() )
         {
             try
             {
@@ -128,7 +128,7 @@ class LdapProtocolHandler extends Demuxi
         }
     }
 
-    
+
     /*
      * (non-Javadoc)
      * @see org.apache.mina.handler.demux.DemuxingIoHandler#messageReceived(org.apache.mina.common.IoSession, java.lang.Object)
@@ -160,25 +160,26 @@ class LdapProtocolHandler extends Demuxi
         if ( message == SslFilter.SESSION_SECURED )
         {
             InternalExtendedRequest req = new ExtendedRequestImpl( 0 );
-            req.setOid( "1.3.6.1.4.1.1466.20037" );
-            req.setPayload( "SECURED".getBytes( "ISO-8859-1" ) );
+            req.setID( "1.3.6.1.4.1.1466.20037" );
+            req.setEncodedValue( "SECURED".getBytes( "ISO-8859-1" ) );
             message = req;
         }
         else if ( message == SslFilter.SESSION_UNSECURED )
         {
             InternalExtendedRequest req = new ExtendedRequestImpl( 0 );
-            req.setOid( "1.3.6.1.4.1.1466.20037" );
-            req.setPayload( "UNSECURED".getBytes( "ISO-8859-1" ) );
+            req.setID( "1.3.6.1.4.1.1466.20037" );
+            req.setEncodedValue( "UNSECURED".getBytes( "ISO-8859-1" ) );
             message = req;
         }
 
-        if ( ( ( InternalRequest ) message ).getControls().size() > 0 && message instanceof InternalResultResponseRequest )
+        if ( ( ( InternalRequest ) message ).getControls().size() > 0
+            && message instanceof InternalResultResponseRequest )
         {
             InternalResultResponseRequest req = ( InternalResultResponseRequest ) message;
-            
+
             for ( Control control : req.getControls().values() )
             {
-                if ( control.isCritical() && ! ldapServer.getSupportedControls().contains( control.getOid() ) )
+                if ( control.isCritical() && !ldapServer.getSupportedControls().contains( control.getOid() ) )
                 {
                     InternalResultResponse resp = req.getResultResponse();
                     resp.getLdapResult().setErrorMessage( "Unsupport critical control: " + control.getOid() );
@@ -207,9 +208,9 @@ class LdapProtocolHandler extends Demuxi
             {
                 session.write( rcme.getResponse() );
                 return;
-            }                
+            }
         }
-        
+
         LOG.warn( "Unexpected exception forcing session to close: sending disconnect notice to client.", cause );
 
         session.write( NoticeOfDisconnect.PROTOCOLERROR );

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -38,13 +38,13 @@ public class ExtendedHandler extends Lda
 {
     public void handle( LdapSession session, InternalExtendedRequest req ) throws Exception
     {
-        ExtendedOperationHandler handler = getLdapServer().getExtendedOperationHandler( req.getOid() );
+        ExtendedOperationHandler handler = getLdapServer().getExtendedOperationHandler( req.getID() );
 
         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.getOid();
+            String msg = "Unrecognized extended operation EXTENSION_OID: " + req.getID();
             InternalLdapResult result = req.getResultResponse().getLdapResult();
             result.setResultCode( ResultCodeEnum.PROTOCOL_ERROR );
             result.setErrorMessage( msg );
@@ -61,7 +61,7 @@ public class ExtendedHandler extends Lda
             InternalLdapResult result = req.getResultResponse().getLdapResult();
             result.setResultCode( ResultCodeEnum.OTHER );
             result.setErrorMessage( ResultCodeEnum.OTHER
-                + ": Extended operation handler for the specified EXTENSION_OID (" + req.getOid()
+                + ": Extended operation handler for the specified EXTENSION_OID (" + req.getID()
                 + ") has failed to process your request:\n" + ExceptionUtils.getStackTrace( e ) );
             InternalExtendedResponse resp = ( InternalExtendedResponse ) req.getResultResponse();
             resp.setEncodedValue( 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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -80,8 +80,8 @@ public abstract class LdapRequestHandler
     {
         this.ldapServer = ldapServer;
     }
-    
-    
+
+
     /**
      * Checks to see if confidentiality requirements are met.  If the 
      * LdapServer requires confidentiality and the SSLFilter is engaged
@@ -98,18 +98,18 @@ public abstract class LdapRequestHandler
      */
     public final boolean isConfidentialityRequirementSatisfied( IoSession session )
     {
-       
-       if ( ! ldapServer.isConfidentialityRequired() )
-       {
-           return true;
-       }
-       
+
+        if ( !ldapServer.isConfidentialityRequired() )
+        {
+            return true;
+        }
+
         IoFilterChain chain = session.getFilterChain();
         return chain.contains( "sslFilter" );
     }
 
-    
-    public void rejectWithoutConfidentiality( IoSession session, InternalResultResponse resp ) 
+
+    public void rejectWithoutConfidentiality( IoSession session, InternalResultResponse resp )
     {
         InternalLdapResult result = resp.getLdapResult();
         result.setResultCode( ResultCodeEnum.CONFIDENTIALITY_REQUIRED );
@@ -117,6 +117,7 @@ public abstract class LdapRequestHandler
         session.write( resp );
     }
 
+
     /**
      *{@inheritDoc} 
      */
@@ -125,24 +126,23 @@ public abstract class LdapRequestHandler
     public final void handleMessage( IoSession session, T message ) throws Exception
     {
         LdapSession ldapSession = ldapServer.getLdapSessionManager().getLdapSession( session );
-        
-        if( ldapSession == null )
+
+        if ( ldapSession == null )
         {
             // in some cases the session is becoming null though the client is sending the UnbindRequest
             // before closing
-            LOG.info( "ignoring the message {} received from null session", message  );
+            LOG.info( "ignoring the message {} received from null session", message );
             return;
         }
-        
+
         // First check that the client hasn't issued a previous BindRequest, unless it
         // was a SASL BindRequest
         if ( ldapSession.isAuthPending() )
         {
             // Only SASL BinRequest are allowed if we already are handling a 
             // SASL BindRequest
-            if ( !( message instanceof BindRequestImpl ) || 
-                 ((BindRequestImpl)message).isSimple() ||
-                 ldapSession.isSimpleAuthPending() )
+            if ( !( message instanceof BindRequestImpl ) || ( ( BindRequestImpl ) message ).isSimple()
+                || ldapSession.isSimpleAuthPending() )
             {
                 LOG.error( I18n.err( I18n.ERR_732 ) );
                 InternalBindResponse bindResponse = new BindResponseImpl( message.getMessageId() );
@@ -153,35 +153,37 @@ public abstract class LdapRequestHandler
                 return;
             }
         }
-        
+
         // TODO - session you get from LdapServer should have the ldapServer 
         // member already set no?  Should remove these lines where ever they
         // may be if that's the case.
         ldapSession.setLdapServer( ldapServer );
-        
+
         // protect against insecure conns when confidentiality is required 
-        if ( ! isConfidentialityRequirementSatisfied( session ) )
+        if ( !isConfidentialityRequirementSatisfied( session ) )
         {
             if ( message instanceof InternalExtendedRequest )
             {
                 // Reject all extended operations except StartTls  
                 InternalExtendedRequest req = ( InternalExtendedRequest ) message;
-                
-                if ( ! req.getOid().equals( StartTlsHandler.EXTENSION_OID ) )
+
+                if ( !req.getID().equals( StartTlsHandler.EXTENSION_OID ) )
                 {
                     rejectWithoutConfidentiality( session, req.getResultResponse() );
                     return;
                 }
-                
+
                 // Allow StartTls extended operations to go through
             }
             else if ( message instanceof InternalResultResponseRequest )
             {
                 // Reject all other operations that have a result response  
-                rejectWithoutConfidentiality( session, ( ( InternalResultResponseRequest ) message ).getResultResponse() );
+                rejectWithoutConfidentiality( session, ( ( InternalResultResponseRequest ) message )
+                    .getResultResponse() );
                 return;
             }
-            else // Just return from unbind, and abandon immediately
+            else
+            // Just return from unbind, and abandon immediately
             {
                 return;
             }
@@ -196,7 +198,7 @@ public abstract class LdapRequestHandler
         else
         {
             CoreSession coreSession = null;
-            
+
             /*
              * All requests except bind automatically presume the authentication 
              * is anonymous if the session has not been authenticated.  Hence a
@@ -208,7 +210,7 @@ public abstract class LdapRequestHandler
                 handle( ldapSession, message );
                 return;
             }
-            
+
             coreSession = getLdapServer().getDirectoryService().getSession();
             ldapSession.setCoreSession( coreSession );
 
@@ -216,12 +218,13 @@ public abstract class LdapRequestHandler
             {
                 return;
             }
-            
+
             handle( ldapSession, message );
             return;
         }
     }
-    
+
+
     /**
      * Handle a Ldap message associated with a session
      * 
@@ -230,8 +233,8 @@ public abstract class LdapRequestHandler
      * @throws Exception If there is an error during the processing of this message
      */
     public abstract void handle( LdapSession session, T message ) throws Exception;
-    
-    
+
+
     /**
      * Handles processing with referrals without ManageDsaIT control.
      */
@@ -251,7 +254,7 @@ public abstract class LdapRequestHandler
         {
             code = ResultCodeEnum.getBestEstimate( e, req.getType() );
         }
-        
+
         result.setResultCode( code );
 
         /*
@@ -264,10 +267,10 @@ public abstract class LdapRequestHandler
         if ( LOG.isDebugEnabled() )
         {
             LOG.debug( msg, e );
-        
+
             msg += ":\n" + ExceptionUtils.getStackTrace( e );
         }
-        
+
         result.setErrorMessage( msg );
 
         if ( e instanceof LdapOperationException )
@@ -275,29 +278,26 @@ public abstract class LdapRequestHandler
             LdapOperationException ne = ( LdapOperationException ) e;
 
             // Add the matchedDN if necessary
-            boolean setMatchedDn = 
-                code == ResultCodeEnum.NO_SUCH_OBJECT             || 
-                code == ResultCodeEnum.ALIAS_PROBLEM              ||
-                code == ResultCodeEnum.INVALID_DN_SYNTAX          || 
-                code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM;
-            
+            boolean setMatchedDn = code == ResultCodeEnum.NO_SUCH_OBJECT || code == ResultCodeEnum.ALIAS_PROBLEM
+                || code == ResultCodeEnum.INVALID_DN_SYNTAX || code == ResultCodeEnum.ALIAS_DEREFERENCING_PROBLEM;
+
             if ( ( ne.getResolvedDn() != null ) && setMatchedDn )
             {
                 result.setMatchedDn( ( DN ) ne.getResolvedDn() );
             }
-            
+
             // Add the referrals if necessary
             if ( e instanceof LdapReferralException )
             {
                 InternalReferral referrals = new ReferralImpl();
-                
+
                 do
                 {
-                    String ref = ((LdapReferralException)e).getReferralInfo();
+                    String ref = ( ( LdapReferralException ) e ).getReferralInfo();
                     referrals.addLdapUrl( ref );
                 }
-                while ( ((LdapReferralException)e).skipReferral() );
-                
+                while ( ( ( LdapReferralException ) e ).skipReferral() );
+
                 result.setReferral( referrals );
             }
         }

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -41,6 +41,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedRequest;
 import org.apache.directory.shared.ldap.name.DN;
 
+
 /**
  * An extended handler for digital certificate generation
  * 
@@ -74,26 +75,27 @@ public class CertGenerationRequestHandle
 
     public void handleExtendedOperation( LdapSession session, InternalExtendedRequest req ) throws Exception
     {
-        ByteBuffer bb = ByteBuffer.wrap( req.getPayload() );
+        ByteBuffer bb = ByteBuffer.wrap( req.getEncodedValue() );
         Asn1Decoder decoder = new CertGenerationDecoder();
         CertGenerationContainer container = new CertGenerationContainer();
-        
+
         try
         {
             decoder.decode( bb, container );
         }
-        catch( DecoderException e )
+        catch ( DecoderException e )
         {
             throw e;
         }
-        
+
         CertGenerationObject certGenObj = container.getCertGenerationObject();
-        
+
         Entry entry = session.getCoreSession().lookup( new DN( certGenObj.getTargetDN() ) );
-        
+
         if ( entry != null )
         {
-            TlsKeyGenerator.addKeyPair( ((ClonedServerEntry)entry).getOriginalEntry(), certGenObj.getIssuerDN(), certGenObj.getSubjectDN(), certGenObj.getKeyAlgorithm() );
+            TlsKeyGenerator.addKeyPair( ( ( ClonedServerEntry ) entry ).getOriginalEntry(), certGenObj.getIssuerDN(),
+                certGenObj.getSubjectDN(), certGenObj.getKeyAlgorithm() );
         }
     }
 

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -77,7 +77,7 @@ public class StoredProcedureExtendedOper
 
     public void handleExtendedOperation( LdapSession session, InternalExtendedRequest req ) throws Exception
     {
-        StoredProcedure spBean = decodeBean( req.getPayload() );
+        StoredProcedure spBean = decodeBean( req.getEncodedValue() );
 
         String procedure = StringTools.utf8ToString( spBean.getProcedure() );
         ClonedServerEntry spUnit = manager.findStoredProcUnit( session.getCoreSession(), procedure );

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -97,7 +97,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.ControlImpl;
 import org.apache.directory.shared.ldap.codec.del.DelRequestCodec;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
-import org.apache.directory.shared.ldap.codec.intermediate.IntermediateResponseCodec;
 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;
@@ -127,6 +126,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.InternalCompareResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalIntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalLdapResult;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
@@ -378,20 +378,20 @@ public class LdapNetworkConnection exten
     /**
      * Convert a IntermediateResponseCodec to a IntermediateResponse message based on the ResponseFuture's type
      */
-    private void setIResponse( IntermediateResponseCodec intermediateResponseCodec, ResponseFuture responseFuture )
-        throws Exception
+    private void setIntermediateResponse( InternalIntermediateResponse internalIntermediateResponse,
+        ResponseFuture responseFuture ) throws Exception
     {
         IntermediateResponse intermediateResponse = null;
 
         if ( responseFuture instanceof SearchFuture )
         {
             intermediateResponse = new SearchIntermediateResponse();
-            addControls( intermediateResponseCodec, ( SearchIntermediateResponse ) intermediateResponse );
+            addControls( internalIntermediateResponse, ( SearchIntermediateResponse ) intermediateResponse );
         }
         else if ( responseFuture instanceof ExtendedFuture )
         {
             intermediateResponse = new ExtendedIntermediateResponse();
-            addControls( intermediateResponseCodec, ( ExtendedIntermediateResponse ) intermediateResponse );
+            addControls( internalIntermediateResponse, ( ExtendedIntermediateResponse ) intermediateResponse );
         }
         else
         {
@@ -400,8 +400,8 @@ public class LdapNetworkConnection exten
                 + responseFuture.getClass().getName() );
         }
 
-        intermediateResponse.setResponseName( intermediateResponseCodec.getResponseName() );
-        intermediateResponse.setResponseValue( intermediateResponseCodec.getResponseValue() );
+        intermediateResponse.setResponseName( internalIntermediateResponse.getResponseName() );
+        intermediateResponse.setResponseValue( internalIntermediateResponse.getResponseValue() );
 
         responseFuture.set( intermediateResponse );
     }
@@ -1764,6 +1764,11 @@ public class LdapNetworkConnection exten
 
                     break;
 
+                case INTERMEDIATE_RESPONSE:
+                    setIntermediateResponse( ( InternalIntermediateResponse ) response, responseFuture );
+
+                    break;
+
                 case MODIFY_RESPONSE:
                     // Transform the response
                     ModifyResponse modifyResponse = convert( ( InternalModifyResponse ) response );
@@ -1852,15 +1857,6 @@ public class LdapNetworkConnection exten
 
             switch ( response.getMessageType() )
             {
-                case INTERMEDIATE_RESPONSE:
-                    IntermediateResponseCodec intermediateResponseCodec = ( IntermediateResponseCodec ) response;
-                    intermediateResponseCodec.setMessageId( messageId );
-                    intermediateResponseCodec.addControls( response.getControls() );
-
-                    setIResponse( intermediateResponseCodec, responseFuture );
-
-                    break;
-
                 case SEARCH_RESULT_DONE:
                     // Store the response into the responseQueue
                     SearchResultDoneCodec searchResultDoneCodec = ( SearchResultDoneCodec ) response;

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -28,7 +28,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.AbstractControl;
 import org.apache.directory.shared.ldap.codec.del.DelRequestCodec;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
-import org.apache.directory.shared.ldap.codec.intermediate.IntermediateResponseCodec;
 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;
@@ -46,6 +45,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalIntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyResponse;
@@ -292,9 +292,9 @@ public class LdapMessageContainer extend
     /**
      * @return Returns the IntermediateResponse stored in the container
      */
-    public IntermediateResponseCodec getIntermediateResponse()
+    public InternalIntermediateResponse getInternalIntermediateResponse()
     {
-        return ( IntermediateResponseCodec ) ldapMessage;
+        return ( InternalIntermediateResponse ) 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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -73,7 +73,6 @@ import org.apache.directory.shared.ldap.
 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.intermediate.IntermediateResponseCodec;
 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;
@@ -95,6 +94,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.DeleteRequestImpl;
 import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
 import org.apache.directory.shared.ldap.message.ExtendedResponseImpl;
+import org.apache.directory.shared.ldap.message.IntermediateResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyDnResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
 import org.apache.directory.shared.ldap.message.ReferralImpl;
@@ -112,6 +112,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteRequest;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalIntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalLdapResult;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
@@ -3184,9 +3185,9 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // Now, we can allocate the IntermediateResponse Object
-                    IntermediateResponseCodec intermediateResponse = new IntermediateResponseCodec();
-                    intermediateResponse.setMessageId( ldapMessageContainer.getMessageId() );
-                    ldapMessageContainer.setLdapMessage( intermediateResponse );
+                    InternalIntermediateResponse intermediateResponse = new IntermediateResponseImpl(
+                        ldapMessageContainer.getMessageId() );
+                    ldapMessageContainer.setInternalMessage( intermediateResponse );
 
                     log.debug( "Intermediate Response" );
                 }
@@ -3210,7 +3211,8 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // We can get the IntermediateResponse Object
-                    IntermediateResponseCodec intermediateResponse = ldapMessageContainer.getIntermediateResponse();
+                    InternalIntermediateResponse intermediateResponse = ldapMessageContainer
+                        .getInternalIntermediateResponse();
 
                     // Get the Value and store it in the IntermediateResponse
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -3230,8 +3232,9 @@ public class LdapMessageGrammar extends 
 
                         try
                         {
-                            OID oid = new OID( StringTools.utf8ToString( responseNameBytes ) );
-                            intermediateResponse.setResponseName( oid );
+                            String oidStr = StringTools.utf8ToString( responseNameBytes );
+                            OID oid = new OID( oidStr );
+                            intermediateResponse.setResponseName( oidStr );
                         }
                         catch ( DecoderException de )
                         {
@@ -3273,7 +3276,8 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // We can get the IntermediateResponse Object
-                    IntermediateResponseCodec intermediateResponse = ldapMessageContainer.getIntermediateResponse();
+                    InternalIntermediateResponse intermediateResponse = ldapMessageContainer
+                        .getInternalIntermediateResponse();
 
                     // Get the Value and store it in the IntermediateResponse
                     TLV tlv = ldapMessageContainer.getCurrentTLV();
@@ -3316,7 +3320,8 @@ public class LdapMessageGrammar extends 
                     LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container;
 
                     // We can allocate the ExtendedRequest Object
-                    IntermediateResponseCodec intermediateResponse = ldapMessageContainer.getIntermediateResponse();
+                    InternalIntermediateResponse intermediateResponse = ldapMessageContainer
+                        .getInternalIntermediateResponse();
 
                     // Get the Value and store it in the IntermediateResponse
                     TLV tlv = ldapMessageContainer.getCurrentTLV();

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java?rev=984812&r1=984811&r2=984812&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapProtocolEncoder.java Thu Aug 12 14:55:50 2010
@@ -36,6 +36,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.CompareResponseImpl;
 import org.apache.directory.shared.ldap.message.DeleteResponseImpl;
 import org.apache.directory.shared.ldap.message.ExtendedResponseImpl;
+import org.apache.directory.shared.ldap.message.IntermediateResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyDnResponseImpl;
 import org.apache.directory.shared.ldap.message.ModifyResponseImpl;
 import org.apache.directory.shared.ldap.message.control.Control;
@@ -44,6 +45,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.internal.InternalCompareResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalDeleteResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedResponse;
+import org.apache.directory.shared.ldap.message.internal.InternalIntermediateResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalLdapResult;
 import org.apache.directory.shared.ldap.message.internal.InternalMessage;
 import org.apache.directory.shared.ldap.message.internal.InternalModifyDnResponse;
@@ -112,7 +114,7 @@ public class LdapProtocolEncoder extends
         if ( ( message instanceof InternalBindResponse ) || ( message instanceof InternalDeleteResponse )
             || ( message instanceof InternalAddResponse ) || ( message instanceof InternalCompareResponse )
             || ( message instanceof InternalExtendedResponse ) || ( message instanceof InternalModifyResponse )
-            || ( message instanceof InternalModifyDnResponse ) )
+            || ( message instanceof InternalModifyDnResponse ) || ( message instanceof InternalIntermediateResponse ) )
         {
             try
             {
@@ -577,6 +579,49 @@ public class LdapProtocolEncoder extends
 
 
     /**
+     * Compute the intermediateResponse length
+     * 
+     * intermediateResponse :
+     * 
+     * 0x79 L1
+     *  |
+     * [+--> 0x80 L2 name
+     * [+--> 0x81 L3 response]]
+     * 
+     * L1 = [ + Length(0x80) + Length(L2) + L2
+     *      [ + Length(0x81) + Length(L3) + L3]]
+     * 
+     * Length(IntermediateResponse) = Length(0x79) + Length(L1) + L1
+     * 
+     * @return The IntermediateResponse length
+     */
+    private int computeIntermediateResponseLength( InternalIntermediateResponse intermediateResponse )
+    {
+        int intermediateResponseLength = 0;
+
+        if ( !StringTools.isEmpty( intermediateResponse.getResponseName() ) )
+        {
+            byte[] responseNameBytes = StringTools.getBytesUtf8( intermediateResponse.getResponseName() );
+
+            int responseNameLength = responseNameBytes.length;
+            intermediateResponseLength += 1 + TLV.getNbBytes( responseNameLength ) + responseNameLength;
+            intermediateResponse.setOidBytes( responseNameBytes );
+        }
+
+        byte[] encodedValue = intermediateResponse.getResponseValue();
+
+        if ( encodedValue != null )
+        {
+            intermediateResponseLength += 1 + TLV.getNbBytes( encodedValue.length ) + encodedValue.length;
+        }
+
+        intermediateResponse.setIntermediateResponseLength( intermediateResponseLength );
+
+        return 1 + TLV.getNbBytes( intermediateResponseLength ) + intermediateResponseLength;
+    }
+
+
+    /**
      * Encode the AddResponse message to a PDU.
      * 
      * @param buffer The buffer where to put the PDU
@@ -750,6 +795,56 @@ public class LdapProtocolEncoder extends
 
 
     /**
+     * Encode the IntermediateResponse message to a PDU. 
+     * IntermediateResponse :
+     *   0x79 LL
+     *     [0x80 LL response name]
+     *     [0x81 LL responseValue]
+     * 
+     * @param buffer The buffer where to put the PDU
+     */
+    private void encodeIntermediateResponse( ByteBuffer buffer, IntermediateResponseImpl intermediateResponse )
+        throws EncoderException
+    {
+        try
+        {
+            // The ExtendedResponse Tag
+            buffer.put( LdapConstants.INTERMEDIATE_RESPONSE_TAG );
+            buffer.put( TLV.getBytes( intermediateResponse.getIntermediateResponseLength() ) );
+
+            // The responseName, if any
+            byte[] responseNameBytes = intermediateResponse.getOidBytes();
+
+            if ( ( responseNameBytes != null ) && ( responseNameBytes.length != 0 ) )
+            {
+                buffer.put( ( byte ) LdapConstants.INTERMEDIATE_RESPONSE_NAME_TAG );
+                buffer.put( TLV.getBytes( responseNameBytes.length ) );
+                buffer.put( responseNameBytes );
+            }
+
+            // The encodedValue, if any
+            byte[] encodedValue = intermediateResponse.getResponseValue();
+
+            if ( encodedValue != null )
+            {
+                buffer.put( ( byte ) LdapConstants.INTERMEDIATE_RESPONSE_VALUE_TAG );
+
+                buffer.put( TLV.getBytes( encodedValue.length ) );
+
+                if ( encodedValue.length != 0 )
+                {
+                    buffer.put( encodedValue );
+                }
+            }
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
+        }
+    }
+
+
+    /**
      * Encode the ModifyResponse message to a PDU.
      * 
      * @param buffer The buffer where to put the PDU
@@ -818,6 +913,9 @@ public class LdapProtocolEncoder extends
             case EXTENDED_RESPONSE:
                 return computeExtendedResponseLength( ( ExtendedResponseImpl ) message );
 
+            case INTERMEDIATE_RESPONSE:
+                return computeIntermediateResponseLength( ( IntermediateResponseImpl ) message );
+
             case MODIFY_RESPONSE:
                 return computeModifyResponseLength( ( ModifyResponseImpl ) message );
 
@@ -854,6 +952,10 @@ public class LdapProtocolEncoder extends
                 encodeExtendedResponse( bb, ( ExtendedResponseImpl ) message );
                 break;
 
+            case INTERMEDIATE_RESPONSE:
+                encodeIntermediateResponse( bb, ( IntermediateResponseImpl ) message );
+                break;
+
             case MODIFY_RESPONSE:
                 encodeModifyResponse( bb, ( ModifyResponseImpl ) message );
                 break;

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -25,13 +25,11 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.asn1.primitives.OID;
 import org.apache.directory.shared.i18n.I18n;
 import org.apache.directory.shared.ldap.codec.bind.BindRequestCodec;
 import org.apache.directory.shared.ldap.codec.bind.SaslCredentials;
 import org.apache.directory.shared.ldap.codec.bind.SimpleAuthentication;
 import org.apache.directory.shared.ldap.codec.extended.ExtendedRequestCodec;
-import org.apache.directory.shared.ldap.codec.intermediate.IntermediateResponseCodec;
 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;
@@ -68,7 +66,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.message.BindRequestImpl;
 import org.apache.directory.shared.ldap.message.ExtendedRequestImpl;
-import org.apache.directory.shared.ldap.message.IntermediateResponseImpl;
 import org.apache.directory.shared.ldap.message.LdapResultImpl;
 import org.apache.directory.shared.ldap.message.ModifyDnRequestImpl;
 import org.apache.directory.shared.ldap.message.ModifyRequestImpl;
@@ -124,10 +121,10 @@ public class LdapTransformer
         }
 
         // Codec : OID requestName -> Internal : String oid
-        internalMessage.setOid( extendedRequest.getRequestName() );
+        internalMessage.setID( extendedRequest.getRequestName() );
 
         // Codec : OctetString requestValue -> Internal : byte [] payload
-        internalMessage.setPayload( extendedRequest.getRequestValue() );
+        internalMessage.setEncodedValue( extendedRequest.getRequestValue() );
 
         return internalMessage;
     }
@@ -700,39 +697,6 @@ public class LdapTransformer
 
 
     /**
-     * Transform a Internal IntermediateResponse to a Codec IntermediateResponse
-     * 
-     * @param internalMessage The incoming Internal IntermediateResponse
-     * @return The IntermediateResponseCodec instance
-     */
-    private static LdapMessageCodec transformIntermediateResponse( InternalMessage internalMessage )
-    {
-        IntermediateResponseImpl internalIntermediateResponse = ( IntermediateResponseImpl ) internalMessage;
-        IntermediateResponseCodec intermediateResponse = new IntermediateResponseCodec();
-
-        // Internal : String oid -> Codec : String responseName
-        try
-        {
-            intermediateResponse.setResponseName( new OID( internalIntermediateResponse.getResponseName() ) );
-        }
-        catch ( DecoderException de )
-        {
-            LOG.warn( "The OID " + internalIntermediateResponse.getResponseName() + " is invalid : " + de.getMessage() );
-            intermediateResponse.setResponseName( null );
-        }
-
-        // Internal : byte [] value -> Codec : byte[] value
-        intermediateResponse.setResponseValue( internalIntermediateResponse.getResponseValue() );
-
-        // Transform the ldapResult
-        intermediateResponse.setLdapResult( transformLdapResult( ( LdapResultImpl ) internalIntermediateResponse
-            .getLdapResult() ) );
-
-        return intermediateResponse;
-    }
-
-
-    /**
      * Transform a Internal SearchResponseDone to a Codec SearchResultDone
      * 
      * @param internalMessage The incoming Internal SearchResponseDone
@@ -846,10 +810,6 @@ public class LdapTransformer
             case BIND_REQUEST:
                 codecMessage = transformBindRequest( msg );
                 break;
-
-            case INTERMEDIATE_RESPONSE:
-                codecMessage = transformIntermediateResponse( msg );
-                break;
         }
 
         codecMessage.setMessageId( msg.getMessageId() );

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -72,24 +72,11 @@ public class ExtendedRequestImpl extends
     // -----------------------------------------------------------------------
 
     /**
-     * Gets the Object Idendifier corresponding to the extended request type.
-     * This is the <b>requestName</b> portion of the ext. req. PDU.
-     * 
-     * @return the dotted-decimal representation as a String of the OID
-     */
-    public String getOid()
-    {
-        return oid;
-    }
-
-
-    /**
      * Sets the Object Idendifier corresponding to the extended request type.
      * 
-     * @param oid
-     *            the dotted-decimal representation as a String of the OID
+     * @param oid the dotted-decimal representation as a String of the OID
      */
-    public void setOid( String oid )
+    public void setID( String oid )
     {
         this.oid = oid;
     }
@@ -102,7 +89,7 @@ public class ExtendedRequestImpl extends
      * 
      * @return byte array of data
      */
-    public byte[] getPayload()
+    public byte[] getEncodedValue()
     {
         if ( payload == null )
         {
@@ -118,10 +105,9 @@ public class ExtendedRequestImpl extends
     /**
      * Sets the extended request's <b>requestValue</b> portion of the PDU.
      * 
-     * @param payload
-     *            byte array of data encapsulating ext. req. parameters
+     * @param payload byte array of data encapsulating ext. req. parameters
      */
-    public void setPayload( byte[] payload )
+    public void setEncodedValue( byte[] payload )
     {
         if ( payload != null )
         {
@@ -214,32 +200,33 @@ public class ExtendedRequestImpl extends
 
         InternalExtendedRequest req = ( InternalExtendedRequest ) obj;
 
-        if ( ( oid != null ) && ( req.getOid() == null ) )
+        if ( ( oid != null ) && ( req.getID() == null ) )
         {
             return false;
         }
 
-        if ( ( oid == null ) && ( req.getOid() != null ) )
+        if ( ( oid == null ) && ( req.getID() != null ) )
         {
             return false;
         }
 
-        if ( ( oid != null ) && ( req.getOid() != null ) && !oid.equals( req.getOid() ) )
+        if ( ( oid != null ) && ( req.getID() != null ) && !oid.equals( req.getID() ) )
         {
             return false;
         }
 
-        if ( ( payload != null ) && ( req.getPayload() == null ) )
+        if ( ( payload != null ) && ( req.getEncodedValue() == null ) )
         {
             return false;
         }
 
-        if ( ( payload == null ) && ( req.getPayload() != null ) )
+        if ( ( payload == null ) && ( req.getEncodedValue() != null ) )
         {
             return false;
         }
 
-        if ( ( payload != null ) && ( req.getPayload() != null ) && !Arrays.equals( payload, req.getPayload() ) )
+        if ( ( payload != null ) && ( req.getEncodedValue() != null )
+            && !Arrays.equals( payload, req.getEncodedValue() ) )
         {
             return false;
         }
@@ -270,15 +257,15 @@ public class ExtendedRequestImpl extends
     }
 
 
+    /**
+     * Gets the Object Idendifier corresponding to the extended request type.
+     * This is the <b>requestName</b> portion of the ext. req. PDU.
+     * 
+     * @return the dotted-decimal representation as a String of the OID
+     */
     public String getID()
     {
-        return getOid();
-    }
-
-
-    public byte[] getEncodedValue()
-    {
-        return getPayload();
+        return oid;
     }
 
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java?rev=984812&r1=984811&r2=984812&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/IntermediateResponseImpl.java Thu Aug 12 14:55:50 2010
@@ -38,9 +38,15 @@ public class IntermediateResponseImpl ex
     /** ResponseName for the intermediate response */
     protected String oid;
 
+    /** The response name as a byte[] */
+    private byte[] oidBytes;
+
     /** Response Value for the intermediate response */
     protected byte[] value;
 
+    /** The encoded intermediateResponse length */
+    private int intermediateResponseLength;
+
 
     // ------------------------------------------------------------------------
     // Constructors
@@ -93,22 +99,33 @@ public class IntermediateResponseImpl ex
 
 
     /**
-     * Gets the OID uniquely identifying this Intemediate response (a.k.a. its
+     * Gets the OID uniquely identifying this Intermediate response (a.k.a. its
      * name).
      * 
-     * @return the OID of the Intemediate response type.
+     * @return the OID of the Intermediate response type.
      */
     public String getResponseName()
     {
-        return oid;
+        return ( ( oid == null ) ? "" : oid );
     }
 
 
     /**
-     * Sets the OID uniquely identifying this Intemediate response (a.k.a. its
+     * Gets the OID bytes
+     * 
+     * @return the OID bytes of the Intermediate response type.
+     */
+    public byte[] getOidBytes()
+    {
+        return oidBytes;
+    }
+
+
+    /**
+     * Sets the OID uniquely identifying this Intermediate response (a.k.a. its
      * name).
      * 
-     * @param oid the OID of the Intemediate response type.
+     * @param oid the OID of the Intermediate response type.
      */
     public void setResponseName( String oid )
     {
@@ -119,6 +136,15 @@ public class IntermediateResponseImpl ex
     /**
      * {@inheritDoc}
      */
+    public void setOidBytes( byte[] oidBytes )
+    {
+        this.oidBytes = oidBytes;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public int hashCode()
     {
@@ -195,4 +221,22 @@ public class IntermediateResponseImpl ex
 
         return true;
     }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setIntermediateResponseLength( int intermediateResponseLength )
+    {
+        this.intermediateResponseLength = intermediateResponseLength;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getIntermediateResponseLength()
+    {
+        return intermediateResponseLength;
+    }
 }

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -71,7 +71,7 @@ public class CancelRequest extends Exten
     public CancelRequest( int messageId, int cancelId )
     {
         super( messageId );
-        setOid( EXTENSION_OID );
+        setID( EXTENSION_OID );
 
         this.cancelId = cancelId;
     }
@@ -111,7 +111,7 @@ public class CancelRequest extends Exten
             }
         }
 
-        return super.getPayload();
+        return super.getEncodedValue();
     }
 
 

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -66,7 +66,7 @@ public class CertGenerationRequest exten
     public CertGenerationRequest( int messageId, String targerDN, String issuerDN, String subjectDN, String keyAlgorithm )
     {
         super( messageId );
-        setOid( EXTENSION_OID );
+        setID( EXTENSION_OID );
 
         this.certGenObj = new CertGenerationObject();
         certGenObj.setTargetDN( targerDN );

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -73,7 +73,7 @@ public class GracefulShutdownRequest ext
     public GracefulShutdownRequest( int messageId, int timeOffline, int delay )
     {
         super( messageId );
-        setOid( EXTENSION_OID );
+        setID( EXTENSION_OID );
         this.timeOffline = timeOffline;
         this.delay = delay;
     }
@@ -142,7 +142,7 @@ public class GracefulShutdownRequest ext
             }
         }
 
-        return super.getPayload();
+        return super.getEncodedValue();
     }
 
 

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -45,8 +45,8 @@ public class LaunchDiagnosticUiRequest e
     public LaunchDiagnosticUiRequest( int messageId )
     {
         super( messageId );
-        setOid( EXTENSION_OID );
-        setPayload( EMPTY_PAYLOAD );
+        setID( EXTENSION_OID );
+        setEncodedValue( 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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -56,7 +56,7 @@ public class StoredProcedureRequest exte
     public StoredProcedureRequest( int messageId )
     {
         super( messageId );
-        this.setOid( EXTENSION_OID );
+        this.setID( EXTENSION_OID );
         this.procedure = new StoredProcedure();
     }
 
@@ -64,7 +64,7 @@ public class StoredProcedureRequest exte
     public StoredProcedureRequest( int messageId, String procedure, String language )
     {
         super( messageId );
-        this.setOid( EXTENSION_OID );
+        this.setID( EXTENSION_OID );
         this.procedure = new StoredProcedure();
         this.setLanguage( language );
         this.setProcedure( procedure );

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.shared.ldap.message.internal;
 
+
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.SingleReplyRequest;
 
@@ -70,16 +71,15 @@ public interface InternalExtendedRequest
      * 
      * @return the dotted-decimal representation as a String of the OID
      */
-    String getOid();
+    String getID();
 
 
     /**
      * Sets the Object Idendifier corresponding to the extended request type.
      * 
-     * @param oid
-     *            the dotted-decimal representation as a String of the OID
+     * @param oid the dotted-decimal representation as a String of the OID
      */
-    void setOid( String oid );
+    void setID( String oid );
 
 
     /**
@@ -89,14 +89,13 @@ public interface InternalExtendedRequest
      * 
      * @return byte array of data
      */
-    byte[] getPayload();
+    byte[] getEncodedValue();
 
 
     /**
      * Sets the extended request's <b>requestValue</b> portion of the PDU.
      * 
-     * @param payload
-     *            byte array of data encapsulating ext. req. parameters
+     * @param payload byte array of data encapsulating ext. req. parameters
      */
-    void setPayload( byte[] payload );
+    void setEncodedValue( byte[] payload );
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalIntermediateResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalIntermediateResponse.java?rev=984812&r1=984811&r2=984812&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalIntermediateResponse.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalIntermediateResponse.java Thu Aug 12 14:55:50 2010
@@ -20,6 +20,7 @@
 
 package org.apache.directory.shared.ldap.message.internal;
 
+
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
 
 
@@ -65,4 +66,25 @@ public interface InternalIntermediateRes
      * @param value The responseValue
      */
     void setResponseValue( byte[] value );
+
+
+    /**
+     * Sets the OID bytes
+     * 
+     * @param oid the OID bytes of the Intermediate response type.
+     */
+    void setOidBytes( byte[] oidBytes );
+
+
+    /**
+     * Stores the encoded length for the IntermediateResponse
+     * @param intermediateResponseLength The encoded length
+     */
+    void setIntermediateResponseLength( int intermediateResponseLength );
+
+
+    /**
+     * @return The encoded IntermediateResponse's length
+     */
+    int getIntermediateResponseLength();
 }

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=984812&r1=984811&r2=984812&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 Thu Aug 12 14:55:50 2010
@@ -31,6 +31,7 @@ import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.InvalidAttributeIdentifierException;
 import javax.naming.ldap.ExtendedRequest;
 import javax.naming.ldap.ExtendedResponse;
 
@@ -275,7 +276,7 @@ public class AttributeUtils
             try
             {
                 String comparedStr = normalizer.normalize( compared.getString() );
-                
+
                 for ( NamingEnumeration<?> values = attr.getAll(); values.hasMoreElements(); /**/)
                 {
                     String value = ( String ) values.nextElement();
@@ -285,7 +286,7 @@ public class AttributeUtils
                     }
                 }
             }
-            catch( NamingException e )
+            catch ( NamingException e )
             {
                 throw new LdapException( e.getMessage() );
             }
@@ -358,7 +359,7 @@ public class AttributeUtils
                 for ( NamingEnumeration<?> values = attr.getAll(); values.hasMoreElements(); /**/)
                 {
                     Object value = values.nextElement();
-    
+
                     if ( value instanceof byte[] && ArrayUtils.isEquals( comparedBytes, value ) )
                     {
                         return true;
@@ -404,7 +405,7 @@ public class AttributeUtils
                 {
                     Object attrVal = attrVals.nextElement();
 
-                    if ( attrVal instanceof String &&  strVal.equalsIgnoreCase( ( String ) attrVal ) )
+                    if ( attrVal instanceof String && strVal.equalsIgnoreCase( ( String ) attrVal ) )
                     {
                         return true;
                     }
@@ -420,7 +421,7 @@ public class AttributeUtils
                 {
                     Object attrVal = attrVals.nextElement();
 
-                    if ( attrVal instanceof byte[]  &&  Arrays.equals( ( byte[] ) attrVal, valueBytes ) )
+                    if ( attrVal instanceof byte[] && Arrays.equals( ( byte[] ) attrVal, valueBytes ) )
                     {
                         return true;
                     }
@@ -488,7 +489,6 @@ public class AttributeUtils
     }
     */
 
-
     /**
      * Creates a new attribute which contains the values representing the
      * difference of two attributes. If both attributes are null then we cannot
@@ -877,7 +877,7 @@ public class AttributeUtils
 
             if ( !parseNumber( str, pos ) )
             {
-                throw new ParseException(I18n.err( I18n.ERR_04345 ), pos.start );
+                throw new ParseException( I18n.err( I18n.ERR_04345 ), pos.start );
             }
         }
     }
@@ -1182,7 +1182,6 @@ public class AttributeUtils
     }
     */
 
-
     /**
      * Convert a BasicAttributes or a AttributesImpl to a ServerEntry
      *
@@ -1327,8 +1326,8 @@ public class AttributeUtils
             return null;
         }
     }
-    
-    
+
+
     public static ExtendedRequest toJndiExtendedRequest( final InternalExtendedRequest request )
     {
         class JndiExtendedRequest implements ExtendedRequest
@@ -1339,22 +1338,24 @@ public class AttributeUtils
                 return toJndiExtendedResponse( request );
             }
 
+
             public byte[] getEncodedValue()
             {
-                return request.getPayload();
+                return request.getEncodedValue();
             }
 
+
             public String getID()
             {
-                return request.getOid();
+                return request.getID();
             }
-            
-        } 
-        
+
+        }
+
         return new JndiExtendedRequest();
     }
-    
-    
+
+
     /**
      * TODO toJndiExtendedResponse. This is NOT correct ATM
      *
@@ -1370,12 +1371,13 @@ public class AttributeUtils
                 return request.getEncodedValue();
             }
 
+
             public String getID()
             {
                 return request.getID();
             }
-        } 
-        
+        }
+
         return new JndiExtendedResponse();
     }
 }



Mime
View raw message