directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r985467 - 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/ apac...
Date Sat, 14 Aug 2010 11:32:41 GMT
Author: elecharny
Date: Sat Aug 14 11:32:40 2010
New Revision: 985467

URL: http://svn.apache.org/viewvc?rev=985467&view=rev
Log:
o Added some missing toString() methods in responses
o Modified the ExtendedResponse API
o Removed the encoder dedicated methods from the ExtendedResponse interface

Modified:
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.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/extended/StartTlsHandler.java
    directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StoredProcedureExtendedOperationHandler.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/actions/ResponseAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.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/extended/GracefulDisconnect.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/extended/StoredProcedureResponse.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java
    directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedResponse.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/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Sat Aug 14 11:32:40 2010
@@ -122,7 +122,7 @@ public class LdapServer extends Director
 
     /** the constant service name of this ldap protocol provider **/
     public static final String SERVICE_NAME = "ldap";
-    
+
     /** The default maximum size limit. */
     private static final long MAX_SIZE_LIMIT_DEFAULT = 100;
 
@@ -137,7 +137,7 @@ public class LdapServer extends Director
 
     /** the session manager for this LdapServer */
     private LdapSessionManager ldapSessionManager = new LdapSessionManager();
-    
+
     /** a set of supported controls */
     private Set<String> supportedControls;
 
@@ -145,17 +145,17 @@ public class LdapServer extends Director
      * The maximum size limit. 
      * @see {@link LdapServer#MAX_SIZE_LIMIT_DEFAULT }
      */
-    private long maxSizeLimit = MAX_SIZE_LIMIT_DEFAULT; 
+    private long maxSizeLimit = MAX_SIZE_LIMIT_DEFAULT;
 
     /** 
      * The maximum time limit.
      * @see {@link LdapServer#MAX_TIME_LIMIT_DEFAULT }
      */
-    private int maxTimeLimit = MAX_TIME_LIMIT_DEFAULT; 
+    private int maxTimeLimit = MAX_TIME_LIMIT_DEFAULT;
 
     /** If LDAPS is activated : the external Keystore file, if defined */
     private String keystoreFile;
-    
+
     /** If LDAPS is activated : the certificate password */
     private String certificatePassword;
 
@@ -163,12 +163,10 @@ public class LdapServer extends Director
     private boolean allowAnonymousAccess = true;
 
     /** The extended operation handlers. */
-    private final Collection<ExtendedOperationHandler> extendedOperationHandlers =
-        new ArrayList<ExtendedOperationHandler>();
+    private final Collection<ExtendedOperationHandler> extendedOperationHandlers = new ArrayList<ExtendedOperationHandler>();
 
     /** The supported authentication mechanisms. */
-    private Map<String, MechanismHandler> saslMechanismHandlers =
-        new HashMap<String, MechanismHandler>();
+    private Map<String, MechanismHandler> saslMechanismHandlers = new HashMap<String, MechanismHandler>();
 
     /** The name of this host, validated during SASL negotiation. */
     private String saslHost = "ldap.example.com";
@@ -178,7 +176,7 @@ public class LdapServer extends Director
 
     /** The quality of protection (QoP), used by DIGEST-MD5 and GSSAPI. */
     private Set<String> saslQop;
-    private String      saslQopString;
+    private String saslQopString;
 
     /** The list of realms serviced by this host. */
     private List<String> saslRealms;
@@ -195,12 +193,11 @@ public class LdapServer extends Director
     private LdapRequestHandler<InternalSearchRequest> searchHandler;
     private LdapRequestHandler<InternalUnbindRequest> unbindHandler;
 
-
     /** the underlying provider codec factory */
     private ProtocolCodecFactory codecFactory;
 
     /** the MINA protocol handler */
-    private final LdapProtocolHandler handler = new LdapProtocolHandler(this);
+    private final LdapProtocolHandler handler = new LdapProtocolHandler( this );
 
     /** tracks start state of the server */
     private boolean started;
@@ -211,17 +208,17 @@ public class LdapServer extends Director
      */
     private boolean confidentialityRequired;
 
-    
     private KeyStore keyStore = null;
 
     private List<IoFilterChainBuilder> chainBuilders = new ArrayList<IoFilterChainBuilder>();
-    
+
     private ReplicationProvider replicationProvider;
-    
+
     private List<SyncreplConfiguration> providerConfigs;
-    
+
     private List<SyncReplConsumer> replConsumers;
-    
+
+
     /**
      * Creates an LDAP protocol provider.
      */
@@ -264,56 +261,55 @@ public class LdapServer extends Director
         {
             setAbandonHandler( new AbandonHandler() );
         }
-        
+
         if ( getAddHandler() == null )
         {
             setAddHandler( new AddHandler() );
         }
-        
+
         if ( getBindHandler() == null )
         {
             BindHandler handler = new BindHandler();
             handler.setSaslMechanismHandlers( saslMechanismHandlers );
             setBindHandler( handler );
         }
-        
+
         if ( getCompareHandler() == null )
         {
             setCompareHandler( new CompareHandler() );
         }
-        
+
         if ( getDeleteHandler() == null )
         {
             setDeleteHandler( new DeleteHandler() );
         }
-        
+
         if ( getExtendedHandler() == null )
         {
             setExtendedHandler( new ExtendedHandler() );
         }
-        
+
         if ( getModifyHandler() == null )
         {
             setModifyHandler( new ModifyHandler() );
         }
-        
+
         if ( getModifyDnHandler() == null )
         {
             setModifyDnHandler( new ModifyDnHandler() );
         }
-        
+
         if ( getSearchHandler() == null )
         {
             setSearchHandler( new SearchHandler() );
         }
-        
+
         if ( getUnbindHandler() == null )
         {
             setUnbindHandler( new UnbindHandler() );
         }
     }
 
-    
     private class AdsKeyStore extends KeyStore
     {
         public AdsKeyStore( KeyStoreSpi keyStoreSpi, Provider provider, String type )
@@ -322,7 +318,7 @@ public class LdapServer extends Director
         }
     }
 
-    
+
     /**
      * loads the digital certificate either from a keystore file or from the admin entry in DIT
      */
@@ -335,8 +331,10 @@ public class LdapServer extends Director
             Provider provider = Security.getProvider( "SUN" );
             LOG.debug( "provider = {}", provider );
             CoreKeyStoreSpi coreKeyStoreSpi = new CoreKeyStoreSpi( getDirectoryService() );
-            keyStore = new KeyStore( coreKeyStoreSpi, provider, "JKS" ) {};
-            
+            keyStore = new KeyStore( coreKeyStoreSpi, provider, "JKS" )
+            {
+            };
+
             try
             {
                 keyStore.load( null, null );
@@ -352,7 +350,7 @@ public class LdapServer extends Director
             FileInputStream fis = null;
             try
             {
-                fis = new FileInputStream( keystoreFile );          
+                fis = new FileInputStream( keystoreFile );
                 keyStore.load( fis, null );
             }
             finally
@@ -365,7 +363,7 @@ public class LdapServer extends Director
         }
     }
 
