|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
edu.washington.cs.pl_if.ssh.SshConnection
public class SshConnection
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static String |
EXIT_CODE_IDENTIFIER
|
static int |
LOG_DEVEL
|
static int |
LOG_ERROR
|
static int |
LOG_FULL
|
static int |
LOG_LEVEL
|
static int |
SSH_CONNECT_TIMEOUT
|
static int |
SSH_KEY_EXCHANGE_TIMEOUT
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
SshConnection(ConnectionController controller,
PlanetLabHost hostname)
create a new instance of a SSHConnection Thread |
Method Summary | |
---|---|
void |
connectionLost(Throwable reason)
|
void |
disconnect()
|
boolean |
download(String remotePath,
File localBaseDir,
String fileFilter,
String localNamingType,
CommandSpec commandSpec)
|
String |
getCommand(int num)
|
int |
getCommandExitStatus(int commandIndex)
|
String |
getCommandExitStatusString(int commandIndex)
|
CommandSpec |
getCommandSpec(int commandIndex)
|
Object[] |
getCommandStats()
|
Connection |
getConnection()
|
int |
getCurrentCommandNum()
|
double |
getExecutionTime(int commandNum)
|
PlanetLabHost |
getHost()
|
String |
getHostname()
|
String |
getLastOutput()
|
List<Map> |
getOutput(int fromRow)
Get output from the ssh connection |
int |
getOutputRowNum(int command)
|
String |
getStatus()
|
void |
halt()
Closes the connction and removes all commands from the execution queue |
boolean |
isCommandCompleted(int commandIndex)
|
boolean |
isConnected()
|
boolean |
isHalted()
|
int |
killCommand(int commandId)
|
static void |
main(String[] args)
used for debugging... |
boolean |
mirrorDir(File baseDir)
|
int |
queueCommand(String command)
Lazy wrapper for queueCommand, - identical to calling queueCommand(command, 0,false) . |
int |
queueCommand(String command,
double timeout,
boolean stopOnError)
Add command to the queue of commands to execute |
void |
run()
|
int |
runCommand(CommandSpec commandSpec,
Session session)
Run a command in the given session |
Session |
startShell()
starts a shell using the connection |
boolean |
upload(File fileOrDir,
CommandSpec commandSpec)
|
boolean |
wasConnected()
checks if this connection is or was successfully connected |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int LOG_ERROR
public static final int LOG_FULL
public static final int LOG_DEVEL
public static final int LOG_LEVEL
public static final int SSH_CONNECT_TIMEOUT
public static final int SSH_KEY_EXCHANGE_TIMEOUT
public static final String EXIT_CODE_IDENTIFIER
Constructor Detail |
---|
public SshConnection(ConnectionController controller, PlanetLabHost hostname)
hostname
- hostname to connect toMethod Detail |
---|
public static void main(String[] args)
args
- public void connectionLost(Throwable reason)
connectionLost
in interface ConnectionMonitor
public void disconnect()
public String getCommand(int num)
public int getCommandExitStatus(int commandIndex)
public String getCommandExitStatusString(int commandIndex)
public CommandSpec getCommandSpec(int commandIndex)
public Object[] getCommandStats()
public Connection getConnection()
public int getCurrentCommandNum()
public double getExecutionTime(int commandNum)
public PlanetLabHost getHost()
public String getHostname()
public String getLastOutput()
public List<Map> getOutput(int fromRow)
public int getOutputRowNum(int command)
public String getStatus()
public void halt()
public boolean isCommandCompleted(int commandIndex)
public boolean isConnected()
public boolean isHalted()
public boolean mirrorDir(File baseDir)
public int queueCommand(String command)
queueCommand(command, 0,false)
.
command
- The command to execute
public int queueCommand(String command, double timeout, boolean stopOnError)
command
- The command to executetimeout
- Maximum time allowed for the command to execute without any
data beeing written to stdout. 0 disablestopOnError
- controller if subsequent commands should be executed if a
non-zero exit code is returned
public int killCommand(int commandId)
public void run()
run
in interface Runnable
run
in class Thread
public int runCommand(CommandSpec commandSpec, Session session) throws IOException, InterruptedException
commandSpec
- session
-
IOException
InterruptedException
public Session startShell()
public boolean wasConnected()
public boolean upload(File fileOrDir, CommandSpec commandSpec)
public boolean download(String remotePath, File localBaseDir, String fileFilter, String localNamingType, CommandSpec commandSpec)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |