geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r577080 - in /geronimo/sandbox/gshell/trunk: gshell-core/src/main/java/org/apache/geronimo/gshell/ gshell-core/src/main/java/org/apache/geronimo/gshell/layout/ gshell-remote/gshell-remote-client/src/main/java/org/apache/geronimo/gshell/remo...
Date Tue, 18 Sep 2007 21:59:06 GMT
Author: jdillon
Date: Tue Sep 18 14:59:05 2007
New Revision: 577080

URL: http://svn.apache.org/viewvc?rev=577080&view=rev
Log:
Don't puke if home isn't set, just use user.home.  Consequently disabling the layout.xml loading
for now
Added support to pass back notifications (like ExitNotification from the remote shell to the
proxy)

Modified:
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java
    geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.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-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/MessageType.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java?rev=577080&r1=577079&r2=577080&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/DefaultShellInfo.java
Tue Sep 18 14:59:05 2007
@@ -73,6 +73,7 @@
 
     public void initialize() throws InitializationException {
         homeDir = detectHomeDir();
+        
         log.debug("Using home directory: {}", homeDir);
 
         try {
@@ -86,16 +87,18 @@
     private File detectHomeDir() throws InitializationException {
         String homePath = branding.getProperty(Branding.HOME);
 
-        //
-        // FIXME: This is not very friendly to folks embedding the shell
-        //
-        
         if (homePath == null) {
-            throw new InitializationException("The '" + branding.getPropertyName(Branding.HOME)
+ "' property must be set for the shell to function correctly");
+            //
+            // FIXME: For now just use the user's home ?  We may actually want to try and
figure this our harder (like
+            //        how Launcher does...
+            //
+
+            homePath = System.getProperty("user.home");
         }
 
         // And now lets resolve this sucker
         File dir;
+        
         try {
             dir = new File(homePath).getCanonicalFile();
         }

Modified: geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java?rev=577080&r1=577079&r2=577080&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-core/src/main/java/org/apache/geronimo/gshell/layout/DefaultLayoutManager.java
Tue Sep 18 14:59:05 2007
@@ -58,12 +58,18 @@
     public void initialize() throws InitializationException {
         assert loader != null;
 
+        //
+        // FIXME: Turn this off for now...
+        //
+
+        /*
         try {
             layout = loader.load();
         }
         catch (IOException e) {
             throw new InitializationException(e.getMessage(), e);
         }
+        */
     }
 
     public Layout getLayout() {

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=577080&r1=577079&r2=577080&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
Tue Sep 18 14:59:05 2007
@@ -123,6 +123,13 @@
             throw new Exception("Remote command execution fault", fault.getCause());
         }
 
+        // Handle result notifications
+        if (result instanceof ExecuteMessage.Notification) {
+            ExecuteMessage.Notification n = (ExecuteMessage.Notification)result;
+
+            throw n.getNotification();
+        }
+
         Object rv = result.getResult();
 
         log.info("Command result: {}", rv);

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=577080&r1=577079&r2=577080&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
Tue Sep 18 14:59:05 2007
@@ -179,7 +179,7 @@
         extends Result
     {
         public Fault(final Throwable cause) {
-            super(MessageType.EXECUTE_RESULT, cause);
+            super(MessageType.EXECUTE_FAULT, cause);
         }
 
         public Fault() {
@@ -188,6 +188,25 @@
 
         public Throwable getCause() {
             return (Throwable) getResult();
+        }
+    }
+
+    /**
+     * Container for any notifications thrown durring execution.
+     */
+    public static class Notification
+        extends Result
+    {
+        public Notification(final org.apache.geronimo.gshell.common.Notification n) {
+            super(MessageType.EXECUTE_NOTIFICATION, n);
+        }
+
+        public Notification() {
+            this(null);
+        }
+
+        public org.apache.geronimo.gshell.common.Notification getNotification() {
+            return (org.apache.geronimo.gshell.common.Notification) getResult();
         }
     }
 }

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=577080&r1=577079&r2=577080&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
Tue Sep 18 14:59:05 2007
@@ -26,17 +26,18 @@
  */
 public enum MessageType
 {
-    ECHO                (EchoMessage.class),
-    HANDSHAKE           (HandShakeMessage.class),
-    HANDSHAKE_RESULT    (HandShakeMessage.Result.class),
-    LOGIN               (LoginMessage.class),
-    LOGIN_RESULT        (LoginMessage.Result.class),
-    OPEN_SHELL          (OpenShellMessage.class),
-    CLOSE_SHELL         (CloseShellMessage.class),
-    EXECUTE             (ExecuteMessage.class),
-    EXECUTE_RESULT      (ExecuteMessage.Result.class),
-    EXECUTE_FAULT       (ExecuteMessage.Fault.class),
-    WRITE_STREAM        (WriteStreamMessage.class),
+    ECHO                    (EchoMessage.class),
+    HANDSHAKE               (HandShakeMessage.class),
+    HANDSHAKE_RESULT        (HandShakeMessage.Result.class),
+    LOGIN                   (LoginMessage.class),
+    LOGIN_RESULT            (LoginMessage.Result.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),
+    WRITE_STREAM            (WriteStreamMessage.class),
     ;
 
     private final Class<? extends Message> type;

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.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/RshServerMessageVisitor.java?rev=577080&r1=577079&r2=577080&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-server/src/main/java/org/apache/geronimo/gshell/remote/server/RshServerMessageVisitor.java
Tue Sep 18 14:59:05 2007
@@ -19,14 +19,12 @@
 
 package org.apache.geronimo.gshell.remote.server;
 
-import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
 
 import org.apache.geronimo.gshell.DefaultEnvironment;
-import org.apache.geronimo.gshell.ExitNotification;
 import org.apache.geronimo.gshell.command.IO;
+import org.apache.geronimo.gshell.common.Notification;
 import org.apache.geronimo.gshell.lookup.EnvironmentLookup;
 import org.apache.geronimo.gshell.lookup.IOLookup;
 import org.apache.geronimo.gshell.remote.message.CloseShellMessage;
@@ -44,7 +42,6 @@
 import org.codehaus.plexus.classworlds.ClassWorld;
 import org.codehaus.plexus.component.annotations.Component;
 import org.codehaus.plexus.component.annotations.Requirement;
-import org.codehaus.plexus.component.factory.ComponentFactory;
 
 /**
  * Defines the logic for server-side message processing.
@@ -230,12 +227,8 @@
 
                     msg.reply(new ExecuteMessage.Result(result));
                 }
-                catch (ExitNotification n) {
-                    //
-                    // TODO: Send client message with this detail...
-                    //
-
-                    log.info("Remote shell requested exit: {}", n);
+                catch (Notification n) {
+                    msg.reply(new ExecuteMessage.Notification(n));
 
                     session.close();
                 }



Mime
View raw message