Tutorial TOC

Chapter 1 Exercises

Files modified: none

Install GT3 core

Get gt3-cvs-core.tar.gz from the instructors

$ cd /tmp
$ tar xzf gt3-cvs-core.tar.gz
$ cd gt3-cvs-core
$ export GLOBUS_LOCATION=`pwd`
GLOBUS_LOCATION is the variable that lets various scripts know where the install is located
$ ant setup
This creates the operating system dependent scripts inside of bin/

Test GT3 core

$ bin/globus-start-container

This starts the GT3 container, which does not return control to the shell. Press Ctrl-C to stop.

If port 8080 is in use, this will fail. Specify an alternate port with -p.

Please stay in $GLOBUS_LOCATION to run this command. We will be using relative paths in some of our deployment parameters, and we will assume that you were in $GLOBUS_LOCATION when you started your container.

Build Fileshare

Get fileshare-tutorial.tar.gz from the instructors

$ cd /tmp
$ tar xzf fileshare-tutorial.tar.gz
$ cd fileshare-tutorial
$ export TUTORIAL_LOCATION=`pwd`
$ ant deployGar -Dogsa.root=$GLOBUS_LOCATION
This builds the fileshare service and installs it into your GT3 install

Test Fileshare

$ cd $GLOBUS_LOCATION
$ bin/globus-start-container
Start the container again. You need to start one after having deployed the service. This is why we stopped the container earlier. Be in $GLOBUS_LOCATION, not $GLOBUS_LOCATION/bin See that FileShareService is now listed.

In a new window (You will need to set the environment variables again in the new window):

$ cd $GLOBUS_LOCATION
$ source setenv.sh
This is *not* a production step. We are only doing this because our code is in "samples"
$ cd /tmp
$ mkdir client
$ cd client
$ export CLIENT_LOCATION=`pwd`
This is to make sure you're not in $GLOBUS_LOCATION when you retrieve a file.
$ java org.globus.ogsa.impl.samples.fileshare.client.GetFile FILENAME

FILENAME may be any file in $GLOBUS_LOCATION, like LICENSE. Do not specify a full or relative path to the file, just the word "LICENSE". After running the command, you should get that file in /tmp/client

[If you had to use an alternate port, you may specify a port after the filename, like java org.globus.ogsa.impl.samples.fileshare.client.GetFile FILENAME PORT]

Chapter 2 Exercises

Files modified:

Undeploy old gar

$ cd $GLOBUS_LOCATION
$ stop container (ctrl-c)
$ ant undeploy -Dgar.id=fileshare

Rebuild Fileshare Client

$ cd $TUTORIAL_LOCATION
$ ant cleanAll -Dogsa.root=$GLOBUS_LOCATION
Removes generated code. This is a good habit to get into, as the ant targets will not recompile code if the stubs already exist.
$ #Make your edits
$ ant deployGar -Dogsa.root=$GLOBUS_LOCATION
Builds new code and deploys it.

Restart the container

$ cd $GLOBUS_LOCATION
$ bin/globus-start-container

Test new GSH functionality

Retrieve a file from yourself, using the GSH published by your container.

$ cd $CLIENT_LOCATION
$ java org.globus.ogsa.impl.samples.fileshare.client.GetFile FILENAME YOUR_GSH

Get a GSH from a neighbor. Retrieve a file from them using their GSH.

$ java org.globus.ogsa.impl.samples.fileshare.client.GetFile FILENAME NEIGHBORS_GSH

Chapter 3 Exercises

Files modified:

Undeploy Fileshare

$ cd $GLOBUS_LOCATION
$ ant undeploy -Dgar.id=fileshare
This makes sure that the old version of your install will not conflict with the version you're about to add. Do this every time before running deployGar

Make your changes.

$ cd $TUTORIAL_LOCATION
$ ant cleanAll -Dogsa.root=$GLOBUS_LOCATION
$ #Edit files in $TUTORIAL_LOCATION
$ ant deployGar -Dogsa.root=$GLOBUS_LOCATION

Restart Container

