geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r576671 - in /geronimo/sandbox/gshell/trunk: gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/ gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/ gshell-remote/gshell-remote-c...
Date Tue, 18 Sep 2007 03:02:30 GMT
Author: jdillon
Date: Mon Sep 17 20:02:29 2007
New Revision: 576671

URL: http://svn.apache.org/viewvc?rev=576671&view=rev
Log:
Add command to execute a remote command-line

Added:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ExecuteMessage.java
      - copied, changed from r576652, geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/EchoMessage.java
Modified:
    geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageType.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/MessageVisitorAdapter.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpServerMessageVisitor.java

Modified: geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java?rev=576671&r1=576670&r2=576671&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-maven-plugin/src/main/java/org/apache/geronimo/gshell/maven/gshell/CommandSetDescriptorMojo.java
Mon Sep 17 20:02:29 2007
@@ -158,7 +158,7 @@
     }
 
     private CommandDescriptor createCommandDescriptor(final Class<?> type) {
-        getLog().debug("Processing command: " + type);
+        getLog().info("Found command: " + type);
 
         CommandDescriptor desc = new CommandDescriptor();
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.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/RshClient.java?rev=576671&r1=576670&r2=576671&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshClient.java
Mon Sep 17 20:02:29 2007
@@ -24,6 +24,7 @@
 import java.net.URI;
 
 import org.apache.geronimo.gshell.remote.message.EchoMessage;
+import org.apache.geronimo.gshell.remote.message.ExecuteMessage;
 import org.apache.geronimo.gshell.remote.message.HandShakeMessage;
 import org.apache.geronimo.gshell.remote.message.Message;
 import org.apache.geronimo.gshell.remote.transport.Transport;
@@ -63,6 +64,16 @@
         Message resp = transport.request(new HandShakeMessage());
 
         log.info("Response: {}", resp);
+    }
+
+    public void execute(final String line) throws Exception {
+        log.info("Executing: {}", line);
+
+        transport.send(new ExecuteMessage(line));
+
+        //
+        // TODO: Need to handle the command result
+        //
     }
 
     public InputStream getInputStream() {

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.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/RshCommand.java?rev=576671&r1=576670&r2=576671&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remote/client/RshCommand.java
Mon Sep 17 20:02:29 2007
@@ -70,7 +70,7 @@
             public Result execute(final String line) throws Exception {
                 assert line != null;
 
-                client.echo(line);
+                client.execute(line);
 
                 return Result.CONTINUE;
             }

Copied: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ExecuteMessage.java
(from r576652, 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/ExecuteMessage.java?p2=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/ExecuteMessage.java&p1=geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/EchoMessage.java&r1=576652&r2=576671&rev=576671&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/ExecuteMessage.java
Mon Sep 17 20:02:29 2007
@@ -22,27 +22,27 @@
 import org.apache.mina.common.ByteBuffer;
 
 /**
- * Echo text.
+ * Execute a command-line.
  *
  * @version $Rev$ $Date$
  */
-public class EchoMessage
+public class ExecuteMessage
     extends MessageSupport
 {
-    private String text;
-    
-    public EchoMessage(final String text) {
-        super(MessageType.ECHO);
-        
-        this.text = text;
+    private String line;
+
+    public ExecuteMessage(final String line) {
+        super(MessageType.EXECUTE);
+
+        this.line = line;
     }
 
-    public EchoMessage() {
+    public ExecuteMessage() {
         this(null);
     }
 
-    public String getText() {
-        return text;
+    public String getLine() {
+        return line;
     }
 
     public void readExternal(final ByteBuffer buff) throws Exception {
@@ -50,7 +50,7 @@
 
         super.readExternal(buff);
 
-        text = readString(buff);
+        line = readString(buff);
     }
 
     public void writeExternal(final ByteBuffer buff) throws Exception {
@@ -58,12 +58,12 @@
 
         super.writeExternal(buff);
 
-        writeString(buff, text);
+        writeString(buff, line);
     }
 
     public void process(final MessageVisitor visitor) throws Exception {
         assert visitor != null;
 
-        visitor.visitEcho(this);
+        visitor.visitExecute(this);
     }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageType.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/MessageType.java?rev=576671&r1=576670&r2=576671&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageType.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageType.java
Mon Sep 17 20:02:29 2007
@@ -29,6 +29,7 @@
     ECHO            (EchoMessage.class),
     HANDSHAKE       (HandShakeMessage.class),
     WRITE_STREAM    (WriteStreamMessage.class),
+    EXECUTE         (ExecuteMessage.class),
     ;
 
     private final Class<? extends Message> type;

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=576671&r1=576670&r2=576671&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
Mon Sep 17 20:02:29 2007
@@ -31,4 +31,6 @@
     void visitHandShake(HandShakeMessage msg) throws Exception;
     
     void visitWriteStream(WriteStreamMessage msg) throws Exception;
+
+    void visitExecute(ExecuteMessage msg) throws Exception;
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitorAdapter.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/MessageVisitorAdapter.java?rev=576671&r1=576670&r2=576671&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitorAdapter.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/message/MessageVisitorAdapter.java
Mon Sep 17 20:02:29 2007
@@ -38,4 +38,8 @@
     public void visitWriteStream(WriteStreamMessage msg) throws Exception {
         // Empty
     }
+
+    public void visitExecute(ExecuteMessage msg) throws Exception {
+        // Empty
+    }
 }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpServerMessageVisitor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpServerMessageVisitor.java?rev=576671&r1=576670&r2=576671&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpServerMessageVisitor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/transport/tcp/TcpServerMessageVisitor.java
Mon Sep 17 20:02:29 2007
@@ -28,6 +28,7 @@
 
 import org.apache.geronimo.gshell.remote.message.EchoMessage;
 import org.apache.geronimo.gshell.remote.message.HandShakeMessage;
+import org.apache.geronimo.gshell.remote.message.ExecuteMessage;
 import org.apache.geronimo.gshell.remote.transport.Transport;
 import org.apache.mina.common.IoSession;
 import org.codehaus.plexus.component.annotations.Component;
@@ -114,5 +115,15 @@
         log.info("HANDSHAKE");
 
         msg.reply(new EchoMessage("SUCCESS"));
+    }
+
+    public void visitExecute(final ExecuteMessage msg) throws Exception {
+        assert msg != null;
+
+        log.info("EXECUTE: {}", msg.getLine());
+
+        //
+        // TODO:
+        //
     }
 }



Mime
View raw message