Get gt3-cvs-core.tar.gz from the instructors
c:\>mkdir tutorial
[Unpack gt3-cvs-core.tar.gz into c:\tutorial\gt3-cvs-core]
c:\tutorial\gt3-cvs-core>set GLOBUS_LOCATION=c:\tutorial\gt3-cvs-core
GLOBUS_LOCATION is the variable that lets various scripts know where the install is located.
c:\tutorial\gt3-cvs-core>set GT3_LOCATION=c:\tutorial\gt3-cvs-core
This variable is just for convenience. It will be used throughout this document.
c:\tutorial\gt3-cvs-core>ant setup
This creates the operating system dependent scripts inside of bin\
c:\tutorial\gt3-cvs-core> bin\globus-start-container
This starts the GT3 container (if you see "The input line is too long." error message on the console see the note about it in the appendix) Control will not return to the prompt. 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% for 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 /d c:\tutorial
[Unpack fileshare-tutorial.tar.gz into c:\tutorial\fileshare-tutorial]
c:\tutorial>cd fileshare-tutorial
c:\tutorial\fileshare-tutorial>set TUTORIAL_LOCATION=c:\tutorial\fileshare-tutorial
c:\tutorial\fileshare-tutorial>ant deployGar -Dogsa.root=%GT3_LOCATION%
This builds the fileshare service and installs it into your GT3 install
>cd /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>start 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 %GT3_LOCATION%, not %GT3_LOCATION%\bin See that FileShareService is now listed. The container will be started in a separate window
c:\tutorial\gt3-cvs-core>setenv.bat
This is *not* a production step. We are only doing this because our code is in "samples" If you see "The input line is too long." error message on the console see the note about it in the appendix)
c:\tutorial\gt3-cvs-core>mkdir client
c:\tutorial\gt3-cvs-core>cd client
c:\tutorial\gt3-cvs-core\client>set CLIENT_LOCATION=c:\tutorial\gt3-cvs-core\client
This is to make sure you're not in %GT3_LOCATION% when you retrieve files.
c:\tutorial\gt3-cvs-core\client>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 "c:\tutorial\gt3-cvs-core\client" directory.
[If you had to use an alternate port, you may specify a port after the filename, for example:
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 /d %GT3_LOCATION%
[Stop the container if it is running ((ctrl-c) or close the window)]
c:\tutorial\gt3-cvs-core>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 deployGarNote: If you get an error saying that lib\fileshare.jar could not be deleted, run "del lib\fileshare.jar", then run ant undeploy -Dgar.id=fileshare again. It is important if you get this error to run undeploy again after manually deleting the file.
>cd /d %TUTORIAL_LOCATION%
c:\tutorial\fileshare-tutorial>ant cleanAll -Dogsa.root=%GT3_LOCATION%
Removes old 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]
c:\tutorial\fileshare-tutorial>ant deployGar -Dogsa.root=%GT3_LOCATION%
Builds new code and deploys it.
>cd /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>start bin\globus-start-container
This starts the container in a separate window
Retrieve a file from yourself, using the GSH published by your container.
>cd /d %CLIENT_LOCATION%
c:\tutorial\gt3-cvs-core\client>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.
c:\tutorial\gt3-cvs-core\client>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 /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>ant undeploy -Dgar.id=fileshare
If undeploy fails please see the following note for help.
>cd /d %TUTORIAL_LOCATION%
c:\tutorial\fileshare-tutorial>ant cleanAll -Dogsa.root=%GT3_LOCATION%
[Edit files in %TUTORIAL_LOCATION% listed above]
c:\tutorial\fileshare-tutorial>ant deployGar -Dogsa.root=%GT3_LOCATION%
>cd /d %GT3_LOCATION%
[Stop the container if it is running ((ctrl-c) or close the window)]
c:\tutorial\gt3-cvs-core>start bin\globus-start-container
This starts the container in a separate window.
>cd /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>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 /d %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 /d %GT3_LOCATION%
[Stop the container if it is running ((ctrl-c) or close the window)]
c:\tutorial\gt3-cvs-core>ant undeploy -Dgar.id=fileshare
>cd /d %TUTORIAL_LOCATION%
c:\tutorial\fileshare-tutorial>ant cleanAll -Dogsa.root=%GT3_LOCATION%
[Modify files]
c:\tutorial\fileshare-tutorial>ant deployGar -Dogsa.root=%GT3_LOCATION%
c:\tutorial\fileshare-tutorial>cd /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>start bin\globus-start-container
This starts the container in a separate window.
Verify that your service appears in the index:
>cd /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>bin\ogsi-find-service-data-by-name 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 /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>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:
c:\tutorial\gt3-cvs-core>bin\ogsi-find-service-data-by-name entry INDEX_GSH
The dates should be current again:
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 /d %GT3_LOCATION%
[Stop the container if it is running ((ctrl-c) or close the window)]
[Create a file named after yourself (mine is Bacon) in "c:\tutorial\gt3-cvs-core"
c:\tutorial\gt3-cvs-core>start bin\globus-start-container
Ensure that you appear in the instructor's Index server.
>cd /d %CLIENT_LOCATION%
c:\tutorial\gt3-cvs-core\client>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.java
src\org\globus\ogsa\impl\samples\fileshare\client\GetFileIndex.java
Uncomment security code
%USERPROFILE%\.globus\cog.properties
Add a line reading cacert=C\:\\tutorial\\fileshare-tutorial\\certificates
You do not need to define%USERPROFILE%, Windows automatically defines it for you.
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 /d %GT3_LOCATION%
[Stop the container if it is running ((ctrl-c) or close the window)]
c:\tutorial\gt3-cvs-core>ant undeploy -Dgar.id=fileshare
>cd /d %TUTORIAL_LOCATION%
c:\tutorial\fileshare-tutorial>ant cleanAll -Dogsa.root=%GT3_LOCATION%
[Modify files]
c:\tutorial\fileshare-tutorial>ant deployGar -Dogsa.root=%GT3_LOCATION%
>cd /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>start bin\globus-start-container
>cd /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>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 /d %CLIENT_LOCATION%
c:\tutorial\gt3-cvs-core\client>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.
>cd /d %CLIENT_LOCATION%
c:\tutorial\gt3-cvs-core\client>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
You may see a warning to check filesystem permissions. This is an expected Windows warning.
>cd /d %CLIENT_LOCATION%
c:\tutorial\gt3-cvs-core\client>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 /d %GT3_LOCATION%
[Stop the container if it is running ((ctrl-c) or close the window)]
c:\tutorial\gt3-cvs-core>ant undeploy -Dgar.id=fileshare
>cd /d %TUTORIAL_LOCATION%
c:\tutorial\fileshare-tutorial>ant cleanAll -Dogsa.root=%GT3_LOCATION%
[Modify files]
c:\tutorial\fileshare-tutorial>ant deployGar -Dogsa.root=%GT3_LOCATION%
>cd /d %GT3_LOCATION%
c:\tutorial\gt3-cvs-core>start bin\globus-start-container
>cd /d %CLIENT_LOCATION%
c:\tutorial\gt3-cvs-core\client>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:
c:\tutorial\gt3-cvs-core\client>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:
c:\tutorial\gt3-cvs-core\client>java org.globus.ogsa.impl.samples.fileshare.client.GetFileIndex FILENAME INDEX_GSH
>subst p: c:\tutorial\gt3-cvs-coreThen reset the GLOBUS_LOCATION to that virtual drive:
>set GLOBUS_LOCATION=p:DO NOT create a virtual drive unless you see "The input line is too long." We have seen problems with the latest version of ant and the use of subst.