public class ProcessShell extends AbstractLoggingBean implements InvertedShell
log
Constructor and Description |
---|
ProcessShell(Collection<String> command) |
ProcessShell(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.
|
int |
exitValue()
Retrieve the exit value of the shell.
|
InputStream |
getErrorStream() |
OutputStream |
getInputStream()
Returns the output stream used to feed the shell.
|
InputStream |
getOutputStream() |
ChannelSession |
getServerChannelSession() |
ServerSession |
getServerSession() |
boolean |
isAlive()
Check if the underlying shell is still alive
|
protected Map<String,String> |
resolveShellEnvironment(Map<String,String> env) |
protected Map<PtyMode,Integer> |
resolveShellTtyOptions(Map<PtyMode,Integer> modes) |
void |
setSession(ServerSession session) |
void |
start(ChannelSession channel,
Environment env)
Starts the command execution.
|
String |
toString() |
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getSession
getSessionContext
public ProcessShell(String... command)
command
- The command components which when joined (with space separator) create the full command to be
executed by the shellpublic ProcessShell(Collection<String> command)
public ServerSession getServerSession()
getServerSession
in interface ServerSessionHolder
ServerSession
usedpublic void setSession(ServerSession session)
setSession
in interface ServerSessionAware
session
- The ServerSession
in which this shell will be executed.public ChannelSession getServerChannelSession()
getServerChannelSession
in interface ServerChannelSessionHolder
public void start(ChannelSession channel, Environment env) throws 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
IOException
- If failed to startprotected Map<String,String> resolveShellEnvironment(Map<String,String> env)
protected Map<PtyMode,Integer> resolveShellTtyOptions(Map<PtyMode,Integer> modes)
public OutputStream getInputStream()
InvertedShell
getInputStream
in interface InvertedShell
OutputStream
used to feed the shellpublic InputStream getOutputStream()
getOutputStream
in interface InvertedShell
InputStream
representing the output stream of the shellpublic InputStream getErrorStream()
getErrorStream
in interface InvertedShell
InputStream
representing the error stream of the shellpublic boolean isAlive()
InvertedShell
isAlive
in interface InvertedShell
true
if alivepublic int exitValue()
InvertedShell
exitValue
in interface InvertedShell
public void destroy(ChannelSession channel)
CommandLifecycle
destroy
in interface CommandLifecycle
channel
- The ChannelSession
through which the command has been receivedCopyright © 2008–2024 The Apache Software Foundation. All rights reserved.