You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/11/20 09:55:31 UTC

svn commit: r719201 - in /servicemix/smx4/kernel/trunk: ./ assembly/ assembly/src/main/descriptors/ assembly/src/main/distribution/text/etc/ assembly/src/main/filtered-resources/etc/ client/ client/src/main/java/org/apache/servicemix/kernel/client/ gsh...

Author: gnodet
Date: Thu Nov 20 00:55:30 2008
New Revision: 719201

URL: http://svn.apache.org/viewvc?rev=719201&view=rev
Log:
SMX4KNL-144: Integrate SSH as the remoting protocol

Added:
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/BogusPasswordAuthenticator.java
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/GShellShellFactory.java
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.java
      - copied, changed from r711737, servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/RshAction.java
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.java
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerFactory.java
      - copied, changed from r711737, servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/RshServerFactory.java
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.properties
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.properties
Removed:
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/
Modified:
    servicemix/smx4/kernel/trunk/assembly/pom.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml
    servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.apache.servicemix.shell.cfg
    servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties
    servicemix/smx4/kernel/trunk/client/pom.xml
    servicemix/smx4/kernel/trunk/client/src/main/java/org/apache/servicemix/kernel/client/Main.java
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/AdminServiceImpl.java
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/commands/ConnectCommand.java
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/bin/servicemix.bat
    servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.apache.servicemix.shell.cfg
    servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml
    servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
    servicemix/smx4/kernel/trunk/gshell/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java
    servicemix/smx4/kernel/trunk/pom.xml

Modified: servicemix/smx4/kernel/trunk/assembly/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/pom.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/pom.xml Thu Nov 20 00:55:30 2008
@@ -206,6 +206,10 @@
             <groupId>org.apache.geronimo.specs</groupId>
             <artifactId>geronimo-annotation_1.0_spec</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.sshd</groupId>
+            <artifactId>sshd</artifactId>
+        </dependency>
     </dependencies>
     <build>
         <resources>

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/unix-bin.xml Thu Nov 20 00:55:30 2008
@@ -219,6 +219,14 @@
                 <include>org.apache.servicemix.kernel.jaas:org.apache.servicemix.kernel.jaas.keystore</include>
             </includes>
         </dependencySet>
+        <dependencySet>
+            <outputDirectory>/system</outputDirectory>
+            <unpack>false</unpack>
+            <outputFileNameMapping>com/google/code/sshd/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+            <includes>
+                <include>com.google.code.sshd:sshd</include>
+            </includes>
+        </dependencySet>
 
     </dependencySets>
 

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/descriptors/windows-bin.xml Thu Nov 20 00:55:30 2008
@@ -211,6 +211,14 @@
                 <include>org.apache.servicemix.kernel.jaas:org.apache.servicemix.kernel.jaas.keystore</include>
             </includes>
         </dependencySet>
