felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r835869 - in /felix/trunk/karaf/shell/ssh/src/main: java/org/apache/felix/karaf/shell/ssh/ resources/OSGI-INF/blueprint/
Date Fri, 13 Nov 2009 15:00:48 GMT
Author: gnodet
Date: Fri Nov 13 15:00:47 2009
New Revision: 835869

URL: http://svn.apache.org/viewvc?rev=835869&view=rev
Log:
Upgrade to latest sshd snapshot

Modified:
    felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellCommandFactory.java
    felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellFactoryImpl.java
    felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/SshTerminal.java
    felix/trunk/karaf/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml

Modified: felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellCommandFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellCommandFactory.java?rev=835869&r1=835868&r2=835869&view=diff
==============================================================================
--- felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellCommandFactory.java
(original)
+++ felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellCommandFactory.java
Fri Nov 13 15:00:47 2009
@@ -24,7 +24,10 @@
 import java.io.OutputStream;
 import java.io.PrintStream;
 
+import org.apache.sshd.server.Command;
 import org.apache.sshd.server.CommandFactory;
+import org.apache.sshd.server.Environment;
+import org.apache.sshd.server.ExitCallback;
 import org.osgi.service.command.CommandProcessor;
 import org.osgi.service.command.CommandSession;
 
@@ -68,7 +71,7 @@
             this.callback = callback;
         }
 
-        public void start() throws IOException {
+        public void start(final Environment env) throws IOException {
             try {
                 CommandSession session = commandProcessor.createSession(in, new PrintStream(out),
new PrintStream(err));
                 session.execute(command);
@@ -80,6 +83,9 @@
             }
         }
 
+        public void destroy() {
+		}
+
     }
 
     private static void close(Closeable... closeables) {

Modified: felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellFactoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellFactoryImpl.java?rev=835869&r1=835868&r2=835869&view=diff
==============================================================================
--- felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellFactoryImpl.java
(original)
+++ felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/ShellFactoryImpl.java
Fri Nov 13 15:00:47 2009
@@ -26,21 +26,26 @@
 import java.io.PrintStream;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.concurrent.Callable;
 
 import org.apache.felix.karaf.shell.console.Completer;
 import org.apache.felix.karaf.shell.console.completer.AggregateCompleter;
 import org.apache.felix.karaf.shell.console.jline.Console;
-import org.apache.sshd.server.ShellFactory;
+import org.apache.sshd.common.Factory;
+import org.apache.sshd.server.Command;
+import org.apache.sshd.server.Environment;
+import org.apache.sshd.server.ExitCallback;
+import org.osgi.service.blueprint.container.ReifiedType;
 import org.osgi.service.command.CommandProcessor;
 import org.osgi.service.command.CommandSession;
 
 /**
- * SSHD {@link org.apache.sshd.server.ShellFactory} which provides access to Shell.
+ * SSHD {@link org.apache.sshd.server.Command} factory which provides access to Shell.
  *
  * @version $Rev: 731517 $ $Date: 2009-01-05 11:25:19 +0100 (Mon, 05 Jan 2009) $
  */
-public class ShellFactoryImpl implements ShellFactory
+public class ShellFactoryImpl implements Factory<Command>
 {
     private CommandProcessor commandProcessor;
     private List<Completer> completers;
@@ -53,11 +58,11 @@
         this.completers = completers;
     }
 
-    public Shell createShell() {
+    public Command create() {
         return new ShellImpl();
     }
 
-    public class ShellImpl implements Shell
+    public class ShellImpl implements Command
     {
         private InputStream in;
 
@@ -135,4 +140,21 @@
         }
     }
 
+    public static Converter getConverter() {
+        return new Converter();
+    }
+
+    public static class Converter implements org.osgi.service.blueprint.container.Converter
{
+
+        public boolean canConvert(Object sourceObject, ReifiedType targetType) {
+            return ShellFactoryImpl.class.isAssignableFrom(sourceObject.getClass())
+                    && Factory.class.equals(targetType.getRawClass())
+                    && Command.class.equals(targetType.getActualTypeArgument(0).getRawClass());
+        }
+
+        public Object convert(Object sourceObject, ReifiedType targetType) throws Exception
{
+            return sourceObject;
+        }
+    }
+
 }

Modified: felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/SshTerminal.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/SshTerminal.java?rev=835869&r1=835868&r2=835869&view=diff
==============================================================================
--- felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/SshTerminal.java
(original)
+++ felix/trunk/karaf/shell/ssh/src/main/java/org/apache/felix/karaf/shell/ssh/SshTerminal.java
Fri Nov 13 15:00:47 2009
@@ -24,10 +24,11 @@
 
 import jline.Terminal;
 import org.apache.sshd.common.PtyMode;
-import org.apache.sshd.server.ShellFactory;
+import org.apache.sshd.server.Environment;
 import org.apache.sshd.server.Signal;
+import org.apache.sshd.server.SignalListener;
 
-public class SshTerminal extends Terminal implements ShellFactory.SignalListener {
+public class SshTerminal extends Terminal implements SignalListener {
 
     public static final short ARROW_START = 27;
     public static final short ARROW_PREFIX = 91;
@@ -42,14 +43,14 @@
     public static final short DEL_THIRD = 51;
     public static final short DEL_SECOND = 126;
 
-    private ShellFactory.Environment environment;
+    private Environment environment;
     private boolean backspaceDeleteSwitched = false;
     private String encoding = System.getProperty("input.encoding", "UTF-8");
     private ReplayPrefixOneCharInputStream replayStream = new ReplayPrefixOneCharInputStream(encoding);
     private InputStreamReader replayReader;
     private boolean isWindowsTerminal;
 
-    public SshTerminal(ShellFactory.Environment environment) {
+    public SshTerminal(Environment environment) {
         this.environment = environment;
         this.environment.addSignalListener(this);
         try {
@@ -74,11 +75,11 @@
     }
 
     public int getTerminalWidth() {
-        return Integer.valueOf(this.environment.getEnv().get(ShellFactory.Environment.ENV_COLUMNS));
+        return Integer.valueOf(this.environment.getEnv().get(Environment.ENV_COLUMNS));
     }
 
     public int getTerminalHeight() {
-        return Integer.valueOf(this.environment.getEnv().get(ShellFactory.Environment.ENV_LINES));
+        return Integer.valueOf(this.environment.getEnv().get(Environment.ENV_LINES));
     }
 
     public boolean isSupported() {

Modified: felix/trunk/karaf/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml?rev=835869&r1=835868&r2=835869&view=diff
==============================================================================
--- felix/trunk/karaf/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml (original)
+++ felix/trunk/karaf/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml Fri Nov
13 15:00:47 2009
@@ -23,6 +23,10 @@
            xmlns:ext="http://geronimo.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
            default-activation="lazy">
 
+    <type-converters>
+        <bean class="org.apache.felix.karaf.shell.ssh.ShellFactoryImpl" factory-method="getConverter"
/>
+    </type-converters>
+
     <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]"/>
 
     <cm:property-placeholder persistent-id="org.apache.felix.karaf.shell">



Mime
View raw message