directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 37431 - in incubator/directory/eve/branches/multi-listener/frontend: api/src/java/org/apache/eve/decoder api/src/java/org/apache/eve/encoder api/src/java/org/apache/eve/event api/src/java/org/apache/eve/processor api/src/java/org/apache/eve/protocol api/src/java/org/apache/eve/seda impl/src/java/org/apache/eve/decoder impl/src/java/org/apache/eve/encoder impl/src/java/org/apache/eve/processor impl/src/test/org/apache/eve/decoder
Date Thu, 02 Sep 2004 22:19:10 GMT
Author: akarasulu
Date: Thu Sep  2 15:19:09 2004
New Revision: 37431

Added:
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/ProtocolProvider.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/ProtocolRegistry.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/RequestHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/encoder/EncoderManagerMonitorAdapter.java
Removed:
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/AbandonHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/AddHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/BindHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/CompareHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/DefaultHandlerRegistry.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/DeleteHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/ExtendedHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/HandlerRegistry.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/ModifyDnHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/ModifyHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/SearchHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/UnbindHandler.java
Modified:
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/decoder/ClientDecoder.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/decoder/DecoderManager.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/encoder/EncoderManager.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/event/RequestEvent.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/event/ResponseEvent.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/processor/RequestProcessor.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/processor/RequestProcessorMonitor.java
   incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/seda/StageMonitor.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DecodeStageHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DefaultDecoderManager.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/encoder/DefaultEncoderManager.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/DefaultRequestProcessor.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/ManyReplyHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/NoReplyHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/RequestHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/RequestProcessorMonitorAdapter.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/SingleReplyHandler.java
   incubator/directory/eve/branches/multi-listener/frontend/impl/src/test/org/apache/eve/decoder/DefaultDecoderManagerTest.java
Log:
Summary:

Removed all LDAP dependencies in frontend plumbing in prep for creation of
the initial jinetd subproject.  Slowly formulating baseline architecture.

Commit changes:

 o removed references to LDAP message framework in events
 o using objects to represent requests and responses instead of LDAP interfaces
 o removed deps on LDAP encoders and decoders leaving stubs for now
 o altered handler design in process to accomodate any protocol
 
Things todo:

 o need to finalize the handler interfaces
 o need to add response serialization for multi-part responses
 o change maven deps 
 o alter project layout now that all is frontend
 o remove backend since this is eve specific
 o write lots of test code
 o figure out the best way to have protocol integration
 o start refactoring eve so it uses this
 o consider consolidating api & impl?
 o fix merlin wrapper project to account for changes



Modified: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/decoder/ClientDecoder.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/decoder/ClientDecoder.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/decoder/ClientDecoder.java	Thu Sep  2 15:19:09 2004
@@ -57,7 +57,7 @@
     
 
     /* (non-Javadoc)
-     * @see org.apache.commons.codec.stateful.StatefulDecoder#decode(
+     * @see org.apache.commons.codec.stateful.StatefulDecoder#decodeNonBlocking(
      * java.lang.Object)
      */
     public void decode( Object encoded ) throws DecoderException

Modified: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/decoder/DecoderManager.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/decoder/DecoderManager.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/decoder/DecoderManager.java	Thu Sep  2 15:19:09 2004
@@ -14,16 +14,16 @@
  *   limitations under the License.
  *
  */
-package org.apache.eve.decoder ;
+package org.apache.eve.decoder;
 
 
-import java.nio.ByteBuffer ;
+import java.nio.ByteBuffer;
 
-import org.apache.eve.listener.ClientKey ;
+import org.apache.eve.listener.ClientKey;
 