-    
+
     /**
      * reloads the SSL context by replacing the existing SslFilter
      * with a new SslFilter after reloading the keystore.
@@ -374,7 +372,7 @@ public class LdapServer extends Director
      */
     public void reloadSslContext() throws Exception
     {
-        if( !started )
+        if ( !started )
         {
             return;
         }
@@ -397,7 +395,7 @@ public class LdapServer extends Director
         }
 
         StartTlsHandler handler = ( StartTlsHandler ) getExtendedOperationHandler( StartTlsHandler.EXTENSION_OID );
-        if( handler != null )
+        if ( handler != null )
         {
             //FIXME dirty hack. IMO StartTlsHandler's code requires a cleanup
             // cause the keystore loading and sslcontext creation code is duplicated
@@ -408,28 +406,28 @@ public class LdapServer extends Director
         LOG.info( "reloaded SSL context successfully" );
     }
 
-    
+
     /**
      * @throws IOException if we cannot bind to the specified port
      * @throws Exception if the LDAP server cannot be started
      */
     public void start() throws Exception
     {
-        if ( ! isEnabled() )
+        if ( !isEnabled() )
         {
             return;
         }
 
-        for ( Transport transport:transports )
+        for ( Transport transport : transports )
         {
-            if ( !(transport instanceof TcpTransport ) )
+            if ( !( transport instanceof TcpTransport ) )
             {
                 LOG.warn( "Cannot listen on an UDP transport : {}", transport );
                 continue;
             }
-            
+
             IoFilterChainBuilder chain;
-            
+
             if ( transport.isSSLEnabled() )
             {
                 loadKeyStore();
@@ -439,39 +437,37 @@ public class LdapServer extends Director
             {
                 chain = new DefaultIoFilterChainBuilder();
             }
-            
+
             // Inject the codec into the chain
-            ((DefaultIoFilterChainBuilder)chain).addLast( "codec", 
-                    new ProtocolCodecFilter( this.getProtocolCodecFactory() ) );
-            
+            ( ( DefaultIoFilterChainBuilder ) chain ).addLast( "codec", new ProtocolCodecFilter( this
+                .getProtocolCodecFactory() ) );
+
             // Now inject an ExecutorFilter for the write operations
             // We use the same number of thread than the number of IoProcessor
             // (NOTE : this has to be double checked)
-            ((DefaultIoFilterChainBuilder)chain).addLast( "executor", 
-                    new ExecutorFilter( 
-                        new UnorderedThreadPoolExecutor( transport.getNbThreads() ),
-                        IoEventType.MESSAGE_RECEIVED ) );
+            ( ( DefaultIoFilterChainBuilder ) chain ).addLast( "executor", new ExecutorFilter(
+                new UnorderedThreadPoolExecutor( transport.getNbThreads() ), IoEventType.MESSAGE_RECEIVED ) );
 
             /*
              * The server is now initialized, we can
              * install the default requests handlers, which need 
              * access to the DirectoryServer instance.
-             */ 
-            installDefaultHandlers();      
-            
+             */
+            installDefaultHandlers();
+
             startNetwork( transport, chain );
         }
-        
-        if( replicationProvider != null )
+
+        if ( replicationProvider != null )
         {
             replicationProvider.init( this );
             ( ( SearchHandler ) getSearchHandler() ).setReplicationProvider( replicationProvider );
         }
-        
+
         startConsumers();
 
         started = true;
-        
+
         LOG.info( "Ldap service started." );
     }
 
@@ -483,66 +479,65 @@ public class LdapServer extends Director
     {
         try
         {
-            for ( Transport transport:transports )
+            for ( Transport transport : transports )
             {
-                if ( !(transport instanceof TcpTransport ) )
+                if ( !( transport instanceof TcpTransport ) )
                 {
                     continue;
                 }
-                
+
                 // we should unbind the service before we begin sending the notice
                 // of disconnect so new connections are not formed while we process
                 List<WriteFuture> writeFutures = new ArrayList<WriteFuture>();
-    
+
                 // If the socket has already been unbound as with a successful
                 // GracefulShutdownRequest then this will complain that the service
                 // is not bound - this is ok because the GracefulShutdown has already
                 // sent notices to to the existing active sessions
                 List<IoSession> sessions;
-    
+
                 try
                 {
-                    sessions = new ArrayList<IoSession>(
-                            getSocketAcceptor( transport ).getManagedSessions().values() );
+                    sessions = new ArrayList<IoSession>( getSocketAcceptor( transport ).getManagedSessions().values() );
                 }
                 catch ( IllegalArgumentException e )
                 {
                     LOG.warn( "Seems like the LDAP service (" + getPort() + ") has already been unbound." );
                     return;
                 }
-    
+
                 getSocketAcceptor( transport ).dispose();
-    
+
                 if ( LOG.isInfoEnabled() )
                 {
                     LOG.info( "Unbind of an LDAP service (" + getPort() + ") is complete." );
                     LOG.info( "Sending notice of disconnect to existing clients sessions." );
                 }
-    
+
                 // Send Notification of Disconnection messages to all connected clients.
                 if ( sessions != null )
                 {
-                    for ( IoSession session:sessions )
+                    for ( IoSession session : sessions )
                     {
                         writeFutures.add( session.write( NoticeOfDisconnect.UNAVAILABLE ) );
                     }
                 }
-    
+
                 // And close the connections when the NoDs are sent.
                 Iterator<IoSession> sessionIt = sessions.iterator();
-    
-                for ( WriteFuture future:writeFutures )
+
+                for ( WriteFuture future : writeFutures )
                 {
                     future.await( 1000L );
                     sessionIt.next().close( true );
                 }
 
-                if( replicationProvider != null )
+                if ( replicationProvider != null )
                 {
                     replicationProvider.stop();
                 }
             }
-            
+
             stopConsumers();
         }
         catch ( Exception e )
@@ -554,10 +549,9 @@ public class LdapServer extends Director
     }
 
 
-    private void startNetwork( Transport transport, IoFilterChainBuilder chainBuilder )
-        throws Exception
+    private void startNetwork( Transport transport, IoFilterChainBuilder chainBuilder ) throws Exception
     {
-        if ( transport.getBackLog() < 0 ) 
+        if ( transport.getBackLog() < 0 )
         {
             // Set the backlog to the default value when it's below 0
             transport.setBackLog( 50 );
@@ -579,29 +573,29 @@ public class LdapServer extends Director
         try
         {
             SocketAcceptor acceptor = getSocketAcceptor( transport );
-            
+
             // Now, configure the acceptor
             // Disable the disconnection of the clients on unbind
             acceptor.setCloseOnDeactivation( false );
-            
+
             // Allow the port to be reused even if the socket is in TIME_WAIT state
             acceptor.setReuseAddress( true );
-            
+
             // No Nagle's algorithm
             acceptor.getSessionConfig().setTcpNoDelay( true );
-            
+
             // Inject the chain
             acceptor.setFilterChainBuilder( chainBuilder );
-            
+
             // Inject the protocol handler
             acceptor.setHandler( getHandler() );
-            
-            ((AbstractSocketSessionConfig)acceptor.getSessionConfig()).setReadBufferSize( 64*1024 );
-            ((AbstractSocketSessionConfig)acceptor.getSessionConfig()).setSendBufferSize( 64*1024 );
+
+            ( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setReadBufferSize( 64 * 1024 );
+            ( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setSendBufferSize( 64 * 1024 );
 
             // Bind to the configured address
             acceptor.bind();
-            
+
             // We are done !
             started = true;
 
@@ -626,11 +620,11 @@ public class LdapServer extends Director
      */
     private void startConsumers() throws Exception
     {
-        if( providerConfigs != null )
+        if ( providerConfigs != null )
         {
             replConsumers = new ArrayList<SyncReplConsumer>( providerConfigs.size() );
-            
-            for( final SyncreplConfiguration config : providerConfigs )
+
+            for ( final SyncreplConfiguration config : providerConfigs )
             {
                 Runnable consumerTask = new Runnable()
                 {
@@ -645,14 +639,14 @@ public class LdapServer extends Director
                             replConsumers.add( consumer );
                             consumer.startSync();
                         }
-                        catch( Exception e )
+                        catch ( Exception e )
                         {
                             LOG.error( "Failed to start the consumer with config {}", config );
                             throw new RuntimeException( e );
                         }
                     }
                 };
-                
+
                 Thread consumerThread = new Thread( consumerTask );
                 consumerThread.setDaemon( true );
                 consumerThread.start();
@@ -666,17 +660,17 @@ public class LdapServer extends Director
      */
     private void stopConsumers()
     {
-        if( replConsumers != null )
+        if ( replConsumers != null )
         {
-            for( SyncReplConsumer consumer : replConsumers )
+            for ( SyncReplConsumer consumer : replConsumers )
             {
                 LOG.info( "stopping the consumer with id {}", consumer.getConfig().getReplicaId() );
                 consumer.disconnet();
             }
         }
     }
-    
-    
+
+
     public String getName()
     {
         return SERVICE_NAME;
@@ -687,25 +681,24 @@ public class LdapServer extends Director
     {
         return handler;
     }
-    
-    
+
+
     public LdapSessionManager getLdapSessionManager()
     {
         return ldapSessionManager;
     }
-    
-    
+
+
     public ProtocolCodecFactory getProtocolCodecFactory()
     {
         return codecFactory;
     }
 
-    
+
     // ------------------------------------------------------------------------
     // Configuration Methods
     // ------------------------------------------------------------------------
 
-
     /**
      * Registeres the specified {@link ExtendedOperationHandler} to this
      * protocol provider to provide a specific LDAP extended operation.
@@ -800,7 +793,7 @@ public class LdapServer extends Director
         return confidentialityRequired;
     }
 
-    
+
     /**
      * Returns <tt>true</tt> if LDAPS is enabled.
      *
@@ -996,6 +989,7 @@ public class LdapServer extends Director
         return saslMechanismHandlers;
     }
 
+
     public void setSaslMechanismHandlers( Map<String, MechanismHandler> saslMechanismHandlers )
     {
         this.saslMechanismHandlers = saslMechanismHandlers;
@@ -1214,8 +1208,8 @@ public class LdapServer extends Director
     {
         return unbindHandler;
     }
-    
-    
+
+
     /**
      * @return The underlying TCP transport port, or -1 if no transport has been 
      * initialized
@@ -1226,20 +1220,20 @@ public class LdapServer extends Director
         {
             return -1;
         }
-        
-        for ( Transport transport:transports )
+
+        for ( Transport transport : transports )
         {
             if ( transport instanceof UdpTransport )
             {
                 continue;
             }
-            
+
             if ( !transport.isSSLEnabled() )
             {
                 return transport.getPort();
             }
         }
-        
+
         return -1;
     }
 
@@ -1254,23 +1248,24 @@ public class LdapServer extends Director
         {
             return -1;
         }
-        
-        for ( Transport transport:transports )
+
+        for ( Transport transport : transports )
         {
             if ( transport instanceof UdpTransport )
             {
                 continue;
             }
-            
+
             if ( transport.isSSLEnabled() )
             {
                 return transport.getPort();
             }
         }
-        
+
         return -1;
     }
 
+
     /**
      * @param abandonHandler The UnbindRequest handler
      */
@@ -1353,17 +1348,17 @@ public class LdapServer extends Director
     public String toString()
     {
         StringBuilder sb = new StringBuilder();
-        
+
         sb.append( "LdapServer[" ).append( getServiceName() ).append( "], listening on :" ).append( '\n' );
-        
+
         if ( getTransports() != null )
         {
-            for ( Transport transport:getTransports() )
+            for ( Transport transport : getTransports() )
             {
                 sb.append( "    " ).append( transport ).append( '\n' );
             }
         }
-        
+
         return sb.toString();
     }
 }

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=985467&r1=985466&r2=985467&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 Sat Aug 14 11:32:40 2010
@@ -64,7 +64,7 @@ public class ExtendedHandler extends Lda
                 + ": 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] );
+            resp.setResponseValue( new byte[0] );
             session.getIoSession().write( req.getResultResponse() );
         }
     }

Modified: directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.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/StartTlsHandler.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java (original)
+++ directory/apacheds/branches/apacheds-codec-merge/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/StartTlsHandler.java Sat Aug 14 11:32:40 2010
@@ -93,8 +93,8 @@ public class StartTlsHandler implements 
         InternalExtendedResponse res = new ExtendedResponseImpl( req.getMessageId() );
         InternalLdapResult result = res.getLdapResult();
         result.setResultCode( ResultCodeEnum.SUCCESS );
-        res.setID( EXTENSION_OID );
-        res.setEncodedValue( new byte[0] );
+        res.setResponseName( EXTENSION_OID );
+        res.setResponseValue( new byte[0] );
 
         // Send a response.
         session.getIoSession().setAttribute( SslFilter.DISABLE_ENCRYPTION_ONCE );

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=985467&r1=985466&r2=985467&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 Sat Aug 14 11:32:40 2010
@@ -104,7 +104,7 @@ public class StoredProcedureExtendedOper
         Object response = engine.invokeProcedure( session.getCoreSession(), procedure, values );
 
         byte[] serializedResponse = SerializationUtils.serialize( ( Serializable ) response );
-        ( ( InternalExtendedResponse ) ( req.getResultResponse() ) ).setEncodedValue( serializedResponse );
+        ( ( InternalExtendedResponse ) ( req.getResultResponse() ) ).setResponseValue( serializedResponse );
         session.getIoSession().write( req.getResultResponse() );
 
     }

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=985467&r1=985466&r2=985467&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 Sat Aug 14 11:32:40 2010
@@ -512,23 +512,24 @@ public class LdapProtocolEncoder extends
      * 
      * @return The ExtendedResponse length
      */
-    private int computeExtendedResponseLength( InternalExtendedResponse extendedResponse )
+    private int computeExtendedResponseLength( InternalExtendedResponse internalExtendedResponse )
     {
+        ExtendedResponseImpl extendedResponse = ( ExtendedResponseImpl ) internalExtendedResponse;
         int ldapResultLength = computeLdapResultLength( extendedResponse.getLdapResult() );
 
         int extendedResponseLength = ldapResultLength;
 
-        String id = extendedResponse.getID();
+        String id = extendedResponse.getResponseName();
 
         if ( id != null )
         {
             byte[] idBytes = StringTools.getBytesUtf8( id );
-            extendedResponse.setIDBytes( idBytes );
+            extendedResponse.setResponseNameBytes( idBytes );
             int idLength = idBytes.length;
             extendedResponseLength += 1 + TLV.getNbBytes( idLength ) + idLength;
         }
 
-        byte[] encodedValue = extendedResponse.getEncodedValue();
+        byte[] encodedValue = extendedResponse.getResponseValue();
 
         if ( encodedValue != null )
         {
@@ -994,7 +995,7 @@ public class LdapProtocolEncoder extends
             encodeLdapResult( buffer, extendedResponse.getLdapResult() );
 
             // The ID, if any
-            byte[] idBytes = extendedResponse.getIDBytes();
+            byte[] idBytes = extendedResponse.getResponseNameBytes();
 
             if ( idBytes != null )
             {
@@ -1008,7 +1009,7 @@ public class LdapProtocolEncoder extends
             }
 
             // The encodedValue, if any
-            byte[] encodedValue = extendedResponse.getEncodedValue();
+            byte[] encodedValue = extendedResponse.getResponseValue();
 
             if ( encodedValue != null )
             {

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java Sat Aug 14 11:32:40 2010
@@ -69,11 +69,11 @@ public class ResponseAction extends Gram
         // OID
         if ( tlv.getLength() == 0 )
         {
-            extendedResponse.setEncodedValue( StringTools.EMPTY_BYTES );
+            extendedResponse.setResponseValue( StringTools.EMPTY_BYTES );
         }
         else
         {
-            extendedResponse.setEncodedValue( tlv.getValue().getData() );
+            extendedResponse.setResponseValue( tlv.getValue().getData() );
         }
 
         // We can have an END transition
@@ -81,7 +81,7 @@ public class ResponseAction extends Gram
 
         if ( IS_DEBUG )
         {
-            log.debug( "Extended value : {}", extendedResponse.getEncodedValue() );
+            log.debug( "Extended value : {}", extendedResponse.getResponseValue() );
         }
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java Sat Aug 14 11:32:40 2010
@@ -76,7 +76,8 @@ public class ResponseNameAction extends 
         }
         else
         {
-            extendedResponse.setID( new OID( StringTools.asciiBytesToString( tlv.getValue().getData() ) ).toString() );
+            extendedResponse.setResponseName( new OID( StringTools.asciiBytesToString( tlv.getValue().getData() ) )
+                .toString() );
         }
 
         // We can have an END transition
@@ -84,7 +85,7 @@ public class ResponseNameAction extends 
 
         if ( IS_DEBUG )
         {
-            log.debug( "OID read : {}", extendedResponse.getID() );
+            log.debug( "OID read : {}", extendedResponse.getResponseName() );
         }
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/AddResponseImpl.java Sat Aug 14 11:32:40 2010
@@ -53,36 +53,36 @@ public class AddResponseImpl extends Int
 
 
     /**
-     * Get a String representation of an AddResponse
-     * 
-     * @return An AddResponse String
+     * {@inheritDoc}
      */
-    public String toString()
+    public void setAddResponseLength( int addResponseLength )
     {
-
-        StringBuffer sb = new StringBuffer();
-
-        sb.append( "    Add Response\n" );
-        sb.append( super.toString() );
-
-        return sb.toString();
+        this.addResponseLength = addResponseLength;
     }
 
 
     /**
      * {@inheritDoc}
      */
-    public void setAddResponseLength( int addResponseLength )
+    public int getAddResponseLength()
     {
-        this.addResponseLength = addResponseLength;
+        return addResponseLength;
     }
 
 
     /**
-     * {@inheritDoc}
+     * Get a String representation of an AddResponse
+     * 
+     * @return An AddResponse String
      */
-    public int getAddResponseLength()
+    public String toString()
     {
-        return addResponseLength;
+
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Add Response\n" );
+        sb.append( super.toString() );
+
+        return sb.toString();
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/BindResponseImpl.java Sat Aug 14 11:32:40 2010
@@ -168,13 +168,32 @@ public class BindResponseImpl extends In
 
 
     /**
+     * {@inheritDoc}
+     */
+    public void setBindResponseLength( int bindResponseLength )
+    {
+        this.bindResponseLength = bindResponseLength;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getBindResponseLength()
+    {
+        return bindResponseLength;
+    }
+
+
+    /**
      * Get a String representation of a BindResponse
      * 
      * @return A BindResponse String
      */
     public String toString()
     {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
+
         sb.append( "    BindResponse\n" );
         sb.append( super.toString() );
 
@@ -186,22 +205,4 @@ public class BindResponseImpl extends In
 
         return sb.toString();
     }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void setBindResponseLength( int bindResponseLength )
-    {
-        this.bindResponseLength = bindResponseLength;
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public int getBindResponseLength()
-    {
-        return bindResponseLength;
-    }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/CompareResponseImpl.java Sat Aug 14 11:32:40 2010
@@ -42,10 +42,9 @@ public class CompareResponseImpl extends
 
 
     /**
-     * Creates a Lockable CompareResponse as a reply to an CompareRequest.
+     * Creates a CompareResponse as a reply to an CompareRequest.
      * 
-     * @param id
-     *            the session unique message id
+     * @param id the session unique message id
      */
     public CompareResponseImpl( final int id )
     {
@@ -77,7 +76,23 @@ public class CompareResponseImpl extends
      */
     public boolean isTrue()
     {
-        return getLdapResult().getResultCode() == ResultCodeEnum.COMPARE_TRUE;
+        return ldapResult.getResultCode() == ResultCodeEnum.COMPARE_TRUE;
     }
 
+
+    /**
+     * Get a String representation of an CompareResponse
+     * 
+     * @return An CompareResponse String
+     */
+    public String toString()
+    {
+
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Compare Response\n" );
+        sb.append( super.toString() );
+
+        return sb.toString();
+    }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/DeleteResponseImpl.java Sat Aug 14 11:32:40 2010
@@ -44,8 +44,7 @@ public class DeleteResponseImpl extends 
     /**
      * Creates a DeleteResponse as a reply to an DeleteRequest.
      * 
-     * @param id
-     *            the session unique message id
+     * @param id the session unique message id
      */
     public DeleteResponseImpl( final int id )
     {
@@ -69,4 +68,20 @@ public class DeleteResponseImpl extends 
     {
         return deleteResponseLength;
     }
+
+
+    /**
+     * Get a String representation of a DelResponse
+     * 
+     * @return A DelResponse String
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Compare Response\n" );
+        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=985467&r1=985466&r2=985467&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 Sat Aug 14 11:32:40 2010
@@ -24,6 +24,7 @@ import java.util.Arrays;
 
 import org.apache.directory.shared.ldap.message.internal.InternalAbstractResultResponse;
 import org.apache.directory.shared.ldap.message.internal.InternalExtendedResponse;
+import org.apache.directory.shared.ldap.util.StringTools;
 
 
 /**
@@ -36,13 +37,13 @@ public class ExtendedResponseImpl extend
     static final long serialVersionUID = -6646752766410531060L;
 
     /** Object identifier for the extended response */
-    protected String oid;
+    protected String responseName;
 
     /** The response name as a byte[] */
-    private byte[] oidBytes;
+    private byte[] responseNameBytes;
 
-    /** Values encoded in the extended response payload */
-    protected byte[] value;
+    /** Value encoded in the extended response payload */
+    protected byte[] responseValue;
 
     /** The encoded extendedResponse length */
     private int extendedResponseLength;
@@ -56,14 +57,20 @@ public class ExtendedResponseImpl extend
      * Creates an ExtendedResponse as a reply to an ExtendedRequest.
      * 
      * @param id the session unique message id
+     * @param responseName the ExtendedResponse's name
      */
-    public ExtendedResponseImpl( final int id, String oid )
+    public ExtendedResponseImpl( final int id, String responseName )
     {
         super( id, TYPE );
-        this.oid = oid;
+        this.responseName = responseName;
     }
 
 
+    /**
+     * Creates an ExtendedResponse as a reply to an ExtendedRequest.
+     * 
+     * @param id the session unique message id
+     */
     public ExtendedResponseImpl( int id )
     {
         super( id, TYPE );
@@ -74,33 +81,32 @@ public class ExtendedResponseImpl extend
     // ExtendedResponse Interface Method Implementations
     // ------------------------------------------------------------------------
     /**
-     * Sets the response OID specific encoded response values.
+     * Sets the response OID specific encoded response value.
      * 
-     * @param value
-     *            the response specific encoded response values.
+     * @param responseValue the response specific encoded response values.
      */
-    public void setEncodedValue( byte[] value )
+    public void setResponseValue( byte[] responseValue )
     {
-        if ( value != null )
+        if ( responseValue != null )
         {
-            this.value = new byte[value.length];
-            System.arraycopy( value, 0, this.value, 0, value.length );
+            this.responseValue = new byte[responseValue.length];
+            System.arraycopy( responseValue, 0, this.responseValue, 0, responseValue.length );
         }
         else
         {
-            this.value = null;
+            this.responseValue = null;
         }
     }
 
 
     /**
-     * Gets the OID bytes.
+     * Gets the responseName bytes.
      * 
-     * @return the OID bytes of the extended response type.
+     * @return the responseName bytes of the extended response type.
      */
-    public byte[] getIDBytes()
+    public byte[] getResponseNameBytes()
     {
-        return oidBytes;
+        return responseNameBytes;
     }
 
 
@@ -108,11 +114,11 @@ public class ExtendedResponseImpl extend
      * Sets the OID uniquely identifying this extended response (a.k.a. its
      * name).
      * 
-     * @param oid the OID of the extended response type.
+     * @param responseName the OID of the extended response type.
      */
-    public void setID( String oid )
+    public void setResponseName( String responseName )
     {
-        this.oid = oid;
+        this.responseName = responseName;
     }
 
 
@@ -121,9 +127,9 @@ public class ExtendedResponseImpl extend
      * 
      * @param oidBytes the OID bytes of the extended response type.
      */
-    public void setIDBytes( byte[] oidBytes )
+    public void setResponseNameBytes( byte[] responseNameBytes )
     {
-        this.oidBytes = oidBytes;
+        this.responseNameBytes = responseNameBytes;
     }
 
 
@@ -134,14 +140,17 @@ public class ExtendedResponseImpl extend
     public int hashCode()
     {
         int hash = 37;
-        if ( oid != null )
+
+        if ( responseName != null )
         {
-            hash = hash * 17 + oid.hashCode();
+            hash = hash * 17 + responseName.hashCode();
         }
-        if ( value != null )
+
+        if ( responseValue != null )
         {
-            hash = hash * 17 + Arrays.hashCode( value );
+            hash = hash * 17 + Arrays.hashCode( responseValue );
         }
+
         hash = hash * 17 + super.hashCode();
 
         return hash;
@@ -174,32 +183,34 @@ public class ExtendedResponseImpl extend
 
         InternalExtendedResponse resp = ( InternalExtendedResponse ) obj;
 
-        if ( ( oid != null ) && ( resp.getID() == null ) )
+        if ( ( responseName != null ) && ( resp.getResponseName() == null ) )
         {
             return false;
         }
 
-        if ( ( oid == null ) && ( resp.getID() != null ) )
+        if ( ( responseName == null ) && ( resp.getResponseName() != null ) )
         {
             return false;
         }
 
-        if ( ( oid != null ) && ( resp.getID() != null ) && !oid.equals( resp.getID() ) )
+        if ( ( responseName != null ) && ( resp.getResponseName() != null )
+            && !responseName.equals( resp.getResponseName() ) )
         {
             return false;
         }
 
-        if ( ( value != null ) && ( resp.getEncodedValue() == null ) )
+        if ( ( responseValue != null ) && ( resp.getResponseValue() == null ) )
         {
             return false;
         }
 
-        if ( ( value == null ) && ( resp.getEncodedValue() != null ) )
+        if ( ( responseValue == null ) && ( resp.getResponseValue() != null ) )
         {
             return false;
         }
 
-        if ( ( value != null ) && ( resp.getEncodedValue() != null ) && !Arrays.equals( value, resp.getEncodedValue() ) )
+        if ( ( responseValue != null ) && ( resp.getResponseValue() != null )
+            && !Arrays.equals( responseValue, resp.getResponseValue() ) )
         {
             return false;
         }
@@ -212,34 +223,54 @@ public class ExtendedResponseImpl extend
      * Gets the OID uniquely identifying this extended response (a.k.a. its
      * name).
      * 
-     * @return the OID of the extended response type.
+     * @return the responseName of the extended response
      */
-    public String getID()
+    public String getResponseName()
     {
-        return oid;
+        return responseName;
     }
 
 
     /**
-     * Gets the reponse OID specific encoded response values.
+     * Gets the response OID specific encoded response values.
      * 
-     * @return the response specific encoded response values.
+     * @return the response specific encoded response value
      */
-    public byte[] getEncodedValue()
+    public byte[] getResponseValue()
     {
-        if ( value == null )
+        if ( responseValue == null )
         {
             return null;
         }
 
-        final byte[] copy = new byte[value.length];
-        System.arraycopy( value, 0, copy, 0, value.length );
+        final byte[] copy = new byte[responseValue.length];
+        System.arraycopy( responseValue, 0, copy, 0, responseValue.length );
         return copy;
     }
 
 
     /**
      * {@inheritDoc}
+     * @deprecated Use the {@link #getResponseValue()} method
+     */
+    public byte[] getEncodedValue()
+    {
+        return getResponseValue();
+    }
+
+
+    /**
+     * {@inheritDoc}
+     * @deprecated Use the {@link #getResponseName()} method
+     */
+    public String getID()
+    {
+        return getResponseName();
+    }
+
+
+    /**
+     * {@inheritDoc}
      */
     public void setExtendedResponseLength( int extendedResponseLength )
     {
@@ -254,4 +285,31 @@ public class ExtendedResponseImpl extend
     {
         return extendedResponseLength;
     }
+
+
+    /**
+     * Get a String representation of an ExtendedResponse
+     * 
+     * @return An ExtendedResponse String
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( "    Extended Response\n" );
+
+        if ( responseName != null )
+        {
+            sb.append( "        ResponseName :'" ).append( responseName ).append( "'\n" );
+        }
+
+        if ( responseValue != null )
+        {
+            sb.append( "        ResponseValue :'" ).append( StringTools.dumpBytes( responseValue ) ).append( "'\n" );
+        }
+
+        sb.append( super.toString() );
+
+        return sb.toString();
+    }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulDisconnect.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulDisconnect.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulDisconnect.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/GracefulDisconnect.java Sat Aug 14 11:32:40 2010
@@ -67,18 +67,20 @@ public class GracefulDisconnect extends 
     private InternalReferral replicatedContexts = new ReferralImpl();
 
 
-    public GracefulDisconnect( byte[] value ) throws DecoderException
+    public GracefulDisconnect( byte[] responseValue ) throws DecoderException
     {
         super( 0, EXTENSION_OID );
-        if ( value != null )
+
+        if ( responseValue != null )
         {
-            this.value = new byte[value.length];
-            System.arraycopy( value, 0, this.value, 0, value.length );
+            this.responseValue = new byte[responseValue.length];
+            System.arraycopy( responseValue, 0, this.responseValue, 0, responseValue.length );
         }
         else
         {
-            this.value = null;
+            this.responseValue = null;
         }
+
         decodeValue();
     }
 
@@ -86,7 +88,7 @@ public class GracefulDisconnect extends 
     public GracefulDisconnect( int timeOffline, int delay )
     {
         super( 0, EXTENSION_OID );
-        super.oid = EXTENSION_OID;
+        responseName = EXTENSION_OID;
         this.timeOffline = timeOffline;
         this.delay = delay;
 
@@ -94,9 +96,9 @@ public class GracefulDisconnect extends 
         buf.append( "The server will disconnect and will be unavailable for " ).append( timeOffline );
         buf.append( " minutes in " ).append( delay ).append( " seconds." );
 
-        super.getLdapResult().setErrorMessage( buf.toString() );
-        super.getLdapResult().setMatchedDn( null );
-        super.getLdapResult().setResultCode( ResultCodeEnum.UNAVAILABLE );
+        ldapResult.setErrorMessage( buf.toString() );
+        ldapResult.setMatchedDn( null );
+        ldapResult.setResultCode( ResultCodeEnum.UNAVAILABLE );
 
         encodeResponse();
     }
@@ -110,15 +112,15 @@ public class GracefulDisconnect extends 
         try
         {
             codec = ( org.apache.directory.shared.ldap.codec.extended.operations.gracefulDisconnect.GracefulDisconnect ) decoder
-                .decode( value );
+                .decode( responseValue );
             this.timeOffline = codec.getTimeOffline();
             this.delay = codec.getDelay();
-            super.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
+            ldapResult.setResultCode( ResultCodeEnum.SUCCESS );
             List<LdapURL> contexts = codec.getReplicatedContexts();
 
-            for ( int ii = 0; ii < contexts.size(); ii++ )
+            for ( LdapURL ldapUrl : contexts )
             {
-                replicatedContexts.addLdapUrl( contexts.get( ii ).toString() );
+                replicatedContexts.addLdapUrl( ldapUrl.toString() );
             }
         }
         catch ( DecoderException e )
@@ -136,25 +138,26 @@ public class GracefulDisconnect extends 
         codec.setDelay( this.delay );
         Iterator<String> contexts = this.replicatedContexts.getLdapUrls().iterator();
 
-        while ( contexts.hasNext() )
+        for ( String ldapUrlStr : replicatedContexts.getLdapUrls() )
         {
-            String urlstr = ( String ) contexts.next();
-            LdapURL url = null;
+            LdapURL ldapUrl = null;
+
             try
             {
-                url = new LdapURL( urlstr );
+                ldapUrl = new LdapURL( ldapUrlStr );
             }
             catch ( LdapURLEncodingException e )
             {
-                log.error( I18n.err( I18n.ERR_04170, urlstr ), e );
+                log.error( I18n.err( I18n.ERR_04170, ldapUrlStr ), e );
                 continue;
             }
-            codec.addReplicatedContexts( url );
+
+            codec.addReplicatedContexts( ldapUrl );
         }
 
         try
         {
-            super.value = codec.encode().array();
+            super.responseValue = codec.encode().array();
         }
         catch ( EncoderException e )
         {
@@ -169,19 +172,19 @@ public class GracefulDisconnect extends 
     // ------------------------------------------------------------------------
 
     /**
-     * Gets the reponse OID specific encoded response values.
+     * Gets the response OID specific encoded response values.
      * 
      * @return the response specific encoded response values.
      */
-    public byte[] getResponse()
+    public byte[] getResponseValue()
     {
-        if ( value == null )
+        if ( responseValue == null )
         {
             encodeResponse();
         }
 
-        final byte[] copy = new byte[value.length];
-        System.arraycopy( value, 0, copy, 0, value.length );
+        final byte[] copy = new byte[responseValue.length];
+        System.arraycopy( responseValue, 0, copy, 0, responseValue.length );
         return copy;
     }
 
@@ -189,14 +192,14 @@ public class GracefulDisconnect extends 
     /**
      * Sets the reponse OID specific encoded response values.
      * 
-     * @param value
-     *            the response specific encoded response values.
+     * @param value the response specific encoded response values.
      */
-    public void setResponse( byte[] value )
+    public void setResponseValue( byte[] responseValue )
     {
-        ByteBuffer bb = ByteBuffer.wrap( value );
+        ByteBuffer bb = ByteBuffer.wrap( responseValue );
         GracefulDisconnectContainer container = new GracefulDisconnectContainer();
         Asn1Decoder decoder = new Asn1Decoder();
+
         try
         {
             decoder.decode( bb, container );
@@ -212,20 +215,19 @@ public class GracefulDisconnect extends 
         this.timeOffline = codec.getTimeOffline();
         List<LdapURL> contexts = codec.getReplicatedContexts();
 
-        for ( int ii = 0; ii < contexts.size(); ii++ )
+        for ( LdapURL ldapUrl : codec.getReplicatedContexts() )
         {
-            LdapURL url = contexts.get( ii );
-            replicatedContexts.addLdapUrl( url.toString() );
+            replicatedContexts.addLdapUrl( ldapUrl.toString() );
         }
 
-        if ( value != null )
+        if ( responseValue != null )
         {
-            this.value = new byte[value.length];
-            System.arraycopy( value, 0, this.value, 0, value.length );
+            this.responseValue = new byte[responseValue.length];
+            System.arraycopy( responseValue, 0, this.responseValue, 0, responseValue.length );
         }
         else
         {
-            this.value = null;
+            this.responseValue = null;
         }
     }
 
@@ -246,8 +248,7 @@ public class GracefulDisconnect extends 
      * Sets the OID uniquely identifying this extended response (a.k.a. its
      * name).
      * 
-     * @param oid
-     *            the OID of the extended response type.
+     * @param oid the OID of the extended response type.
      */
     public void setResponseName( String oid )
     {

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=985467&r1=985466&r2=985467&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 Sat Aug 14 11:32:40 2010
@@ -99,8 +99,8 @@ public class StoredProcedureRequest exte
         throws NamingException
     {
         StoredProcedureResponse resp = ( StoredProcedureResponse ) getResultResponse();
-        resp.setEncodedValue( berValue );
-        resp.setID( id );
+        resp.setResponseValue( berValue );
+        resp.setResponseName( id );
         return resp;
     }
 
@@ -135,7 +135,7 @@ public class StoredProcedureRequest exte
         if ( response == null )
         {
             StoredProcedureResponse spr = new StoredProcedureResponse( getMessageId() );
-            spr.setID( EXTENSION_OID );
+            spr.setResponseName( EXTENSION_OID );
             response = spr;
         }
 

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureResponse.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureResponse.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/extended/StoredProcedureResponse.java Sat Aug 14 11:32:40 2010
@@ -32,5 +32,4 @@ public class StoredProcedureResponse ext
 
     private static final long serialVersionUID = 1L;
     public static final String EXTENSION_OID = "1.3.6.1.4.1.18060.0.1.7";
-
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractMessage.java Sat Aug 14 11:32:40 2010
@@ -41,7 +41,7 @@ public abstract class InternalAbstractMe
     static final long serialVersionUID = 7601738291101182094L;
 
     /** Map of message controls using OID Strings for keys and Control values */
-    private final Map<String, Control> controls;
+    protected final Map<String, Control> controls;
 
     /** The encoded controls length */
     private int controlsLength;

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalAbstractResultResponse.java Sat Aug 14 11:32:40 2010
@@ -22,6 +22,7 @@ package org.apache.directory.shared.ldap
 
 import org.apache.directory.shared.ldap.codec.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.LdapResultImpl;
+import org.apache.directory.shared.ldap.message.control.Control;
 
 
 /**
@@ -32,7 +33,7 @@ import org.apache.directory.shared.ldap.
 public abstract class InternalAbstractResultResponse extends InternalAbstractResponse implements InternalResultResponse
 {
     /** Response result components */
-    private InternalLdapResult result = new LdapResultImpl();
+    protected InternalLdapResult ldapResult = new LdapResultImpl();
 
 
     // ------------------------------------------------------------------------
@@ -62,7 +63,7 @@ public abstract class InternalAbstractRe
      */
     public InternalLdapResult getLdapResult()
     {
-        return result;
+        return ldapResult;
     }
 
 
@@ -115,17 +116,17 @@ public abstract class InternalAbstractRe
 
         InternalResultResponse resp = ( InternalResultResponse ) obj;
 
-        if ( getLdapResult() != null && resp.getLdapResult() == null )
+        if ( ldapResult != null && resp.getLdapResult() == null )
         {
             return false;
         }
 
-        if ( getLdapResult() == null && resp.getLdapResult() != null )
+        if ( ldapResult == null && resp.getLdapResult() != null )
         {
             return false;
         }
 
-        if ( getLdapResult() != null && resp.getLdapResult() != null && !getLdapResult().equals( resp.getLdapResult() ) )
+        if ( ( ldapResult != null ) && ( resp.getLdapResult() != null ) && !ldapResult.equals( resp.getLdapResult() ) )
         {
             return false;
         }
@@ -141,13 +142,18 @@ public abstract class InternalAbstractRe
      */
     public String toString()
     {
-        if ( result != null )
-        {
-            return result.toString();
-        }
-        else
+        StringBuilder sb = new StringBuilder();
+
+        sb.append( ldapResult );
+
+        if ( ( controls != null ) && ( controls.size() != 0 ) )
         {
-            return "No result";
+            for ( Control control : controls.values() )
+            {
+                sb.append( control );
+            }
         }
+
+        return sb.toString();
     }
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedResponse.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedResponse.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedResponse.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/main/java/org/apache/directory/shared/ldap/message/internal/InternalExtendedResponse.java Sat Aug 14 11:32:40 2010
@@ -41,15 +41,7 @@ public interface InternalExtendedRespons
      * 
      * @return the OID of the extended response type.
      */
-    String getID();
-
-
-    /**
-     * Gets the OID bytes.
-     * 
-     * @return the OID bytes of the extended response type.
-     */
-    byte[] getIDBytes();
+    String getResponseName();
 
 
     /**
@@ -58,43 +50,21 @@ public interface InternalExtendedRespons
      * 
      * @param oidv the OID of the extended response type.
      */
-    void setID( String oid );
-
-
-    /**
-     * Sets the OID bytes.
-     * 
-     * @param oidBytes the OID bytes of the extended response type.
-     */
-    void setIDBytes( byte[] oidBytes );
+    void setResponseName( String oid );
 
 
     /**
-     * Gets the reponse OID specific encoded response values.
+     * Gets the response OID specific encoded response values.
      * 
      * @return the response specific encoded response values.
      */
-    byte[] getEncodedValue();
+    byte[] getResponseValue();
 
 
     /**
-     * Sets the reponse OID specific encoded response values.
+     * Sets the response OID specific encoded response values.
      * 
-     * @param value
-     *            the response specific encoded response values.
-     */
-    void setEncodedValue( byte[] value );
-
-
-    /**
-     * Stores the encoded length for the ExtendedResponse
-     * @param extendedResponseLength The encoded length
-     */
-    void setExtendedResponseLength( int extendedResponseLength );
-
-
-    /**
-     * @return The encoded ExtendedResponse's length
+     * @param responseValue the response specific encoded response values.
      */
-    int getExtendedResponseLength();
+    void setResponseValue( byte[] responseValue );
 }

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=985467&r1=985466&r2=985467&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 Sat Aug 14 11:32:40 2010
@@ -18,9 +18,9 @@
  *  
  */
 
-
 package org.apache.directory.shared.ldap.sp;
 
+
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -37,6 +37,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureRequest;
 import org.apache.directory.shared.ldap.message.extended.StoredProcedureResponse;
 
+
 /**
  * A utility class for working with Java Stored Procedures at the base level.
  *
@@ -45,7 +46,6 @@ import org.apache.directory.shared.ldap.
 public class JavaStoredProcUtils
 {
 
-    
     /**
      * Returns the stream data of a Java class.
      * 
@@ -66,7 +66,7 @@ public class JavaStoredProcUtils
         File file = new File( url.getFile() );
         int size = ( int ) file.length();
         byte[] buf = new byte[size];
-        
+
         try
         {
             in.read( buf );
@@ -78,10 +78,11 @@ public class JavaStoredProcUtils
             ne.setRootCause( e );
             throw ne;
         }
-        
+
         return buf;
     }
-    
+
+
     /**
      * Loads a Java class's stream data as a subcontext of an LdapContext given.
      * 
@@ -96,21 +97,23 @@ public class JavaStoredProcUtils
     {
         byte[] buf = getClassFileAsStream( clazz );
         String fullClassName = clazz.getName();
-        
+
         Attributes attributes = new BasicAttributes( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, true );
         attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "storedProcUnit" );
         attributes.get( SchemaConstants.OBJECT_CLASS_AT ).add( "javaStoredProcUnit" );
         attributes.put( "storedProcLangId", "Java" );
         attributes.put( "storedProcUnitName", fullClassName );
         attributes.put( "javaByteCode", buf );
-        
-        ctx.createSubcontext( "storedProcUnitName=" + fullClassName , attributes );
+
+        ctx.createSubcontext( "storedProcUnitName=" + fullClassName, attributes );
     }
-    
-    public static Object callStoredProcedure( LdapContext ctx, String procedureName, Object[] arguments ) throws NamingException
+
+
+    public static Object callStoredProcedure( LdapContext ctx, String procedureName, Object[] arguments )
+        throws NamingException
     {
         String language = "Java";
-        
+
         Object responseObject;
         try
         {
@@ -118,7 +121,7 @@ public class JavaStoredProcUtils
              * Create a new stored procedure execution request.
              */
             StoredProcedureRequest req = new StoredProcedureRequest( 0, procedureName, language );
-            
+
             /**
              * For each argument UTF-8-encode the type name
              * and Java-serialize the value
@@ -132,17 +135,17 @@ public class JavaStoredProcUtils
                 value = SerializationUtils.serialize( ( Serializable ) arguments[i] );
                 req.addParameter( type, value );
             }
-            
+
             /**
              * Call the stored procedure via the extended operation
              * and get back its return value.
              */
             StoredProcedureResponse resp = ( StoredProcedureResponse ) ctx.extendedOperation( req );
-            
+
             /**
              * Restore a Java object from the return value.
              */
-            byte[] responseStream = resp.getEncodedValue();
+            byte[] responseStream = resp.getResponseValue();
             responseObject = SerializationUtils.deserialize( responseStream );
         }
         catch ( Exception e )
@@ -151,8 +154,8 @@ public class JavaStoredProcUtils
             ne.setRootCause( e );
             throw ne;
         }
-        
+
         return responseObject;
     }
-    
+
 }

Modified: directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java?rev=985467&r1=985466&r2=985467&view=diff
==============================================================================
--- directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java (original)
+++ directory/shared/branches/shared-codec-merge/ldap/src/test/java/org/apache/directory/shared/ldap/message/ExtendedResponseImplTest.java Sat Aug 14 11:32:40 2010
@@ -59,8 +59,8 @@ public class ExtendedResponseImplTest
     {
         // Construct the Search response to test with results and referrals
         ExtendedResponseImpl response = new ExtendedResponseImpl( 45 );
-        response.setEncodedValue( "Hello World!".getBytes() );
-        response.setID( "1.1.1.1" );
+        response.setResponseValue( "Hello World!".getBytes() );
+        response.setResponseName( "1.1.1.1" );
         InternalLdapResult result = response.getLdapResult();
 
         try
@@ -124,7 +124,18 @@ public class ExtendedResponseImplTest
             }
 
 
-            public void setID( String a_oid )
+            public String getResponseName()
+            {
+                return "1.1.1.1";
+            }
+
+
+            public void setID( String oid )
+            {
+            }
+
+
+            public void setResponseName( String oid )
             {
             }
 
@@ -135,7 +146,18 @@ public class ExtendedResponseImplTest
             }
 
 
-            public void setEncodedValue( byte[] a_value )
+            public byte[] getResponseValue()
+            {
+                return "Hello World!".getBytes();
+            }
+
+
+            public void setEncodedValue( byte[] value )
+            {
+            }
+
+
+            public void setResponseValue( byte[] value )
             {
             }
 
@@ -243,17 +265,6 @@ public class ExtendedResponseImplTest
             }
 
 
-            public int getExtendedResponseLength()
-            {
-                return 0;
-            }
-
-
-            public void setExtendedResponseLength( int extendedResponseLength )
-            {
-            }
-
-
             public byte[] getIDBytes()
             {
                 return null;
@@ -314,9 +325,9 @@ public class ExtendedResponseImplTest
     public void testNotEqualsDiffNames()
     {
         ExtendedResponseImpl resp0 = createStub();
-        resp0.setID( "1.2.3.4" );
+        resp0.setResponseName( "1.2.3.4" );
         ExtendedResponseImpl resp1 = createStub();
-        resp1.setID( "1.2.3.4.5" );
+        resp1.setResponseName( "1.2.3.4.5" );
 
         assertFalse( resp0.equals( resp1 ) );
         assertFalse( resp1.equals( resp0 ) );
@@ -330,9 +341,9 @@ public class ExtendedResponseImplTest
     public void testNotEqualsDiffResponses()
     {
         ExtendedResponseImpl resp0 = createStub();
-        resp0.setEncodedValue( "abc".getBytes() );
+        resp0.setResponseValue( "abc".getBytes() );
         ExtendedResponseImpl resp1 = createStub();
-        resp1.setEncodedValue( "123".getBytes() );
+        resp1.setResponseValue( "123".getBytes() );
 
         assertFalse( resp0.equals( resp1 ) );
         assertFalse( resp1.equals( resp0 ) );



Mime
View raw message