Samples in Globus Toolkit 3.0
A number of grid services are provided samples in the Globus Toolkit
3.0 (GTK3.0). This webpage provides details about setting up and running
these samples.
The GTK3.0 must be installed on your system. In all the illustrations
that are provided along with the guidelines, the GTK3.0 directory is test_install_dir
and its location is /home/purshah/test_install_dir.
Building the Samples
In order to build the samples, use the following command from your
GTK3.0 directory: ant samples.
For example,
[purshah@danube
test_install_dir]$ ant samples
generates the output that is provided in the file samples_build_output.txt.
If the samples are built successfully, then all the sample grid
services have been deployed in the container provided in GTK3.0. In
order to check what services have been deployed start the container in
GTK3.0 by using the command ant
startContainer from the GTK3.0 directory. This displays
all the services that are presently deployed in the container in your
GTK3.0. For example,
[purshah@danube
test_install_dir]$ ant startContainer
generates the output that is provided in the file container_output.txt.
Using a Sample Grid Service
In order to use a Grid Service, the following steps must be taken:
- Start the Container using ant
startContainer.
- Then in another window, create an instance of the Grid Service
using java
org.globus.ogsa.client.CreateService <service-url> <id>.
In this command, <service-url>
is the Grid Service Handle (GSH) of the Grid Service Factory that must
produce an instance of the Grid Service called <id>.
- Run the command-line client that interacts with the Grid Service
instance.
For example, we shall have a look at a sample Basic Counter Service that is
provided in GTK3.0. It is a simple counter maintaining the calculated
value as state. Three operations can be performed:
- GetValue - returns present value of the counter
- Add - adds to the counter value
- Subtract - subtracts from the counter value
The source code for the service is available in <gtk3.0>/samples/org/globus/ogsa/impl/samples/counter/basic
and for the clients is available in <gtk3.0>/samples/org/globus/ogsa/impl/samples/counter/client.
Steps 2 and 3 for this service are shown in counter.txt.
Creating a Client for a Sample Grid Service
In order to interact with a Grid Service, a client must be created that
initiates some operation performed by the Grid Service. For this
purpose, a client must use the Service Locator and Port Type classes
defined for the Grid Service. Using these classes a new instance of the
Grid Service's Port Type is created and a call is made to an operation
(i.e. method) of the Grid Service by supplying the URL for the instance
of the Grid Service and any other arguments as needed by the operation.
Details about these classes and methods can be obtained from the APIs
provided in GTK3.0 at <gtk3.0>/docs/api.
For example, a client for the sample Google Search Service is defined
in DoSpellingSuggestion.java.