g-Eclipse
Release 1.0.0

eu.geclipse.batch
Class SSHPersistantConnection

java.lang.Object
  extended by eu.geclipse.batch.SSHPersistantConnection
All Implemented Interfaces:
IBidirectionalConnection

public class SSHPersistantConnection
extends java.lang.Object
implements IBidirectionalConnection

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


Constructor Summary
SSHPersistantConnection()
           
 
Method Summary
 void close()
          Tears down the established SSH session .
 void connect()
          Creates a SSH tunnel to the remote host.
 void createSession(ISSHConnectionInfo sshConnectionInfo, java.util.List<IForward> forwards)
          Creates a new SSH session using the specified ssh connection information.
 java.io.InputStream getErrorStream()
          Returns the error stream for this tunnel
 java.io.InputStream getInputStream()
          Returns the InputStream of the connection.
 java.io.OutputStream getOutputStream()
          Returns the OutputStream of the connection.
 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

SSHPersistantConnection

public SSHPersistantConnection()
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

isSessionActive

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

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

close

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

Specified by:
close in interface IBidirectionalConnection

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: IBidirectionalConnection
Returns the InputStream of the connection.

Specified by:
getInputStream in interface IBidirectionalConnection
Returns:
the InputStream of the connection.
Throws:
java.io.IOException - thrown if a connection error occurs.

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Description copied from interface: IBidirectionalConnection
Returns the OutputStream of the connection.

Specified by:
getOutputStream in interface IBidirectionalConnection
Returns:
the OutputStream of the connection.
Throws:
java.io.IOException - thrown if a connection error occurs.

getErrorStream

public java.io.InputStream getErrorStream()
                                   throws java.io.IOException
Returns the error stream for this tunnel

Returns:
Returns the error stream.
Throws:
java.io.IOException

connect

public void connect()
             throws ProblemException
Creates a SSH tunnel to the remote host.

Parameters:
inStream - The input stream for the tunnel
outStream - The output stream for the tunnel
errStream - The error stream for the tunnel
Throws:
ProblemException - If the tunnel could not successfully be established

g-Eclipse
Release 1.0.0