public class Gram
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static java.util.Hashtable |
callbackHandlers |
private static org.apache.commons.logging.Log |
logger |
Constructor and Description |
---|
Gram() |
Modifier and Type | Method and Description |
---|---|
static void |
cancel(GramJob job)
This function cancels an already running job.
|
private static void |
checkHttpReply(int code) |
private static void |
checkProtocolVersion(int protocolVersion) |
private static byte[] |
consumeRenewToken(ExtendedGSSContext c,
byte[] wrappedToken)
Unwraps and discards frame of a token according to the GRAM "renew"
protocol for use in a GSI delegation handshake.
|
static void |
deactivateAllCallbackHandlers()
Deactivates all callback handlers.
|
static CallbackHandler |
deactivateCallbackHandler(org.ietf.jgss.GSSCredential cred)
Deactivates a callback handler for a given credential.
|
private static void |
debug(java.lang.String header,
GatekeeperReply reply)
Debug function for displaying the gatekeeper reply.
|
private static void |
debug(java.lang.String header,
HttpResponse response)
Debug function for displaying HTTP responses.
|
private static void |
debug(java.lang.String header,
java.lang.String msg)
A general debug message that prints the header and msg
when the debug level is smaler than 3
|
private static java.net.Socket |
gatekeeperConnect(org.ietf.jgss.GSSCredential cred,
ResourceManagerContact rmc,
boolean doDel,
boolean limitedDelegation) |
static int |
getActiveJobs()
Returns total number of jobs currently running
for all credentials -- all callback handlers
|
static int |
getActiveJobs(org.ietf.jgss.GSSCredential cred)
Returns number of jobs currently running
for a specified credential (one credential one callback handler)
|
private static org.ietf.jgss.GSSCredential |
getJobCredentials(GramJob job) |
private static CallbackHandler |
initCallbackHandler(org.ietf.jgss.GSSCredential cred) |
private static GatekeeperReply |
jmConnect(org.ietf.jgss.GSSCredential cred,
GlobusURL jobURL,
java.lang.String msg) |
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(org.ietf.jgss.GSSCredential cred,
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.
|
private static byte[] |
produceRenewToken(ExtendedGSSContext c,
byte[] token)
Frames and wraps a token according to the GRAM "renew" protocol
for use in a GSI delegation handshake.
|
static void |
registerListener(GramJob job)
This function registers the job for status updates.
|
static void |
registerListener(GramJob job,
CallbackHandler handler) |
static void |
renew(GramJob job,
org.ietf.jgss.GSSCredential newCred)
Requests that a globus job manager accept newly delegated credentials.
|
static void |
renew(GramJob job,
org.ietf.jgss.GSSCredential newCred,
boolean limitedDelegation)
Requests that a globus job manager accept newly delegated credentials.
|
private static GatekeeperReply |
renewDelegationHandshake(ExtendedGSSContext context,
org.ietf.jgss.GSSCredential newCred,
GSIGssOutputStream out,
GSIGssInputStream in)
Completes a GSI delegation handshake with a globus job manager
that has agreed to a (previously sent) GRAM "renew" request.
|
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) |
private static org.apache.commons.logging.Log logger
protected static java.util.Hashtable callbackHandlers
private static java.net.Socket gatekeeperConnect(org.ietf.jgss.GSSCredential cred, ResourceManagerContact rmc, boolean doDel, boolean limitedDelegation) throws org.ietf.jgss.GSSException, GramException
org.ietf.jgss.GSSException
GramException
private static void checkProtocolVersion(int protocolVersion) throws GramException
GramException
private static void checkHttpReply(int code) throws GramException
code
- GramException
public static int getActiveJobs()
public static int getActiveJobs(org.ietf.jgss.GSSCredential cred)
public static void ping(java.lang.String resourceManagerContact) throws GramException, org.ietf.jgss.GSSException
resourceManagerContact
- resource manager contactGramException
- if an error occurs or user in unauthorizedorg.ietf.jgss.GSSException
public static void ping(org.ietf.jgss.GSSCredential cred, java.lang.String resourceManagerContact) throws GramException, org.ietf.jgss.GSSException
cred
- user credentialsresourceManagerContact
- resource manager contactGramException
- if an error occurs or user in unauthorizedorg.ietf.jgss.GSSException
public static void request(java.lang.String resourceManagerContact, GramJob job) throws GramException, org.ietf.jgss.GSSException
resourceManagerContact
- resource manager contactjob
- gram jobGramException
- if an error occurs during submissonorg.ietf.jgss.GSSException
public static void request(java.lang.String resourceManagerContact, GramJob job, boolean batchJob) throws GramException, org.ietf.jgss.GSSException
resourceManagerContact
- resource manager contactjob
- gram jobbatchJob
- true if batch job, interactive otherwiseGramException
- if an error occurs during submissonorg.ietf.jgss.GSSException
public static void request(java.lang.String resourceManagerContact, GramJob job, boolean batchJob, boolean limitedDelegation) throws GramException, org.ietf.jgss.GSSException
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.GramException
- if an error occurs during submissonorg.ietf.jgss.GSSException
private static GatekeeperReply jmConnect(org.ietf.jgss.GSSCredential cred, GlobusURL jobURL, java.lang.String msg) throws GramException, org.ietf.jgss.GSSException
GramException
org.ietf.jgss.GSSException
private static byte[] produceRenewToken(ExtendedGSSContext c, byte[] token) throws org.ietf.jgss.GSSException
c
- The context used to wrap the tokentoken
- The unaltered output of the context's initDelegationorg.ietf.jgss.GSSException
- if an error occurs during token wrapping or if
context is insufficientprivate static byte[] consumeRenewToken(ExtendedGSSContext c, byte[] wrappedToken) throws org.ietf.jgss.GSSException
c
- The context to use to unwrap the tokenwrappedToken
- Token received from job manager during GSI handshakeorg.ietf.jgss.GSSException
- if an error occurs during token wrapping or if
context is insufficientprivate static GatekeeperReply renewDelegationHandshake(ExtendedGSSContext context, org.ietf.jgss.GSSCredential newCred, GSIGssOutputStream out, GSIGssInputStream in) throws org.ietf.jgss.GSSException, java.io.IOException
context
- Previously established context with job managernewCred
- The credential used to generate a new delegated proxyout
- Stream used to send messages to job managerin
- Stream used to receive messages from job managerorg.ietf.jgss.GSSException
- if an error occurs during token wrapping/unwrappingjava.io.IOException
- if a communication error occurspublic static void renew(GramJob job, org.ietf.jgss.GSSCredential newCred) throws GramException, org.ietf.jgss.GSSException
job
- The job whose credentials are to be renewed/refreshednewCred
- The credentials to use in the delegation processorg.ietf.jgss.GSSException
- if a GSSAPI error occursGramException
- if a connection/communication error occurs or if
delegation failedpublic static void renew(GramJob job, org.ietf.jgss.GSSCredential newCred, boolean limitedDelegation) throws GramException, org.ietf.jgss.GSSException
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 proxyorg.ietf.jgss.GSSException
- if a GSSAPI error occursGramException
- if a connection/communication error occurs or if
delegation failedpublic static void cancel(GramJob job) throws GramException, org.ietf.jgss.GSSException
job
- job to be canceledGramException
- if an error occurs during cancelorg.ietf.jgss.GSSException
public static void jobStatus(GramJob job) throws GramException, org.ietf.jgss.GSSException
job
- the job whose status is to be updated.GramException
- if an error occurs during status update.org.ietf.jgss.GSSException
public static int jobSignal(GramJob job, int signal, java.lang.String arg) throws GramException, org.ietf.jgss.GSSException
job
- the signaled jobsignal
- type of the signalarg
- argument of the signalGramException
- if an error occurs during cancelorg.ietf.jgss.GSSException
public static void registerListener(GramJob job) throws GramException, org.ietf.jgss.GSSException
job
- the jobGramException
- if an error occurs during registrationorg.ietf.jgss.GSSException
public static void registerListener(GramJob job, CallbackHandler handler) throws GramException, org.ietf.jgss.GSSException
GramException
org.ietf.jgss.GSSException
public static void unregisterListener(GramJob job) throws GramException, org.ietf.jgss.GSSException
job
- the jobGramException
- if an error occurs during unregisteringorg.ietf.jgss.GSSException
public static void unregisterListener(GramJob job, CallbackHandler handler) throws GramException, org.ietf.jgss.GSSException
GramException
org.ietf.jgss.GSSException
public static void deactivateAllCallbackHandlers()
public static CallbackHandler deactivateCallbackHandler(org.ietf.jgss.GSSCredential cred)
cred
- the credential of the callback handler.private static CallbackHandler initCallbackHandler(org.ietf.jgss.GSSCredential cred) throws org.ietf.jgss.GSSException, GramException
org.ietf.jgss.GSSException
GramException
private static org.ietf.jgss.GSSCredential getJobCredentials(GramJob job) throws org.ietf.jgss.GSSException
org.ietf.jgss.GSSException
private static void debug(java.lang.String header, GatekeeperReply reply)
private static void debug(java.lang.String header, HttpResponse response)
private static void debug(java.lang.String header, java.lang.String msg)
header
- The header to be printedmsg
- The message to be printed