-import org.apache.commons.codec.DecoderException ;
-import org.apache.commons.codec.stateful.DecoderMonitor ;
-import org.apache.commons.codec.stateful.DecoderCallback ;
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.stateful.DecoderMonitor;
+import org.apache.commons.codec.stateful.DecoderCallback;
 
 
 /**
@@ -37,49 +37,26 @@
  */
 public interface DecoderManager
 {
-    /** Avalon likes to have the ROLE associated with the service interface */
-    String ROLE = DecoderManager.class.getName() ;
-
-    /**
-     * Sets a client decoder's callback.
-     * 
-     * @param key the unique key associated with the client
-     * @param cb the decoder callback used to deliver decode events to
-     */
-    void setCallback( ClientKey key, DecoderCallback cb ) ;
-
-    /**
-     * Sets a client decoder's monitor.
-     * 
-     * @param key the unique key associated with the client
-     * @param monitor the monitor used to deliver events
-     */
-    void setDecoderMonitor( ClientKey key, DecoderMonitor monitor ) ;
-
-    /**
-     * Disables callback events for a client destroying decoding state if any.
-     * 
-     * @param key the unique key associated with the client
-     */
-    boolean disable( ClientKey key ) ;
-
     /**
-     * Decodes a buffer of encoded data.
+     * Decodes a chunk buffer of encoded data without blocking.  The chunk may
+     * contain one or more fragments of a message without necessarily containing
+     * an entire message.
      * 
      * @param key the unique key associated with the client
      * @param buffer the buffer of encoded data
-     * @return the set of keys for decoding sessions
      * @throws DecoderException if there is a failure while decoding
      */
-    void decode( ClientKey key, ByteBuffer buffer ) throws DecoderException ;
+    void decodeNonBlocking( ClientKey key, ByteBuffer buffer )
+            throws DecoderException;
     
     /**
-     * One shot synchronous decode operation requiring a complete unit of 
-     * encoded data to return the decoded equivalent immediately.
+     * One shot blocking operation requiring a single complete unit of encoded
+     * data to return the decoded request object immediately.
      * 
-     * @param buffer the buffer containing all the encoded data
-     * @return the decoded object
+     * @param buffer the buffer containing a single encoded message
+     * @return the decoded object representing the message
      * @throws DecoderException if there is a failure while decoding
      */
-    Object decode( ByteBuffer buffer ) throws DecoderException ;
+    Object decodeBlocking( ClientKey key, ByteBuffer buffer )
+            throws DecoderException;
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/encoder/EncoderManager.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/encoder/EncoderManager.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/encoder/EncoderManager.java	Thu Sep  2 15:19:09 2004
@@ -16,24 +16,31 @@
  */
 package org.apache.eve.encoder ;
 
+
 import org.apache.commons.codec.EncoderException ;
 
-import org.apache.ldap.common.message.Response ;
+import org.apache.eve.listener.ClientKey;
+
+import java.nio.ByteBuffer;
+
 
 /**
+ * An encoder manager used to encode a protocol specific response message into
+ * a byte buffer.  No requirement is enforced on the protocol or the type of
+ * encoding applied.
  *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public interface EncoderManager
 {
 
     /**
-     * Synchronously encodes an LDAPv3 protocol Response message into a byte
-     * buffer that can be written to a Stream as an BER encoded PDU.
+     * Synchronously encodes a protocol Response message into a byte buffer.
      *
-     * @param a_response the LDAP Response message to be encoded.
+     * @param key the client's key
+     * @param response the protocol response message to be encoded.
      */
-    public byte [] encode( Response a_response ) throws EncoderException ;
+    public ByteBuffer encode( ClientKey key, Object response )
+            throws EncoderException;
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/event/RequestEvent.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/event/RequestEvent.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/event/RequestEvent.java	Thu Sep  2 15:19:09 2004
@@ -18,20 +18,18 @@
 
 
 import org.apache.eve.listener.ClientKey ;
-import org.apache.ldap.common.message.Request ;
 
 
 /**
- * An event used to denote the arrival of a client request.
+ * An event used to denote the arrival of a protocol client request.
  *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public class RequestEvent extends ClientEvent
 {
-    /** the LDAP request message */
-    private final Request request ;
+    /** the request message */
+    private final Object request ;
 
     
     /**
@@ -39,9 +37,9 @@
      *  
      * @param source the source that created this event
      * @param clientKey the key of the client associated with this event
-     * @param request the LDAP request message
+     * @param request the request message
      */
-    public RequestEvent( Object source, ClientKey clientKey, Request request )
+    public RequestEvent( Object source, ClientKey clientKey, Object request )
     {
         super( source, clientKey ) ;
         this.request = request ; 
@@ -49,11 +47,11 @@
     
     
     /**
-     * Gets the LDAP request message associated with this event.
+     * Gets the request message associated with this event.
      * 
-     * @return the LDAP request message associated with this event
+     * @return the request message associated with this event
      */
-    public Request getRequest()
+    public Object getRequest()
     {
         return request ;
     }

Modified: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/event/ResponseEvent.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/event/ResponseEvent.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/event/ResponseEvent.java	Thu Sep  2 15:19:09 2004
@@ -18,7 +18,6 @@
 
 
 import org.apache.eve.listener.ClientKey ;
-import org.apache.ldap.common.message.Response ;
 
 
 /**
@@ -26,14 +25,13 @@
  * only connotates that a response was made not delivered.  The delivery is an
  * output event.
  *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public class ResponseEvent extends ClientEvent
 {
-    /** the LDAP response message */
-    private final Response response ;
+    /** the response message */
+    private final Object response ;
 
     
     /**
@@ -42,10 +40,10 @@
      *  
      * @param source the source that created this event
      * @param clientKey the key of the client associated with this event
-     * @param response the LDAP response message
+     * @param response the response message
      */
     public ResponseEvent( Object source, ClientKey clientKey, 
-                          Response response )
+                          Object response )
     {
         super( source, clientKey ) ;
         this.response = response ;
@@ -53,11 +51,11 @@
     
     
     /**
-     * Gets the LDAP response message associated with this event.
+     * Gets the response message associated with this event.
      * 
-     * @return the LDAP response message associated with this event
+     * @return the response message associated with this event
      */
-    public Response getResponse()
+    public Object getResponse()
     {
         return response ;
     }

Modified: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/processor/RequestProcessor.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/processor/RequestProcessor.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/processor/RequestProcessor.java	Thu Sep  2 15:19:09 2004
@@ -19,7 +19,7 @@
 
 /**
  * A service designed to process request events which denote the arrival, 
- * read, and decode of a client request ready to be handled.
+ * read, and decodeNonBlocking of a client request ready to be handled.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
  * Apache Directory Project</a>

Modified: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/processor/RequestProcessorMonitor.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/processor/RequestProcessorMonitor.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/processor/RequestProcessorMonitor.java	Thu Sep  2 15:19:09 2004
@@ -21,7 +21,6 @@
 
 import org.apache.eve.event.Subscriber ;
 import org.apache.eve.listener.ClientKey ;
-import org.apache.ldap.common.message.Request ;
 
 
 /**
@@ -49,5 +48,5 @@
      * @param request
      * @param t
      */
-    void failedOnSingleReply( ClientKey key, Request request, Throwable t ) ;
+    void failedOnSingleReply( ClientKey key, Object request, Throwable t ) ;
 }

Added: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/ProtocolProvider.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/ProtocolProvider.java	Thu Sep  2 15:19:09 2004
@@ -0,0 +1,39 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.protocol;
+
+
+import org.apache.commons.codec.stateful.StatefulDecoder;
+import org.apache.commons.codec.stateful.StatefulEncoder;
+
+
+/**
+ * Document me.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
+ *         Project</a>
+ * @version $Rev$
+ */
+public interface ProtocolProvider
+{
+    StatefulDecoder getDecoder();
+    StatefulEncoder getEncoder();
+    boolean isNoReply( Object request );
+    boolean isSingleReply( Object request );
+    boolean isMultiReply( Object request );
+    
+}

Added: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/ProtocolRegistry.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/ProtocolRegistry.java	Thu Sep  2 15:19:09 2004
@@ -0,0 +1,70 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.protocol;
+
+
+/**
+ * A protocol registry service.  Components lookup the key(port) to protocol
+ * correspondence using this registry.  The registry need not store standard
+ * port to protocol mappings; it can have a protocol assigned to multiple
+ * ports as well.  This registry will be used to by the listener to bind server
+ * sockets and by other components to switch the apparatus to handle different
+ * protcol requests.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
+ *         Project</a>
+ * @version $Rev$
+ */
+public interface ProtocolRegistry
+{
+    /**
+     * Looks up the ports used for a tcp or udp based protocol.
+     *
+     * @param protocol the protocol descriptor string (unique)
+     * @param isTcp whether or not the protocol ports are tcp or udp based
+     * @return the set of ports servicing the protocol
+     */
+    int[] getPorts( String protocol, boolean isTcp );
+
+    /**
+     * Looks up the protocol associated with a port and a transport.
+     *
+     * @param port the port to check the protocol of
+     * @param isTcp whether or not the protocol port is tcp or udp based
+     * @return the protocol descriptor string or null if the specificed port
+     * is not bound for the protocol on the specified transport
+     */
+    String getProtocol( int port, boolean isTcp );
+
+    /**
+     * Looks up the ports used for a tcp based protocol.
+     *
+     * @param protocol the protocol descriptor string (unique)
+     * @return the set of ports servicing the protocol, or an empty array if
+     * no ports are bound for the protocol
+     */
+    int[] getPorts( String protocol );
+
+    /**
+     * Looks up the protocol associated with a port using a tcp transport.
+     *
+     * @param port the port to check the protocol of
+     * @return the protocol descriptor string, or null if a protocol is not
+     * associated with that port using tcp
+     */
+    String getProtocol( int port );
+}

Added: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/RequestHandler.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/protocol/RequestHandler.java	Thu Sep  2 15:19:09 2004
@@ -0,0 +1,30 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.protocol ;
+
+
+
+/**
+ * Root of all request handler types.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface RequestHandler
+{
+}

Modified: incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/seda/StageMonitor.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/seda/StageMonitor.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/api/src/java/org/apache/eve/seda/StageMonitor.java	Thu Sep  2 15:19:09 2004
@@ -21,7 +21,7 @@
 
 
 /**
- * Interface used to monitor Stage services.
+ * Interface used to monitor Stage protocol.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
  * Apache Directory Project</a>

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DecodeStageHandler.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DecodeStageHandler.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DecodeStageHandler.java	Thu Sep  2 15:19:09 2004
@@ -29,7 +29,7 @@
 
 
 /**
- * A decoder manager's decode StageHandler for use only with enqueued 
+ * A decoder manager's decodeNonBlocking StageHandler for use only with enqueued
  * InputEvents.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
@@ -43,7 +43,7 @@
 
     
     /**
-     * Creates the decoder manager's decode stage handler.
+     * Creates the decoder manager's decodeNonBlocking stage handler.
      * 
      * @param manager the decoder manager this handler is for
      */
@@ -55,7 +55,7 @@
 
     /**
      * Uses the client key to have the decoder manager lookup the client's 
-     * stateful decoder.  The decoder's decode method is called and control is
+     * stateful decoder.  The decoder's decodeNonBlocking method is called and control is
      * returned.  Error handling is left upto the decoder's monitor.
      * 
      * @see org.apache.eve.seda.StageHandler#handleEvent(java.util.EventObject)

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java	Thu Sep  2 15:19:09 2004
@@ -19,8 +19,6 @@
 
 import java.util.EventObject ; 
 
-import org.apache.commons.lang.exception.ExceptionUtils ;
-
 import org.apache.eve.event.Subscriber ;
 
 
@@ -28,8 +26,7 @@
  * An adapter for decoder manager monitors where all failures actually throw
  * a wrapped runtime exception of the throwables they encounter.
  *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public class DecoderManagerMonitorAdapter implements DecoderManagerMonitor
@@ -39,9 +36,12 @@
      * org.apache.eve.event.Subscriber, 
      * java.util.EventObject, java.lang.Throwable)
      */
-    public void 
-        failedOnInform( Subscriber subscriber, EventObject event, Throwable t )
+    public void failedOnInform( Subscriber subscriber, EventObject event,
+                                Throwable t )
     {
-        System.out.println( ExceptionUtils.getFullStackTrace( t ) )     ;
+        if ( t != null )
+        {
+            t.printStackTrace();
+        }
     }
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DefaultDecoderManager.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DefaultDecoderManager.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/decoder/DefaultDecoderManager.java	Thu Sep  2 15:19:09 2004
@@ -14,43 +14,40 @@
  *   limitations under the License.
  *
  */
-package org.apache.eve.decoder ;
+package org.apache.eve.decoder;
 
 
-import java.util.Map ;
-import java.util.HashMap ;
-import java.util.EventObject ;
-
-import java.nio.ByteBuffer ;
-
-import org.apache.ldap.common.message.Request ;
-import org.apache.ldap.common.message.MessageDecoder;
-
-import org.apache.eve.event.InputEvent ;
-import org.apache.eve.seda.StageConfig ;
-import org.apache.eve.event.EventRouter ;
-import org.apache.eve.seda.DefaultStage ;
-import org.apache.eve.listener.ClientKey ;
-import org.apache.eve.event.ConnectEvent ;
-import org.apache.eve.event.RequestEvent ;
-import org.apache.eve.event.DisconnectEvent ;
-import org.apache.eve.event.InputSubscriber ;
-import org.apache.eve.event.ConnectSubscriber ;
-import org.apache.eve.seda.LoggingStageMonitor ;
-import org.apache.eve.event.AbstractSubscriber ;
-import org.apache.eve.event.DisconnectSubscriber ;
-
-import org.apache.commons.codec.DecoderException ;
-import org.apache.commons.codec.stateful.DecoderMonitor ;
-import org.apache.commons.codec.stateful.DecoderCallback ;
-import org.apache.commons.codec.stateful.StatefulDecoder ;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EventObject;
+
+import java.nio.ByteBuffer;
+
+import org.apache.eve.event.InputEvent;
+import org.apache.eve.seda.StageConfig;
+import org.apache.eve.event.EventRouter;
+import org.apache.eve.seda.DefaultStage;
+import org.apache.eve.listener.ClientKey;
+import org.apache.eve.event.ConnectEvent;
+import org.apache.eve.event.RequestEvent;
+import org.apache.eve.event.DisconnectEvent;
+import org.apache.eve.event.InputSubscriber;
+import org.apache.eve.event.ConnectSubscriber;
+import org.apache.eve.seda.LoggingStageMonitor;
+import org.apache.eve.event.AbstractSubscriber;
+import org.apache.eve.event.DisconnectSubscriber;
+
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.stateful.DecoderCallback;
+import org.apache.commons.codec.stateful.StatefulDecoder;
+
+import org.apache.commons.lang.NotImplementedException;
 
 
 /**
  * Default decoder managing component implementation.
  *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public class DefaultDecoderManager extends DefaultStage
@@ -61,11 +58,11 @@
     DisconnectSubscriber
 {
     /** event router or bus this component subscribes and publishes events on */
-    private final EventRouter router ;
+    private final EventRouter router;
     /** map of decoders for client keys */
-    private final Map decoders = new HashMap() ;
+    private final Map decoders = new HashMap();
     /** the monitor used for this decoder manager */
-    private DecoderManagerMonitor monitor ;
+    private DecoderManagerMonitor monitor;
 
 
     /**
@@ -76,15 +73,15 @@
      */
     public DefaultDecoderManager( EventRouter router, StageConfig config )
     {
-        super( config ) ;
+        super( config );
         
-        this.router = router ;
-        this.monitor = new DecoderManagerMonitorAdapter() ;
-        super.setMonitor( new LoggingStageMonitor( getClass() ) ) ;
-
-        router.subscribe( InputEvent.class, this ) ;
-        router.subscribe( ConnectEvent.class, this ) ;
-        router.subscribe( DisconnectEvent.class, this ) ;
+        this.router = router;
+        this.monitor = new DecoderManagerMonitorAdapter();
+        super.setMonitor( new LoggingStageMonitor( getClass() ) );
+
+        router.subscribe( InputEvent.class, this );
+        router.subscribe( ConnectEvent.class, this );
+        router.subscribe( DisconnectEvent.class, this );
     }
     
     
@@ -104,11 +101,11 @@
     {
         try
         {
-            AbstractSubscriber.inform( this, event ) ;
+            AbstractSubscriber.inform( this, event );
         }
         catch ( Throwable t )
         {
-            monitor.failedOnInform( this, event, t ) ;
+            monitor.failedOnInform( this, event, t );
         }
     }
 
@@ -122,8 +119,8 @@
     public void inform( InputEvent event )
     {
         // claim interest and release after asynchronous processing of event
-        event.claimInterest( this ) ;
-        enqueue( event ) ;
+        event.claimInterest( this );
+        enqueue( event );
     }
     
 
@@ -135,9 +132,27 @@
      */
     public void inform( DisconnectEvent event )
     {
-        decoders.remove( event.getClientKey() ) ;
+        decoders.remove( event.getClientKey() );
     }
-    
+
+
+    /**
+     * Temporary place holder for functionality that looks up a protocol
+     * specific StatefulDecoder.
+     *
+     * @param key the client key used to determine associated protocol
+     * @return the new stateful nonblocking protocol specific decoder
+     */
+    private StatefulDecoder createClientDecoder( ClientKey key )
+    {
+        if ( key == null )
+        {
+            throw new NullPointerException(
+                    "non null client key required to create decoder" );
+        }
+        throw new NotImplementedException( "create new decoder for client" );
+    }
+
 
     /**
      * We basically create a new client decoder and put it into a map for
@@ -148,8 +163,9 @@
      */
     public void inform( ConnectEvent event )
     {
-        ClientKey key = event.getClientKey() ;
-        StatefulDecoder decoder = new ClientDecoder( key, new MessageDecoder() ) ;
+        StatefulDecoder decoder;
+        ClientKey key = event.getClientKey();
+        decoder = new ClientDecoder( key, createClientDecoder( key ) );
 
         /*
          * Here the decoder informs us that a unit of data is decoded.  In the
@@ -162,13 +178,12 @@
             public void decodeOccurred( StatefulDecoder decoder,
                                         Object decoded )
             {
-                ClientKey key = ( ( ClientDecoder ) decoder ).getClientKey() ;
-                RequestEvent event = new RequestEvent( this, key,
-                        ( Request ) decoded );
-                router.publish( event ) ;
+                ClientKey key = ( ( ClientDecoder ) decoder ).getClientKey();
+                RequestEvent event = new RequestEvent( this, key, decoded );
+                router.publish( event );
             }
         });
-        decoders.put( key, decoder ) ;
+        decoders.put( key, decoder );
     }
 
 
@@ -178,81 +193,48 @@
 
     
     /* (non-Javadoc)
-     * @see org.apache.eve.decoder.DecoderManager#setCallback(
-     * org.apache.eve.listener.ClientKey, 
-     * org.apache.commons.codec.stateful.DecoderCallback)
-     */
-    public void setCallback( ClientKey key, DecoderCallback cb )
-    {
-        StatefulDecoder decoder = ( StatefulDecoder ) decoders.get( key ) ;
-        decoder.setCallback( cb ) ;
-    }
-
-    
-    /* (non-Javadoc)
-     * @see org.apache.eve.decoder.DecoderManager#setDecoderMonitor(
-     * org.apache.eve.listener.ClientKey, 
-     * org.apache.commons.codec.stateful.DecoderMonitor)
-     */
-    public void setDecoderMonitor( ClientKey key, DecoderMonitor monitor )
-    {
-        StatefulDecoder decoder = ( StatefulDecoder ) decoders.get( key ) ;
-        decoder.setDecoderMonitor( monitor ) ;
-    }
-
-    
-    /* (non-Javadoc)
-     * @see org.apache.eve.decoder.DecoderManager#disable(
-     * org.apache.eve.listener.ClientKey)
-     */
-    public boolean disable( ClientKey key )
-    {
-        StatefulDecoder decoder = ( StatefulDecoder ) decoders.remove( key ) ;
-        return decoder != null ;
-    }
-    
-
-    /* (non-Javadoc)
-     * @see org.apache.eve.decoder.DecoderManager#decode(
+     * @see org.apache.eve.decoder.DecoderManager#decodeNonBlocking(
      * org.apache.eve.listener.ClientKey, java.nio.ByteBuffer)
      */
-    public void decode( ClientKey key, ByteBuffer buffer ) 
+    public void decodeNonBlocking( ClientKey key, ByteBuffer buffer )
         throws DecoderException
     {
-        StatefulDecoder decoder = ( StatefulDecoder ) decoders.get( key ) ;
-        decoder.decode( buffer ) ;
+        StatefulDecoder decoder = ( StatefulDecoder ) decoders.get( key );
+        decoder.decode( buffer );
     }
 
     
     /* (non-Javadoc)
-     * @see org.apache.eve.decoder.DecoderManager#decode(java.nio.ByteBuffer)
+     * @see org.apache.eve.decoder.DecoderManager#
+     * decodeNonBlocking(java.nio.ByteBuffer)
      */
-    public Object decode( ByteBuffer buffer ) throws DecoderException
+    public Object decodeBlocking( ClientKey key, ByteBuffer buffer )
+            throws DecoderException
     {
         // replace this decoder with a real one later
-        StatefulDecoder decoder = new MessageDecoder();
+        StatefulDecoder decoder = createClientDecoder( key );
         // used array to set a value on final variable and get by compiler
-        final Object[] decoded = new Object[1] ;
+        final Object[] decoded = new Object[1];
         
         decoder.setCallback( new DecoderCallback() 
         {
             public void decodeOccurred( StatefulDecoder decoder, Object obj )
             {
-                decoded[0] = obj ;
+                decoded[0] = obj;
             }
         });
         
         // force synchronous callback 
-        decoder.decode( buffer ) ;
+        decoder.decode( buffer );
         
         // the decoded value should be set
         if ( decoded[0] == null )
         {
             throw new DecoderException( "Expected a complete encoded unit of "
-                    + "data but got a partial encoding in buffer arg" ) ;
+                    + "data but got a partial encoding in buffer arg" );
         }
         
-        return decoded[0] ;
+        return decoded[0];
     }
 
 
@@ -268,7 +250,7 @@
      */
     public DecoderManagerMonitor getMonitor()
     {
-        return monitor ;
+        return monitor;
     }
     
 
@@ -277,7 +259,7 @@
      */
     public void setMonitor( DecoderManagerMonitor monitor )
     {
-        this.monitor = monitor ;
+        this.monitor = monitor;
     }
 
 
@@ -289,6 +271,6 @@
      */
     StatefulDecoder getDecoder( ClientKey key )
     {
-        return ( StatefulDecoder ) decoders.get( key ) ;
+        return ( StatefulDecoder ) decoders.get( key );
     }
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/encoder/DefaultEncoderManager.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/encoder/DefaultEncoderManager.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/encoder/DefaultEncoderManager.java	Thu Sep  2 15:19:09 2004
@@ -14,26 +14,27 @@
  *   limitations under the License.
  *
  */
-package org.apache.eve.encoder ;
+package org.apache.eve.encoder;
 
 
 import java.nio.ByteBuffer;
 import java.util.EventObject;
 
 import org.apache.commons.codec.EncoderException;
-import org.apache.eve.encoder.EncoderManager ;
-import org.apache.eve.encoder.EncoderManagerMonitor;
-import org.apache.eve.event.AbstractSubscriber;
+import org.apache.commons.lang.NotImplementedException;
+
 import org.apache.eve.event.EventRouter;
 import org.apache.eve.event.OutputEvent;
 import org.apache.eve.event.ResponseEvent;
 import org.apache.eve.event.ResponseSubscriber;
+import org.apache.eve.event.AbstractSubscriber;
+
 import org.apache.eve.seda.DefaultStage;
-import org.apache.eve.seda.DefaultStageConfig;
 import org.apache.eve.seda.StageHandler;
+import org.apache.eve.seda.DefaultStageConfig;
 import org.apache.eve.seda.LoggingStageMonitor;
-import org.apache.ldap.common.message.MessageEncoder;
-import org.apache.ldap.common.message.Response;
+
+import org.apache.eve.listener.ClientKey;
 
 
 /**
@@ -49,8 +50,8 @@
     implements EncoderManager, ResponseSubscriber
 {
     /** the event router used to publish and subscribe to events on */
-    private final EventRouter router ;
-    private EncoderManagerMonitor monitor ;
+    private final EventRouter router;
+    private EncoderManagerMonitor monitor;
     
     
     /**
@@ -61,11 +62,12 @@
     public DefaultEncoderManager( EventRouter router, 
                                   DefaultStageConfig config )
     {
-        super( config ) ;
-        super.setMonitor( new LoggingStageMonitor( this.getClass() ) ) ;
-        config.setHandler( new EncoderStageHandler() ) ;
-        this.router = router ;
-        this.router.subscribe( ResponseEvent.class, this ) ;
+        super( config );
+        super.setMonitor( new LoggingStageMonitor( this.getClass() ) );
+        monitor = new EncoderManagerMonitorAdapter();
+        config.setHandler( new EncoderStageHandler() );
+        this.router = router;
+        this.router.subscribe( ResponseEvent.class, this );
     }
     
     
@@ -76,11 +78,11 @@
     {
         try
         {
-            AbstractSubscriber.inform( this, event ) ;
+            AbstractSubscriber.inform( this, event );
         }
         catch( Throwable t )
         {
-            monitor.failedOnInform( this, event, t ) ;
+            monitor.failedOnInform( this, event, t );
         }
     }
     
@@ -91,18 +93,19 @@
      */
     public void inform( ResponseEvent event )
     {
-        super.enqueue( event ) ;
+        super.enqueue( event );
     }
 
 
     /* (non-Javadoc)
-     * @see org.apache.eve.encoder.EncoderManager#encode(
-     * org.apache.ldap.common.message.Response)
+     * @see org.apache.eve.encoder.EncoderManager#encode(ClientKey, Object)
      */
-    public byte[] encode( Response response ) throws EncoderException
+    public ByteBuffer encode( ClientKey key, Object response )
+            throws EncoderException
     {
-        MessageEncoder encoder = new MessageEncoder() ;
-        return encoder.encode( response ) ;
+//        MessageEncoder encoder = new MessageEncoder();
+//        return encoder.encode( response );
+        throw new NotImplementedException( "need to delegate to encoder" );
     }
     
     
@@ -114,21 +117,21 @@
          */
         public void handleEvent( EventObject generic )
         {
-            ByteBuffer buf = null ;
-            ResponseEvent event = ( ResponseEvent ) generic ;
+            ByteBuffer buf = null;
+            ResponseEvent event = ( ResponseEvent ) generic;
             
             try
             {
-                buf = ByteBuffer.wrap( encode( event.getResponse() ) ) ;
+                buf = encode( event.getClientKey(), event.getResponse() );
             }
             catch ( EncoderException e )
             {
-                monitor.failedOnEncode( DefaultEncoderManager.this, event, e ) ;
+                monitor.failedOnEncode( DefaultEncoderManager.this, event, e );
             }
             
             OutputEvent outEvent = new OutputEvent( DefaultEncoderManager.this, 
-                    event.getClientKey(), buf ) ;
-            router.publish( outEvent ) ;
+                    event.getClientKey(), buf );
+            router.publish( outEvent );
         }
     }
 }

