com.mindbright.sshcommon
Interface SSHConsoleRemote

All Known Implementing Classes:
SSH2ConsoleRemote, SSH2SCP1Client, SSHConsoleClient, SSHSCPClient

public interface SSHConsoleRemote

Basic interface to classes implementing a console to a remote command or shell.


Method Summary
 void changeStdOut(NonBlockingOutput out)
          Changes the output stream where stdout is written to in the underlying session channel.
 void changeStdOut(java.io.OutputStream out)
          Changes the output stream where stdout is written to in the underlying session channel.
 void close()
          Closes the session channel.
 void close(boolean waitforcloseconfirm)
          Closes the session channel.
 boolean command(java.lang.String command)
          Runs single command on server.
 NonBlockingOutput getNBStdIn()
          Gets the stdin stream of the underlying session channel.
 NonBlockingInput getNBStdOut()
          Gets the stdout stream of the underlying session channel.
 java.io.OutputStream getStdIn()
          Gets the stdin stream of the underlying session channel.
 java.io.InputStream getStdOut()
          Gets the stdout stream of the underlying session channel.
 boolean shell()
          Starts an interactive shell on the server, note that no PTY is allocated.
 

Method Detail

command

boolean command(java.lang.String command)
Runs single command on server. Stdout from the command will be sent to the local stdout.

Note, this will create an extra pair of threads to handle the data.

Parameters:
command - command line to run
Returns:
a boolean indicating success or failure

shell

boolean shell()
Starts an interactive shell on the server, note that no PTY is allocated.

Returns:
a boolean indicating success or failure

close

void close()
Closes the session channel. That is cancels a command/shell in progress if it hasn't already exited.


close

void close(boolean waitforcloseconfirm)
Closes the session channel. If waitforcloseconfirm is true it waits for the remote end to acknowledge the close.


changeStdOut

void changeStdOut(java.io.OutputStream out)
                  throws java.lang.IllegalArgumentException
Changes the output stream where stdout is written to in the underlying session channel.

Note that this method only works if the underlying session uses blocking streams and threads.

Parameters:
out - new stdout stream
Throws:
IllegalArgumetExcpetion - if the underlying session uses non-blocking IO
java.lang.IllegalArgumentException

getStdIn

java.io.OutputStream getStdIn()
Gets the stdin stream of the underlying session channel. Note, this is an output stream since one wants to write to stdin.

Note that this method returns null if the underlying stream uses non-blocking io

Returns:
the input stream of stdout stream

getStdOut

java.io.InputStream getStdOut()
Gets the stdout stream of the underlying session channel. Note, this is an input stream since one wants to read from stdout.

Note that this method returns null if the underlying stream uses non-blocking io

Returns:
the input stream of stdout stream

changeStdOut

void changeStdOut(NonBlockingOutput out)
                  throws java.lang.IllegalArgumentException
Changes the output stream where stdout is written to in the underlying session channel.

Note that this method only works if the underlying session uses non-blocking io.

Parameters:
out - new stdout stream
Throws:
IllegalArgumetExcpetion - if the underlying session uses blocking IO
java.lang.IllegalArgumentException

getNBStdIn

NonBlockingOutput getNBStdIn()
Gets the stdin stream of the underlying session channel. Note, this is an output stream since one wants to write to stdin.

Note that this method returns null if the underlying stream uses blocking io

Returns:
the input stream of stdout stream

getNBStdOut

NonBlockingInput getNBStdOut()
Gets the stdout stream of the underlying session channel. Note, this is an input stream since one wants to read from stdout.

Note that this method returns null if the underlying stream uses blocking io

Returns:
the input stream of stdout stream