Class UnknownCommand

java.lang.Object
org.apache.sshd.server.shell.UnknownCommand
All Implemented Interfaces:
Runnable, Command, CommandLifecycle

public class UnknownCommand extends Object implements Command, Runnable
Implementation of an unknown command that can be returned by CommandFactory when the command is not known, as it is supposed to always return a valid Command object.
  • Field Details

  • Constructor Details

    • UnknownCommand

      public UnknownCommand(String command)
  • Method Details

    • getCommand

      public String getCommand()
    • getMessage

      public String getMessage()
    • setInputStream

      public void setInputStream(InputStream in)
      Description copied from interface: Command
      Set the input stream that can be used by the shell to read input.
      Specified by:
      setInputStream in interface Command
      Parameters:
      in - The InputStream used by the shell to read input.
    • setOutputStream

      public void setOutputStream(OutputStream out)
      Description copied from interface: Command
      Set the output stream that can be used by the shell to write its output.
      Specified by:
      setOutputStream in interface Command
      Parameters:
      out - The OutputStream used by the shell to write its output
    • setErrorStream

      public void setErrorStream(OutputStream err)
      Description copied from interface: Command
      Set the error stream that can be used by the shell to write its errors.
      Specified by:
      setErrorStream in interface Command
      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 Runnable
    • start

      public void start(ChannelSession channel, Environment env) throws 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:
      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 Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object