Package org.apache.sshd.server.shell
Class UnknownCommand
java.lang.Object
org.apache.sshd.server.shell.UnknownCommand
- All Implemented Interfaces:
Runnable,Command,CommandDirectErrorStreamAware,CommandDirectInputStreamAware,CommandDirectOutputStreamAware,CommandDirectStreamsAware,CommandLifecycle
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 Summary
FieldsModifier and TypeFieldDescriptionprivate ExitCallbackprivate final Stringprivate OutputStreamprivate InputStreamprivate final Stringprivate OutputStream -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy(ChannelSession channel) This method is called by the SSH server to destroy the command because the client has disconnected somehow.booleaninthashCode()voidrun()voidSet the error stream that can be used by the shell to write its errors.voidsetExitCallback(ExitCallback callback) Set the callback that the shell has to call when it is closed.voidSet the input stream that can be used by the shell to read input.voidSet the output stream that can be used by the shell to write its output.voidstart(ChannelSession channel, Environment env) Starts the command execution.toString()
-
Field Details
-
command
-
message
-
in
-
out
-
err
-
callback
-
-
Constructor Details
-
UnknownCommand
-
-
Method Details
-
getCommand
-
getMessage
-
setInputStream
Description copied from interface:CommandDirectInputStreamAwareSet the input stream that can be used by the shell to read input.- Specified by:
setInputStreamin interfaceCommandDirectInputStreamAware- Parameters:
in- TheInputStreamused by the shell to read input.
-
setOutputStream
Description copied from interface:CommandDirectOutputStreamAwareSet the output stream that can be used by the shell to write its output.- Specified by:
setOutputStreamin interfaceCommandDirectOutputStreamAware- Parameters:
out- TheOutputStreamused by the shell to write its output
-
setErrorStream
Description copied from interface:CommandDirectErrorStreamAwareSet the error stream that can be used by the shell to write its errors.- Specified by:
setErrorStreamin interfaceCommandDirectErrorStreamAware- Parameters:
err- TheOutputStreamused by the shell to write its errors
-
setExitCallback
Description copied from interface:CommandSet the callback that the shell has to call when it is closed.- Specified by:
setExitCallbackin interfaceCommand- Parameters:
callback- TheExitCallbackto call when shell is closed
-
run
public void run() -
start
Description copied from interface:CommandLifecycleStarts the command execution. All streams must have been set before calling this method. The command should implementRunnable, and this method should spawn a new thread like:Thread(this).start();- Specified by:
startin interfaceCommandLifecycle- Parameters:
channel- TheChannelSessionthrough which the command has been receivedenv- TheEnvironment- Throws:
IOException- If failed to start
-
destroy
Description copied from interface:CommandLifecycleThis method is called by the SSH server to destroy the command because the client has disconnected somehow.- Specified by:
destroyin interfaceCommandLifecycle- Parameters:
channel- TheChannelSessionthrough which the command has been received
-
hashCode
public int hashCode() -
equals
-
toString
-