Class UnknownCommand

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private ExitCallback callback  
      private java.lang.String command  
      private java.io.OutputStream err  
      private java.io.InputStream in  
      private java.lang.String message  
      private java.io.OutputStream out  
    • Constructor Summary

      Constructors 
      Constructor Description
      UnknownCommand​(java.lang.String command)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy​(ChannelSession channel)
      This method is called by the SSH server to destroy the command because the client has disconnected somehow.
      boolean equals​(java.lang.Object obj)  
      java.lang.String getCommand()  
      java.lang.String getMessage()  
      int hashCode()  
      void run()  
      void setErrorStream​(java.io.OutputStream err)
      Set the error stream that can be used by the shell to write its errors.
      void setExitCallback​(ExitCallback callback)
      Set the callback that the shell has to call when it is closed.
      void setInputStream​(java.io.InputStream in)
      Set the input stream that can be used by the shell to read input.
      void setOutputStream​(java.io.OutputStream out)
      Set the output stream that can be used by the shell to write its output.
      void start​(ChannelSession channel, Environment env)
      Starts the command execution.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • command

        private final java.lang.String command
      • message

        private final java.lang.String message
      • in

        private java.io.InputStream in
      • out

        private java.io.OutputStream out
      • err

        private java.io.OutputStream err
    • Constructor Detail

      • UnknownCommand

        public UnknownCommand​(java.lang.String command)
    • Method Detail

      • getCommand

        public java.lang.String getCommand()
      • getMessage

        public java.lang.String getMessage()
      • setErrorStream

        public void setErrorStream​(java.io.OutputStream err)
        Description copied from interface: CommandDirectErrorStreamAware
        Set the error stream that can be used by the shell to write its errors.
        Specified by:
        setErrorStream in interface CommandDirectErrorStreamAware
        Parameters:
        err - The OutputStream used by the shell to write its errors
      • setExitCallback

        public void setExitCallback​(ExitCallback callback)
        Description copied from interface: Command
        Set the callback that the shell has to call when it is closed.
        Specified by:
        setExitCallback in interface Command
        Parameters:
        callback - The ExitCallback to call when shell is closed
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • start

        public void start​(ChannelSession channel,
                          Environment env)
                   throws java.io.IOException
        Description copied from interface: CommandLifecycle
        Starts the command execution. All streams must have been set before calling this method. The command should implement Runnable, and this method should spawn a new thread like:
         
         Thread(this).start();
         
         
        Specified by:
        start in interface CommandLifecycle
        Parameters:
        channel - The ChannelSession through which the command has been received
        env - The Environment
        Throws:
        java.io.IOException - If failed to start
      • destroy

        public void destroy​(ChannelSession channel)
        Description copied from interface: CommandLifecycle
        This method is called by the SSH server to destroy the command because the client has disconnected somehow.
        Specified by:
        destroy in interface CommandLifecycle
        Parameters:
        channel - The ChannelSession through which the command has been received
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object