$ cd $GLOBUS_LOCATION
$ Stop the container if it is running.
$ bin/globus-start-container

Query servicedata

$ cd $GLOBUS_LOCATION
$ bin/ogsi-find-service-data-by-name "http://ogsa.globus.org/samples/2003/09/fileshare":NumberOfFileGets FILESHARE_GSH
First argument is namespace-qualified SDE, second arg is GSH. Should see a return value like:
Service Data Values: <ns2:serviceDataValues xmlns:ns2="http://www.gridforum.org/namespaces/2003/03/serviceData"> <ns3:NumberOfFileGets gt:originator="http://140.221.57.104:8080/ogsa/services/samples/fileshare/FileShareService" ogsi:availableUntil="2003-10-08T17:44:12.247Z" ogsi:goodFrom="2003-10-07T17:44:11.246Z" ogsi:goodUntil="2003-10-08T17:44:11.247Z" xmlns:gt="http://ogsa.globus.org/" xmlns:ns3="http://ogsa.globus.org/samples/2003/09/fileshare" xmlns:ogsi="http://www.gridforum.org/namespaces/2003/03/OGSI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:int">0</ns3:NumberOfFileGets></ns2:serviceDataValues>

You should recognized the originator and attrs from your populateAttrs() function. The actual value here is "0". Also try querying for the filelist. Both should be initialized at startup by the postCreate call.

$ cd $CLIENT_LOCATION

Try running GetFile a number of times. Query the servicedata again. It should update appropriately.

Try running the query against your neighbor's GSH. Get a file from them, then query the SDE again to see that it updated.

Extra exercise idea: Create new SDEs of your own

Chapter 4 Exercises

Files modified:

Clean up, modify code, redeploy

$ cd $GLOBUS_LOCATION
$ # Stop the container if it is running
$ ant undeploy -Dgar.id=fileshare
$ cd $TUTORIAL_LOCATION
$ ant cleanAll -Dogsa.root=$GLOBUS_LOCATION
$ # modify files
$ ant deployGar -Dogsa.root=$GLOBUS_LOCATION
$ cd $GLOBUS_LOCATION
$ bin/globus-start-container

Query the Index

Verify that your service appears in the index:

$ cd $GLOBUS_LOCATION
$ bin/ogsi-find-service-data-by-name "http://www.gridforum.org/namespaces/2003/03/OGSI":entry INDEX_GSH

The instructors will provide the GSH of the Index to register to.

Your IP address should appear in the (very long!) results, in an entry named "ogsi:handle" under a ogsi:memberServiceLocator entry:

<ogsi:memberServiceLocator xsi:type="ogsi:LocatorType">
<ogsi:handle xsi:type="ogsi:HandleType">http://140.221.57.104:8080/ogsa/services/samples/fileshare/FileShareService</ogsi:handle>

Note that depending when your service gets registered, there may be many other entries already. It may be easier to save the output to a file, then search for your IP.

Chapter 5 Exercises

Files modified: none.

Query to find the lifetime of your subscription:

$ cd $GLOBUS_LOCATION
$ bin/ogsi-find-service-data-by-name entry INDEX_GSH
In the large amount of output, you should see lines like:
availableUntil: 2003-10-07T22:32:27.761Z
Check again after that time has passed:
$ bin/ogsi-find-service-data-by-name entry INDEX_GSH
availableUntil: 2003-10-07T22:33:47.784Z

Chapter 6 Exercises

Files modified: New files used:

Add a file and restart (no undeploy/redeploy required)

$ cd $GLOBUS_LOCATION
$ # Stop the container if it is running
$ # Create a file named after yourself (mine is Bacon)
$ bin/globus-start-container

Ensure that you appear in the instructor's Index server.

$ cd $CLIENT_LOCATION
$ java org.globus.ogsa.impl.samples.fileshare.client.GetFileIndex FILENAME INDEX_GSH

Expected output:

The 'Bacon' is published by:
1. http://140.221.57.104:8080/ogsa/services/samples/fileshare/FileShareService
Trying to get file from: http://140.221.57.104:8080/ogsa/services/samples/fileshare/FileShareService
File received.