Added: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/encoder/EncoderManagerMonitorAdapter.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/encoder/EncoderManagerMonitorAdapter.java	Thu Sep  2 15:19:09 2004
@@ -0,0 +1,48 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.eve.encoder;
+
+
+import java.util.EventObject;
+
+
+/**
+ * A minimalistic monitor adapter for the EncoderManager.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class EncoderManagerMonitorAdapter implements EncoderManagerMonitor
+{
+    public void failedOnInform( EncoderManager manager, EventObject event,
+                                Throwable t )
+    {
+        if ( t != null )
+        {
+            t.printStackTrace();
+        }
+    }
+
+    public void failedOnEncode( EncoderManager manager, EventObject event,
+                                Throwable t )
+    {
+        if ( t != null )
+        {
+            t.printStackTrace();
+        }
+    }
+}

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/DefaultRequestProcessor.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/DefaultRequestProcessor.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/DefaultRequestProcessor.java	Thu Sep  2 15:19:09 2004
@@ -20,7 +20,7 @@
 import java.util.Iterator ;
 import java.util.EventObject ;
 
-import org.apache.commons.lang.exception.ExceptionUtils ;
+import org.apache.commons.lang.NotImplementedException;
 
 import org.apache.eve.event.EventRouter ;
 import org.apache.eve.event.RequestEvent ;
@@ -36,23 +36,6 @@
 import org.apache.eve.seda.DefaultStageConfig ;
 import org.apache.eve.seda.LoggingStageMonitor;
 
-import org.apache.ldap.common.message.Request ;
-import org.apache.ldap.common.message.Response ;
-import org.apache.ldap.common.message.LdapResult ;
-import org.apache.ldap.common.message.ResultCodeEnum ;
-import org.apache.ldap.common.message.ResultResponse ;
-import org.apache.ldap.common.message.LdapResultImpl ;
-import org.apache.ldap.common.message.MessageTypeEnum ;
-import org.apache.ldap.common.message.AddResponseImpl ;
-import org.apache.ldap.common.message.ManyReplyRequest ;
-import org.apache.ldap.common.message.BindResponseImpl ;
-import org.apache.ldap.common.message.ModifyResponseImpl ;
-import org.apache.ldap.common.message.SingleReplyRequest ;
-import org.apache.ldap.common.message.DeleteResponseImpl ;
-import org.apache.ldap.common.message.CompareResponseImpl ;
-import org.apache.ldap.common.message.ExtendedResponseImpl ;
-import org.apache.ldap.common.message.ModifyDnResponseImpl ;
-
 
 /**
  * Default RequestProcessor service implemented as a POJO.
@@ -64,7 +47,6 @@
 public class DefaultRequestProcessor extends DefaultStage
     implements RequestProcessor, RequestSubscriber
 {
-    private final HandlerRegistry hooks ;
     private final EventRouter router ;
     private RequestProcessorMonitor monitor = null ;
     
@@ -74,10 +56,8 @@
      * 
      * @param router the event router we subscribe and publish to
      * @param config the configuration for this stage 
-     * @param hooks the handler registry to use for setting the request hooks
      */
