Gram (Java Globus API)

org.globus.gram
Class Gram

java.lang.Object
  |
  +--org.globus.gram.Gram

public class Gram
extends java.lang.Object

This is the main class for using the Globus GRAM API It implements all of the GRAM API functionality such as job submission, canceling, gatekeeper pinging, and job signaling. It also allows for callback registering and unregistering.


Field Summary
protected static java.util.Hashtable callbackHandlers
           
 
Constructor Summary
Gram()
           
 
Method Summary
static void cancel(GramJob job)
          This function cancels an already running job.
static int getActiveJobs()
           
static int getActiveJobs(GlobusProxy proxy)
           
static int jobSignal(GramJob job, int signal, java.lang.String arg)
          This function sends a signal to a job.
static void jobStatus(GramJob job)
          This function updates the status of a job (within the job object), and throws an exception if the status is not OK.
static void ping(GlobusProxy proxy, java.lang.String resourceManagerContact)
          Performs ping operation on the gatekeeper with specified user credentials.
static void ping(java.lang.String resourceManagerContact)
          Performs ping operation on the gatekeeper with default user credentials.
static void registerListener(GramJob job)
          This function registers the job for status updates.
static void registerListener(GramJob job, CallbackHandler handler)
           
static void request(java.lang.String resourceManagerContact, GramJob job)
          Submits a GramJob to specified gatekeeper as an interactive job.
static void request(java.lang.String resourceManagerContact, GramJob job, boolean batchJob)
          Submits a GramJob to specified gatekeeper as a interactive or batch job.
static void request(java.lang.String resourceManagerContact, GramJob job, boolean batchJob, boolean limitedDelegation)
          Submits a GramJob to specified gatekeeper as a interactive or batch job.
static void unregisterListener(GramJob job)
          This function unregisters the job from callback listener.
static void unregisterListener(GramJob job, CallbackHandler handler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callbackHandlers

protected static java.util.Hashtable callbackHandlers
Constructor Detail

Gram

public Gram()
Method Detail

getActiveJobs

public static int getActiveJobs()
                         throws GlobusProxyException
Throws:
GlobusProxyException

getActiveJobs

public static int getActiveJobs(GlobusProxy proxy)
                         throws GlobusProxyException
Parameters:
proxy -
Throws:
GlobusProxyException

ping

public static void ping(java.lang.String resourceManagerContact)
                 throws GramException,
                        GlobusProxyException
Performs ping operation on the gatekeeper with default user credentials. Verifies if the user is authorized to submit a job to that gatekeeper.

Parameters:
resourceManagerContact - resource manager contact
Throws:
GramException - if an error occurs or user in unauthorized
GlobusProxyException

ping

public static void ping(GlobusProxy proxy,
                        java.lang.String resourceManagerContact)
                 throws GramException,
                        GlobusProxyException
Performs ping operation on the gatekeeper with specified user credentials. Verifies if the user is authorized to submit a job to that gatekeeper.

Parameters:
proxy - user credentials
resourceManagerContact - resource manager contact
Throws:
GramException - if an error occurs or user in unauthorized
GlobusProxyException

request

public static void request(java.lang.String resourceManagerContact,
                           GramJob job)
                    throws GramException,
                           GlobusProxyException
Submits a GramJob to specified gatekeeper as an interactive job. Performs limited delegation.

Parameters:
resourceManagerContact - resource manager contact
job - gram job
Throws:
GramException - if an error occurs during submisson
GlobusProxyException

request

public static void request(java.lang.String resourceManagerContact,
                           GramJob job,
                           boolean batchJob)
                    throws GramException,
                           GlobusProxyException
Submits a GramJob to specified gatekeeper as a interactive or batch job. Performs limited delegation.

Parameters:
resourceManagerContact - resource manager contact
job - gram job
batchJob - true if batch job, interactive otherwise
Throws:
GramException - if an error occurs during submisson
GlobusProxyException

request

public static void request(java.lang.String resourceManagerContact,
                           GramJob job,
                           boolean batchJob,
                           boolean limitedDelegation)
                    throws GramException,
                           GlobusProxyException
Submits a GramJob to specified gatekeeper as a interactive or batch job.

Parameters:
resourceManagerContact - resource manager contact
job - gram job
batchJob - true if batch job, interactive otherwise.
limitedDelegation - true for limited delegation, false for full delegation. limited delegation should be the default option.
Throws:
GramException - if an error occurs during submisson
GlobusProxyException

cancel

public static void cancel(GramJob job)
                   throws GramException,
                          GlobusProxyException
This function cancels an already running job.

Parameters:
job - job to be canceled
Throws:
GramException - if an error occurs during cancel
GlobusProxyException

jobStatus

public static void jobStatus(GramJob job)
                      throws GramException,
                             GlobusProxyException
This function updates the status of a job (within the job object), and throws an exception if the status is not OK. If the job manager cannot be contacted the job error code is set to GramException.ERROR_CONTACTING_JOB_MANAGER and an exception with the same error code is thrown.

Parameters:
job - the job whose status is to be updated.
Throws:
GramException - if an error occurs during status update.
GlobusProxyException

jobSignal

public static int jobSignal(GramJob job,
                            int signal,
                            java.lang.String arg)
                     throws GramException,
                            GlobusProxyException
This function sends a signal to a job.

Parameters:
job - the signaled job
signal - type of the signal
arg - argument of the signal
Throws:
GramException - if an error occurs during cancel
GlobusProxyException

registerListener

public static void registerListener(GramJob job)
                             throws GramException,
                                    GlobusProxyException
This function registers the job for status updates.

Parameters:
job - the job
Throws:
GramException - if an error occurs during registration
GlobusProxyException

registerListener

public static void registerListener(GramJob job,
                                    CallbackHandler handler)
                             throws GramException,
                                    GlobusProxyException
GramException
GlobusProxyException

unregisterListener

public static void unregisterListener(GramJob job)
                               throws GramException,
                                      GlobusProxyException
This function unregisters the job from callback listener. The job status will not be updated.

Parameters:
job - the job
Throws:
GramException - if an error occurs during unregistering
GlobusProxyException

unregisterListener

public static void unregisterListener(GramJob job,
                                      CallbackHandler handler)
                               throws GramException,
                                      GlobusProxyException
GramException
GlobusProxyException