# Package org.globus.gram

package org.globus.gram
This library is a full implementation of the GRAM client API. It allows for submitting and canceling of jobs, polling for job status and sending signals to a job. The library enables a user to 'ping' a gatekeeper to verify if the user can authenticate to it. In addition, this library allows for registering and un-registering of callback listeners that listen for job status updates. The callbacks are implemented as Java events.
Beyond the functionality of Globus, the Java GRAM API allows the specification of the delegation type to perform-either full or limited.

Notification of state changes for GRAM jobs is supported by the user's class adding itself as a listener to a GramJob. See the example below for more details.

## Example

    public class GramExample implements GramJobListener {

       private someMethod() {
         ...

         String gramContact = "pitcairn.mcs.anl.gov:6722:...";
         String rsl = "invalid input: '&'(executable=...)(...)(...)";

         try {
             Gram.ping(gramContact);
         } catch (GramException e) {
            // can't submit
            return;
         }

         job.addListener(this);
         // add this class as a listener for state changes

         GramJob job = null;
         try {
            job = new GramJob(rsl);
            Gram.request(gramContact,job);
         } catch (GramException e) {
            // request failed
            ...
         }

         ...

         try {
             job.cancel();
         } catch (GramException e) {
           // cancel failed
           ...
         }
       }

       // this method must be implemented in order for the class to
       // implement the GramJobListener class
       public stateChanged(GramJob job) {
           System.out.println("Job state change \n" +
                              "     ID   : " + job.getID() + "\n"  +
                              "     State: " + job.getStateAsString());
        }
    }

## Package Specification

## Related Documentation

For overviews, tutorials, examples, guides, and tool documentation, please see:

- Java CoG Kit
- Globus

Related Packages
Package
Description
org.globus.gram.example
org.globus.gram.internal
Low-level protocol classes used by the org.globus.gram package.
Class
Description
CallbackHandler
The `Server` class acts as a basic multi-threaded HTTPS server.
Gram
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.
GramAttributes
A convienience class for operating on GRAM-specific RSL attributes.
GramException
This class defeines the Exceptions which are thrown by the various Gram and GramJob methods.
GramJob
This class represents a simple gram job.
GramJobListener
This interface is used to allow objects created by the Globus user to listen for status changes of GramJobs.
GramJobRun
WaitingForCommitException
This class represents a specific type of GramException.