-    public DefaultRequestProcessor( EventRouter router, StageConfig config, 
-                                    HandlerRegistry hooks )
+    public DefaultRequestProcessor( EventRouter router, StageConfig config )
     {
         super( config ) ;
         
@@ -85,7 +65,6 @@
         defaultConfig.setHandler( new ProcessorStageHandler() ) ;
         super.setMonitor( new LoggingStageMonitor( getClass() ) ) ;
         
-        this.hooks = hooks ;
         this.router = router ;
         this.router.subscribe( RequestEvent.class, this ) ;
         this.monitor = new RequestProcessorMonitorAdapter() ;
@@ -123,43 +102,49 @@
         /**
          * Event handler method for processing RequestEvents.
          *
-         * @param unspecific the RequestEvent to process.
+         * @param nonspecific the RequestEvent to process.
          */
-        public void handleEvent( EventObject unspecific )
+        public void handleEvent( EventObject nonspecific )
         {
-            RequestEvent event = ( RequestEvent ) unspecific ;
-            Request request = event.getRequest() ;
+            RequestEvent event = ( RequestEvent ) nonspecific ;
             ClientKey key = event.getClientKey() ;
-            RequestHandler handler = hooks.lookup( request.getType() ) ;
 
-            if( handler == null )
-            {
-                throw new IllegalArgumentException( 
-                        "Unknown request message type: "
-                        + request.getType().getName() ) ;
-            }
+            RequestHandler handler = getProtocolHandler( event.getClientKey(),
+                    event.getRequest() );
 
             switch( handler.getHandlerType().getValue() )
             {
             case( HandlerTypeEnum.NOREPLY_VAL ):
                 NoReplyHandler noreply = ( NoReplyHandler ) handler ;
-                noreply.handle( request ) ;
+                noreply.handle( event.getRequest() ) ;
                 break ;
             case( HandlerTypeEnum.SINGLEREPLY_VAL ):
                 SingleReplyHandler single = ( SingleReplyHandler ) handler ;
-                reply( single, ( SingleReplyRequest ) request, key ) ;
+                reply( single, event.getRequest(), key ) ;
                 break ;
             case( HandlerTypeEnum.MANYREPLY_VAL ):
                 ManyReplyHandler many = ( ManyReplyHandler ) handler ;
-                reply( many, ( ManyReplyRequest ) request, key ) ;
+                reply( many, event.getRequest(), key ) ;
                 break ;
             default:
-                throw new IllegalArgumentException( "Unrecognized type: "
-                    + handler.getRequestType().getName() ) ;
+                throw new IllegalArgumentException(
+                        "Unrecognized handler type: "
+                        + handler.getHandlerType() ) ;
             }
         }
     }
