com.norbl.util.ssh
Class SshExec

java.lang.Object
  extended by com.norbl.util.ssh.SshExec

public class SshExec
extends java.lang.Object

Methods for remotely executing commands via ssh. It includes a general exec method and a few specialized ones (such as creating an rsa keypair.


Field Summary
protected  ch.ethz.ssh2.Connection connection
           
 
Constructor Summary
SshExec(ch.ethz.ssh2.Connection connection)
           
 
Method Summary
 void closeConnection()
           
static java.lang.String exec(ch.ethz.ssh2.Connection connection, java.lang.String cmd)
           
 java.lang.String exec(java.lang.String cmd)
          Note that
 void execNoRead(java.lang.String cmd)
           
 boolean fileExists(java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

protected ch.ethz.ssh2.Connection connection
Constructor Detail

SshExec

public SshExec(ch.ethz.ssh2.Connection connection)
        throws java.io.IOException
Throws:
java.io.IOException
Method Detail

exec

public java.lang.String exec(java.lang.String cmd)
                      throws java.io.IOException
Note that

Parameters:
cmd - connection.execCommand() does not return until the exec is complete. If it calls an app that runs forever. it never returns.
Returns:
Throws:
java.io.IOException

execNoRead

public void execNoRead(java.lang.String cmd)
                throws java.io.IOException
Throws:
java.io.IOException

closeConnection

public void closeConnection()

exec

public static java.lang.String exec(ch.ethz.ssh2.Connection connection,
                                    java.lang.String cmd)
                             throws java.io.IOException
Throws:
java.io.IOException

fileExists

public boolean fileExists(java.lang.String path)
                   throws java.io.IOException
Throws:
java.io.IOException