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/
$ 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.
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
$ 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]
src/org/globus/ogsa/impl/samples/fileshare/client/GetFile.java
Change client.chapter1() call to client.chapter2() in the main() function.
$ cd $GLOBUS_LOCATION
$ stop container (ctrl-c)
$ ant undeploy -Dgar.id=fileshare
$ 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.
$ cd $GLOBUS_LOCATION
$ bin/globus-start-container
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
schema/samples/fileshare/fileshare_port_type.gwsdl
Uncomment gwsdl:serviceData entries at end of file Look for "Uncomment for Chapter 3"
src/org/globus/ogsa/impl/samples/fileshare/FileShareImpl.java
Uncomment Chapter 3 sections to add SDE functionality Look for "uncomment for Chapter 3". There will be five sections to uncomment.
$ 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
$ cd $TUTORIAL_LOCATION
$ ant cleanAll -Dogsa.root=$GLOBUS_LOCATION
$ #Edit files in $TUTORIAL_LOCATION
$ ant deployGar -Dogsa.root=$GLOBUS_LOCATION
$ cd $GLOBUS_LOCATION
$ Stop the container if it is running.
$ bin/globus-start-container
$ 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
fileshare-server-config.wsdd
Uncomment operationProviders, registry, registry-lifetime, and registry-keepalive parameters. The instructors will provide the host:port for the registry. Make sure you change the registry parameter before deploying!
schema/samples/fileshare/fileshare_port_type.gwsdl
Add "ogsi:NotificationSource" to extends= line. It is space delimited, no commas required.
$ 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
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.
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
src/org/globus/ogsa/impl/samples/fileshare/client/GetFileIndex.java
Inspect the code to find the XPath queries
$ 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
fileshare-server-config.wsdd
Uncomment securityConfig parameter
src/org/globus/ogsa/impl/samples/fileshare/client/GetFile.javasrc/org/globus/ogsa/impl/samples/fileshare/client/GetFileIndex.javaUncomment security code
$HOME/.globus/cog.properties
Add cacert=[$TUTORIAL_LOCATION]/certificates
You need to put in the literal value of $TUTORIAL_LOCATION, likecacert=/tmp/fileshare-tutorial/certificates
src/org/globus/ogsa/impl/samples/fileshare/security-config.xml
This adds authentication to the getFile operation, leaves other operations insecure
$TUTORIAL_LOCATION/certificates/usercert.pem$TUTORIAL_LOCATION/certificates/userkey.pem
These will be your user certificate and key.
$ 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
$ 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.
$ 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.
fileshare-server-config.wsdd
Change the name of the service to FileShareFactoryService.
Uncomment the factory parameters
Prefix the parameters of FileShareService with "instance-". Everything after the "ALL" comment, including the operationProviders and the securityConfig. Everything. Really. Including the Chapter 4 section.
src/org/globus/ogsa/impl/samples/fileshare/FileShareFactoryCallback.java
This is what the generic factory will call to create a FileShareImpl
src/org/globus/ogsa/impl/samples/fileshare/client/CreateFileShare.java
This is the client code to call thecreateServiceoperation on the FileShareFactoryService. That operation is defined by the FactoryProvider. WhencreateServiceis called, the FactoryProvider will invoke thecreateServiceObjectoperation on the factoryCallback specified in the .wsdd. That in turn will invoke the FactoryCallback listed previously.
$ 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
$ 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