-    
+
+
+    private RequestHandler getProtocolHandler( ClientKey key, Object request )
+    {
+        if ( key == null || request == null )
+        {
+            throw new NullPointerException(
+                    "both key and request must not be null" );
+        }
+        throw new NotImplementedException( "need mech to acquire handler" );
+    }
+
 
     /**
      * Handles the generation and return of multiple responses.
@@ -168,36 +153,42 @@
      * @param request the request responded to
      */
     private void reply( ManyReplyHandler handler, 
-                        ManyReplyRequest request,
+                        Object request,
                         ClientKey key )
     {
-        Response response = null ;
-        LdapResult result = null ;
+        Object response = null ;
 
         try
          {
              Iterator list = handler.handle( request ) ;
-             while ( list.hasNext() ) 
+
+             if ( handler.isResponseOrdered() )
              {
-                 response = ( Response ) list.next() ;
+                 while ( list.hasNext() )
+                 {
+                     response = list.next() ;
+
+                     // @todo: need to force serialized response processing
+                     // perhaps we need to add an isResponseOrdered or a
+                     // response sequence number for multi-part responses
+
+                     throw new NotImplementedException(
+                             "need response serialization" );
+                 }
+             }
+             else
+             {
+                 while ( list.hasNext() )
+                 {
+                     response = list.next() ;
+                     router.publish( new ResponseEvent( this, key, response ) );
+                 }
              }
          }
 
-         // If the individual handlers do not do a global catch and report this
-         // will sheild the server from complete failure on a request reporting
-         // at a minimum the stack trace that cause the request to fail.
          catch( Throwable t )
          {
              monitor.failedOnSingleReply( key, request, t ) ;
-            
-             ResultResponse resultResponse = handler.getDoneResponse( 
-                     request.getMessageId() ) ;
-             result = new LdapResultImpl( response ) ;
-             result.setMatchedDn( "" ) ;
-             result.setErrorMessage( ExceptionUtils.getFullStackTrace( t ) ) ;
-             result.setResultCode( ResultCodeEnum.OPERATIONSERROR ) ;
-             resultResponse.setLdapResult( result ) ;
-             router.publish( new ResponseEvent( this, key, resultResponse ) ) ;
          }
     }
     
