You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/11/03 00:39:55 UTC

svn commit: rev 56443 - incubator/directory/seda/trunk/src/examples/org/apache/seda/examples

Author: akarasulu
Date: Tue Nov  2 15:39:54 2004
New Revision: 56443

Modified:
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/DiscardProtocolProvider.java
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/EchoProtocolProvider.java
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruHandler.java
Log:
forgot to refactor the examples

Modified: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/DiscardProtocolProvider.java
==============================================================================
--- incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/DiscardProtocolProvider.java	(original)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/DiscardProtocolProvider.java	Tue Nov  2 15:39:54 2004
@@ -21,10 +21,8 @@
 import org.apache.commons.codec.stateful.EncoderFactory;
 import org.apache.commons.codec.stateful.StatefulDecoder;
 import org.apache.commons.codec.stateful.StatefulEncoder;
-import org.apache.seda.protocol.HandlerTypeEnum;
-import org.apache.seda.protocol.NoReplyHandler;
-import org.apache.seda.protocol.ProtocolProvider;
-import org.apache.seda.protocol.RequestHandler;
+import org.apache.seda.protocol.*;
+import org.apache.seda.listener.ClientKey;
 
 
 /**
@@ -61,17 +59,12 @@
         return this;
     }
 
-    public RequestHandler getHandler(Object request)
+    public RequestHandler getHandler(ClientKey key, Object request)
     {
-        return new NoReplyHandler()
+        return new AbstractNoReplyHandler()
             {
-                public void handle(Object request)
+                public void handle(ClientKey key, Object request)
                 {
-                }
-
-                public HandlerTypeEnum getHandlerType()
-                {
-                    return HandlerTypeEnum.NOREPLY;
                 }
             };
     }

Modified: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/EchoProtocolProvider.java
==============================================================================
--- incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/EchoProtocolProvider.java	(original)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/EchoProtocolProvider.java	Tue Nov  2 15:39:54 2004
@@ -21,6 +21,7 @@
 import org.apache.seda.protocol.ProtocolProvider;
 import org.apache.seda.protocol.RequestHandler;
 import org.apache.seda.protocol.SingleReplyHandler;
+import org.apache.seda.listener.ClientKey;
 
 
 /**
@@ -117,7 +118,7 @@
      * @param request the ByteBuffer containing the data to echo
      * @return the same ByteBuffer without any changes
      */
-    public RequestHandler getHandler(Object request)
+    public RequestHandler getHandler(ClientKey key, Object request)
     {
         return PASSTHRU_HANDLER;
     }

Modified: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruHandler.java
==============================================================================
--- incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruHandler.java	(original)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruHandler.java	Tue Nov  2 15:39:54 2004
@@ -14,21 +14,20 @@
  *   limitations under the License.
  *
  */
-
 package org.apache.seda.examples;
 
-import org.apache.seda.protocol.HandlerTypeEnum;
-import org.apache.seda.protocol.SingleReplyHandler;
+
+import org.apache.seda.listener.ClientKey;
+import org.apache.seda.protocol.AbstractSingleReplyHandler;
 
 
 /**
- * Document me.
+ * A handler that returns what it gets.
  *
- * @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 PassThruHandler implements SingleReplyHandler
+public class PassThruHandler extends AbstractSingleReplyHandler
 {
     /**
      * Returns the request back without any changes as a response.
@@ -36,18 +35,8 @@
      * @param request the buffer of data to be echo'd.
      * @return the response to the request but resp = req here.
      */
-    public Object handle(Object request)
+    public Object handle(ClientKey key, Object request)
     {
         return request;
-    }
-
-    /**
-     * Gets the handler type.
-     *
-     * @return a HandlerTypeEnum constant.
-     */
-    public HandlerTypeEnum getHandlerType()
-    {
-        return HandlerTypeEnum.SINGLEREPLY;
     }
 }