Package org.globus.gram
Class Gram
- java.lang.Object
-
- org.globus.gram.Gram
-
public class Gram extends java.lang.ObjectThis 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
Fields Modifier and Type Field Description protected static java.util.HashtablecallbackHandlers
-
Constructor Summary
Constructors Constructor Description Gram()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcancel(GramJob job)This function cancels an already running job.static voiddeactivateAllCallbackHandlers()Deactivates all callback handlers.static CallbackHandlerdeactivateCallbackHandler(org.ietf.jgss.GSSCredential cred)Deactivates a callback handler for a given credential.static intgetActiveJobs()Returns total number of jobs currently running for all credentials -- all callback handlersstatic intgetActiveJobs(org.ietf.jgss.GSSCredential cred)Returns number of jobs currently running for a specified credential (one credential one callback handler)static intjobSignal(GramJob job, int signal, java.lang.String arg)This function sends a signal to a job.static voidjobStatus(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 voidping(java.lang.String resourceManagerContact)Performs ping operation on the gatekeeper with default user credentials.static voidping(org.ietf.jgss.GSSCredential cred, java.lang.String resourceManagerContact)Performs ping operation on the gatekeeper with specified user credentials.static voidregisterListener(GramJob job)This function registers the job for status updates.static voidregisterListener(GramJob job, CallbackHandler handler)static voidrenew(GramJob job, org.ietf.jgss.GSSCredential newCred)Requests that a globus job manager accept newly delegated credentials.static voidrenew(GramJob job, org.ietf.jgss.GSSCredential newCred, boolean limitedDelegation)Requests that a globus job manager accept newly delegated credentials.static voidrequest(java.lang.String resourceManagerContact, GramJob job)Submits a GramJob to specified gatekeeper as an interactive job.static voidrequest(java.lang.String resourceManagerContact, GramJob job, boolean batchJob)Submits a GramJob to specified gatekeeper as a interactive or batch job.static voidrequest(java.lang.String resourceManagerContact, GramJob job, boolean batchJob, boolean limitedDelegation)Submits a GramJob to specified gatekeeper as a interactive or batch job.static voidunregisterListener(GramJob job)This function unregisters the job from callback listener.static voidunregisterListener(GramJob job, CallbackHandler handler)
-
-
-
Method Detail
-
getActiveJobs
public static int getActiveJobs()
Returns total number of jobs currently running for all credentials -- all callback handlers- Returns:
- number of jobs running
-
getActiveJobs
public static int getActiveJobs(org.ietf.jgss.GSSCredential cred)
Returns number of jobs currently running for a specified credential (one credential one callback handler)- Returns:
- number of jobs running for given credential
-
ping
public static void ping(java.lang.String resourceManagerContact) throws GramException, org.ietf.jgss.GSSExceptionPerforms 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 unauthorizedorg.ietf.jgss.GSSException
-
ping
public static void ping(org.ietf.jgss.GSSCredential cred, java.lang.String resourceManagerContact) throws GramException, org.ietf.jgss.GSSExceptionPerforms ping operation on the gatekeeper with specified user credentials. Verifies if the user is authorized to submit a job to that gatekeeper.- Parameters:
cred- user credentialsresourceManagerContact- resource manager contact- Throws:
GramException- if an error occurs or user in unauthorizedorg.ietf.jgss.GSSException
-
request
public static void request(java.lang.String resourceManagerContact, GramJob job) throws GramException, org.ietf.jgss.GSSExceptionSubmits a GramJob to specified gatekeeper as an interactive job. Performs limited delegation.- Parameters:
resourceManagerContact- resource manager contactjob- gram job- Throws:
GramException- if an error occurs during submissonorg.ietf.jgss.GSSException
-
request
public static void request(java.lang.String resourceManagerContact, GramJob job, boolean batchJob) throws GramException, org.ietf.jgss.GSSExceptionSubmits a GramJob to specified gatekeeper as a interactive or batch job. Performs limited delegation.- Parameters:
resourceManagerContact- resource manager contactjob- gram jobbatchJob- true if batch job, interactive otherwise- Throws:
GramException- if an error occurs during submissonorg.ietf.jgss.GSSException
-
request
public static void request(java.lang.String resourceManagerContact, GramJob job, boolean batchJob, boolean limitedDelegation) throws GramException, org.ietf.jgss.GSSExceptionSubmits a GramJob to specified gatekeeper as a interactive or batch job.- Parameters:
resourceManagerContact- resource manager contactjob- gram jobbatchJob- 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 submissonorg.ietf.jgss.GSSException
-
renew
public static void renew(GramJob job, org.ietf.jgss.GSSCredential newCred) throws GramException, org.ietf.jgss.GSSException
Requests that a globus job manager accept newly delegated credentials. Uses limited delegation.- Parameters:
job- The job whose credentials are to be renewed/refreshednewCred- The credentials to use in the delegation process- Throws:
org.ietf.jgss.GSSException- if a GSSAPI error occursGramException- if a connection/communication error occurs or if delegation failed
-
renew
public static void renew(GramJob job, org.ietf.jgss.GSSCredential newCred, boolean limitedDelegation) throws GramException, org.ietf.jgss.GSSException
Requests that a globus job manager accept newly delegated credentials. This consists of a "renew" message in the GRAM protocol followed by a GSI delegation handshake using wrapped/framed tokens. Upon successful delegation, the job's credentials are set to the ones used in delegation.- Parameters:
job- The job whose credentials are to be renewed/refreshednewCred- The credentials to use in the delegation processlimitedDelegation- Whether to use a full or limited proxy- Throws:
org.ietf.jgss.GSSException- if a GSSAPI error occursGramException- if a connection/communication error occurs or if delegation failed
-
cancel
public static void cancel(GramJob job) throws GramException, org.ietf.jgss.GSSException
This function cancels an already running job.- Parameters:
job- job to be canceled- Throws:
GramException- if an error occurs during cancelorg.ietf.jgss.GSSException
-
jobStatus
public static void jobStatus(GramJob job) throws GramException, org.ietf.jgss.GSSException
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.org.ietf.jgss.GSSException
-
jobSignal
public static int jobSignal(GramJob job, int signal, java.lang.String arg) throws GramException, org.ietf.jgss.GSSException
This function sends a signal to a job.- Parameters:
job- the signaled jobsignal- type of the signalarg- argument of the signal- Throws:
GramException- if an error occurs during cancelorg.ietf.jgss.GSSException
-
registerListener
public static void registerListener(GramJob job) throws GramException, org.ietf.jgss.GSSException
This function registers the job for status updates.- Parameters:
job- the job- Throws:
GramException- if an error occurs during registrationorg.ietf.jgss.GSSException
-
registerListener
public static void registerListener(GramJob job, CallbackHandler handler) throws GramException, org.ietf.jgss.GSSException
- Throws:
GramExceptionorg.ietf.jgss.GSSException
-
unregisterListener
public static void unregisterListener(GramJob job) throws GramException, org.ietf.jgss.GSSException
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 unregisteringorg.ietf.jgss.GSSException
-
unregisterListener
public static void unregisterListener(GramJob job, CallbackHandler handler) throws GramException, org.ietf.jgss.GSSException
- Throws:
GramExceptionorg.ietf.jgss.GSSException
-
deactivateAllCallbackHandlers
public static void deactivateAllCallbackHandlers()
Deactivates all callback handlers.
-
deactivateCallbackHandler
public static CallbackHandler deactivateCallbackHandler(org.ietf.jgss.GSSCredential cred)
Deactivates a callback handler for a given credential.- Parameters:
cred- the credential of the callback handler.- Returns:
- the callback handler that was deactivated. Null, if no callback handler is associated with the credential
-
-