public class UnknownCommand extends java.lang.Object implements Command, java.lang.Runnable
CommandFactory
when the command is not
known, as it is supposed to always return a valid Command
object.Modifier and Type | Field and 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 and Description |
---|
UnknownCommand(java.lang.String command) |
Modifier and Type | Method and 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() |
private final java.lang.String command
private final java.lang.String message
private java.io.InputStream in
private java.io.OutputStream out
private java.io.OutputStream err
private ExitCallback callback
public java.lang.String getCommand()
public java.lang.String getMessage()
public void setInputStream(java.io.InputStream in)
CommandDirectInputStreamAware
setInputStream
in interface CommandDirectInputStreamAware
in
- The InputStream
used by the shell to read input.public void setOutputStream(java.io.OutputStream out)
CommandDirectOutputStreamAware
setOutputStream
in interface CommandDirectOutputStreamAware
out
- The OutputStream
used by the shell to write its outputpublic void setErrorStream(java.io.OutputStream err)
CommandDirectErrorStreamAware
setErrorStream
in interface CommandDirectErrorStreamAware
err
- The OutputStream
used by the shell to write its errorspublic void setExitCallback(ExitCallback callback)
Command
setExitCallback
in interface Command
callback
- The ExitCallback
to call when shell is closedpublic void run()
run
in interface java.lang.Runnable
public void start(ChannelSession channel, Environment env) throws java.io.IOException
CommandLifecycle
Runnable
, and this method should spawn a new thread like:
Thread(this).start();
start
in interface CommandLifecycle
channel
- The ChannelSession
through which the command has been receivedenv
- The Environment
java.io.IOException
- If failed to startpublic void destroy(ChannelSession channel)
CommandLifecycle
destroy
in interface CommandLifecycle
channel
- The ChannelSession
through which the command has been receivedpublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object