com.maverick.sshd.shell
Class VirtualShell

java.lang.Object
  extended by com.maverick.sshd.Channel
      extended by com.maverick.sshd.SessionChannel
          extended by com.maverick.sshd.shell.VirtualShell
All Implemented Interfaces:
com.maverick.ssh.components.SshComponent

public class VirtualShell
extends SessionChannel


Nested Class Summary
static interface VirtualShell.WindowSizeChangeListener
           
 
Nested classes/interfaces inherited from class com.maverick.sshd.Channel
Channel.QueuedData
 
Field Summary
 
Fields inherited from class com.maverick.sshd.SessionChannel
CHANNEL_TYPE
 
Fields inherited from class com.maverick.sshd.Channel
connection, localwindow, localWindowLock, state
 
Constructor Summary
VirtualShell()
           
 
Method Summary
 void addWindowSizeChangeListener(VirtualShell.WindowSizeChangeListener listener)
           
protected  boolean allocatePseudoTerminal(String term, int cols, int rows, int width, int height, byte[] modes)
          If the client requests a pseudo terminal for the session this method will be invoked before the shell, exec or subsystem is started.
protected  void changeWindowDimensions(int cols, int rows, int width, int height)
          When the window (terminal) size changes on the client side, it MAY send notification in which case this method will be invoked to notify the session that a change has occurred.
protected  boolean executeCommand(String cmd)
          Invoked when the user wants to execute a command
 String getInformation()
           
protected  void onChannelClosed()
          Called when the channel has been closed to enable resources to be freed.
protected  void onChannelOpenFailure()
          Called when the remote side fails to open a channel in response to our request.
protected  void onLocalEOF()
          Called when the local side is EOF.
protected  void onSessionOpen()
          Called once the session is open and data can be sent/received.
protected  void processSignal(String signal)
          A signal can be delivered to the process by the client.
protected  void processStdinData(byte[] data)
          just writes the input data to the outputstream of the 'input' field.
 void removeWindowSizeChangeListener(VirtualShell.WindowSizeChangeListener listener)
           
protected  boolean setEnvironmentVariable(String name, String value)
          If the client requests that an environment variable be set this method will be invoked.
protected  boolean startShell()
          Invoked when the user wants to start a shell.
 
Methods inherited from class com.maverick.sshd.SessionChannel
createChannel, evaluateWindowSpace, getSessionIdentifier, haltIncomingData, idle, onChannelClosing, onChannelData, onChannelFree, onChannelOpen, onChannelOpenConfirmation, onChannelRequest, onExtendedData, onRemoteEOF, openChannel, resumeIncomingData, sendExitStatus, sendStderrData, sendStderrData, sendStdoutData, sendStdoutData
 
Methods inherited from class com.maverick.sshd.Channel
addEventListener, addInputListener, addOutputListener, canClose, close, getConnection, getContext, getLocalId, getLocalPacket, getLocalWindow, getName, getQueueSize, getRemoteId, getRemotePacket, getRemoteWindow, hasQueuedData, isClosed, isClosing, isEOF, isLocalEOF, isOpen, isRemoteEOF, onRemoteClose, onWindowAdjust, queueSize, registerExtendedData, removeEventListener, sendChannelData, sendChannelData, sendChannelRequest, sendEOF, sendExtendedData, sendRequestResponse, sendWindowAdjust
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VirtualShell

public VirtualShell()
Method Detail

addWindowSizeChangeListener

public void addWindowSizeChangeListener(VirtualShell.WindowSizeChangeListener listener)

removeWindowSizeChangeListener

public void removeWindowSizeChangeListener(VirtualShell.WindowSizeChangeListener listener)

processStdinData

protected void processStdinData(byte[] data)
just writes the input data to the outputstream of the 'input' field.

Specified by:
processStdinData in class SessionChannel
See Also:
SessionChannel.processStdinData(byte[])

executeCommand

protected boolean executeCommand(String cmd)
Description copied from class: SessionChannel
Invoked when the user wants to execute a command

Specified by:
executeCommand in class SessionChannel
Returns:
true if the cmd has been executed, otherwise false

changeWindowDimensions

protected void changeWindowDimensions(int cols,
                                      int rows,
                                      int width,
                                      int height)
Description copied from class: SessionChannel
When the window (terminal) size changes on the client side, it MAY send notification in which case this method will be invoked to notify the session that a change has occurred.

Specified by:
changeWindowDimensions in class SessionChannel

onSessionOpen

protected void onSessionOpen()
Description copied from class: SessionChannel
Called once the session is open and data can be sent/received. This event happens once the user has either started the shell or executed a command.

Specified by:
onSessionOpen in class SessionChannel

startShell

protected boolean startShell()
Description copied from class: SessionChannel
Invoked when the user wants to start a shell.

Specified by:
startShell in class SessionChannel
Returns:
true if the shell has been started, otherwise false

allocatePseudoTerminal

protected boolean allocatePseudoTerminal(String term,
                                         int cols,
                                         int rows,
                                         int width,
                                         int height,
                                         byte[] modes)
Description copied from class: SessionChannel
If the client requests a pseudo terminal for the session this method will be invoked before the shell, exec or subsystem is started.

Specified by:
allocatePseudoTerminal in class SessionChannel
Returns:
boolean

setEnvironmentVariable

protected boolean setEnvironmentVariable(String name,
                                         String value)
Description copied from class: SessionChannel
If the client requests that an environment variable be set this method will be invoked.

Specified by:
setEnvironmentVariable in class SessionChannel
Returns:
true if the variable has been set, otherwise false

onChannelOpenFailure

protected void onChannelOpenFailure()
Description copied from class: Channel
Called when the remote side fails to open a channel in response to our request. It only makes sense for some channel types to override this method. A local forwarding channel will never receive this message for example.

Overrides:
onChannelOpenFailure in class Channel

processSignal

protected void processSignal(String signal)
Description copied from class: SessionChannel
A signal can be delivered to the process by the client. If a signal is received this method will be invoked so that the session may evaluate and take the required action.

Specified by:
processSignal in class SessionChannel

onChannelClosed

protected void onChannelClosed()
Description copied from class: Channel
Called when the channel has been closed to enable resources to be freed.

Specified by:
onChannelClosed in class Channel

onLocalEOF

protected void onLocalEOF()
Description copied from class: Channel
Called when the local side is EOF.

Specified by:
onLocalEOF in class Channel

getInformation

public String getInformation()
Specified by:
getInformation in class Channel


Copyright © 2012. All Rights Reserved.