directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r111228 - incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol
Date Wed, 08 Dec 2004 06:27:56 GMT
Author: trustin
Date: Tue Dec  7 22:27:54 2004
New Revision: 111228

URL: http://svn.apache.org/viewcvs?view=rev&rev=111228
Log:
 * Removed protocol package's Connector and Acceptor and replaced them with ProtocolSessionHandler
 * Renamed SessionHandler to ProtocolSessionListener
 * Renamed Codec to ProtocolCodec
 * Adding ProtocolSessionHandler which wraps core.SessionHandler
 * Renamed MessageParseException to ProtocolViolationException

Example code:

Acceptor acceptor = new TcpAcceptor();
ProtocolSessionHandler handler = new ProtocolSessionHandler(codec);
handler.addListener(new MyProtocolSessionListener());
acceptor.bind(new InetSocketAddress(8080), handler);
Added:
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolCodec.java
      - copied, changed from r111227, incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Codec.java
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSession.java
      - copied, changed from r111227, incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Session.java
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java
  (contents, props changed)
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionListener.java
      - copied, changed from r111227, incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/SessionHandler.java
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolViolationException.java
      - copied, changed from r111227, incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/MessageParseException.java
Removed:
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Acceptor.java
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Codec.java
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Connector.java
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/MessageParseException.java
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Session.java
   incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/SessionHandler.java

Deleted: /incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Acceptor.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Acceptor.java?view=auto&rev=111227
==============================================================================

Deleted: /incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Codec.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Codec.java?view=auto&rev=111227
==============================================================================

Deleted: /incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Connector.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Connector.java?view=auto&rev=111227
==============================================================================

Deleted: /incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/MessageParseException.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/MessageParseException.java?view=auto&rev=111227
==============================================================================

Copied: incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolCodec.java
(from r111227, incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Codec.java)
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolCodec.java?view=diff&rev=111228&p1=incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Codec.java&r1=111227&p2=incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolCodec.java&r2=111228
==============================================================================
--- incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Codec.java
(original)
+++ incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolCodec.java
Tue Dec  7 22:27:54 2004
@@ -17,7 +17,7 @@
 /*
  * @(#) $Id$
  */
-package org.apache.mina.upstream;
+package org.apache.mina.protocol;
 
 import java.nio.ByteBuffer;
 
@@ -28,9 +28,9 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
  */
