geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r731517 - in /geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main: java/org/apache/geronimo/gshell/commands/ssh/ShellFactoryImpl.java resources/META-INF/gshell/components.xml
Date Mon, 05 Jan 2009 10:25:20 GMT
Author: gnodet
Date: Mon Jan  5 02:25:19 2009
New Revision: 731517

URL: http://svn.apache.org/viewvc?rev=731517&view=rev
Log:
GSHELL-155: When remote logging through SSH, the shell variables are not set correctly (prompt,
user, etc...)

Modified:
    geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/ShellFactoryImpl.java
    geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/resources/META-INF/gshell/components.xml

Modified: geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/ShellFactoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/ShellFactoryImpl.java?rev=731517&r1=731516&r2=731517&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/ShellFactoryImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/ShellFactoryImpl.java
Mon Jan  5 02:25:19 2009
@@ -32,6 +32,8 @@
 import org.apache.geronimo.gshell.notification.ExitNotification;
 import org.apache.geronimo.gshell.shell.ShellContext;
 import org.apache.geronimo.gshell.shell.ShellContextHolder;
+import org.apache.geronimo.gshell.registry.CommandResolver;
+import org.apache.geronimo.gshell.application.Application;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,6 +53,8 @@
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    private Application application;
+
     private Console.Prompter prompter;
 
     private CommandLineExecutor executor;
@@ -101,6 +105,14 @@
         this.errorHandler = errorHandler;
     }
 
+    public Application getApplication() {
+        return application;
+    }
+
+    public void setApplication(Application application) {
+        this.application = application;
+    }
+
     public Shell createShell() {
         return new ShellImpl();
     }
@@ -140,7 +152,21 @@
 
         public void start(final Map<String,String> env) throws IOException {
             this.io = new IO(in, out, err, false);
-            this.variables = new Variables((Map)env);
+
+            // Create variables, inheriting the application ones
+            this.variables = new Variables(application.getVariables());
+            // Set up additional env
+            if (env != null) {
+                for (Map.Entry<String,String> entry : env.entrySet()) {
+                    this.variables.set(entry.getKey(), entry.getValue());
+                }
+            }
+            this.variables.set("gshell.prompt", application.getModel().getBranding().getPrompt());
+            this.variables.set(CommandResolver.GROUP, "/");
+            this.variables.set("gshell.username", env.get("USER"));
+            this.variables.set("gshell.hostname", application.getLocalHost());
+            // HACK: Add history for the 'history' command, since its not part of the Shell
intf it can't really access it
+            this.variables.set("gshell.internal.history", getHistory(), true);
             new Thread(this).start();
         }
 

Modified: geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/resources/META-INF/gshell/components.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/resources/META-INF/gshell/components.xml?rev=731517&r1=731516&r2=731517&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/resources/META-INF/gshell/components.xml
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/resources/META-INF/gshell/components.xml
Mon Jan  5 02:25:19 2009
@@ -51,6 +51,7 @@
     <bean name="sshServer" class="com.google.code.sshd.SshServer" factory-method="setUpDefaultServer"
scope="prototype">
         <property name="shellFactory">
             <bean class="org.apache.geronimo.gshell.commands.ssh.ShellFactoryImpl">
+                <property name="application" ref="application" />
                 <property name="completers">
                     <list>
                         <ref bean="commandsCompleter"/>



Mime
View raw message