geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r787966 - in /geronimo/gshell/trunk: gshell-assembly/src/main/underlay/etc/ gshell-commands/gshell-ssh/ gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/ gshell-commands/gshell-ssh/src/main/resources/META-INF...
Date Wed, 24 Jun 2009 10:24:03 GMT
Author: jdillon
Date: Wed Jun 24 10:24:03 2009
New Revision: 787966

URL: http://svn.apache.org/viewvc?rev=787966&view=rev
Log:
(GSHELL-163) Upgrade to org.apache.sshd 0.1.0

Modified:
    geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
    geronimo/gshell/trunk/gshell-commands/gshell-ssh/pom.xml
    geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java
    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/java/org/apache/geronimo/gshell/commands/ssh/SshAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshServerAction.java
    geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/resources/META-INF/gshell/components.xml

Modified: geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml?rev=787966&r1=787965&r2=787966&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml (original)
+++ geronimo/gshell/trunk/gshell-assembly/src/main/underlay/etc/application.xml Wed Jun 24
10:24:03 2009
@@ -29,7 +29,10 @@
     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
         <property name="properties">
             <props>
-                <prop key="gshell.version">1.0-alpha-2-SNAPSHOT</prop>
+                <!--
+                FIXME: Use filtering to automatically keep this updated.
+                -->
+                <prop key="gshell.version">1.0-alpha-3-SNAPSHOT</prop>
             </props>
         </property>
     </bean>

Modified: geronimo/gshell/trunk/gshell-commands/gshell-ssh/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-ssh/pom.xml?rev=787966&r1=787965&r2=787966&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-ssh/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-ssh/pom.xml Wed Jun 24 10:24:03 2009
@@ -37,35 +37,6 @@
         SSH support.
     </description>
 
-    <repositories>
-        <repository>
-            <id>sshd.releases</id>
-            <name>SSHD Repository</name>
-            <url>http://sshd.googlecode.com/svn/m2-repo/</url>
-            <layout>default</layout>
-            <snapshots>
-                <enabled>false</enabled>
-            </snapshots>
-            <releases>
-                <enabled>true</enabled>
-            </releases>
-        </repository>
-        <repository>
-            <id>sshd.snapshots</id>
-            <name>SSHD Repository</name>
-            <url>http://sshd.googlecode.com/svn/m2-snapshot-repo/</url>
-            <layout>default</layout>
-            <snapshots>
-                <enabled>true</enabled>
-                <updatePolicy>daily</updatePolicy>
-                <checksumPolicy>ignore</checksumPolicy>
-            </snapshots>
-            <releases>
-                <enabled>false</enabled>
-            </releases>
-        </repository>
-    </repositories>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.geronimo.gshell</groupId>
@@ -88,9 +59,9 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.code.sshd</groupId>
-            <artifactId>sshd</artifactId>
-            <version>0.1</version>
+            <groupId>org.apache.sshd</groupId>
+            <artifactId>sshd-core</artifactId>
+            <version>0.1.0</version>
         </dependency>
     </dependencies>
 

Modified: geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java?rev=787966&r1=787965&r2=787966&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/JSecurityPasswordAuthenticator.java
Wed Jun 24 10:24:03 2009
@@ -19,7 +19,6 @@
 
 package org.apache.geronimo.gshell.commands.ssh;
 
-import com.google.code.sshd.server.PasswordAuthenticator;
 import org.jsecurity.SecurityUtils;
 import org.jsecurity.authc.AuthenticationException;
 import org.jsecurity.authc.UsernamePasswordToken;
