public abstract class ExecutableCommand extends Object
com.maverick.sshd.ConfigurationContext
and they
make use of the input/output streams provided to communicate with the client.Modifier and Type | Field and Description |
---|---|
protected SessionChannel |
session
The session channel instance on which this command is being executed
|
protected OutputStream |
stderr
Write STDERR data to this OutputStream
|
protected InputStream |
stdin
Receive STDIN from this InputStream
|
protected OutputStream |
stdout
Write STDOUT data to this OutputStream *
|
static int |
STILL_ACTIVE
Value returned from
getExitCode() to indicate that the process
is still active. |
Constructor and Description |
---|
ExecutableCommand() |
ExecutableCommand(int incomingBufferSize) |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
createProcess(String cmd,
Map<String,String> environment)
Create the process but wait for the
onStart() method before
performing any IO. |
abstract int |
getExitCode()
Get the exit code for this process.
|
InputStream |
getInputStream()
Get the STDIN InputStream for this process.
|
OutputStream |
getOutputStream()
Get the STDOUT OutputStream for this process.
|
SessionChannel |
getSession() |
OutputStream |
getStderrOutputStream()
Get the STDERR OutputStream for this process.
|
protected long |
getTimeout() |
void |
init(SessionChannel session)
Initialize the command.
|
abstract void |
kill()
Kill the command.
|
abstract void |
onStart()
Called once the command has been started.
|
void |
processStdinData(byte[] data)
Called by the session to pass incoming data into the process.
|
void |
start()
Start the command.
|
public static final int STILL_ACTIVE
getExitCode()
to indicate that the process
is still active.protected SessionChannel session
protected OutputStream stdout
protected OutputStream stderr
protected InputStream stdin
public ExecutableCommand()
public ExecutableCommand(int incomingBufferSize)
public void init(SessionChannel session)
session
- protected long getTimeout()
public SessionChannel getSession()
public abstract boolean createProcess(String cmd, Map<String,String> environment)
onStart()
method before
performing any IO.cmd
- environment
- public void start()
public abstract void onStart()
public abstract void kill()
public abstract int getExitCode()
STILL_ACTIVE
.public OutputStream getOutputStream()
public OutputStream getStderrOutputStream()
public InputStream getInputStream()
public void processStdinData(byte[] data) throws IOException
data
- IOException
Copyright © 2024. All rights reserved.