Be aware! While a Windows machine will not necessarily be case-sensitive about the filename, Unix machines will be. Make sure that you have the capitalization of your filename correct when you request it.

Now try retrieving a file from your neighbor by searching the Index for their name. After you retrieve the file, run the query again. You should see multiple sources for the file now.

Extra exercise idea: Construct more complicated XPath queries

Chapter 7 Exercises

Files modified: New files used:

Clean up, modify code, redeploy

$ cd $GLOBUS_LOCATION
$ # Stop the container if it is running
$ ant undeploy -Dgar.id=fileshare
$ cd $TUTORIAL_LOCATION
$ ant cleanAll -Dogsa.root=$GLOBUS_LOCATION
$ # modify files
$ ant deployGar -Dogsa.root=$GLOBUS_LOCATION
$ cd $GLOBUS_LOCATION
$ bin/globus-start-container

Try different operations

$ cd $GLOBUS_LOCATION
$ bin/ogsi-find-service-data-by-name http://ogsa.globus.org/samples/2003/09/fileshare:FileList FILESHARE_GSH
You should see the normal output, because the findServiceData call has been left without security. Query your fileshare service directly, not the Index being run by the instructors.
$ cd $CLIENT_LOCATION
$ java org.globus.ogsa.impl.samples.fileshare.client.GetFile FILENAME FILESHARE_GSH

Output should look like:

[...]
Error: Defective credential detected [Root error message: Proxy file (/tmp/x509up_u500) not found.]

On the server side, you should see something like:

org.globus.ogsa.impl.security.SecurityManager [getSystemSubject:70] ERROR: Failed to get system subject org.globus.gsi.GlobusCredentialException: Proxy file (/tmp/x509up_u500) not found.
This is because you have not initialized your proxy to interact with secure operations.

Create a proxy

$ java org.globus.tools.ProxyInit -cert $TUTORIAL_LOCATION/certificates/usercert.pem -key $TUTORIAL_LOCATION/certificates/userkey.pem

Expected output:

Your identity: O=Grid,OU=Tutorial,OU=User,CN=user50
Creating proxy, please wait...
Your proxy is valid until Wed Oct 08 04:32:30 CDT 2003

$ java org.globus.ogsa.impl.samples.fileshare.client.GetFile FILENAME FILESHARE_GSH

Extra exercise idea: Try adding gridmap authorization to the GetFile operation.

Chapter 8 Transience

Files modified: New files used:

Clean up, modify code, redeploy

$ cd $GLOBUS_LOCATION
$ # Stop the container if it is running
$ ant undeploy -Dgar.id=fileshare
$ cd $TUTORIAL_LOCATION
$ ant cleanAll -Dogsa.root=$GLOBUS_LOCATION
$ # modify files
$ ant deployGar -Dogsa.root=$GLOBUS_LOCATION
$ cd $GLOBUS_LOCATION
$ bin/globus-start-container

Use the Factory

$ cd $CLIENT_LOCATION
$ java org.globus.ogsa.impl.samples.fileshare.client.CreateFileShare DIRNAME_TO_SHARE
First argument is name of directory to share.

Expected output:

If you have a proxy, it will succeed with:

File Share Handle: http://140.221.57.104:8080/ogsa/services/samples/fileshare/FileShareFactoryService/hash-14141119-1065564907262
Termination Time: infinity

If it fails with "Error: org.gridforum.ogsi.NoSuchServiceFaultType: samples/fileshare/FileShareFactoryService", verify that you renamed the FileShareService to the FileShareFactoryService in the .wsdd.

Now get a file from the newly-created service:

$ cd $CLIENT_LOCATION
$ java org.globus.ogsa.impl.samples.fileshare.client.GetFile FILENAME NEW_GSH
Received file 'filename' of size 7

Verify that the created service is also registering into the index:

$ java org.globus.ogsa.impl.samples.fileshare.client.GetFileIndex FILENAME INDEX_GSH