g-Eclipse
Release 1.0.0

eu.geclipse.batch
Class SSHConnection

java.lang.Object
  extended by eu.geclipse.batch.SSHConnection

public class SSHConnection
extends java.lang.Object

Class used to establish an ssh connection to a remote server.


Constructor Summary
SSHConnection()
           
 
Method Summary
 void createSession(ISSHConnectionInfo sshConnectionInfo, java.util.List<IForward> forwards)
          Creates a new SSH session using the specified ssh connection information.
 void endSession()
          Tears down the established SSH session .
 java.lang.String execCommand(java.lang.String command)
          Execute a command on the remote host and returns the output.
 java.lang.String execCommand(java.lang.String command, java.io.InputStream stdin)
          Execute a command on the remote host and returns the output.
 boolean isSessionActive()
          Test if the session to the server is established.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SSHConnection

public SSHConnection()
Method Detail

createSession

public void createSession(ISSHConnectionInfo sshConnectionInfo,
                          java.util.List<IForward> forwards)
                   throws ProblemException
Creates a new SSH session using the specified ssh connection information.

Parameters:
sshConnectionInfo - the connection information describing the ssh session.
forwards - list of port forwards to create.
Throws:
ProblemException - If the ssh connection cannot be established

endSession

public void endSession()
Tears down the established SSH session .


isSessionActive

public boolean isSessionActive()
Test if the session to the server is established.

Returns:
Returns true if the session is established, false otherwise.

execCommand

public java.lang.String execCommand(java.lang.String command)
                             throws ProblemException
Execute a command on the remote host and returns the output.

Parameters:
command - The command to be executed on the remote host.
Returns:
Returns the output of the executed command if executed successfully, if no output of the successfully executed command null is returned.
Throws:
ProblemException - If the command is not successfully executed.

execCommand

public java.lang.String execCommand(java.lang.String command,
                                    java.io.InputStream stdin)
                             throws ProblemException
Execute a command on the remote host and returns the output.

Parameters:
command - The command to be executed on the remote host.
stdin -
Returns:
Returns the output of the executed command if executed successfully, if no output of the successfully executed command null is returned.
Throws:
ProblemException - If the command is not successfully executed.

g-Eclipse
Release 1.0.0