Top Description Fields Constructors Methods
org.apache.sshd.server.shell

public Class ProcessShell

extends AbstractLoggingBean
implements InvertedShell
Class Inheritance
All Implemented Interfaces
org.apache.sshd.server.shell.InvertedShell, org.apache.sshd.server.session.ServerSessionAware, org.apache.sshd.server.command.CommandLifecycle, org.apache.sshd.server.channel.ServerChannelSessionHolder, org.apache.sshd.server.session.ServerSessionHolder, org.apache.sshd.common.session.SessionHolder, org.apache.sshd.common.session.SessionContextHolder
Imports
java.io.IOException, .InputStream, .OutputStream, java.util.ArrayList, .Arrays, .Collection, .Collections, .List, .Map, .Objects, org.apache.sshd.common.channel.PtyMode, org.apache.sshd.common.util.GenericUtils, .MapEntryUtils, .ValidateUtils, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.common.util.logging.AbstractLoggingBean, org.apache.sshd.server.Environment, org.apache.sshd.server.channel.ChannelSession, .PuttyRequestHandler, org.apache.sshd.server.session.ServerSession

Bridges the I/O streams between the SSH command and the process that executes it
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private ChannelSession
private String
private final List<String>
private TtyFilterInputStream
private TtyFilterOutputStream
private TtyFilterInputStream
private Process
private ServerSession
Inherited from org.apache.sshd.common.util.logging.AbstractLoggingBean:
log

Constructor Summary

AccessConstructor and Description
public
ProcessShell(String...
The command components which when joined (with space separator) create the full command to be executed by the shell
command
)

public

Method Summary

Modifier and TypeMethod and Description
public void
destroy(ChannelSession
The ChannelSession through which the command has been received
channel
)

Implements org.apache.sshd.server.command.CommandLifecycle.destroy.

This method is called by the SSH server to destroy the command because the client has disconnected somehow.

public int
exitValue()

Implements org.apache.sshd.server.shell.InvertedShell.exitValue.

Retrieve the exit value of the shell.

public InputStream
public OutputStream
getInputStream()

Implements org.apache.sshd.server.shell.InvertedShell.getInputStream.

Returns the output stream used to feed the shell.

public InputStream
public ChannelSession
public ServerSession
public boolean
isAlive()

Implements org.apache.sshd.server.shell.InvertedShell.isAlive.

Check if the underlying shell is still alive

protected Map<String, String>
protected Map<PtyMode, Integer>
public void
setSession(ServerSession
The ServerSession in which this shell will be executed.
session
)

Implements org.apache.sshd.server.session.ServerSessionAware.setSession.

public void
start(ChannelSession
The ChannelSession through which the command has been received
channel
,
Environment env)

Implements org.apache.sshd.server.command.CommandLifecycle.start.

Starts the command execution.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.apache.sshd.common.util.logging.AbstractLoggingBean:
debugdebugdebugdebugdebugerrorerrorerrorerrorerrorgetSimplifiedLoggerinfoinfowarnwarnwarnwarnwarnwarnwarnwarn

Field Detail

channelSessionback to summary
private ChannelSession channelSession
cmdValueback to summary
private String cmdValue
commandback to summary
private final List<String> command
errback to summary
private TtyFilterInputStream err
inback to summary
private TtyFilterOutputStream in
outback to summary
private TtyFilterInputStream out
processback to summary
private Process process
sessionback to summary
private ServerSession session

Constructor Detail

ProcessShellback to summary
public ProcessShell(String... command)
Parameters
command:String[]

The command components which when joined (with space separator) create the full command to be executed by the shell

ProcessShellback to summary
public ProcessShell(Collection<String> command)

Method Detail

destroyback to summary
public void destroy(ChannelSession channel)

Implements org.apache.sshd.server.command.CommandLifecycle.destroy.

Doc from org.apache.sshd.server.command.CommandLifecycle.destroy.

This method is called by the SSH server to destroy the command because the client has disconnected somehow.

Parameters
channel:ChannelSession

The ChannelSession through which the command has been received

Annotations
@Override
exitValueback to summary
public int exitValue()

Implements org.apache.sshd.server.shell.InvertedShell.exitValue.

Doc from org.apache.sshd.server.shell.InvertedShell.exitValue.

Retrieve the exit value of the shell. This method must only be called when the shell is not alive anymore.

Returns:int

the exit value of the shell

Annotations
@Override
getErrorStreamback to summary
public InputStream getErrorStream()

Implements org.apache.sshd.server.shell.InvertedShell.getErrorStream.

Returns:InputStream

Doc from org.apache.sshd.server.shell.InvertedShell.getErrorStream.

The InputStream representing the error stream of the shell

Annotations
@Override
getInputStreamback to summary
public OutputStream getInputStream()

Implements org.apache.sshd.server.shell.InvertedShell.getInputStream.

Doc from org.apache.sshd.server.shell.InvertedShell.getInputStream.

Returns the output stream used to feed the shell. This method is called after the shell has been started.

Returns:OutputStream

The OutputStream used to feed the shell

Annotations
@Override
getOutputStreamback to summary
public InputStream getOutputStream()

Implements org.apache.sshd.server.shell.InvertedShell.getOutputStream.

Returns:InputStream

Doc from org.apache.sshd.server.shell.InvertedShell.getOutputStream.

The InputStream representing the output stream of the shell

Annotations
@Override
getServerChannelSessionback to summary
public ChannelSession getServerChannelSession()

Implements org.apache.sshd.server.channel.ServerChannelSessionHolder.getServerChannelSession.

Annotations
@Override
getServerSessionback to summary
public ServerSession getServerSession()

Implements org.apache.sshd.server.session.ServerSessionHolder.getServerSession.

Returns:ServerSession

Doc from org.apache.sshd.server.session.ServerSessionHolder.getServerSession.

The underlying ServerSession used

Annotations
@Override
isAliveback to summary
public boolean isAlive()

Implements org.apache.sshd.server.shell.InvertedShell.isAlive.

Doc from org.apache.sshd.server.shell.InvertedShell.isAlive.

Check if the underlying shell is still alive

Returns:boolean

true if alive

Annotations
@Override
resolveShellEnvironmentback to summary
protected Map<String, String> resolveShellEnvironment(Map<String, String> env)
resolveShellTtyOptionsback to summary
protected Map<PtyMode, Integer> resolveShellTtyOptions(Map<PtyMode, Integer> modes)
setSessionback to summary
public void setSession(ServerSession session)

Implements org.apache.sshd.server.session.ServerSessionAware.setSession.

Parameters
session:ServerSession

Doc from org.apache.sshd.server.session.ServerSessionAware.setSession.

The ServerSession in which this shell will be executed.

Annotations
@Override
startback to summary
public void start(ChannelSession channel, Environment env) throws IOException

Implements org.apache.sshd.server.command.CommandLifecycle.start.

Doc from org.apache.sshd.server.command.CommandLifecycle.start.

Starts the command execution. All streams must have been set before calling this method. The command should implement java.lang.Runnable, and this method should spawn a new thread like:

Thread(this).start();

Parameters
channel:ChannelSession

The ChannelSession through which the command has been received

env:Environment

The Environment

Annotations
@Override
Exceptions
IOException:
If failed to start
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override