geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r578531 - in /geronimo/sandbox/gshell/trunk/gshell-remote: gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/ gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ gshell-remote-common/src/m...
Date Sun, 23 Sep 2007 00:21:42 GMT
Author: jdillon
Date: Sat Sep 22 17:21:40 2007
New Revision: 578531

URL: http://svn.apache.org/viewvc?rev=578531&view=rev
Log:
Update the visitor api to take a session and visitor, since almost all of the visitor operations
want a session anyways

Modified:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitor.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitorSupport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/CloseShellMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ConnectMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/EchoMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ExecuteMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/LoginMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/OpenShellMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerHandler.java

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientHandler.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClientHandler.java
Sat Sep 22 17:21:40 2007
@@ -22,6 +22,7 @@
 import org.apache.geronimo.gshell.remote.message.MessageHandler;
 import org.apache.geronimo.gshell.remote.message.MessageVisitorSupport;
 import org.apache.geronimo.gshell.remote.message.rsh.EchoMessage;
+import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -49,7 +50,7 @@
     private class Visitor
         extends MessageVisitorSupport
     {
-        public void visitEcho(final EchoMessage msg) throws Exception {
+        public void visitEcho(IoSession session, final EchoMessage msg) throws Exception
{
             assert msg != null;
 
             log.info("ECHO: {}", msg.getText());

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/Message.java
Sat Sep 22 17:21:40 2007
@@ -49,7 +49,7 @@
 
     IoSession getSession();
 
-    void process(MessageVisitor visitor) throws Exception;
+    void process(IoSession session, MessageVisitor visitor) throws Exception;
 
     void freeze();
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageHandler.java
Sat Sep 22 17:21:40 2007
@@ -82,13 +82,14 @@
         if (obj instanceof Message) {
             Message msg = (Message)obj;
 
-            // Attach the session to the context
+            // Attach the session to the message (which is needed for methods like reply())
             msg.setSession(session);
             msg.freeze();
-
+            
             // Hand over to visitor for processing
             MessageVisitor visitor = MessageVisitor.BINDER.lookup(session);
-            msg.process(visitor);
+
+            msg.process(session, visitor);
         }
         else {
             throw new InvalidMessageException(obj);

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageSupport.java
Sat Sep 22 17:21:40 2007
@@ -189,7 +189,7 @@
         return frozen;
     }
 
-    public void process(final MessageVisitor visitor) throws Exception {
+    public void process(final IoSession session, final MessageVisitor visitor) throws Exception
{
         // Non-operation
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitor.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitor.java
Sat Sep 22 17:21:40 2007
@@ -26,6 +26,7 @@
 import org.apache.geronimo.gshell.remote.message.rsh.LoginMessage;
 import org.apache.geronimo.gshell.remote.message.rsh.OpenShellMessage;
 import org.apache.geronimo.gshell.remote.session.SessionAttributeBinder;
+import org.apache.mina.common.IoSession;
 
 /**
  * Provides an abstraction layer for message processing.
@@ -40,15 +41,15 @@
     
     SessionAttributeBinder<MessageVisitor> BINDER = new SessionAttributeBinder<MessageVisitor>(MessageVisitor.class);
 
-    void visitConnect(ConnectMessage msg) throws Exception;
+    void visitConnect(IoSession session, ConnectMessage msg) throws Exception;
 
-    void visitLogin(LoginMessage msg) throws Exception;
+    void visitLogin(IoSession session, LoginMessage msg) throws Exception;
 
-    void visitEcho(EchoMessage msg) throws Exception;
+    void visitEcho(IoSession session, EchoMessage msg) throws Exception;
 
-    void visitOpenShell(OpenShellMessage msg) throws Exception;
+    void visitOpenShell(IoSession session, OpenShellMessage msg) throws Exception;
 
-    void visitCloseShell(CloseShellMessage msg) throws Exception;
+    void visitCloseShell(IoSession session, CloseShellMessage msg) throws Exception;
 
-    void visitExecute(ExecuteMessage msg) throws Exception;
+    void visitExecute(IoSession session, ExecuteMessage msg) throws Exception;
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitorSupport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitorSupport.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitorSupport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitorSupport.java
Sat Sep 22 17:21:40 2007
@@ -25,6 +25,7 @@
 import org.apache.geronimo.gshell.remote.message.rsh.OpenShellMessage;
 import org.apache.geronimo.gshell.remote.message.rsh.ConnectMessage;
 import org.apache.geronimo.gshell.remote.message.rsh.LoginMessage;
+import org.apache.mina.common.IoSession;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -44,15 +45,15 @@
 
     protected MessageVisitorSupport() {}
 
-    public void visitConnect(ConnectMessage msg) throws Exception {}
+    public void visitConnect(IoSession session, ConnectMessage msg) throws Exception {}
 
-    public void visitLogin(LoginMessage msg) throws Exception {}
+    public void visitLogin(IoSession session, LoginMessage msg) throws Exception {}
 
-    public void visitEcho(EchoMessage msg) throws Exception {}
+    public void visitEcho(IoSession session, EchoMessage msg) throws Exception {}
 
-    public void visitOpenShell(OpenShellMessage msg) throws Exception {}
+    public void visitOpenShell(IoSession session, OpenShellMessage msg) throws Exception
{}
 
-    public void visitCloseShell(CloseShellMessage msg) throws Exception {}
+    public void visitCloseShell(IoSession session, CloseShellMessage msg) throws Exception
{}
 
-    public void visitExecute(ExecuteMessage msg) throws Exception {}
+    public void visitExecute(IoSession session, ExecuteMessage msg) throws Exception {}
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/CloseShellMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/CloseShellMessage.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/CloseShellMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/CloseShellMessage.java
Sat Sep 22 17:21:40 2007
@@ -22,6 +22,7 @@
 import org.apache.geronimo.gshell.remote.message.MessageSupport;
 import org.apache.geronimo.gshell.remote.message.MessageType;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
+import org.apache.mina.common.IoSession;
 
 /**
  * Close the remote shell instance.
@@ -35,9 +36,9 @@
         super(MessageType.CLOSE_SHELL);
     }
 
-    public void process(final MessageVisitor visitor) throws Exception {
+    public void process(final IoSession session, final MessageVisitor visitor) throws Exception
{
         assert visitor != null;
 
-        visitor.visitCloseShell(this);
+        visitor.visitCloseShell(session, this);
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ConnectMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ConnectMessage.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ConnectMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ConnectMessage.java
Sat Sep 22 17:21:40 2007
@@ -26,6 +26,7 @@
 import org.apache.geronimo.gshell.remote.message.MessageType;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoSession;
 
 /**
  * Initial client to server message to initiate the connection.
@@ -64,8 +65,8 @@
         this.clientKey = clientKey;
     }
 
-    public void process(final MessageVisitor visitor) throws Exception {
-        visitor.visitConnect(this);
+    public void process(final IoSession session, final MessageVisitor visitor) throws Exception
{
+        visitor.visitConnect(session, this);
     }
 
     public void readExternal(final ByteBuffer in) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/EchoMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/EchoMessage.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/EchoMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/EchoMessage.java
Sat Sep 22 17:21:40 2007
@@ -24,6 +24,7 @@
 import org.apache.geronimo.gshell.remote.message.MessageType;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoSession;
 
 /**
  * Echo text.
@@ -65,9 +66,9 @@
         Marshaller.writeString(out, text);
     }
 
-    public void process(final MessageVisitor visitor) throws Exception {
+    public void process(final IoSession session, final MessageVisitor visitor) throws Exception
{
         assert visitor != null;
 
-        visitor.visitEcho(this);
+        visitor.visitEcho(session, this);
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ExecuteMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ExecuteMessage.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ExecuteMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/ExecuteMessage.java
Sat Sep 22 17:21:40 2007
@@ -25,6 +25,7 @@
 import org.apache.geronimo.gshell.remote.message.MessageType;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoSession;
 
 /**
  * Execute a command.  This supports all flavors of the {@link CommandExecutor} execution
methods.
@@ -94,10 +95,10 @@
         Marshaller.writeObject(out, args);
     }
 
-    public void process(final MessageVisitor visitor) throws Exception {
+    public void process(final IoSession session, final MessageVisitor visitor) throws Exception
{
         assert visitor != null;
 
-        visitor.visitExecute(this);
+        visitor.visitExecute(session, this);
     }
 
     //

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/LoginMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/LoginMessage.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/LoginMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/LoginMessage.java
Sat Sep 22 17:21:40 2007
@@ -27,6 +27,7 @@
 import org.apache.geronimo.gshell.remote.message.MessageType;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
 import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.util.StringUtils;
 
 /**
@@ -74,8 +75,8 @@
         return password;
     }
 
-    public void process(final MessageVisitor visitor) throws Exception {
-        visitor.visitLogin(this);
+    public void process(final IoSession session, final MessageVisitor visitor) throws Exception
{
+        visitor.visitLogin(session, this);
     }
 
     public void readExternal(final ByteBuffer in) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/OpenShellMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/OpenShellMessage.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/OpenShellMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/rsh/OpenShellMessage.java
Sat Sep 22 17:21:40 2007
@@ -22,6 +22,7 @@
 import org.apache.geronimo.gshell.remote.message.MessageSupport;
 import org.apache.geronimo.gshell.remote.message.MessageType;
 import org.apache.geronimo.gshell.remote.message.MessageVisitor;
+import org.apache.mina.common.IoSession;
 
 /**
  * Open a remote shell instance.
@@ -35,9 +36,9 @@
         super(MessageType.OPEN_SHELL);
     }
 
-    public void process(final MessageVisitor visitor) throws Exception {
+    public void process(final IoSession session, final MessageVisitor visitor) throws Exception
{
         assert visitor != null;
 
-        visitor.visitOpenShell(this);
+        visitor.visitOpenShell(session, this);
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerHandler.java?rev=578531&r1=578530&r2=578531&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerHandler.java
Sat Sep 22 17:21:40 2007
@@ -72,7 +72,7 @@
     implements Initializable
 {
     //
-    // TODO: Introduce a context object which we can stuff any kinda of data we want into
for the session... and have one binder, etc...
+    // TODO: Introduce a context object which we can stuff any kinda of data we want into
for the client connection... and have one binder, etc...
     //
 
     private static final SessionAttributeBinder<PublicKey> CLIENT_KEY_BINDER = new
SessionAttributeBinder<PublicKey>(RshServerHandler.class, "clientpk");
@@ -122,11 +122,6 @@
         if (securityToken.equals(token)) {
             super.messageReceived(session, obj);
         }
-        else if (token != null) {
-            log.error("Invalid security token: {}", token);
-
-            session.close();
-        }
         else if (obj instanceof HandshakeMessage) {
             super.messageReceived(session, obj);
         }
@@ -183,6 +178,10 @@
     // MessageVisitor
     //
 
+    //
+    // TODO: Introduce a context object which we can stuff any kinda of data we want into
for the remote shell session... and have one binder, etc...
+    //
+
     private static final SessionAttributeBinder<IO> IO_BINDER = new SessionAttributeBinder<IO>(IO.class);
 
     private static final SessionAttributeBinder<Environment> ENV_BINDER = new SessionAttributeBinder<Environment>(Environment.class);
@@ -197,12 +196,8 @@
         //
 
         @Override
-        public void visitConnect(final ConnectMessage msg) throws Exception {
-            assert msg != null;
-
+        public void visitConnect(final IoSession session, final ConnectMessage msg) throws
Exception {
             log.debug("Processing handshake");
-
-            IoSession session = msg.getSession();
             
             // Try to cancel the timeout task
             if (!cancelTimeout(session)) {
@@ -227,13 +222,9 @@
         }
 
         @Override
-        public void visitLogin(final LoginMessage msg) throws Exception {
-            assert msg != null;
-
+        public void visitLogin(final IoSession session, final LoginMessage msg) throws Exception
{
             log.debug("Processing login");
 
-            IoSession session = msg.getSession();
-
             // Try to cancel the timeout task
             if (!cancelTimeout(session)) {
                 log.warn("Aborting login processing; timeout has triggered");
@@ -278,13 +269,9 @@
         }
 
         @Override
-        public void visitOpenShell(final OpenShellMessage msg) throws Exception {
-            assert msg != null;
-
+        public void visitOpenShell(final IoSession session, final OpenShellMessage msg) throws
Exception {
             log.info("OPEN SHELL: {}", msg);
 
-            IoSession session = msg.getSession();
-
             RemoteShellContainer shellContainer = createContainer();
             RemoteShellContainer.BINDER.bind(session, shellContainer);
 
@@ -292,7 +279,7 @@
             IO io = new IO(SessionInputStream.BINDER.lookup(session), SessionOutputStream.BINDER.lookup(session),
false);
 
             //
-            // FIXME: We need to set the verbosity of this I/O context as specified by the
client
+            // TODO: We need to set the verbosity of this I/O context as specified by the
client
             //
 
             IOLookup.set(shellContainer, io);
@@ -315,13 +302,9 @@
         }
 
         @Override
-        public void visitCloseShell(final CloseShellMessage msg) throws Exception {
-            assert msg != null;
-
+        public void visitCloseShell(final IoSession session, final CloseShellMessage msg)
throws Exception {
             log.info("CLOSE SHELL: {}", msg);
 
-            IoSession session = msg.getSession();
-
             log.info("Closing shell");
 
             RemoteShell shell = SHELL_BINDER.unbind(session);
@@ -351,13 +334,9 @@
         //
 
         @Override
-        public void visitExecute(final ExecuteMessage msg) throws Exception {
-            assert msg != null;
-
+        public void visitExecute(final IoSession session, final ExecuteMessage msg) throws
Exception {
             log.info("EXECUTE: {}", msg);
 
-            IoSession session = msg.getSession();
-
             RemoteShell shell = SHELL_BINDER.lookup(session);
 
             try {
@@ -396,21 +375,16 @@
         //
 
         @Override
-        public void visitEcho(final EchoMessage msg) throws Exception {
+        public void visitEcho(final IoSession session, final EchoMessage msg) throws Exception
{
             assert msg != null;
 
             log.info("ECHO: {}", msg);
 
             String text = msg.getText();
 
-            //
-            // HACK:
-            //
-
             if ("NOISE MAKER".equals(text)) {
                 log.info("Making noise...");
 
-                final IoSession session = msg.getSession();
                 final PrintWriter out = new PrintWriter(SessionOutputStream.BINDER.lookup(session),
false);
 
                 new Thread("NOISE MAKER") {



Mime
View raw message