geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r580731 - in /geronimo/sandbox/gshell/trunk: gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ gshe...
Date Sun, 30 Sep 2007 14:52:44 GMT
Author: jdillon
Date: Sun Sep 30 07:52:42 2007
New Revision: 580731

URL: http://svn.apache.org/viewvc?rev=580731&view=rev
Log:
For now simplify things a little and drop the Message.Type and Message.Factory muck, may bring
back when we revisit tighter protocol encoding

Modified:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ClientMessageHandlerSupport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ClientSessionContext.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/EchoHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/CloseShellMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ConnectMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/EchoMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ExecuteMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/LoginMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/OpenShellMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/RshMessage.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CloseShellHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ConnectHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/EchoHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/LoginHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerMessageHandlerSupport.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageHandlerSupport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
    geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTester.java

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ClientMessageHandlerSupport.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/handler/ClientMessageHandlerSupport.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ClientMessageHandlerSupport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ClientMessageHandlerSupport.java
Sun Sep 30 07:52:42 2007
@@ -32,7 +32,7 @@
     extends MessageHandlerSupport<T>
     implements ClientMessageHandler<T>
 {
-    protected ClientMessageHandlerSupport(final Message.Type type) {
+    protected ClientMessageHandlerSupport(final Class<T> type) {
         super(type);
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ClientSessionContext.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/handler/ClientSessionContext.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ClientSessionContext.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/ClientSessionContext.java
Sun Sep 30 07:52:42 2007
@@ -37,5 +37,6 @@
     /** The server's public key. */
     public PublicKey pk;
 
+    /** The subject which the remote client has been authenticated as. */
     public Subject subject;
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/EchoHandler.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/handler/EchoHandler.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/EchoHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/handler/EchoHandler.java
Sun Sep 30 07:52:42 2007
@@ -20,7 +20,6 @@
 package org.apache.geronimo.gshell.remote.client.handler;
 
 import org.apache.geronimo.gshell.remote.message.EchoMessage;
-import org.apache.geronimo.gshell.remote.message.RshMessage;
 import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.component.annotations.Component;
 
@@ -34,7 +33,7 @@
     extends ClientMessageHandlerSupport<EchoMessage>
 {
     public EchoHandler() {
-        super(RshMessage.Type.ECHO);
+        super(EchoMessage.class);
     }
 
     public void handle(final IoSession session, final ClientSessionContext context, final
EchoMessage message) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/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/CloseShellMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/CloseShellMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/CloseShellMessage.java
Sun Sep 30 07:52:42 2007
@@ -27,7 +27,5 @@
 public class CloseShellMessage
     extends RshMessage
 {
-    public CloseShellMessage() {
-        super(Type.CLOSE_SHELL);
-    }
+    public CloseShellMessage() {}
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/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/ConnectMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ConnectMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ConnectMessage.java
Sun Sep 30 07:52:42 2007
@@ -29,39 +29,21 @@
 public class ConnectMessage
     extends RshMessage
 {
-    private PublicKey publicKey;
-
-    protected ConnectMessage(final Type type, final PublicKey publicKey) {
-        super(type);
+    private final PublicKey publicKey;
 
+    public ConnectMessage(final PublicKey publicKey) {
         this.publicKey = publicKey;
     }
 
-    public ConnectMessage(final PublicKey clientKey) {
-        this(Type.CONNECT, clientKey);
-    }
-
-    public ConnectMessage() {
-        this(null);
-    }
-
     public PublicKey getPublicKey() {
-        if (publicKey == null) {
-            throw new IllegalStateException("Missing public key");
-        }
-
         return publicKey;
     }
 
-    public void setPublicKey(final PublicKey publicKey) {
-        this.publicKey = publicKey;
-    }
-
     public static class Result
         extends ConnectMessage
     {
         public Result(final PublicKey serverKey) {
-            super(Type.CONNECT_RESULT, serverKey);
+            super(serverKey);
         }
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/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/EchoMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/EchoMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/EchoMessage.java
Sun Sep 30 07:52:42 2007
@@ -30,8 +30,6 @@
     private final String text;
     
     public EchoMessage(final String text) {
-        super(Type.ECHO);
-        
         this.text = text;
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/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/ExecuteMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ExecuteMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ExecuteMessage.java
Sun Sep 30 07:52:42 2007
@@ -29,15 +29,13 @@
 public class ExecuteMessage
     extends RshMessage
 {
-    private Flavor flavor;
+    private final Flavor flavor;
     
-    private String path;
+    private final String path;
 
-    private Object[] args;
+    private final Object[] args;
 
     private ExecuteMessage(final Flavor flavor, final String path, final Object[] args) {
-        super(Type.EXECUTE);
-
         this.flavor = flavor;
         this.path = path;
         this.args = args;
@@ -65,32 +63,6 @@
         return flavor.execute(this, executor);
     }
 
-    /*
-    public void readExternal(final ByteBuffer in) throws Exception {
-        assert in != null;
-
-        super.readExternal(in);
-
-        this.flavor = Marshaller.readEnum(in, Flavor.class);
-
-        this.path = Marshaller.readString(in);
-
-        this.args = (Object[]) Marshaller.readObject(in);
-    }
-
-    public void writeExternal(final ByteBuffer out) throws Exception {
-        assert out != null;
-
-        super.writeExternal(out);
-
-        Marshaller.writeEnum(out, flavor);
-
-        Marshaller.writeString(out, path);
-
-        Marshaller.writeObject(out, args);
-    }
-    */
-
     //
     // Flavor
     //
@@ -122,65 +94,25 @@
         }
     }
 
-    /**
-     * Response for execute messages which contain the result of the command execution.
-     */
     public static class Result
         extends RshMessage
     {
-        private Object result;
-
-        protected Result(final Type type, final Object result) {
-            super(type);
-
-            this.result = result;
-        }
+        private final Object result;
 
         public Result(final Object result) {
-            this(Type.EXECUTE_RESULT, result);
-
             this.result = result;
         }
 
-        public Result() {
-            this(null, null);
-        }
-
         public Object getResult() {
             return result;
         }
-
-        /*
-        public void readExternal(final ByteBuffer in) throws Exception {
-            assert in != null;
-
-            super.readExternal(in);
-
-            result = Marshaller.readObject(in);
-        }
-
-        public void writeExternal(final ByteBuffer out) throws Exception {
-            assert out != null;
-
-            super.writeExternal(out);
-
-            Marshaller.writeObject(out, result);
-        }
-        */
     }
 
-    /**
-     * Response for execute messages which resulted in a server-side exception.
-     */
     public static class Fault
         extends Result
     {
         public Fault(final Throwable cause) {
-            super(Type.EXECUTE_FAULT, cause);
-        }
-
-        public Fault() {
-            this(null);
+            super(cause);
         }
 
         public Throwable getCause() {
@@ -188,18 +120,11 @@
         }
     }
 
-    /**
-     * Response for execute messages which resulted in a server-side notification.
-     */
     public static class Notification
         extends Result
     {
         public Notification(final org.apache.geronimo.gshell.common.Notification n) {
-            super(Type.EXECUTE_NOTIFICATION, n);
-        }
-
-        public Notification() {
-            this(null);
+            super(n);
         }
 
         public org.apache.geronimo.gshell.common.Notification getNotification() {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/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/LoginMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/LoginMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/LoginMessage.java
Sun Sep 30 07:52:42 2007
@@ -33,15 +33,13 @@
 public class LoginMessage
     extends RshMessage
 {
-    private String username;
+    private final String username;
 
-    private char[] password;
+    private final char[] password;
 
-    private String realm;
+    private final String realm;
     
     public LoginMessage(final String username, final char[] password, final String realm)
{
-        super(Type.LOGIN);
-
         this.username = username;
         
         this.password = password;
@@ -73,11 +71,9 @@
     public static class Success
         extends RshMessage
     {
-        private Serializable token;
+        private final Serializable token;
 
         public Success(Serializable token) {
-            super(Type.LOGIN_SUCCESS);
-
             this.token = token;
         }
 
@@ -89,18 +85,12 @@
     public static class Failure
         extends RshMessage
     {
-        private String reason;
+        private final String reason;
 
         public Failure(final String reason) {
-            super(Type.LOGIN_FAILURE);
-
             this.reason = reason;
         }
 
-        public Failure() {
-            this(null);
-        }
-        
         public String getReason() {
             return reason;
         }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/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/OpenShellMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/OpenShellMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/OpenShellMessage.java
Sun Sep 30 07:52:42 2007
@@ -27,7 +27,5 @@
 public class OpenShellMessage
     extends RshMessage
 {
-    public OpenShellMessage() {
-        super(Type.OPEN_SHELL);
-    }
+    public OpenShellMessage() {}
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/RshMessage.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/RshMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/RshMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/RshMessage.java
Sun Sep 30 07:52:42 2007
@@ -20,7 +20,6 @@
 package org.apache.geronimo.gshell.remote.message;
 
 import org.apache.geronimo.gshell.whisper.message.BaseMessage;
-import org.apache.geronimo.gshell.whisper.message.Message;
 
 /**
  * ???
@@ -30,37 +29,5 @@
 public class RshMessage
     extends BaseMessage
 {
-    protected RshMessage(final Type type) {
-        super(type);
-    }
-
-    public static enum Type
-        implements Message.Type
-    {
-        ECHO                    (EchoMessage.class),
-        CONNECT                 (ConnectMessage.class),
-        CONNECT_RESULT          (ConnectMessage.Result.class),
-        LOGIN                   (LoginMessage.class),
-        LOGIN_SUCCESS           (LoginMessage.Success.class),
-        LOGIN_FAILURE           (LoginMessage.Failure.class),
-        OPEN_SHELL              (OpenShellMessage.class),
-        CLOSE_SHELL             (CloseShellMessage.class),
-        EXECUTE                 (ExecuteMessage.class),
-        EXECUTE_RESULT          (ExecuteMessage.Result.class),
-        EXECUTE_NOTIFICATION    (ExecuteMessage.Notification.class),
-        EXECUTE_FAULT           (ExecuteMessage.Fault.class),
-        ;
-
-        private final Class<? extends RshMessage> type;
-
-        private Type(Class<? extends RshMessage> type) {
-            assert type != null;
-
-            this.type = type;
-        }
-
-        public Class<? extends RshMessage> getType() {
-            return type;
-        }
-    }
+    protected RshMessage() {}
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CloseShellHandler.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/handler/CloseShellHandler.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CloseShellHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/CloseShellHandler.java
Sun Sep 30 07:52:42 2007
@@ -21,7 +21,6 @@
 
 import org.apache.geronimo.gshell.remote.message.CloseShellMessage;
 import org.apache.geronimo.gshell.remote.message.EchoMessage;
-import org.apache.geronimo.gshell.remote.message.RshMessage;
 import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.component.annotations.Component;
 
@@ -35,7 +34,7 @@
     extends ServerMessageHandlerSupport<CloseShellMessage>
 {
     public CloseShellHandler() {
-        super(RshMessage.Type.CLOSE_SHELL);
+        super(CloseShellMessage.class);
     }
 
     public void handle(final IoSession session, final ServerSessionContext context, final
CloseShellMessage message) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ConnectHandler.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/handler/ConnectHandler.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ConnectHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ConnectHandler.java
Sun Sep 30 07:52:42 2007
@@ -21,7 +21,6 @@
 
 import org.apache.geronimo.gshell.remote.crypto.CryptoContext;
 import org.apache.geronimo.gshell.remote.message.ConnectMessage;
-import org.apache.geronimo.gshell.remote.message.RshMessage;
 import org.apache.geronimo.gshell.remote.server.RshServer;
 import org.apache.geronimo.gshell.remote.server.timeout.TimeoutManager;
 import org.apache.mina.common.IoSession;
@@ -44,7 +43,7 @@
     private TimeoutManager timeoutManager;
     
     public ConnectHandler() {
-        super(RshMessage.Type.CONNECT);
+        super(ConnectMessage.class);
     }
 
     public void handle(final IoSession session, final ServerSessionContext context, final
ConnectMessage message) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/EchoHandler.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/handler/EchoHandler.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/EchoHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/EchoHandler.java
Sun Sep 30 07:52:42 2007
@@ -20,7 +20,6 @@
 package org.apache.geronimo.gshell.remote.server.handler;
 
 import org.apache.geronimo.gshell.remote.message.EchoMessage;
-import org.apache.geronimo.gshell.remote.message.RshMessage;
 import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.component.annotations.Component;
 
@@ -34,7 +33,7 @@
     extends ServerMessageHandlerSupport<EchoMessage>
 {
     public EchoHandler() {
-        super(RshMessage.Type.ECHO);
+        super(EchoMessage.class);
     }
 
     public void handle(final IoSession session, final ServerSessionContext context, final
EchoMessage message) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.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/handler/ExecuteHandler.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ExecuteHandler.java
Sun Sep 30 07:52:42 2007
@@ -23,7 +23,6 @@
 import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
 import org.apache.geronimo.gshell.lookup.IOLookup;
 import org.apache.geronimo.gshell.remote.message.ExecuteMessage;
-import org.apache.geronimo.gshell.remote.message.RshMessage;
 import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.component.annotations.Component;
 
@@ -37,7 +36,7 @@
     extends ServerMessageHandlerSupport<ExecuteMessage>
 {
     public ExecuteHandler() {
-        super(RshMessage.Type.EXECUTE);
+        super(ExecuteMessage.class);
     }
 
     public void handle(final IoSession session, final ServerSessionContext context, final
ExecuteMessage message) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/LoginHandler.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/handler/LoginHandler.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/LoginHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/LoginHandler.java
Sun Sep 30 07:52:42 2007
@@ -27,7 +27,6 @@
 import org.apache.geronimo.gshell.remote.jaas.JaasConfigurationHelper;
 import org.apache.geronimo.gshell.remote.jaas.UsernamePasswordCallbackHandler;
 import org.apache.geronimo.gshell.remote.message.LoginMessage;
-import org.apache.geronimo.gshell.remote.message.RshMessage;
 import org.apache.geronimo.gshell.remote.server.timeout.TimeoutManager;
 import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.component.annotations.Component;
@@ -49,7 +48,7 @@
     private TimeoutManager timeoutManager;
 
     public LoginHandler() {
-        super(RshMessage.Type.LOGIN);
+        super(LoginMessage.class);
     }
 
     public void initialize() throws InitializationException {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.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/handler/OpenShellHandler.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/OpenShellHandler.java
Sun Sep 30 07:52:42 2007
@@ -25,7 +25,6 @@
 import org.apache.geronimo.gshell.remote.RemoteShell;
 import org.apache.geronimo.gshell.remote.message.EchoMessage;
 import org.apache.geronimo.gshell.remote.message.OpenShellMessage;
-import org.apache.geronimo.gshell.remote.message.RshMessage;
 import org.apache.geronimo.gshell.remote.server.RemoteIO;
 import org.apache.geronimo.gshell.remote.server.RemoteShellContainer;
 import org.apache.mina.common.IoSession;
@@ -47,7 +46,7 @@
     private PlexusContainer container;
 
     public OpenShellHandler() {
-        super(RshMessage.Type.OPEN_SHELL);
+        super(OpenShellMessage.class);
     }
 
     public void handle(final IoSession session, final ServerSessionContext context, final
OpenShellMessage message) throws Exception {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerMessageHandlerSupport.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/handler/ServerMessageHandlerSupport.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerMessageHandlerSupport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerMessageHandlerSupport.java
Sun Sep 30 07:52:42 2007
@@ -32,7 +32,7 @@
     extends MessageHandlerSupport<T>
     implements ServerMessageHandler<T>
 {
-    protected ServerMessageHandlerSupport(final Message.Type type) {
+    protected ServerMessageHandlerSupport(final Class<T> type) {
         super(type);
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.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/handler/ServerSessionContext.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/handler/ServerSessionContext.java
Sun Sep 30 07:52:42 2007
@@ -44,8 +44,16 @@
 
     public Identity identity;
 
+    public Subject getSubject() {
+        return identity.getSubject();
+    }
+
+    public UserPrincipal getUserPrincipal() {
+        return getSubject().getPrincipals(UserPrincipal.class).iterator().next();
+    }
+
     public String getUsername() {
-        return identity.getSubject().getPrincipals(UserPrincipal.class).iterator().next().getName();
+        return getUserPrincipal().getName();
     }
 
     public RemoteShellContainer container;

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/BaseMessage.java
Sun Sep 30 07:52:42 2007
@@ -34,8 +34,6 @@
 {
     private static final AtomicLong SEQUENCE_GENERATOR = new AtomicLong(0);
 
-    private Type type;
-
     private ID id = LongMessageID.generate();
 
     private ID cid;
@@ -44,13 +42,7 @@
 
     private long timestamp = System.currentTimeMillis();
 
-    protected BaseMessage(final Type type) {
-        assert type != null;
-        
-        this.type = type;
-
-        this.timestamp = System.currentTimeMillis();
-    }
+    protected BaseMessage() {}
 
     public int hashCode() {
         return getId().hashCode();
@@ -58,10 +50,6 @@
 
     public String toString() {
         return new ReflectionToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).toString();
-    }
-
-    public Type getType() {
-        return type;
     }
 
     public ID getId() {

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/Message.java
Sun Sep 30 07:52:42 2007
@@ -38,8 +38,6 @@
     //
     // void setCorrelationId(ID id);
 
-    Type getType();
-
     long getTimestamp();
 
     long getSequence();
@@ -48,30 +46,5 @@
         extends Serializable
     {
         // Empty
-    }
-
-    //
-    // TODO: Make the Type an Enum using Generics
-    //
-
-    interface Type
-        extends Serializable
-    {
-        Class<? extends Message> getType();
-
-        //
-        // TODO: Just expose a byte index() and serialize that and leave the mapping up to
the protocol implementation
-        //
-    }
-
-    interface Factory
-    {
-        Message create(Type type) throws Exception;
-
-        // TODO: ??
-        // Message create(byte index) throws Exception;
-        //
-        // Would still really like to use enums... but need to do some magic to marshal and
unmarshal them...
-        //
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageHandlerSupport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageHandlerSupport.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageHandlerSupport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/message/MessageHandlerSupport.java
Sun Sep 30 07:52:42 2007
@@ -32,16 +32,15 @@
 {
     protected final Logger log = LoggerFactory.getLogger(getClass());
     
-    private Message.Type type;
+    private Class<T> type;
 
-    protected MessageHandlerSupport(final Message.Type type) {
+    protected MessageHandlerSupport(final Class<T> type) {
         assert type != null;
 
         this.type = type;
     }
 
     public Class<T> getType() {
-        // noinspection unchecked
-        return (Class<T>) type.getType();
+        return type;
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/stream/StreamMessage.java
Sun Sep 30 07:52:42 2007
@@ -25,7 +25,6 @@
 import java.nio.channels.WritableByteChannel;
 
 import org.apache.geronimo.gshell.whisper.message.BaseMessage;
-import org.apache.geronimo.gshell.whisper.message.Message;
 import org.apache.mina.common.ByteBuffer;
 
 /**
@@ -36,11 +35,9 @@
 public class StreamMessage
     extends BaseMessage
 {
-    private byte[] bytes;
-
-    public StreamMessage(final Type type, final ByteBuffer buffer) throws IOException {
-        super(type);
+    private final byte[] bytes;
 
+    public StreamMessage(final ByteBuffer buffer) throws IOException {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         
         WritableByteChannel channel = Channels.newChannel(baos);
@@ -50,25 +47,7 @@
         bytes = baos.toByteArray();
     }
 
-    public StreamMessage(final ByteBuffer buffer) throws IOException {
-        this(StreamMessage.Type.IN, buffer);
-    }
-
     public ByteBuffer getBuffer() {
         return ByteBuffer.wrap(bytes);
-    }
-
-    public static enum Type
-        implements Message.Type
-    {
-
-        IN,  // (local SYSOUT to remote SYSIN)
-        OUT, // ???
-        ERR  // ???
-        ;
-
-        public Class<? extends Message> getType() {
-            return StreamMessage.class;
-        }
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransport.java
Sun Sep 30 07:52:42 2007
@@ -38,8 +38,8 @@
 import org.apache.mina.common.IoConnector;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.common.WriteFuture;
 import org.apache.mina.common.ThreadModel;
+import org.apache.mina.common.WriteFuture;
 
 /**
  * Support for {@link Transport} implementations.

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/main/java/org/apache/geronimo/gshell/whisper/transport/base/BaseTransportServer.java
Sun Sep 30 07:52:42 2007
@@ -23,8 +23,8 @@
 import java.net.URI;
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.apache.geronimo.gshell.whisper.transport.TransportServer;
 import org.apache.geronimo.gshell.whisper.session.ThreadPoolModel;
+import org.apache.geronimo.gshell.whisper.transport.TransportServer;
 import org.apache.mina.common.IoAcceptor;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.ThreadModel;

Modified: geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTester.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTester.java?rev=580731&r1=580730&r2=580731&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTester.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-whisper/src/test/java/org/apache/geronimo/gshell/whisper/message/PingPongProtocolTester.java
Sun Sep 30 07:52:42 2007
@@ -43,37 +43,16 @@
         System.err.println(">>> [" + Thread.currentThread().getName() + "] " + msg);
     }
 
-    public static enum PingPongMessageType
-        implements Message.Type
-    {
-        PING(PingMessage.class),
-        PONG(PongMessage.class);
-
-        Class<? extends Message> type;
-
-        PingPongMessageType(Class<? extends Message> type) {
-            this.type = type;
-        }
-
-        public Class<? extends Message> getType() {
-            return type;
-        }
-    }
-
     public static class PingMessage
         extends BaseMessage
     {
-        public PingMessage() {
-            super(PingPongMessageType.PING);
-        }
+        public PingMessage() {}
     }
 
     public static class PongMessage
         extends BaseMessage
     {
-        public PongMessage() {
-            super(PingPongMessageType.PONG);
-        }
+        public PongMessage() {}
     }
 
 



Mime
View raw message