@@ -27,6 +26,7 @@
 import org.jsecurity.subject.Subject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.sshd.server.PasswordAuthenticator;
 
 /**
  * <a href="http://jsecurity.org">JSecurity</a> {@link PasswordAuthenticator}.

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=787966&r1=787965&r2=787966&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
Wed Jun 24 10:24:03 2009
@@ -19,9 +19,9 @@
 
 package org.apache.geronimo.gshell.commands.ssh;
 
-import com.google.code.sshd.server.ShellFactory;
 import jline.Completor;
 import jline.History;
+import org.apache.geronimo.gshell.application.Application;
 import org.apache.geronimo.gshell.command.Variables;
 import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
 import org.apache.geronimo.gshell.console.Console;
@@ -30,10 +30,10 @@
 import org.apache.geronimo.gshell.io.Closer;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.notification.ExitNotification;
+import org.apache.geronimo.gshell.registry.CommandResolver;
 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.apache.sshd.server.ShellFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -118,7 +118,7 @@
     }
 
     public class ShellImpl
-        implements ShellFactory.DirectShell, org.apache.geronimo.gshell.shell.Shell, ShellContext,
Runnable
+        implements ShellFactory.Shell, org.apache.geronimo.gshell.shell.Shell, ShellContext,
Runnable
     {
         private InputStream in;
 
@@ -146,24 +146,26 @@
             this.err = err;
         }
 
-        public void setExitCallback(ExitCallback callback) {
+        public void setExitCallback(final ExitCallback callback) {
             this.callback = callback;
         }
 
-        public void start(final Map<String,String> env) throws IOException {
+        public void start(final Environment env) throws IOException {
             this.io = new IO(in, out, err, false);
 
             // 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()) {
+                for (Map.Entry<String,String> entry : env.getEnv().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"));
+            if (env != null) {
+                this.variables.set("gshell.username", env.getEnv().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);
@@ -179,7 +181,6 @@
         }
 
         public Object execute(final String line) throws Exception {
-
             return executor.execute(getContext(), line);
         }
 
@@ -196,9 +197,11 @@
         }
 
         public void close() {
-            closed = true;
-            Closer.close(in, out, err);
-            callback.onExit(0);
+            if (!closed) {
+                closed = true;
+                Closer.close(in, out, err);
+                callback.onExit(0);
+            }
         }
 
         public boolean isInteractive() {

Modified: geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshAction.java?rev=787966&r1=787965&r2=787966&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshAction.java
Wed Jun 24 10:24:03 2009
@@ -19,11 +19,6 @@
 
 package org.apache.geronimo.gshell.commands.ssh;
 
-import com.google.code.sshd.ClientChannel;
-import com.google.code.sshd.ClientSession;
-import com.google.code.sshd.SshClient;
-import com.google.code.sshd.common.util.NoCloseInputStream;
-import com.google.code.sshd.common.util.NoCloseOutputStream;
 import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.clp.Option;
 import org.apache.geronimo.gshell.command.CommandAction;
@@ -33,6 +28,13 @@
 import org.apache.geronimo.gshell.io.PromptReader;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.apache.sshd.SshClient;
+import org.apache.sshd.ClientSession;
+import org.apache.sshd.ClientChannel;
+import org.apache.sshd.client.future.ConnectFuture;
+import org.apache.sshd.common.util.NoCloseInputStream;
+import org.apache.sshd.common.util.NoCloseOutputStream;
+import org.apache.sshd.common.future.CloseFuture;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -130,10 +132,13 @@
         // Create the client from prototype
         SshClient client = container.getBean(SshClient.class);
         log.debug("Created client: {}", client);
-        client.start();;
+        client.start();
 
         try {
-            ClientSession session = client.connect(hostname, port);
+            ConnectFuture future = client.connect(hostname, port);
+            future.await();
+            ClientSession session = future.getSession();
+
             try {
                 io.info(messages.getMessage("info.connected"));
 
@@ -151,7 +156,8 @@
                 channel.open();
                 channel.waitFor(ClientChannel.CLOSED, 0);
             } finally {
-                session.close();
+                session.close(false);
+
             }
         } finally {
             client.stop();

Modified: geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshServerAction.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshServerAction.java?rev=787966&r1=787965&r2=787966&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshServerAction.java
(original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-ssh/src/main/java/org/apache/geronimo/gshell/commands/ssh/SshServerAction.java
Wed Jun 24 10:24:03 2009
@@ -19,7 +19,6 @@
 
 package org.apache.geronimo.gshell.commands.ssh;
 
-import com.google.code.sshd.SshServer;
 import org.apache.geronimo.gshell.clp.Option;
 import org.apache.geronimo.gshell.command.CommandAction;
 import org.apache.geronimo.gshell.command.CommandContext;
@@ -27,6 +26,7 @@
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.apache.sshd.SshServer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

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=787966&r1=787965&r2=787966&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
Wed Jun 24 10:24:03 2009
@@ -45,10 +45,10 @@
         </gshell:command-bundle>
     </gshell:plugin>
 
-    <bean name="sshClient" class="com.google.code.sshd.SshClient" factory-method="setUpDefaultClient"
scope="prototype">
+    <bean name="sshClient" class="org.apache.sshd.SshClient" factory-method="setUpDefaultClient"
scope="prototype">
     </bean>
 
-    <bean name="sshServer" class="com.google.code.sshd.SshServer" factory-method="setUpDefaultServer"
scope="prototype">
+    <bean name="sshServer" class="org.apache.sshd.SshServer" factory-method="setUpDefaultServer"
scope="prototype">
         <property name="shellFactory">
             <bean class="org.apache.geronimo.gshell.commands.ssh.ShellFactoryImpl">
                 <property name="application" ref="application" />
@@ -78,7 +78,7 @@
         <property name="passwordAuthenticator" ref="passwordAuthenticator"/>
     </bean>
 
-    <bean name="keyPairProvider" class="com.google.code.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider"/>
+    <bean name="keyPairProvider" class="org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider"/>
 
     <bean name="passwordAuthenticator" class="org.apache.geronimo.gshell.commands.ssh.JSecurityPasswordAuthenticator">
         <constructor-arg ref="securityManager"/>



Mime
View raw message