-public interface Codec {
-    boolean encode(Session session, Object message, ByteBuffer out);
+public interface ProtocolCodec {
+    boolean encode(ProtocolSession session, Object message, ByteBuffer out);
 
-    Object decode(Session session, ByteBuffer in)
-           throws MessageParseException;
+    Object decode(ProtocolSession session, ByteBuffer in)
+           throws ProtocolViolationException;
 }

Copied: incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSession.java
(from r111227, incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Session.java)
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSession.java?view=diff&rev=111228&p1=incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Session.java&r1=111227&p2=incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSession.java&r2=111228
==============================================================================
--- incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Session.java
(original)
+++ incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSession.java
Tue Dec  7 22:27:54 2004
@@ -17,12 +17,12 @@
 /*
  * @(#) $Id$
  */
-package org.apache.mina.upstream;
+package org.apache.mina.protocol;
 
 import java.net.SocketAddress;
 
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.SessionConfig;
+import org.apache.mina.core.IdleStatus;
+import org.apache.mina.core.SessionConfig;
 
 
 /**
@@ -31,15 +31,7 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
  */
-public interface Session {
-    void addHandler(SessionHandler handler);
-
-    void removeHandler(SessionHandler handler);
-
-    Codec getCodec();
-
-    void setCodec(Codec codec);
-
+public interface ProtocolSession {
     void close();
 
     Object getAttachment();

Added: incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java?view=auto&rev=111228
==============================================================================
--- (empty file)
+++ incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java
Tue Dec  7 22:27:54 2004
@@ -0,0 +1,53 @@
+/*
+ * @(#) $Id$
+ */
+package org.apache.mina.protocol;
+
+import org.apache.commons.lang.Validate;
+import org.apache.mina.core.IdleStatus;
+import org.apache.mina.core.Session;
+import org.apache.mina.core.SessionHandler;
+
+/**
+ * TODO Document me.
+ * TODO Implement me.
+ * 
+ * @author Apache Software Foundation
+ * @version $Rev$, $Date$
+ * 
+ */
+public class ProtocolSessionHandler implements SessionHandler {
+	
+	private final ProtocolCodec codec;
+
+	public ProtocolSessionHandler(ProtocolCodec codec) {
+		Validate.notNull(codec);
+		this.codec = codec;
+	}
+	
+	public void addListener(ProtocolSessionListener listener) {
+		
+	}
+	
+	public void removeListener(ProtocolSessionListener listener) {
+		
+	}
+	
+	public void sessionOpened(Session session) {
+	}
+
+	public void sessionClosed(Session session) {
+	}
+
+	public void sessionIdle(Session session, IdleStatus status) {
+	}
+
+	public void exceptionCaught(Session session, Throwable cause) {
+	}
+
+	public void dataRead(Session session, int readBytes) {
+	}
+
+	public void dataWritten(Session session, int writtenBytes) {
+	}
+}

Copied: incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionListener.java
(from r111227, incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/SessionHandler.java)
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionListener.java?view=diff&rev=111228&p1=incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/SessionHandler.java&r1=111227&p2=incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionListener.java&r2=111228
==============================================================================
--- incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/SessionHandler.java
(original)
+++ incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolSessionListener.java
Tue Dec  7 22:27:54 2004
@@ -17,9 +17,9 @@
 /*
  * @(#) $Id$
  */
-package org.apache.mina.upstream;
+package org.apache.mina.protocol;
 
-import org.apache.mina.common.IdleStatus;
+import org.apache.mina.core.IdleStatus;
 
 
 /**
@@ -28,18 +28,18 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
  */
-public interface SessionHandler {
-    void sessionOpened(Session session);
+public interface ProtocolSessionListener {
+    void sessionOpened(ProtocolSession session);
 
-    void sessionClosed(Session session);
+    void sessionClosed(ProtocolSession session);
 
-    void sessionIdle(Session session, IdleStatus status);
+    void sessionIdle(ProtocolSession session, IdleStatus status);
 
-    void exceptionCaught(Session session, Throwable cause);
+    void exceptionCaught(ProtocolSession session, Throwable cause);
 
-    void messageReceived(Session session, Object message);
+    void messageReceived(ProtocolSession session, Object message);
 
-    void messageSent(Session session, Object message);
+    void messageSent(ProtocolSession session, Object message);
 
-    void sessionWritable(Session session);
+    void sessionWritable(ProtocolSession session);
 }

Copied: incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolViolationException.java
(from r111227, incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/MessageParseException.java)
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolViolationException.java?view=diff&rev=111228&p1=incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/MessageParseException.java&r1=111227&p2=incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolViolationException.java&r2=111228
==============================================================================
--- incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/MessageParseException.java
(original)
+++ incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/ProtocolViolationException.java
Tue Dec  7 22:27:54 2004
@@ -14,43 +14,43 @@
  *   limitations under the License.
  *
  */
-package org.apache.mina.upstream;
+package org.apache.mina.protocol;
 
 import java.io.IOException;
 
 import java.nio.ByteBuffer;
 
 import org.apache.commons.lang.Validate;
-import org.apache.mina.common.util.ByteBuffers;
+import org.apache.mina.util.ByteBuffers;
 
 
 /**
- * An exception that is thrown when {@link Codec} cannot understand or
+ * An exception that is thrown when {@link ProtocolCodec} cannot understand or
  * validate incoming data.
  *
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
  */
-public class MessageParseException extends IOException {
+public class ProtocolViolationException extends IOException {
     private ByteBuffer buffer;
 
     /**
      * Constructs a new instance.
      */
-    public MessageParseException() {
+    public ProtocolViolationException() {
     }
 
     /**
      * Constructs a new instance with the specified message.
      */
-    public MessageParseException(String message) {
+    public ProtocolViolationException(String message) {
         super(message);
     }
 
     /**
      * Constructs a new instance with the specified cause.
      */
-    public MessageParseException(Throwable cause) {
+    public ProtocolViolationException(Throwable cause) {
         initCause(cause);
     }
 
@@ -58,7 +58,7 @@
      * Constructs a new instance with the specified message and the specified
      * cause.
      */
-    public MessageParseException(String message, Throwable cause) {
+    public ProtocolViolationException(String message, Throwable cause) {
         super(message);
         initCause(cause);
     }

Deleted: /incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Session.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/Session.java?view=auto&rev=111227
==============================================================================

Deleted: /incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/SessionHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/seda/branches/trustin/src/java/org/apache/mina/protocol/SessionHandler.java?view=auto&rev=111227
==============================================================================

Mime
View raw message