+        <dependencySet>
+            <outputDirectory>/system</outputDirectory>
+            <unpack>false</unpack>
+            <outputFileNameMapping>com/google/code/sshd/${artifact.artifactId}/${artifact.baseVersion}/${artifact.artifactId}-${artifact.baseVersion}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+            <includes>
+                <include>com.google.code.sshd:sshd</include>
+            </includes>
+        </dependencySet>
 
     </dependencySets>
 

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.apache.servicemix.shell.cfg
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.apache.servicemix.shell.cfg?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.apache.servicemix.shell.cfg (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/distribution/text/etc/org.apache.servicemix.shell.cfg Thu Nov 20 00:55:30 2008
@@ -20,4 +20,4 @@
 #
 startLocalConsole=${servicemix.startLocalConsole}
 startRemoteShell=${servicemix.startRemoteShell}
-remoteShellLocation=tcp://localhost:8101/
+sshPort=8101

Modified: servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties (original)
+++ servicemix/smx4/kernel/trunk/assembly/src/main/filtered-resources/etc/startup.properties Thu Nov 20 00:55:30 2008
@@ -63,6 +63,7 @@
 org/apache/servicemix/kernel/jaas/org.apache.servicemix.kernel.jaas.config/${pom.version}/org.apache.servicemix.kernel.jaas.config-${pom.version}.jar=50
 org/apache/servicemix/kernel/jaas/org.apache.servicemix.kernel.jaas.keystore/${pom.version}/org.apache.servicemix.kernel.jaas.keystore-${pom.version}.jar=50
 org/ops4j/pax/url/pax-url-wrap/${pax.url.version}/pax-url-wrap-${pax.url.version}.jar=5
+com/google/code/sshd/sshd/${sshd.version}/sshd-${sshd.version}.jar=50
 
 #
 # Start console last

Modified: servicemix/smx4/kernel/trunk/client/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/client/pom.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/client/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/client/pom.xml Thu Nov 20 00:55:30 2008
@@ -63,6 +63,7 @@
                         <_donotcopy>(CVS|.svn|config.properties)</_donotcopy>
                         <Main-Class>org.apache.servicemix.kernel.client.Main</Main-Class>
                         <Class-Path>
+                            ../system/com/google/code/sshd/sshd/${sshd.version}/sshd-${sshd.version}.jar
                             ../system/org/apache/servicemix/kernel/gshell/org.apache.servicemix.kernel.gshell.core/${pom.version}/org.apache.servicemix.kernel.gshell.core-${pom.version}.jar
                             ../system/org/apache/servicemix/bundles/org.apache.servicemix.bundles.mina/${mina.version}/org.apache.servicemix.bundles.mina-${mina.version}.jar
                         </Class-Path>

Modified: servicemix/smx4/kernel/trunk/client/src/main/java/org/apache/servicemix/kernel/client/Main.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/client/src/main/java/org/apache/servicemix/kernel/client/Main.java?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/client/src/main/java/org/apache/servicemix/kernel/client/Main.java (original)
+++ servicemix/smx4/kernel/trunk/client/src/main/java/org/apache/servicemix/kernel/client/Main.java Thu Nov 20 00:55:30 2008
@@ -16,24 +16,10 @@
  */
 package org.apache.servicemix.kernel.client;
 
-import java.net.URI;
-import java.util.List;
-import java.util.LinkedList;
-
-import org.apache.geronimo.gshell.remote.client.RshClient;
-import org.apache.geronimo.gshell.remote.client.handler.EchoHandler;
-import org.apache.geronimo.gshell.remote.client.handler.ClientMessageHandler;
-import org.apache.geronimo.gshell.whisper.transport.TransportException;
-import org.apache.geronimo.gshell.whisper.transport.TransportFactory;
-import org.apache.geronimo.gshell.whisper.transport.TransportFactoryLocator;
-import org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransportFactory;
-import org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransport;
-import org.apache.geronimo.gshell.whisper.stream.StreamFeeder;
-import org.apache.geronimo.gshell.notification.ExitNotification;
-import org.apache.geronimo.gshell.security.crypto.CryptoContextImpl;
-import org.apache.geronimo.gshell.security.crypto.CryptoContext;
-import org.apache.geronimo.gshell.io.IO;
-import org.apache.servicemix.kernel.gshell.core.remote.RemoteShellProxy;
+import com.google.code.sshd.SshClient;
+import com.google.code.sshd.ClientSession;
+import com.google.code.sshd.Channel;
+import jline.ConsoleReader;
 
 /**
  * A very simple
@@ -41,23 +27,24 @@
 public class Main {
 
     public static void main(String[] args) throws Exception {
-        URI address = new URI("tcp://127.0.0.1:8101/");
+        String host = "localhost";
+        int port = 8101;
         String user = "smx";
         String password = "smx";
         StringBuilder sb = new StringBuilder();
 
-        boolean options = true;
         for (int i = 0; i < args.length; i++) {
             if (args[i].charAt(0) == '-') {
                 if (args[i].equals("-a")) {
-                    address = new URI(args[++i]);
+                    port = Integer.parseInt(args[++i]);
                 } else if (args[i].equals("-u")) {
                     user = args[++i];
                 } else if (args[i].equals("-p")) {
                     password = args[++i];
                 } else if (args[i].equals("--help")) {
                     System.out.println("Apache ServiceMix Kernel client");
-                    System.out.println("  -a [address]  specify the URL to connect to");
+                    System.out.println("  -a [port]     specify the port to connect to");
+                    System.out.println("  -h [host]     specify the host to connect to");
                     System.out.println("  -u [user]     specify the user name");
                     System.out.println("  -p [password] specify the password");
                     System.out.println("  --help        shows this help message");
@@ -71,59 +58,32 @@
             } else {
                 sb.append(args[i]);
                 sb.append(' ');
-                options = false;
             }
         }
-        RshClient client = null;
-        try {
-            IO io = new IO();
-            CryptoContext context = new CryptoContextImpl();
-            List<ClientMessageHandler> handlers = new LinkedList<ClientMessageHandler>();
-            handlers.add(new EchoHandler());
-            client = new RshClient(context, new Locator(), handlers) {
-                protected void onSessionClosed() {
-                    System.exit(2);
-                }
-            };
 
-            client.connect(address, new URI("tcp://0.0.0.0:0"));
-            client.login(user, password);
-            StreamFeeder outputFeeder = new StreamFeeder(client.getInputStream(), io.outputStream);
-            outputFeeder.createThread().start();
-            client.openShell();
-            io.out.println("Connected");
-
-            String commandLine = sb.toString().trim();
-            if (commandLine.length() > 0) {
-                client.execute(commandLine);
-            } else {
-                RemoteShellProxy shell = new RemoteShellProxy(client, io, "localhost", user);
-                shell.run();
-            }
-        } catch (ExitNotification e) {
-            System.exit(0);
+        // TODO: implement sending a direct command
+
+        SshClient client = null;
+        try {
+            client = SshClient.setUpDefaultClient();
+            client.start();
+            ClientSession session = client.connect(host, port);
+            session.authPassword(user, password);
+            Channel channel = session.createChannel("shell");
+            channel.setIn(new ConsoleReader().getInput());
+            channel.setOut(System.out);
+            channel.setErr(System.err);
+            channel.open();
+            channel.waitFor(Channel.CLOSED, 0);
         } catch (Throwable t) {
             t.printStackTrace();
             System.exit(1);
         } finally {
             try {
-                client.closeShell();
-                client.close();
+                client.stop();
             } catch (Throwable t) { }
         }
         System.exit(0);
     }
 
-    private static class Locator implements TransportFactoryLocator {
-        public TransportFactory locate(URI uri) throws TransportException {
-            return new SimpleTcpTransportFactory();
-        }
-
-    }
-
-    private static class SimpleTcpTransportFactory extends TcpTransportFactory {
-        protected TcpTransport createTransport() {
-            return new TcpTransport();
-        }
-    }
 }

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/filtered-resources/org/apache/servicemix/kernel/gshell/admin/etc/startup.properties Thu Nov 20 00:55:30 2008
@@ -63,6 +63,7 @@
 org/apache/servicemix/kernel/jaas/org.apache.servicemix.kernel.jaas.config/${pom.version}/org.apache.servicemix.kernel.jaas.config-${pom.version}.jar=50
 org/apache/servicemix/kernel/jaas/org.apache.servicemix.kernel.jaas.keystore/${pom.version}/org.apache.servicemix.kernel.jaas.keystore-${pom.version}.jar=50
 org/ops4j/pax/url/pax-url-wrap/${pax.url.version}/pax-url-wrap-${pax.url.version}.jar=5
+com/google/code/sshd/sshd/${sshd.version}/sshd-${sshd.version}.jar=50
 
 #
 # Start console last

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/AdminServiceImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/AdminServiceImpl.java?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/AdminServiceImpl.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/AdminServiceImpl.java Thu Nov 20 00:55:30 2008
@@ -89,27 +89,27 @@
             throw new IllegalArgumentException("Instance '" + name + "' already exists");
         }
         File serviceMixBase = new File(location != null ? location : ("instances/" + name)).getCanonicalFile();
-        int remoteShellPort = port;
-        if (remoteShellPort <= 0) {
+        int sshPort = port;
+        if (sshPort <= 0) {
             try {
                 Preferences prefs = preferences.getUserPreferences("AdminServiceState");
-                remoteShellPort = prefs.getInt("port", defaultPortStart + 1);
-                prefs.putInt("port", remoteShellPort + 1);
+                sshPort = prefs.getInt("port", defaultPortStart + 1);
+                prefs.putInt("port", sshPort + 1);
                 prefs.flush();
                 prefs.sync();
             } catch (Exception e) {
                 try {
                     ServerSocket ss = new ServerSocket(0);
-                    remoteShellPort = ss.getLocalPort();
+                    sshPort = ss.getLocalPort();
                     ss.close();
                 } catch (Exception t) {
                 }
             }
-            if (remoteShellPort <= 0) {
-                remoteShellPort = defaultPortStart;
+            if (sshPort <= 0) {
+                sshPort = defaultPortStart;
             }
         }
-        println("Creating new instance on port " + remoteShellPort + " at: @|bold " + serviceMixBase + "|");
+        println("Creating new instance on port " + sshPort + " at: @|bold " + serviceMixBase + "|");
 
         mkdir(serviceMixBase, "bin");
         mkdir(serviceMixBase, "etc");
@@ -127,7 +127,7 @@
         HashMap<String, String> props = new HashMap<String, String>();
         props.put("${servicemix.home}", System.getProperty("servicemix.home"));
         props.put("${servicemix.base}", serviceMixBase.getPath());
-        props.put("${servicemix.remoteShellPort}", Integer.toString(remoteShellPort));
+        props.put("${servicemix.sshPort}", Integer.toString(sshPort));
         copyFilteredResourceToDir(serviceMixBase, "etc/org.apache.servicemix.shell.cfg", props);
         if( System.getProperty("os.name").startsWith("Win") ) {
             copyFilteredResourceToDir(serviceMixBase, "bin/servicemix.bat", props);

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/InstanceImpl.java Thu Nov 20 00:55:30 2008
@@ -73,9 +73,8 @@
             is = new FileInputStream(f);
             Properties props = new Properties();
             props.load(is);
-            String loc = props.getProperty("remoteShellLocation");
-            URI uri = new URI(loc);
-            return uri.getPort();
+            String loc = props.getProperty("sshPort");
+            return Integer.parseInt(loc);
         } finally {
             if (is != null) {
                 is.close();
@@ -96,9 +95,7 @@
         } finally {
             is.close();
         }
-        String loc = props.getProperty("remoteShellLocation");
-        loc = loc.replace(Integer.toString(new URI(loc).getPort()), Integer.toString(port));
-        props.setProperty("remoteShellLocation", loc);
+        props.setProperty("sshPort", Integer.toString(port));
         OutputStream os = new FileOutputStream(f);
         try {
             props.store(os, null);

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/commands/ConnectCommand.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/commands/ConnectCommand.java?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/commands/ConnectCommand.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/java/org/apache/servicemix/kernel/gshell/admin/internal/commands/ConnectCommand.java Thu Nov 20 00:55:30 2008
@@ -37,7 +37,7 @@
 
     protected Object doExecute() throws Exception {
         int port = getExistingInstance(instance).getPort();
-        ShellContextHolder.get().getShell().execute("remote/rsh -u " + username + " -p " + password + " -n " + instance + " tcp://localhost:" + port);
+        ShellContextHolder.get().getShell().execute("remote/ssh -u " + username + " -p " + password + " -n " + instance + " tcp://localhost:" + port);
         return Result.SUCCESS;
     }
 }

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/bin/servicemix.bat
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/bin/servicemix.bat?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/bin/servicemix.bat (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/bin/servicemix.bat Thu Nov 20 00:55:30 2008
@@ -22,4 +22,4 @@
 SETLOCAL
 SET SERVICEMIX_HOME=${servicemix.home}
 
-%SERVICEMIX_HOME%\bin\servicemix.bat %*
\ No newline at end of file
+%SERVICEMIX_HOME%\bin\servicemix.bat %*

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.apache.servicemix.shell.cfg
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.apache.servicemix.shell.cfg?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.apache.servicemix.shell.cfg (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-admin/src/main/resources/org/apache/servicemix/kernel/gshell/admin/etc/org.apache.servicemix.shell.cfg Thu Nov 20 00:55:30 2008
@@ -20,4 +20,4 @@
 #
 startLocalConsole=${servicemix.startLocalConsole}
 startRemoteShell=${servicemix.startRemoteShell}
-remoteShellLocation=tcp://0.0.0.0:${servicemix.remoteShellPort}/
+sshPort=${servicemix.sshPort}

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/pom.xml Thu Nov 20 00:55:30 2008
@@ -53,6 +53,11 @@
             org.codehaus.plexus*;resolution:=optional,
             org.apache.maven*;resolution:=optional,
             org.apache.mina*;resolution:=optional,
+            net.sf.jpam*;resolution:=optional,
+            com.jcraft*;resolution:=optional,
+            org.bouncycastle*;resolution:=optional,
+            com.sun*;resolution:=optional,
+            com.google.code.sshd.server.keyprovider,
             *
         </gshell.osgi.import>
         <!-- TODO: remove plexus util package -->
@@ -109,6 +114,7 @@
             <artifactId>gshell-vfs</artifactId>
             <version>${gshell.version}</version>
         </dependency>
+        <!--
         <dependency>
             <groupId>org.apache.geronimo.gshell.commands</groupId>
             <artifactId>gshell-remote</artifactId>
@@ -120,6 +126,7 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        -->
         <dependency>
             <groupId>org.apache.geronimo.gshell.wisdom</groupId>
             <artifactId>gshell-wisdom-core</artifactId>
@@ -203,7 +210,10 @@
             <groupId>org.apache.servicemix.bundles</groupId>
             <artifactId>org.apache.servicemix.bundles.mina</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>com.google.code.sshd</groupId>
+            <artifactId>sshd</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.apache.servicemix.bundles</groupId>
             <artifactId>org.apache.servicemix.bundles.junit</artifactId>
@@ -284,10 +294,12 @@
                                     <include>org.apache.geronimo.gshell.support:gshell-vfs</include>
                                     <include>org.apache.geronimo.gshell.support:gshell-vfs-meta</include>
                                     <include>org.apache.geronimo.gshell.support:gshell-yarn</include>
+                                    <!--
                                     <include>org.apache.geronimo.gshell.remote:gshell-remote-client</include>
                                     <include>org.apache.geronimo.gshell.remote:gshell-remote-common</include>
                                     <include>org.apache.geronimo.gshell.remote:gshell-remote-server</include>
                                     <include>org.apache.geronimo.gshell.remote:gshell-whisper</include>
+                                    -->
                                     <include>org.apache.geronimo.gshell.wisdom:gshell-wisdom-core</include>
                                     <include>org.apache.geronimo.gshell.wisdom:gshell-wisdom-bootstrap</include>
                                     <include>jline:jline</include>
@@ -427,6 +439,7 @@
                                         <exclude>org/apache/geronimo/gshell/**</exclude>
                                     </excludes>
                                 </filter>
+                                <!--
                                 <filter>
                                     <artifact>org.apache.geronimo.gshell.remote:gshell-remote-client</artifact>
                                     <excludes>
@@ -451,6 +464,7 @@
                                         <exclude>org/apache/geronimo/gshell/**</exclude>
                                     </excludes>
                                 </filter>
+                                -->
                                 <filter>
                                     <artifact>org.apache.geronimo.gshell.wisdom:gshell-wisdom-core</artifact>
                                     <excludes>

Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/BogusPasswordAuthenticator.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/BogusPasswordAuthenticator.java?rev=719201&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/BogusPasswordAuthenticator.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/BogusPasswordAuthenticator.java Thu Nov 20 00:55:30 2008
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.kernel.gshell.core.sshd;
+
+import com.google.code.sshd.server.PasswordAuthenticator;
+
+public class BogusPasswordAuthenticator implements PasswordAuthenticator {
+
+    public Object authenticate(String username, String password) {
+        return (username != null && username.equals(password)) ? username : null;
+    }
+
+}

Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/GShellShellFactory.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/GShellShellFactory.java?rev=719201&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/GShellShellFactory.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/GShellShellFactory.java Thu Nov 20 00:55:30 2008
@@ -0,0 +1,251 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.kernel.gshell.core.sshd;
+
+import java.util.Map;
+import java.util.List;
+import java.io.OutputStream;
+import java.io.InputStream;
+import java.io.Closeable;
+import java.io.IOException;
+
+import com.google.code.sshd.server.ShellFactory;
+import org.apache.geronimo.gshell.shell.ShellContext;
+import org.apache.geronimo.gshell.shell.ShellContextHolder;
+import org.apache.geronimo.gshell.shell.Shell;
+import org.apache.geronimo.gshell.io.IO;
+import org.apache.geronimo.gshell.command.Variables;
+import org.apache.geronimo.gshell.console.Console;
+import org.apache.geronimo.gshell.console.JLineConsole;
+import org.apache.geronimo.gshell.console.completer.AggregateCompleter;
+import org.apache.geronimo.gshell.notification.ExitNotification;
+import org.apache.geronimo.gshell.notification.ErrorNotification;
+import org.apache.geronimo.gshell.application.model.Branding;
+import org.apache.geronimo.gshell.commandline.CommandLineExecutor;
+import org.apache.geronimo.gshell.ansi.AnsiRenderer;
+import org.apache.geronimo.gshell.wisdom.shell.ConsoleErrorHandlerImpl;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
+import jline.History;
+import jline.Completor;
+
+public class GShellShellFactory implements ShellFactory {
+
+    private Logger logger = LoggerFactory.getLogger(getClass());
+    private Branding branding;
+    private Console.Prompter prompter;
+    private CommandLineExecutor executor;
+    private History history;
+    private List<Completor> completers;
+    private Console.ErrorHandler errorHandler;
+
+    public Branding getBranding() {
+        return branding;
+    }
+
+    public void setBranding(Branding branding) {
+        this.branding = branding;
+    }
+
+    public Console.Prompter getPrompter() {
+        return prompter;
+    }
+
+    public void setPrompter(Console.Prompter prompter) {
+        this.prompter = prompter;
+    }
+
+    public CommandLineExecutor getExecutor() {
+        return executor;
+    }
+
+    public void setExecutor(CommandLineExecutor executor) {
+        this.executor = executor;
+    }
+
+    public History getHistory() {
+        return history;
+    }
+
+    public void setHistory(History history) {
+        this.history = history;
+    }
+
+    public List<Completor> getCompleters() {
+        return completers;
+    }
+
+    public void setCompleters(List<Completor> completers) {
+        this.completers = completers;
+    }
+
+    public Console.ErrorHandler getErrorHandler() {
+        return errorHandler;
+    }
+
+    public void setErrorHandler(Console.ErrorHandler errorHandler) {
+        this.errorHandler = errorHandler;
+    }
+
+    public Shell createShell() {
+        return new ShellImpl();
+    }
+
+    public class ShellImpl implements ShellFactory.DirectShell, org.apache.geronimo.gshell.shell.Shell, ShellContext, Runnable {
+
+        private InputStream in;
+        private OutputStream out;
+        private OutputStream err;
+        private IO io;
+        private Variables variables;
+        private boolean closed;
+
+        public ShellImpl() {
+        }
+
+        public void setInputStream(InputStream in) {
+            this.in = in;
+        }
+
+        public void setOutputStream(OutputStream out) {
+            this.out = out;
+        }
+
+        public void setErrorStream(OutputStream err) {
+            this.err = err;
+        }
+
+        public void start(Map<String,String> env) throws Exception {
+            this.io = new IO(in, out, err, false);
+            this.variables = new Variables((Map) env);
+            new Thread(this).start();
+        }
+
+        public boolean isAlive() {
+            return !closed;
+        }
+
+        public int exitValue() {
+            if (!closed) {
+                throw new IllegalThreadStateException();
+            }
+            return 0;
+        }
+
+        public void destroy() {
+            close();
+        }
+
+        public ShellContext getContext() {
+            return this;
+        }
+
+        public Object execute(String line) throws Exception {
+
+            return executor.execute(getContext(), line);
+        }
+
+        public Object execute(String command, Object[] args) throws Exception {
+            return executor.execute(getContext(), args);
+        }
+
+        public Object execute(Object... args) throws Exception {
+            return executor.execute(getContext(), args);
+        }
+
+        public boolean isOpened() {
+            return !closed;
+        }
+
+        public void close() {
+            closed = true;
+            close(in);
+            close(out);
+            close(err);
+        }
+
+        public boolean isInteractive() {
+            return false;
+        }
+
+        public void run(Object... args) throws Exception {
+            Console.Executor executor = new Console.Executor() {
+                public Result execute(final String line) throws Exception {
+                    assert line != null;
+                    try {
+                        ShellImpl.this.execute(line);
+                    }
+                    catch (ExitNotification n) {
+                        return Result.STOP;
+                    }
+                    return Result.CONTINUE;
+                }
+            };
+
+            IO io = getContext().getIo();
+
+            // Setup the console runner
+            JLineConsole console = new JLineConsole(executor, io);
+            console.setPrompter(getPrompter());
+            console.setErrorHandler(getErrorHandler());
+            console.setHistory(getHistory());
+            if (completers != null) {
+                // Have to use aggregate here to get the completion list to update properly
+                console.addCompleter(new AggregateCompleter(completers));
+            }
+            console.run();
+        }
+
+        public org.apache.geronimo.gshell.shell.Shell getShell() {
+            return this;
+        }
+
+        public IO getIo() {
+            return io;
+        }
+
+        public Variables getVariables() {
+            return variables;
+        }
+
+        public void run() {
+            ShellContext ctx = ShellContextHolder.get(true);
+            try {
+                ShellContextHolder.set(getContext());
+                ShellImpl.this.run();
+            } catch (Exception e) {
+                e.printStackTrace();
+                // TODO: do something about this exception
+            } finally {
+                ShellContextHolder.set(ctx);
+                close();
+            }
+        }
+
+        private void close(Closeable c) {
+            try {
+                c.close();
+            } catch (IOException e) {
+                // Ignore
+            }
+        }
+
+    }
+
+}

Copied: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.java (from r711737, servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/RshAction.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/RshAction.java&r1=711737&r2=719201&rev=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/RshAction.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.java Thu Nov 20 00:55:30 2008
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-package org.apache.servicemix.kernel.gshell.core.remote;
+package org.apache.servicemix.kernel.gshell.core.sshd;
 
 import org.apache.geronimo.gshell.clp.Argument;
 import org.apache.geronimo.gshell.clp.Option;
@@ -25,8 +25,6 @@
 import org.apache.geronimo.gshell.command.CommandContext;
 import org.apache.geronimo.gshell.io.IO;
 import org.apache.geronimo.gshell.io.PromptReader;
-import org.apache.geronimo.gshell.notification.ExitNotification;
-import org.apache.geronimo.gshell.remote.client.RshClient;
 import org.apache.geronimo.gshell.spring.BeanContainer;
 import org.apache.geronimo.gshell.spring.BeanContainerAware;
 import org.apache.geronimo.gshell.i18n.MessageSource;
@@ -34,22 +32,22 @@
 import org.slf4j.LoggerFactory;
 
 import java.net.URI;
-import java.util.ArrayList;
 import java.util.List;
 
+import com.google.code.sshd.SshClient;
+import com.google.code.sshd.ClientSession;
+import com.google.code.sshd.Channel;
+
 /**
  * Connect to a remote shell server.
  *
  * @version $Rev: 707952 $ $Date: 2008-10-26 08:51:45 +0100 (Sun, 26 Oct 2008) $
  */
-public class RshAction
+public class SshAction
     implements CommandAction, BeanContainerAware
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
-    @Option(name="-b", aliases={"--bind"})
-    private URI local;
-
     @Option(name="-u", aliases={"--username"})
     private String username;
 
@@ -131,43 +129,42 @@
         }
 
         // Create the client from prototype
