edu.sdsc.inca.agent.access
Class Globus

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

public class Globus
extends AccessMethod

A class that implements AccessMethod using Globus commands (i.e., gridFTP and GRAM) for transferring files and running processes on remote resources.

Author:
Shava Smallen <ssmallen@sdsc.edu>

Nested Class Summary
 class Globus.GlobusStatusListener
          A subclass of StatusListener will be notified when our job's status has changed
 
Field Summary
protected  java.lang.String gramContact
           
static java.lang.String GRIDFTP_PROVIDER
           
protected  java.lang.String gridFtpContact
           
static int MINIMUM_LIFETIME
           
 
Constructor Summary
Globus(java.lang.String resource, edu.sdsc.inca.util.ResourcesWrapper resources, java.lang.String temp, java.lang.String provider)
          Create a new remote process controlling it via Globus commands.
 
Method Summary
 void get(java.lang.String[] remoteFiles, java.lang.String localDirPath)
          Transfer a list of remote files to a directory on the local machine using GridFTP.
 boolean isActive()
          Check whether the remote process is alive.
 java.lang.String prependHome(java.lang.String path)
          Given a path relative to the home directory, prepend '$(HOME)/' to the path and return the new string.
 void put(java.lang.String[] localFiles, java.lang.String remoteDirPath)
          Transfer a list of local files to a directory on a remote machine using GridFTP.
 AccessMethodOutput run(java.lang.String executable, java.lang.String[] arguments, java.lang.String stdin, java.lang.String directory)
          Execute the specified process on the remote resource.
 void setProxy(ReporterManagerProxy proxy)
          Set the proxy for Globus related tasks.
 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()
          Kill the remote process that was started by the start() call.
 
Methods inherited from class edu.sdsc.inca.agent.AccessMethod
create, get, put, run, run, start, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MINIMUM_LIFETIME

public static final int MINIMUM_LIFETIME
See Also:
Constant Field Values

GRIDFTP_PROVIDER

public static final java.lang.String GRIDFTP_PROVIDER
See Also:
Constant Field Values

gridFtpContact

protected java.lang.String gridFtpContact

gramContact

protected java.lang.String gramContact
Constructor Detail

Globus

public Globus(java.lang.String resource,
              edu.sdsc.inca.util.ResourcesWrapper resources,
              java.lang.String temp,
              java.lang.String provider)
       throws edu.sdsc.inca.ConfigurationException
Create a new remote process controlling it via Globus commands. The given resource should exist in the resource configuration file and have the following fields defined: gridFtpServer, gridFtpPort, gramServer, and gramPort. If one of those fields is missing, a ConfigurationException is thrown.

Parameters:
resource - The name of the resource to start the process on
resources - The resource configuration information.
temp - Path to a directory for temporary files to be stored
provider - Indicate version of globus to use (i.e., GT2 or GT4)
Throws:
edu.sdsc.inca.ConfigurationException - if trouble configuring globus resource
Method Detail

get

public void get(java.lang.String[] remoteFiles,
                java.lang.String localDirPath)
         throws AccessMethodException
Transfer a list of remote files to a directory on the local machine using GridFTP.

Overrides:
get in class AccessMethod
Parameters:
remoteFiles - Array of paths to remote files that will be transfered
localDirPath - Path to the local directory where the remote file will be placed
Throws:
AccessMethodException - if unable to put file

isActive

public boolean isActive()
Check whether the remote process is alive.

Specified by:
isActive in class AccessMethod
Returns:
true if the remote process is alive; false otherwise.

prependHome

public java.lang.String prependHome(java.lang.String path)
Given a path relative to the home directory, prepend '$(HOME)/' to the path and return the new string.

Overrides:
prependHome in class AccessMethod
Parameters:
path - A path relative to the user's home directory
Returns:
A new string that contains '$(HOME)/' prepended to the provided path.

run

public AccessMethodOutput run(java.lang.String executable,
                              java.lang.String[] arguments,
                              java.lang.String stdin,
                              java.lang.String directory)
                       throws AccessMethodException,
                              java.lang.InterruptedException
Execute the specified process on the remote resource. This call will block until the process has completed.

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 RemoteProcessObject.
Throws:
AccessMethodException - if unable to execute remote process
java.lang.InterruptedException - if interrupted while running remote process

setProxy

public void setProxy(ReporterManagerProxy proxy)
Set the proxy for Globus related tasks.

Parameters:
proxy - The reporter manager proxy object that can be used to retrieve a proxy from the MyProxy server if available

start

public void start(java.lang.String executable,
                  java.lang.String[] arguments,
                  java.lang.String stdin,
                  java.lang.String directory)
           throws AccessMethodException
Start a process on a remote machine. This is a non-blocking call.

Specified by:
start 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
Throws:
AccessMethodException - if unable to start remote process

stop

public void stop()
          throws AccessMethodException
Kill the remote process that was started by the start() call.

Specified by:
stop in class AccessMethod
Throws:
AccessMethodException

put

public void put(java.lang.String[] localFiles,
                java.lang.String remoteDirPath)
         throws AccessMethodException
Transfer a list of local files to a directory on a remote machine using GridFTP.

Overrides:
put in class AccessMethod
Parameters:
localFiles - Array of local file paths that will be transfered
remoteDirPath - Path to the directory on the remote machine where the local file will be placed
Throws:
AccessMethodException - if unable to transfer files