edu.sdsc.inca.agent.access
Class Manual

java.lang.Object
  extended by edu.sdsc.inca.agent.AccessMethod
      extended by edu.sdsc.inca.agent.access.Manual

public class Manual
extends AccessMethod

A class that implements manual AccessMethod (i.e., agent doesn't directly have remote access but instead prints out commands to log). This is meant for sites which want to locally control reporter manager startup or where none of the provided access methods work).

Author:
Shava Smallen <ssmallen@sdsc.edu>

Constructor Summary
Manual(java.lang.String resource, edu.sdsc.inca.util.ResourcesWrapper resources)
          Create a new manual process.
 
Method Summary
 void get(java.lang.String remoteFile, java.lang.String localDir)
          Log the remote file that would be transferred to a directory on the local machine.
 boolean isActive()
          Checks to see if the current ssh session is active.
 void put(java.lang.String localFile, java.lang.String remoteDir)
          Log the file that would be transferred to a directory on a remote machine .
 AccessMethodOutput run(java.lang.String executable, java.lang.String[] arguments, java.lang.String stdin, java.lang.String directory)
          Log the command that should be executed on the remote machine.
 void start(java.lang.String executable, java.lang.String[] arguments, java.lang.String stdin, java.lang.String directory)
          Start a process on a remote machine.
 void stop()
          Just log that the process needs to be stopped.
 
Methods inherited from class edu.sdsc.inca.agent.AccessMethod
create, get, prependHome, put, run, run, start, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Manual

public Manual(java.lang.String resource,
              edu.sdsc.inca.util.ResourcesWrapper resources)
Create a new manual process.

Parameters:
resource - The name of the resource to start the process on
resources - The resource configuration information.
Method Detail

get

public void get(java.lang.String remoteFile,
                java.lang.String localDir)
         throws AccessMethodException
Log the remote file that would be transferred to a directory on the local machine.

Overrides:
get in class AccessMethod
Parameters:
remoteFile - Path to the remote file that will be transfered
localDir - Path to the directory on the local machine where the remote file will be placed
Throws:
AccessMethodException - if unable to fetch remote file

put

public void put(java.lang.String localFile,
                java.lang.String remoteDir)
         throws AccessMethodException
Log the file that would be transferred to a directory on a remote machine .

Overrides:
put in class AccessMethod
Parameters:
localFile - Path to the local file that will be transfered
remoteDir - Path to the directory on the remote machine where the local file will be placed
Throws:
AccessMethodException - if unable to transfer remote file

run

public AccessMethodOutput run(java.lang.String executable,
                              java.lang.String[] arguments,
                              java.lang.String stdin,
                              java.lang.String directory)
Log the command that should be executed on the remote machine.

Specified by:
run in class AccessMethod
Parameters:
executable - Path to the remote executable.
arguments - Contains the arguments that should be passed to the executable
stdin - A string that will be passedd in as stdin to the process when it is started
directory - Path to the directory where the process will be executed from
Returns:
The stdout and stderr of the executed process in AccessMethodOutput

start

public void start(java.lang.String executable,
                  java.lang.String[] arguments,
                  java.lang.String stdin,
                  java.lang.String directory)
Start a process on a remote machine. This is a non-blocking call. Important note: this process will not be killed on call to stop()

Specified by:
start in class AccessMethod
Parameters:
executable - Path to the remote executable.
arguments - Contains the arguments that should be passed to the executable
directory - Path to the directory where the process will be executed
stdin - A string that will be passedd in as stdin to the process when it is started

stop

public void stop()
          throws AccessMethodException
Just log that the process needs to be stopped.

Specified by:
stop in class AccessMethod
Throws:
AccessMethodException

isActive

public boolean isActive()
                 throws AccessMethodException
Checks to see if the current ssh session is active. Does not indicate whether the remote process is alive (for now).

Specified by:
isActive in class AccessMethod
Returns:
true if the SSH session is alive; false otherwise.
Throws:
AccessMethodException - if unable to determine if process is active