-        RshClient client = container.getBean(RshClient.class);
-
+        SshClient client = container.getBean(SshClient.class);
         log.debug("Created client: {}", client);
-
-        client.connect(remote, local);
-
+        ClientSession session = client.connect(remote.getHost(), remote.getPort());
         io.info(messages.getMessage("info.connected"));
+        session.authPassword(username, password);
+        Channel channel = session.createChannel("shell");
+        channel.setIn(io.inputStream);
+        channel.setOut(io.outputStream);
+        channel.setErr(io.errorStream);
+        channel.open();
+        channel.waitFor(Channel.CLOSED, 0);
+
+//        RemoteShellProxy shell = new RemoteShellProxy(client, io, instance, username);
+//
+//        Object result = Result.SUCCESS;
+//
+//        try {
+//            if (command == null) {
+//                command = new ArrayList<String>();
+//            }
+//
+//            shell.run(command.toArray());
+//        }
+//        catch (ExitNotification n) {
+//            // Make sure that we catch this notification, so that our parent shell doesn't exit when the remote shell does
+//            result = n.code;
+//        }
+//
+//        shell.close();
+//
+//        io.verbose(messages.getMessage("verbose.disconnecting"));
+//
+//        client.close();
+//
+//        io.verbose(messages.getMessage("verbose.disconnected"));
 
-        client.login(username, password);
-
-        // client.echo("HELLO");
-        // Thread.sleep(1 * 1000);
-
-        RemoteShellProxy shell = new RemoteShellProxy(client, io, instance, username);
-
-        Object result = Result.SUCCESS;
-
-        try {
-            if (command == null) {
-                command = new ArrayList<String>();
-            }
-
-            shell.run(command.toArray());
-        }
-        catch (ExitNotification n) {
-            // Make sure that we catch this notification, so that our parent shell doesn't exit when the remote shell does
-            result = n.code;
-        }
-
-        shell.close();
-
-        io.verbose(messages.getMessage("verbose.disconnecting"));
-
-        client.close();
-
-        io.verbose(messages.getMessage("verbose.disconnected"));
-
-        return result;
+        return Result.SUCCESS;
     }
 }
\ No newline at end of file

Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.java?rev=719201&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.java (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.java Thu Nov 20 00:55:30 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.servicemix.kernel.gshell.core.sshd;
+
+import org.apache.geronimo.gshell.command.CommandAction;
+import org.apache.geronimo.gshell.command.CommandContext;
+import org.apache.geronimo.gshell.spring.BeanContainerAware;
+import org.apache.geronimo.gshell.spring.BeanContainer;
+
+public class SshServerAction
+        implements CommandAction, BeanContainerAware
+{
+    private BeanContainer container;
+
+    public void setBeanContainer(BeanContainer container) {
+        this.container = container;
+    }
+
+    public Object execute(CommandContext context) throws Exception {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+}

Copied: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerFactory.java (from r711737, servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/RshServerFactory.java)
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerFactory.java?p2=servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerFactory.java&p1=servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/RshServerFactory.java&r1=711737&r2=719201&rev=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/remote/RshServerFactory.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/java/org/apache/servicemix/kernel/gshell/core/sshd/SshServerFactory.java Thu Nov 20 00:55:30 2008
@@ -16,32 +16,22 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.servicemix.kernel.gshell.core.remote;
+package org.apache.servicemix.kernel.gshell.core.sshd;
 
-import java.net.URI;
+import com.google.code.sshd.SshServer;
 
-import org.apache.geronimo.gshell.remote.server.RshServer;
+public class SshServerFactory {
 
-public class RshServerFactory {
-
-    private RshServer server;
+    private SshServer server;
 
     private String location;
 
     private boolean start;
 
-    public RshServerFactory(RshServer server) {
+    public SshServerFactory(SshServer server) {
         this.server = server;
     }
 
-    public String getLocation() {
-        return location;
-    }
-
-    public void setLocation(String location) {
-        this.location = location;
-    }
-
     public boolean isStart() {
         return start;
     }
@@ -53,7 +43,7 @@
     public void start() throws Exception {
         if (start) {
             try {
-                server.bind(URI.create(location));
+                server.start();
             } catch (Exception e) {
                 e.printStackTrace();
                 throw e;
@@ -63,7 +53,7 @@
 
     public void stop() throws Exception {
         if (start) {
-            server.close();
+            server.stop();
         }
     }
 

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-commands.xml Thu Nov 20 00:55:30 2008
@@ -130,15 +130,13 @@
     </gshell:command-bundle>
 
     <gshell:command-bundle>
-        <gshell:command name="remote/rsh">
-            <gshell:action class="org.apache.servicemix.kernel.gshell.core.remote.RshAction"/>
+        <gshell:command name="remote/ssh">
+            <gshell:action class="org.apache.servicemix.kernel.gshell.core.sshd.SshAction"/>
         </gshell:command>
 
-        <gshell:command name="remote/rsh-server">
-            <gshell:action class="org.apache.geronimo.gshell.commands.remote.RshServerAction"/>
+        <gshell:command name="remote/sshd">
+            <gshell:action class="org.apache.servicemix.kernel.gshell.core.sshd.SshServerAction"/>
         </gshell:command>
-
-        <gshell:link name="remote/rshd" target="remote/rsh-server"/>
     </gshell:command-bundle>
 
     <gshell:command-bundle>

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-osgi.xml Thu Nov 20 00:55:30 2008
@@ -63,13 +63,14 @@
         <osgix:default-properties>
             <prop key="startLocalConsole">true</prop>
             <prop key="startRemoteShell">true</prop>
-            <prop key="remoteShellLocation">tcp://0.0.0.0:8101/</prop>
+            <prop key="sshPort">8101</prop>
             <prop key="clientKeyAlias">servicemix</prop>
             <prop key="clientKeystore">RshKeystore</prop>
             <prop key="clientTruststore">RshTruststore</prop>
             <prop key="serverKeyAlias">servicemix</prop>
             <prop key="serverKeystore">RshKeystore</prop>
             <prop key="serverTruststore">RshTruststore</prop>
+            <prop key="hostKey">${servicemix.base}/etc/host.key</prop>
         </osgix:default-properties>
     </osgix:property-placeholder>
     

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell-remote.xml Thu Nov 20 00:55:30 2008
@@ -36,120 +36,59 @@
        default-init-method="init"
        default-destroy-method="destroy">
 
-    <bean id="timeoutManager" class="org.apache.geronimo.gshell.remote.server.timeout.TimeoutManagerImpl" lazy-init="true"/>
-
-    <bean id="rshServer" class="org.apache.geronimo.gshell.remote.server.RshServer" scope="prototype">
-        <constructor-arg ref="timeoutManager"/>
-        <constructor-arg ref="transportFactoryLocator"/>
-        <constructor-arg>
-            <list>
-                <bean class="org.apache.geronimo.gshell.remote.server.handler.ConnectHandler">
-                    <constructor-arg ref="cryptoContext"/>
-                    <constructor-arg ref="timeoutManager"/>
-                </bean>
-                <bean class="org.apache.servicemix.kernel.gshell.core.remote.LoginHandler">
-                    <constructor-arg ref="timeoutManager"/>
-                    <constructor-arg value="RshServer" />
-                </bean>
-                <bean class="org.apache.servicemix.kernel.gshell.core.remote.OpenShellHandler"/>
-                <bean class="org.apache.geronimo.gshell.remote.server.handler.ExecuteHandler"/>
-                <bean class="org.apache.geronimo.gshell.remote.server.handler.CloseShellHandler"/>
-                <bean class="org.apache.geronimo.gshell.remote.server.handler.EchoHandler"/>
-                <bean class="org.apache.geronimo.gshell.remote.server.handler.CompleteHandler" />
-            </list>
-        </constructor-arg>
+    <bean name="sshClient" class="com.google.code.sshd.SshClient" factory-method="setUpDefaultClient" init-method="start" destroy-method="stop">
     </bean>
 
-    <bean id="remoteShell" class="org.apache.geronimo.gshell.remote.server.RemoteShellImpl" scope="prototype">
-        <constructor-arg ref="commandLineExecutor"/>
-
-        <property name="completers">
-            <list>
-                <ref bean="commandsCompleter"/>
-                <ref bean="aliasNameCompleter"/>
-            </list>
+    <bean name="sshServer" class="com.google.code.sshd.SshServer" factory-method="setUpDefaultServer" scope="prototype">
+        <property name="port" value="${sshPort}" />
+        <property name="shellFactory">
+            <bean class="org.apache.servicemix.kernel.gshell.core.sshd.GShellShellFactory">
+                <property name="branding" ref="branding" />
+                <property name="completers">
+                    <list>
+                        <ref bean="commandsCompleter"/>
+                        <ref bean="aliasNameCompleter"/>
+                    </list>
+                </property>
+                <property name="executor" ref="commandLineExecutor" />
+                <property name="prompter">
+                    <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsolePrompterImpl">
+                        <constructor-arg ref="application"/>
+                    </bean>
+                </property>
+                <property name="errorHandler">
+                    <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsoleErrorHandlerImpl" />
+                </property>
+                <property name="history">
+                    <bean class="org.apache.geronimo.gshell.wisdom.shell.HistoryImpl">
+                        <constructor-arg ref="application"/>
+                    </bean>
+                </property>
+            </bean>
         </property>
+        <property name="keyPairProvider" ref="keyPairProvider" />
+        <property name="passwordAuthenticator" ref="passwordAuthenticator" />
     </bean>
 
-    <bean class="org.apache.geronimo.gshell.remote.client.RshClient" scope="prototype">
-        <constructor-arg ref="cryptoContext"/>
-        <constructor-arg ref="transportFactoryLocator"/>
-        <constructor-arg>
-            <list>
-                <bean class="org.apache.geronimo.gshell.remote.client.handler.EchoHandler"/>
-            </list>
-        </constructor-arg>
+    <bean name="keyPairProvider" class="com.google.code.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider">
+        <property name="path" value="${hostKey}" />
     </bean>
-
-    <bean id="transportFactoryLocator" class="org.apache.geronimo.gshell.whisper.transport.TransportFactoryLocatorImpl" lazy-init="true">
-        <property name="factories">
-            <set>
-                <ref bean="vmTransportFactory"/>
-                <ref bean="tcpTransportFactory"/>
-                <ref bean="sslTransportFactory"/>
-            </set>
-        </property>
+    <!--
+    <bean name="passwordAuthenticator" class="com.google.code.sshd.server.jaas.JaasPasswordAuthenticator">
+        <property name="domain" value="SshServer" />
     </bean>
+    -->
+    <bean name="passwordAuthenticator" class="org.apache.servicemix.kernel.gshell.core.sshd.BogusPasswordAuthenticator" />
 
-    <!-- vm:// -->
-
-    <bean id="vmTransportFactory" class="org.apache.geronimo.gshell.whisper.transport.vm.VmTransportFactory" lazy-init="true"/>
-
-    <bean id="vmTransport" class="org.apache.geronimo.gshell.whisper.transport.vm.VmTransport" scope="prototype"/>
-
-    <bean id="vmTransportServer" class="org.apache.geronimo.gshell.whisper.transport.vm.VmTransportServer" scope="prototype"/>
-
-    <!-- tcp:// -->
-
-    <bean id="tcpTransportFactory" class="org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransportFactory" lazy-init="true"/>
-
-    <bean id="tcpTransport" class="org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransport" scope="prototype"/>
-
-    <bean id="tcpTransportServer" class="org.apache.geronimo.gshell.whisper.transport.tcp.TcpTransportServer" scope="prototype"/>
-
-    <!-- ssl:// -->
-
-    <bean id="sslTransportFactory" class="org.apache.geronimo.gshell.whisper.transport.ssl.SslTransportFactory" lazy-init="true"/>
-
-    <bean id="sslContextFactory" class="org.apache.servicemix.kernel.gshell.core.remote.KeystoreSSLContextFactory" lazy-init="true">
-        <property name="keystoreManager" ref="keystoreManager" />
-        <property name="clientKeystore" value="${clientKeystore}" />
-        <property name="clientKeyAlias" value="${clientKeyAlias}" />
-        <property name="clientTruststore" value="${clientTruststore}" />
-        <property name="serverKeystore" value="${serverKeystore}" />
-        <property name="serverKeyAlias" value="${serverKeyAlias}" />
-        <property name="serverTruststore" value="${serverTruststore}" />
-     </bean>
-
-    <bean id="sslTransport" class="org.apache.geronimo.gshell.whisper.transport.ssl.SslTransport" scope="prototype">
-        <property name="sslContextFactory" ref="sslContextFactory"/>
-    </bean>
-
-    <bean id="sslTransportServer" class="org.apache.geronimo.gshell.whisper.transport.ssl.SslTransportServer" scope="prototype">
-        <property name="sslContextFactory" ref="sslContextFactory"/>
-    </bean>
-
-
-    <bean id="rshServerFactory" class="org.apache.servicemix.kernel.gshell.core.remote.RshServerFactory"
-                                init-method="start" destroy-method="stop">
-        <constructor-arg ref="rshServer" />
-        <property name="location" value="${remoteShellLocation}" />
+    <bean id="sshServerFactory" class="org.apache.servicemix.kernel.gshell.core.sshd.SshServerFactory" init-method="start" destroy-method="stop">
+        <constructor-arg ref="sshServer" />
         <property name="start" value="${startRemoteShell}" />
     </bean>
 
-    <osgi:reference id="keystoreManager" interface="org.apache.servicemix.kernel.jaas.config.KeystoreManager" cardinality="1..1" />
-
-    <jaas:config id="RshClient">
-        <jaas:module className="org.apache.geronimo.gshell.remote.client.auth.RemoteLoginModule" flags="required" />
-    </jaas:config>
-
-    <jaas:config id="RshServer" rank="-1">
+    <!--
+    <jaas:config id="SshServer" rank="-1">
         <jaas:module className="org.apache.geronimo.gshell.remote.server.auth.BogusLoginModule" flags="required" />
     </jaas:config>
-
-    <bean id="cryptoContext" class="org.apache.geronimo.gshell.security.crypto.CryptoContextImpl" lazy-init="true">
-        <property name="transformation" value="RSA"/>
-        <property name="provider" value="default"/>
-    </bean>
+    -->
 
 </beans>
\ No newline at end of file

Modified: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml (original)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/META-INF/spring/gshell.xml Thu Nov 20 00:55:30 2008
@@ -123,10 +123,7 @@
             </bean>
         </property>
         <property name="errorHandler">
-            <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsoleErrorHandlerImpl">
-                <constructor-arg ref="eventManager"/>
-                <constructor-arg ref="application"/>
-            </bean>
+            <bean class="org.apache.geronimo.gshell.wisdom.shell.ConsoleErrorHandlerImpl" />
         </property>
         <property name="history">
             <bean class="org.apache.geronimo.gshell.wisdom.shell.HistoryImpl">

Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.properties?rev=719201&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.properties (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshAction.properties Thu Nov 20 00:55:30 2008
@@ -0,0 +1,36 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##  http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 703511 $ $Date: 2008-10-10 18:07:36 +0200 (Fri, 10 Oct 2008) $
+##
+
+command.description=Open a shell on a remote SSH server.
+
+command.manual=\
+  TODO: date manual
+
+info.connecting=Connecting to: {0}
+info.connected=Connected
+
+prompt.username=Username
+prompt.password=Password
+
+verbose.disconnecting=Disconnecting
+verbose.disconnected=Disconnected

Added: servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.properties
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.properties?rev=719201&view=auto
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.properties (added)
+++ servicemix/smx4/kernel/trunk/gshell/gshell-core/src/main/resources/org/apache/servicemix/kernel/gshell/core/sshd/SshServerAction.properties Thu Nov 20 00:55:30 2008
@@ -0,0 +1,27 @@
+##
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##  http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+##
+## $Rev: 703511 $ $Date: 2008-10-10 18:07:36 +0200 (Fri, 10 Oct 2008) $
+##
+
+command.description=Start an SSH server.
+
+command.manual=\
+  TODO: date manual
\ No newline at end of file

Modified: servicemix/smx4/kernel/trunk/gshell/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/gshell/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/gshell/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java (original)
+++ servicemix/smx4/kernel/trunk/gshell/itests/src/test/java/org/apache/servicemix/kernel/gshell/itests/CoreTest.java Thu Nov 20 00:55:30 2008
@@ -35,6 +35,7 @@
             getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.mina"),
             getBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.oro"),
             getBundle("org.apache.servicemix.kernel.jaas", "org.apache.servicemix.kernel.jaas.config"),
+            getBundle("com.google.code.sshd", "sshd"),
             getBundle("org.apache.servicemix.kernel.gshell", "org.apache.servicemix.kernel.gshell.core")
         };
     }

Modified: servicemix/smx4/kernel/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/kernel/trunk/pom.xml?rev=719201&r1=719200&r2=719201&view=diff
==============================================================================
--- servicemix/smx4/kernel/trunk/pom.xml (original)
+++ servicemix/smx4/kernel/trunk/pom.xml Thu Nov 20 00:55:30 2008
@@ -96,6 +96,7 @@
         <servicemix.specs.version>1.2-SNAPSHOT</servicemix.specs.version>
         <spring.osgi.version>1.1.0</spring.osgi.version>
         <spring.version>2.5.5</spring.version>
+        <sshd.version>1.0-SNAPSHOT</sshd.version>
         <woodstox.version>3.2.7_1</woodstox.version>
     </properties>
 
@@ -148,6 +149,18 @@
                 <enabled>false</enabled>
             </snapshots>
         </repository>
+        <!-- SSHD snapshots -->
+        <repository>
+            <id>sshd-snapshots</id>
+            <name>SSHD Snapshots repository</name>
+            <url>http://sshd.googlecode.com/svn/m2-snapshot-repo/</url>
+            <releases>
+                <enabled>false</enabled>
+            </releases>
+            <snapshots>
+                <enabled>true</enabled>
+            </snapshots>
+        </repository>
     </repositories>
 
     <pluginRepositories>
@@ -663,6 +676,11 @@
                 <artifactId>easymock</artifactId>
                 <version>${easymock.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.google.code.sshd</groupId>
+                <artifactId>sshd</artifactId>
+                <version>${sshd.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>