directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r122627 - in incubator/directory/network/trunk/mina/src: examples/org/apache/mina/examples/echoserver examples/org/apache/mina/examples/netcat examples/org/apache/mina/examples/reverser java/org/apache/mina/io java/org/apache/mina/io/socket java/org/apache/mina/protocol java/org/apache/mina/registry
Date Fri, 17 Dec 2004 07:49:42 GMT
Author: trustin
Date: Thu Dec 16 23:49:42 2004
New Revision: 122627

URL: http://svn.apache.org/viewcvs?view=rev&rev=122627
Log:
Fixed: Example didn't compile
Added:
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java
      - copied, changed from r122618, incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSessionHandler.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolHandler.java
      - copied, changed from r122618, incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java
Removed:
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSessionHandler.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java
Modified:
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoServerSessionHandler.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/Main.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/Main.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatSessionHandler.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/Main.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolSessionHandler.java
   incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineCodec.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Acceptor.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Connector.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpAcceptor.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpConnector.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpSession.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolProvider.java
   incubator/directory/network/trunk/mina/src/java/org/apache/mina/registry/ServiceRegistry.java

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoServerSessionHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoServerSessionHandler.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoServerSessionHandler.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoServerSessionHandler.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoServerSessionHandler.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/EchoServerSessionHandler.java
Thu Dec 16 23:49:42 2004
@@ -1,4 +1,6 @@
 /*
+ *   @(#) $Id$
+ *
  *   Copyright 2004 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,70 +16,76 @@
  *   limitations under the License.
  *
  */
-/*
- * @(#) $Id$
- */
 package org.apache.mina.examples.echoserver;
 
 import org.apache.mina.core.IdleStatus;
-import org.apache.mina.core.ReadBuffer;
-import org.apache.mina.core.Session;
-import org.apache.mina.core.SessionHandler;
-import org.apache.mina.core.WriteBuffer;
-
+import org.apache.mina.io.ReadBuffer;
+import org.apache.mina.io.IoSession;
+import org.apache.mina.io.IoHandler;
+import org.apache.mina.io.WriteBuffer;
 
 /**
  * TODO Document me.
- *
+ * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,
  */
