Class Ssh


  • public class Ssh
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.function.Supplier<org.apache.sshd.client.SshClient> clientBuilder  
      private static int defaultPort  
      private java.util.function.Consumer<Ssh.ExecuteParams> execute  
      static java.lang.String[] functions  
      private java.lang.String ip  
      private int port  
      private org.apache.sshd.server.SshServer server  
      private java.util.function.Supplier<org.apache.sshd.server.SshServer> serverBuilder  
      private java.util.function.Consumer<Ssh.ShellParams> shell  
    • Constructor Summary

      Constructors 
      Constructor Description
      Ssh​(java.util.function.Consumer<Ssh.ShellParams> shell, java.util.function.Consumer<Ssh.ExecuteParams> execute, java.util.function.Supplier<org.apache.sshd.server.SshServer> serverBuilder, java.util.function.Supplier<org.apache.sshd.client.SshClient> clientBuilder)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.apache.sshd.client.session.ClientSession connectWithRetries​(java.io.PrintWriter stdout, org.apache.sshd.client.SshClient client, java.lang.String username, java.lang.String host, int port, int maxAttempts)  
      private static int getFlag​(Attributes attributes, Attributes.InputFlag flag)  
      private static int getFlag​(Attributes attributes, Attributes.LocalFlag flag)  
      private static int getFlag​(Attributes attributes, Attributes.OutputFlag flag)  
      void ssh​(Terminal terminal, LineReader reader, java.lang.String user, java.io.InputStream stdin, java.io.PrintStream stdout, java.io.PrintStream stderr, java.lang.String[] argv)  
      void sshd​(java.io.PrintStream stdout, java.io.PrintStream stderr, java.lang.String[] argv)  
      private void start()  
      private void status​(java.io.PrintStream stdout)  
      private void stop()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • functions

        public static final java.lang.String[] functions
      • serverBuilder

        private final java.util.function.Supplier<org.apache.sshd.server.SshServer> serverBuilder
      • clientBuilder

        private final java.util.function.Supplier<org.apache.sshd.client.SshClient> clientBuilder
      • server

        private org.apache.sshd.server.SshServer server
      • port

        private int port
      • ip

        private java.lang.String ip
    • Constructor Detail

      • Ssh

        public Ssh​(java.util.function.Consumer<Ssh.ShellParams> shell,
                   java.util.function.Consumer<Ssh.ExecuteParams> execute,
                   java.util.function.Supplier<org.apache.sshd.server.SshServer> serverBuilder,
                   java.util.function.Supplier<org.apache.sshd.client.SshClient> clientBuilder)
    • Method Detail

      • ssh

        public void ssh​(Terminal terminal,
                        LineReader reader,
                        java.lang.String user,
                        java.io.InputStream stdin,
                        java.io.PrintStream stdout,
                        java.io.PrintStream stderr,
                        java.lang.String[] argv)
                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • connectWithRetries

        private org.apache.sshd.client.session.ClientSession connectWithRetries​(java.io.PrintWriter stdout,
                                                                                org.apache.sshd.client.SshClient client,
                                                                                java.lang.String username,
                                                                                java.lang.String host,
                                                                                int port,
                                                                                int maxAttempts)
                                                                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • sshd

        public void sshd​(java.io.PrintStream stdout,
                         java.io.PrintStream stderr,
                         java.lang.String[] argv)
                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • status

        private void status​(java.io.PrintStream stdout)
      • start

        private void start()
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • stop

        private void stop()
                   throws java.io.IOException
        Throws:
        java.io.IOException