@@ -208,12 +199,10 @@
      * @param handler the handler that generates the single response
      * @param request the request responded to
      */
-    private void reply( SingleReplyHandler handler, SingleReplyRequest request,
+    private void reply( SingleReplyHandler handler, Object request,
                         ClientKey key )
     {
-        int id = request.getMessageId() ;
-        LdapResult result = null ;
-        ResultResponse response = null ;
+        Object response = null ;
 
         try
         {
@@ -225,38 +214,8 @@
         // at a minimum the stack trace that cause the request to fail.
         catch( Throwable t )
         {
-            switch( request.getResponseType().getValue() )
-            {
-            case( MessageTypeEnum.ADDRESPONSE_VAL ):
-                response = new AddResponseImpl( id ) ;
-                break ;
-            case( MessageTypeEnum.BINDRESPONSE_VAL ):
-                response = new BindResponseImpl( id ) ;
-                break ;
-            case( MessageTypeEnum.COMPARERESPONSE_VAL ):
-                response = new CompareResponseImpl( id ) ;
-                break ;
-            case( MessageTypeEnum.DELRESPONSE_VAL ):
-                response = new DeleteResponseImpl( id ) ;
-                break ;
-            case( MessageTypeEnum.EXTENDEDRESP_VAL ):
-                response = new ExtendedResponseImpl( id ) ;
-                break ;
-            case( MessageTypeEnum.MODDNRESPONSE_VAL ):
-                response = new ModifyDnResponseImpl( id ) ;
-                break ;
-            case( MessageTypeEnum.MODIFYRESPONSE_VAL ):
-                response = new ModifyResponseImpl( id ) ;
-                break ;
-            }
-
             monitor.failedOnSingleReply( key, request, t ) ;
-            
-            result = new LdapResultImpl( response ) ;
-            result.setMatchedDn( "" ) ;
-            result.setErrorMessage( ExceptionUtils.getFullStackTrace( t ) ) ;
-            result.setResultCode( ResultCodeEnum.OPERATIONSERROR ) ;
-            response.setLdapResult( result ) ;
+            return;
         }
 
         router.publish( new ResponseEvent( this, key, response ) ) ;

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/ManyReplyHandler.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/ManyReplyHandler.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/ManyReplyHandler.java	Thu Sep  2 15:19:09 2004
@@ -19,15 +19,11 @@
 
 import java.util.Iterator ;
 
-import org.apache.ldap.common.message.ManyReplyRequest ;
-import org.apache.ldap.common.message.ResultResponse;
-
 
 /**
  * A handler for requests that can generate zero, one or more responses.
  *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public interface ManyReplyHandler extends RequestHandler
@@ -39,12 +35,14 @@
      * @param request the request that may generate many replies
      * @return an enumeration over the responses
      */
-    Iterator handle( ManyReplyRequest request ) ;
-    
+    Iterator handle( Object request ) ;
+
     /**
-     * Gets the terminating response.
-     * 
-     * @return the finishing response that carries the result
+     * Determinates whether or not a multi-reply request's responses should be
+     * returned in sequence to a client.
+     *
+     * @return true if order of replies are required by the protocol, false
+     * if response order is insignificant.
      */
-    ResultResponse getDoneResponse( int id ) ;
+    boolean isResponseOrdered();
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/NoReplyHandler.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/NoReplyHandler.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/NoReplyHandler.java	Thu Sep  2 15:19:09 2004
@@ -17,9 +17,6 @@
 package org.apache.eve.processor ;
 
 
-import org.apache.ldap.common.message.Request ;
-
-
 /**
  * Represents handlers that do not return a response to the client.
  *
@@ -36,5 +33,5 @@
      *
      * @param request the request without a response.
      */
-    void handle( Request request ) ;
+    void handle( Object request ) ;
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/RequestHandler.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/RequestHandler.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/RequestHandler.java	Thu Sep  2 15:19:09 2004
@@ -17,9 +17,6 @@
 package org.apache.eve.processor ;
 
 
-import org.apache.ldap.common.message.MessageTypeEnum ;
-
-
 /**
  * Root of all request handler types.
  *
@@ -35,11 +32,4 @@
      * @return a HandlerTypeEnum constant.
      */
     HandlerTypeEnum getHandlerType() ;
-
-    /**
-     * Gets the request message type handled by this handler.
-     *
-     * @return a MessageTypeEnum constant associated with the request message.
-     */
-    MessageTypeEnum getRequestType() ;
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/RequestProcessorMonitorAdapter.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/RequestProcessorMonitorAdapter.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/RequestProcessorMonitorAdapter.java	Thu Sep  2 15:19:09 2004
@@ -23,7 +23,6 @@
 
 import org.apache.eve.event.Subscriber ;
 import org.apache.eve.listener.ClientKey ;
-import org.apache.ldap.common.message.Request ;
 
 
 /**
@@ -53,7 +52,7 @@
      * (org.apache.eve.listener.ClientKey, 
      * org.apache.ldap.common.message.Request, java.lang.Throwable)
      */
-    public void failedOnSingleReply( ClientKey key, Request request, 
+    public void failedOnSingleReply( ClientKey key, Object request,
                                      Throwable t )
     {
         // @todo We should be able to email this or even post it to JIRA.
@@ -62,10 +61,10 @@
         
         StringBuffer buf = new StringBuffer() ;
         buf.append( "Encountered an operational error while processing " ) ;
-        buf.append( request.getType().getName() ) ;
+        buf.append( request ) ;
         buf.append( " request. Please report the the following server stack" );
-        buf.append( " trace to the Apache Directory Project:\n" ) ;
-        buf.append( ExceptionUtils.getFullStackTrace( t ) ) ;
+        buf.append( " trace to the Apache Directory Project.\n" ) ;
         System.err.println( buf.toString() ) ;
+        t.printStackTrace();
     }
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/SingleReplyHandler.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/SingleReplyHandler.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/java/org/apache/eve/processor/SingleReplyHandler.java	Thu Sep  2 15:19:09 2004
@@ -17,35 +17,22 @@
 package org.apache.eve.processor ;
 
 
-import org.apache.ldap.common.message.ResultResponse ;
-import org.apache.ldap.common.message.MessageTypeEnum ;
-import org.apache.ldap.common.message.SingleReplyRequest ;
-
-
 /**
  * Request handler signature for those requests that generate a single response
  * for a request.
  *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
 public interface SingleReplyHandler
     extends RequestHandler
 {
     /**
-     * Gets the response message type for this SingleReplyHandler.
-     *
-     * @return the MessageTypeEnum constant associated with this handler.
-     */
-    MessageTypeEnum getResponseType() ;
-
-    /**
      * Handles a request that generates a sole response by returning the
      * response object back to the caller.
      *
      * @param request the request to handle.
      * @return the response to the request argument.
      */
-    ResultResponse handle( SingleReplyRequest request ) ;
+    Object handle( Object request ) ;
 }

Modified: incubator/directory/eve/branches/multi-listener/frontend/impl/src/test/org/apache/eve/decoder/DefaultDecoderManagerTest.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/frontend/impl/src/test/org/apache/eve/decoder/DefaultDecoderManagerTest.java	(original)
+++ incubator/directory/eve/branches/multi-listener/frontend/impl/src/test/org/apache/eve/decoder/DefaultDecoderManagerTest.java	Thu Sep  2 15:19:09 2004
@@ -17,7 +17,6 @@
 package org.apache.eve.decoder ;
 
 
-import java.nio.ByteBuffer ;
 import java.util.EventObject ;
 
 import org.apache.eve.buffer.BufferPool;
@@ -25,18 +24,13 @@
 import org.apache.eve.buffer.DefaultBufferPool;
 import org.apache.eve.buffer.DefaultBufferPoolConfig;
 import org.apache.eve.event.AbstractSubscriber;
-import org.apache.eve.event.ConnectEvent;
 import org.apache.eve.event.EventRouter ;
 import org.apache.eve.event.DefaultEventRouter ;
-import org.apache.eve.event.InputEvent;
 import org.apache.eve.event.RequestEvent;
 import org.apache.eve.event.RequestSubscriber;
 
 import org.apache.eve.seda.DefaultStageConfig ;
 import org.apache.eve.thread.ThreadPool;
-import org.apache.ldap.common.message.AbandonRequest;
-import org.apache.ldap.common.message.AbandonRequestImpl;
-import org.apache.ldap.common.message.MessageEncoder;
 
 import junit.framework.TestCase ;
 
@@ -123,42 +117,7 @@
         super( arg0 ) ;
     }
 
-    
-    public void testDefaultDecoderManager() throws Exception
-    {
-        AbandonRequest request = new AbandonRequestImpl( 6 ) ;
-        request.setAbandoned( 44 ) ;
-
-        MessageEncoder encoder = new MessageEncoder() ;
-        
-        byte [] encoded = encoder.encode( request ) ;
-        ByteBuffer buf = bp.getBuffer( this ) ;
-        buf.put( encoded ) ;
-        buf.flip() ;
-        
-        final BufferPool pool = bp ;
-        InputEvent e = new InputEvent( this, null, buf ) 
-        {
-            public ByteBuffer claimInterest(Object party)
-            {
-                pool.claimInterest(getBuffer(), party) ;
-                return getBuffer().asReadOnlyBuffer() ;
-            }
 
-            public void releaseInterest(Object party)
-            {
-                pool.releaseClaim(getBuffer(), party) ;
-            }
-        } ;
-        
-        bp.releaseClaim(buf, this) ;
-        router.publish( new ConnectEvent(this, null) ) ;
-        router.publish( e ) ;
-        decodeMan.stop() ;
-        assertNotNull( this.event ) ;
-    }
-    
-    
     public void inform( RequestEvent event )
     {
         System.out.println( "\n\nRequestEvent Set!!!\n\n" ) ;

Mime
View raw message