-public class EchoServerSessionHandler implements SessionHandler {
-    public void sessionOpened(Session session) {
-        System.out.println(session.getRemoteAddress() + ": OPEN");
+public class EchoServerSessionHandler implements IoHandler
+{
+    public void sessionOpened( IoSession IoSession )
+    {
+        System.out.println( IoSession.getRemoteAddress() + ": OPEN" );
     }
 
-    public void sessionClosed(Session session) {
-        System.out.println(session.getRemoteAddress() + ": CLOSED");
+    public void sessionClosed( IoSession IoSession )
+    {
+        System.out.println( IoSession.getRemoteAddress() + ": CLOSED" );
     }
 
-    public void sessionIdle(Session session, IdleStatus status) {
-        System.out.println(session.getRemoteAddress() + ": IDLE");
+    public void sessionIdle( IoSession IoSession, IdleStatus status )
+    {
+        System.out.println( IoSession.getRemoteAddress() + ": IDLE" );
     }
 
-    public void exceptionCaught(Session session, Throwable cause) {
-        System.out.println(session.getRemoteAddress() + ": EXCEPTION");
-        cause.printStackTrace(System.out);
+    public void exceptionCaught( IoSession IoSession, Throwable cause )
+    {
+        System.out.println( IoSession.getRemoteAddress() + ": EXCEPTION" );
+        cause.printStackTrace( System.out );
     }
 
-    public void dataRead(Session session, int readBytes) {
-        System.out.println(session.getRemoteAddress() + ": READ (" +
-                           readBytes + "B)");
+    public void dataRead( IoSession IoSession, int readBytes )
+    {
+        System.out.println( IoSession.getRemoteAddress() + ": READ ("
+                            + readBytes + "B)" );
 
-        ReadBuffer rb = session.getReadBuffer();
-        WriteBuffer wb = session.getWriteBuffer();
+        ReadBuffer rb = IoSession.getReadBuffer();
+        WriteBuffer wb = IoSession.getWriteBuffer();
 
-        if (rb.remaining() <= wb.remaining()) {
-            wb.put(rb);
+        if( rb.remaining() <= wb.remaining() )
+        {
+            wb.put( rb );
             wb.flush();
             rb.signal();
         }
     }
 
-    public void dataWritten(Session session, int writtenBytes) {
-        System.out.println(session.getRemoteAddress() + ": WRITTEN (" +
-                           writtenBytes + "B)");
-
-        ReadBuffer rb = session.getReadBuffer();
-        WriteBuffer wb = session.getWriteBuffer();
-
-        if (rb.hasRemaining() && rb.remaining() <= wb.remaining()) {
-            wb.put(rb);
+    public void dataWritten( IoSession IoSession, int writtenBytes )
+    {
+        System.out.println( IoSession.getRemoteAddress() + ": WRITTEN ("
+                            + writtenBytes + "B)" );
+
+        ReadBuffer rb = IoSession.getReadBuffer();
+        WriteBuffer wb = IoSession.getWriteBuffer();
+
+        if( rb.hasRemaining() && rb.remaining() <= wb.remaining() )
+        {
+            wb.put( rb );
             wb.flush();
             rb.signal();
         }
     }
 
-	public void markerReleased(Session session, Object marker) {
-	}
-}
+    public void markerReleased( IoSession IoSession, Object marker )
+    {
+    }
+}
\ No newline at end of file

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/Main.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/Main.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/Main.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/Main.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/Main.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/echoserver/Main.java
Thu Dec 16 23:49:42 2004
@@ -1,4 +1,6 @@
 /*
+ *   @(#) $Id$
+ *
  *   Copyright 2004 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,30 +16,28 @@
  *   limitations under the License.
  *
  */
-/*
- * @(#) $Id$
- */
 package org.apache.mina.examples.echoserver;
 
 import java.net.InetSocketAddress;
 
-import org.apache.mina.core.Acceptor;
-import org.apache.mina.core.socket.TcpAcceptor;
-
+import org.apache.mina.io.Acceptor;
+import org.apache.mina.io.socket.TcpAcceptor;
 
 /**
  * TODO Document me.
- *
+ * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,
  */
-public class Main {
+public class Main
+{
     private static final int PORT = 8080;
 
-    public static void main(String[] args) throws Exception {
+    public static void main( String[] args ) throws Exception
+    {
         Acceptor acceptor = new TcpAcceptor();
-        acceptor.bind(new InetSocketAddress(PORT),
-                      new EchoServerSessionHandler());
-        System.out.println("Listening on port " + PORT);
+        acceptor.bind( new InetSocketAddress( PORT ),
+                       new EchoServerSessionHandler() );
+        System.out.println( "Listening on port " + PORT );
     }
-}
+}
\ No newline at end of file

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/Main.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/Main.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/Main.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/Main.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/Main.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/Main.java
Thu Dec 16 23:49:42 2004
@@ -1,4 +1,6 @@
 /*
+ *   @(#) $Id$
+ *
  *   Copyright 2004 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,32 +16,33 @@
  *   limitations under the License.
  *
  */
-/*
- * @(#) $Id$
- */
 package org.apache.mina.examples.netcat;
 
 import java.net.InetSocketAddress;
 
-import org.apache.mina.core.socket.TcpConnector;
-
+import org.apache.mina.io.socket.TcpConnector;
 
 /**
  * TODO Document me.
- *
+ * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,
  */
-public class Main {
-    public static void main(String[] args) throws Exception {
-        if (args.length != 2) {
-            System.out.println(Main.class.getName() + " <hostname> <port>");
+public class Main
+{
+    public static void main( String[] args ) throws Exception
+    {
+        if( args.length != 2 )
+        {
+            System.out.println( Main.class.getName() + " <hostname> <port>" );
             return;
         }
 
         TcpConnector connector = new TcpConnector();
-        connector.connect(new InetSocketAddress(args[0],
-                                                Integer.parseInt(args[1])),
-                          60, new NetCatSessionHandler());
+        connector
+                 .connect(
+                           new InetSocketAddress( args[ 0 ],
+                                                  Integer.parseInt( args[ 1 ] ) ),
+                           60, new NetCatSessionHandler() );
     }
-}
+}
\ No newline at end of file

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatSessionHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatSessionHandler.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatSessionHandler.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatSessionHandler.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatSessionHandler.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/netcat/NetCatSessionHandler.java
Thu Dec 16 23:49:42 2004
@@ -1,4 +1,6 @@
 /*
+ *   @(#) $Id$
+ *
  *   Copyright 2004 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,52 +16,57 @@
  *   limitations under the License.
  *
  */
-/*
- * @(#) $Id$
- */
 package org.apache.mina.examples.netcat;
 
 import org.apache.mina.core.IdleStatus;
-import org.apache.mina.core.ReadBuffer;
-import org.apache.mina.core.Session;
-import org.apache.mina.core.SessionHandler;
-
+import org.apache.mina.io.ReadBuffer;
+import org.apache.mina.io.IoSession;
+import org.apache.mina.io.IoHandler;
 
 /**
  * TODO Document me.
- *
+ * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,
  */
-public class NetCatSessionHandler implements SessionHandler {
-    public void sessionOpened(Session session) {
-        session.getConfig().setIdleTime(IdleStatus.READER_IDLE, 10);
+public class NetCatSessionHandler implements IoHandler
+{
+    public void sessionOpened( IoSession session )
+    {
+        session.getConfig().setIdleTime( IdleStatus.READER_IDLE, 10 );
     }
 
-    public void sessionClosed(Session session) {
-        System.err.println("Total " + session.getReadBytes() + " byte(s)");
+    public void sessionClosed( IoSession session )
+    {
+        System.err.println( "Total " + session.getReadBytes() + " byte(s)" );
     }
 
-    public void sessionIdle(Session session, IdleStatus status) {
+    public void sessionIdle( IoSession session, IdleStatus status )
+    {
         session.close();
     }
 
-    public void exceptionCaught(Session session, Throwable cause) {
+    public void exceptionCaught( IoSession session, Throwable cause )
+    {
     }
 
-    public void dataRead(Session session, int readBytes) {
+    public void dataRead( IoSession session, int readBytes )
+    {
         ReadBuffer buf = session.getReadBuffer();
 
-        while (buf.hasRemaining()) {
-            System.out.print((char) buf.get());
+        while( buf.hasRemaining() )
+        {
+            System.out.print( ( char ) buf.get() );
         }
         buf.signal();
         System.out.flush();
     }
 
-    public void dataWritten(Session session, int writtenBytes) {
+    public void dataWritten( IoSession session, int writtenBytes )
+    {
     }
 
-	public void markerReleased(Session session, Object marker) {
-	}
-}
+    public void markerReleased( IoSession session, Object marker )
+    {
+    }
+}
\ No newline at end of file

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/Main.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/Main.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/Main.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/Main.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/Main.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/Main.java
Thu Dec 16 23:49:42 2004
@@ -1,4 +1,6 @@
 /*
+ *   @(#) $Id$
+ *
  *   Copyright 2004 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,31 +16,29 @@
  *   limitations under the License.
  *
  */
-/*
- * @(#) $Id$
- */
 package org.apache.mina.examples.reverser;
 
 import java.net.InetSocketAddress;
 
-import org.apache.mina.core.Acceptor;
-import org.apache.mina.core.socket.TcpAcceptor;
-import org.apache.mina.protocol.CoreAdapter;
-
+import org.apache.mina.io.Acceptor;
+import org.apache.mina.io.socket.TcpAcceptor;
+import org.apache.mina.protocol.IoAdapter;
 
 /**
  * TODO Document me.
- *
+ * 
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$,
  */
-public class Main {
+public class Main
+{
     private static final int PORT = 8080;
 
-    public static void main(String[] args) throws Exception {
+    public static void main( String[] args ) throws Exception
+    {
         Acceptor acceptor = new TcpAcceptor();
-        acceptor.bind(new InetSocketAddress(PORT),
-                      CoreAdapter.adapt(new ReverseProtocolProvider()));
-        System.out.println("Listening on port " + PORT);
+        acceptor.bind( new InetSocketAddress( PORT ),
+                       IoAdapter.adapt( new ReverseProtocolProvider() ) );
+        System.out.println( "Listening on port " + PORT );
     }
-}
+}
\ No newline at end of file

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolProvider.java
Thu Dec 16 23:49:42 2004
@@ -1,28 +1,46 @@
 /*
- * @(#) $Id$
+ *   @(#) $Id$
+ *
+ *   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.mina.examples.reverser;
 
 import org.apache.mina.protocol.ProtocolCodec;
 import org.apache.mina.protocol.ProtocolProvider;
-import org.apache.mina.protocol.ProtocolSessionHandler;
+import org.apache.mina.protocol.ProtocolHandler;
 
 /**
  * TODO Document me.
  * 
  * @author Trustin Lee (trustin@apache.org)
- * @version $Rev$, $Date$, 
+ * @version $Rev$, $Date$,
  */
-public class ReverseProtocolProvider implements ProtocolProvider {
-	
-	private static ProtocolSessionHandler HANDLER = new ReverseProtocolSessionHandler();
-
-	public ProtocolCodec newCodec() {
-		return new TextLineCodec();
-	}
-
-	public ProtocolSessionHandler getHandler() {
-		return HANDLER;
-	}
+public class ReverseProtocolProvider implements ProtocolProvider
+{
 
-}
+    private static ProtocolHandler HANDLER = new ReverseProtocolSessionHandler();
+
+    public ProtocolCodec newCodec()
+    {
+        return new TextLineCodec();
+    }
+
+    public ProtocolHandler getHandler()
+    {
+        return HANDLER;
+    }
+
+}
\ No newline at end of file

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolSessionHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolSessionHandler.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolSessionHandler.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolSessionHandler.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolSessionHandler.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/ReverseProtocolSessionHandler.java
Thu Dec 16 23:49:42 2004
@@ -1,51 +1,75 @@
 /*
- * @(#) $Id$
+ *   @(#) $Id$
+ *
+ *   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.mina.examples.reverser;
 
 import org.apache.mina.core.IdleStatus;
 import org.apache.mina.protocol.ProtocolSession;
-import org.apache.mina.protocol.ProtocolSessionHandler;
+import org.apache.mina.protocol.ProtocolHandler;
 
 /**
  * TODO Document me.
  * 
  * @author Trustin Lee (trustin@apache.org)
- * @version $Rev$, $Date$, 
+ * @version $Rev$, $Date$,
  */
-public class ReverseProtocolSessionHandler implements ProtocolSessionHandler {
+public class ReverseProtocolSessionHandler implements ProtocolHandler
+{
 
-	public void sessionOpened(ProtocolSession session) {
-		System.out.println(session.getRemoteAddress() + " OPENED");
-	}
-
-	public void sessionClosed(ProtocolSession session) {
-		System.out.println(session.getRemoteAddress() + " CLOSED");
-	}
-
-	public void sessionIdle(ProtocolSession session, IdleStatus status) {
-		System.out.println(session.getRemoteAddress() + " IDLE(" + status + ")");
-	}
-
-	public void exceptionCaught(ProtocolSession session, Throwable cause) {
-		System.out.println(session.getRemoteAddress() + " EXCEPTION");
-		cause.printStackTrace(System.out);
-		session.close();
-	}
-
-	public void messageReceived(ProtocolSession session, Object message) {
-		System.out.println(session.getRemoteAddress() + " RCVD: " + message);
-		
-		String str = message.toString();
-		StringBuffer buf = new StringBuffer(str.length());
-		for (int i = str.length()-1; i >= 0; i--) {
-			buf.append(str.charAt(i));
-		}
-		
-		session.write(buf.toString());
-	}
-
-	public void messageSent(ProtocolSession session, Object message) {
-		System.out.println(session.getRemoteAddress() + " SENT: " + message);
-	}
-}
+    public void sessionOpened( ProtocolSession session )
+    {
+        System.out.println( session.getRemoteAddress() + " OPENED" );
+    }
+
+    public void sessionClosed( ProtocolSession session )
+    {
+        System.out.println( session.getRemoteAddress() + " CLOSED" );
+    }
+
+    public void sessionIdle( ProtocolSession session, IdleStatus status )
+    {
+        System.out.println( session.getRemoteAddress() + " IDLE(" + status
+                            + ")" );
+    }
+
+    public void exceptionCaught( ProtocolSession session, Throwable cause )
+    {
+        System.out.println( session.getRemoteAddress() + " EXCEPTION" );
+        cause.printStackTrace( System.out );
+        session.close();
+    }
+
+    public void messageReceived( ProtocolSession session, Object message )
+    {
+        System.out.println( session.getRemoteAddress() + " RCVD: " + message );
+
+        String str = message.toString();
+        StringBuffer buf = new StringBuffer( str.length() );
+        for( int i = str.length() - 1; i >= 0; i-- )
+        {
+            buf.append( str.charAt( i ) );
+        }
+
+        session.write( buf.toString() );
+    }
+
+    public void messageSent( ProtocolSession session, Object message )
+    {
+        System.out.println( session.getRemoteAddress() + " SENT: " + message );
+    }
+}
\ No newline at end of file

Modified: incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineCodec.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineCodec.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineCodec.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineCodec.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineCodec.java
(original)
+++ incubator/directory/network/trunk/mina/src/examples/org/apache/mina/examples/reverser/TextLineCodec.java
Thu Dec 16 23:49:42 2004
@@ -1,10 +1,25 @@
 /*
- * @(#) $Id$
+ *   @(#) $Id$
+ *
+ *   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.mina.examples.reverser;
 
-import org.apache.mina.core.ReadBuffer;
-import org.apache.mina.core.WriteBuffer;
+import org.apache.mina.io.ReadBuffer;
+import org.apache.mina.io.WriteBuffer;
 import org.apache.mina.protocol.ProtocolCodec;
 import org.apache.mina.protocol.ProtocolSession;
 import org.apache.mina.protocol.ProtocolViolationException;
@@ -13,59 +28,75 @@
  * TODO Document me.
  * 
  * @author Trustin Lee (trustin@apache.org)
- * @version $Rev$, $Date$, 
+ * @version $Rev$, $Date$,
  */
-public class TextLineCodec implements ProtocolCodec {
-	
-	private String encodeData;
-	private int encodePos;
-	private StringBuffer decodeBuf = new StringBuffer();
-
-	public boolean encode(ProtocolSession session, Object message,
-			WriteBuffer out) throws ProtocolViolationException {
-		
-		if (message != encodeData) {
-			String val = message.toString();
-			if (val.length() > 256) {
-				throw new ProtocolViolationException("Cannot encode too long string.");
-			}
-			encodeData = val + "\r\n";
-			encodePos = 0;
-		}
-		
-		for (; encodePos < encodeData.length(); encodePos++) {
-			if (out.hasRemaining()) {
-				out.put((byte) encodeData.charAt(encodePos));
-			} else {
-				return false;
-			}
-		}
-		
-		encodeData = null;
-		return true;
-	}
-
-	public Object decode(ProtocolSession session, ReadBuffer in)
-			throws ProtocolViolationException {
-		do {
-			byte b = in.get();
-			switch (b) {
-			case '\r':
-				break;
-			case '\n':
-				String result = decodeBuf.toString();
-				decodeBuf.delete(0, decodeBuf.length());
-				return result;
-			default:
-				decodeBuf.append((char) b);
-			}
-			
-			if (decodeBuf.length() > 256) {
-				decodeBuf.delete(0, decodeBuf.length());
-				throw new ProtocolViolationException("The line is too long.");
-			}
-		} while (in.hasRemaining());
-		
-		return null;
-	}
-}
+public class TextLineCodec implements ProtocolCodec
+{
+
+    private String encodeData;
+
+    private int encodePos;
+
+    private StringBuffer decodeBuf = new StringBuffer();
+
+    public boolean encode( ProtocolSession session, Object message,
+                          WriteBuffer out ) throws ProtocolViolationException
+    {
+
+        if( message != encodeData )
+        {
+            String val = message.toString();
+            if( val.length() > 256 )
+            {
+                throw new ProtocolViolationException(
+                                                      "Cannot encode too long string." );
+            }
+            encodeData = val + "\r\n";
+            encodePos = 0;
+        }
+
+        for( ; encodePos < encodeData.length(); encodePos++ )
+        {
+            if( out.hasRemaining() )
+            {
+                out.put( ( byte ) encodeData.charAt( encodePos ) );
+            }
+            else
+            {
+                return false;
+            }
+        }
+
+        encodeData = null;
+        return true;
+    }
+
+    public Object decode( ProtocolSession session, ReadBuffer in )
+            throws ProtocolViolationException
+    {
+        do
+        {
+            byte b = in.get();
+            switch( b )
+            {
+            case '\r':
+                break;
+            case '\n':
+                String result = decodeBuf.toString();
+                decodeBuf.delete( 0, decodeBuf.length() );
+                return result;
+            default:
+                decodeBuf.append( ( char ) b );
+            }
+
+            if( decodeBuf.length() > 256 )
+            {
+                decodeBuf.delete( 0, decodeBuf.length() );
+                throw new ProtocolViolationException( "The line is too long." );
+            }
+        }
+        while( in.hasRemaining() );
+
+        return null;
+    }
+}
\ No newline at end of file

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Acceptor.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Acceptor.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Acceptor.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Acceptor.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Acceptor.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Acceptor.java	Thu Dec
16 23:49:42 2004
@@ -30,7 +30,7 @@
  */
 public interface Acceptor
 {
-    void bind( SocketAddress address, IoSessionHandler defaultHandler )
+    void bind( SocketAddress address, IoHandler defaultHandler )
             throws IOException;
 
     void unbind( SocketAddress address );

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Connector.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Connector.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Connector.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Connector.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Connector.java	(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/Connector.java	Thu
Dec 16 23:49:42 2004
@@ -30,9 +30,9 @@
  */
 public interface Connector
 {
-    void connect( SocketAddress address, IoSessionHandler defaultHandler )
+    void connect( SocketAddress address, IoHandler defaultHandler )
             throws IOException;
 
     void connect( SocketAddress address, int timeout,
-                 IoSessionHandler defaultHandler ) throws IOException;
+                 IoHandler defaultHandler ) throws IOException;
 }

Copied: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java
(from r122618, incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSessionHandler.java)
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSessionHandler.java&r1=122618&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSessionHandler.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoHandler.java	Thu
Dec 16 23:49:42 2004
@@ -26,7 +26,7 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
  */
-public interface IoSessionHandler
+public interface IoHandler
 {
     void sessionOpened( IoSession IoSession );
 

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSessionHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/IoSessionHandler.java?view=auto&rev=122626
==============================================================================

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpAcceptor.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpAcceptor.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpAcceptor.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpAcceptor.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpAcceptor.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpAcceptor.java
Thu Dec 16 23:49:42 2004
@@ -33,7 +33,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.mina.io.Acceptor;
-import org.apache.mina.io.IoSessionHandler;
+import org.apache.mina.io.IoHandler;
 
 /**
  * TODO Insert type comment.
@@ -65,14 +65,14 @@
         selector = Selector.open();
     }
 
-    public void bind( SocketAddress address, IoSessionHandler defaultHandler )
+    public void bind( SocketAddress address, IoHandler defaultHandler )
             throws IOException
     {
         this.bind( address, 50, defaultHandler );
     }
 
     public synchronized void bind( SocketAddress address, int backlog,
-                                  IoSessionHandler defaultHandler )
+                                  IoHandler defaultHandler )
             throws IOException
     {
         Validate.notNull( address );
@@ -157,7 +157,7 @@
 
                         TcpSession session = new TcpSession(
                                                              ch,
-                                                             ( IoSessionHandler ) key
+                                                             ( IoHandler ) key
                                                                                      .attachment()
);
                         TcpIoProcessor.getInstance().addSession( session );
                     }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpConnector.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpConnector.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpConnector.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpConnector.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpConnector.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpConnector.java
Thu Dec 16 23:49:42 2004
@@ -32,7 +32,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.mina.io.Connector;
-import org.apache.mina.io.IoSessionHandler;
+import org.apache.mina.io.IoHandler;
 
 /**
  * TODO Insert type comment. TODO Stop worker thread when not used.
@@ -62,14 +62,14 @@
         selector = Selector.open();
     }
 
-    public void connect( SocketAddress address, IoSessionHandler defaultHandler )
+    public void connect( SocketAddress address, IoHandler defaultHandler )
             throws IOException
     {
         connect( address, Integer.MAX_VALUE, defaultHandler );
     }
 
     public void connect( SocketAddress address, int timeout,
-                        IoSessionHandler defaultHandler ) throws IOException
+                        IoHandler defaultHandler ) throws IOException
     {
         Validate.notNull( address );
         Validate.notNull( defaultHandler );
@@ -198,7 +198,7 @@
         }
     }
 
-    private void newSession( SocketChannel ch, IoSessionHandler handler )
+    private void newSession( SocketChannel ch, IoHandler handler )
     {
         TcpSession session = new TcpSession( ch, handler );
         TcpIoProcessor.getInstance().addSession( session );
@@ -236,13 +236,13 @@
     {
         private final long deadline;
 
-        private final IoSessionHandler handler;
+        private final IoHandler handler;
 
         private boolean done;
 
         private IOException exception;
 
-        private ConnectEntry( int timeout, IoSessionHandler handler )
+        private ConnectEntry( int timeout, IoHandler handler )
         {
             this.deadline = System.currentTimeMillis() + timeout * 1000L;
             this.handler = handler;

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpSession.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpSession.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpSession.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpSession.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpSession.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/io/socket/TcpSession.java
Thu Dec 16 23:49:42 2004
@@ -27,7 +27,7 @@
 import org.apache.mina.core.SessionConfig;
 import org.apache.mina.io.ReadBuffer;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.IoSessionHandler;
+import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.WriteBuffer;
 import org.apache.mina.util.ByteBufferPool;
 
@@ -47,7 +47,7 @@
 
     private final TcpWriteBuffer writeBuf;
 
-    private final IoSessionHandler handler;
+    private final IoHandler handler;
 
     private SelectionKey key;
 
@@ -70,7 +70,7 @@
     /**
      * Creates a new instance.
      */
-    TcpSession( SocketChannel ch, IoSessionHandler defaultHandler )
+    TcpSession( SocketChannel ch, IoHandler defaultHandler )
     {
         this.ch = ch;
         this.config = new TcpSessionConfig( ch );
@@ -89,7 +89,7 @@
         return ch;
     }
 
-    IoSessionHandler getHandler()
+    IoHandler getHandler()
     {
         return handler;
     }

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/IoAdapter.java
Thu Dec 16 23:49:42 2004
@@ -25,7 +25,7 @@
 import org.apache.mina.core.*;
 import org.apache.mina.io.ReadBuffer;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.IoSessionHandler;
+import org.apache.mina.io.IoHandler;
 import org.apache.mina.io.WriteBuffer;
 import org.apache.mina.util.Queue;
 
@@ -39,16 +39,16 @@
 {
     private static final Log log = LogFactory.getLog( IoAdapter.class );
 
-    public static IoSessionHandler adapt( ProtocolProvider protocolProvider )
+    public static IoHandler adapt( ProtocolProvider protocolProvider )
     {
         return new SessionHandlerAdapter( protocolProvider );
     }
 
-    private static class SessionHandlerAdapter implements IoSessionHandler
+    private static class SessionHandlerAdapter implements IoHandler
     {
         private final ProtocolCodec codec;
 
-        private final ProtocolSessionHandler handler;
+        private final ProtocolHandler handler;
 
         public SessionHandlerAdapter( ProtocolProvider protocolProvider )
         {

Copied: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolHandler.java
(from r122618, incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java)
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolHandler.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java&r1=122618&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolHandler.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolHandler.java
Thu Dec 16 23:49:42 2004
@@ -26,7 +26,7 @@
  * @author Trustin Lee (trustin@apache.org)
  * @version $Rev$, $Date$
  */
-public interface ProtocolSessionHandler
+public interface ProtocolHandler
 {
     void sessionOpened( ProtocolSession session );
 

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolProvider.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolProvider.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolProvider.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolProvider.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolProvider.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolProvider.java
Thu Dec 16 23:49:42 2004
@@ -28,5 +28,5 @@
 {
     ProtocolCodec newCodec();
 
-    ProtocolSessionHandler getHandler();
+    ProtocolHandler getHandler();
 }

Deleted: /incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/protocol/ProtocolSessionHandler.java?view=auto&rev=122626
==============================================================================

Modified: incubator/directory/network/trunk/mina/src/java/org/apache/mina/registry/ServiceRegistry.java
Url: http://svn.apache.org/viewcvs/incubator/directory/network/trunk/mina/src/java/org/apache/mina/registry/ServiceRegistry.java?view=diff&rev=122627&p1=incubator/directory/network/trunk/mina/src/java/org/apache/mina/registry/ServiceRegistry.java&r1=122626&p2=incubator/directory/network/trunk/mina/src/java/org/apache/mina/registry/ServiceRegistry.java&r2=122627
==============================================================================
--- incubator/directory/network/trunk/mina/src/java/org/apache/mina/registry/ServiceRegistry.java
(original)
+++ incubator/directory/network/trunk/mina/src/java/org/apache/mina/registry/ServiceRegistry.java
Thu Dec 16 23:49:42 2004
@@ -21,7 +21,7 @@
 import java.io.IOException;
 import java.util.Iterator;
 
-import org.apache.mina.io.IoSessionHandler;
+import org.apache.mina.io.IoHandler;
 
 /**
  * Interface for the internet service registry. The registry is used by Netty
@@ -33,7 +33,7 @@
  */
 public interface ServiceRegistry
 {
-    void bind( Service service, IoSessionHandler sessionHandler )
+    void bind( Service service, IoHandler sessionHandler )
             throws IOException;
 
     void unbind( Service service );

Mime
View raw message