Access Keys:
Skip to content (Access Key - 0)

caGrid 1.3


PhotoSharing Operations


Table of Contents

Operations


Over the following steps we'll be adding all of the operations for our service. The steps are similar for each operation.

  • Create the method
  • Specify the input parameters
  • Specify the output parameters
  • Specify error handling via faults

Methods to be created:

createGallery grantViewGalleryPrivileges
listGalleries revokeViewGalleryPrivileges
getGalleryName grantAddImagePrivileges
addImage revokeAddImagePrivileges
listImages listUsersWithViewPrivileges
getImage listUsersWithAddPrivileges

createGallery


Input

  1. Click the Services tab
  2. Select PhotoSharing (Main Service)
  3. Click the Add Method button
  4. Set createGallery to Method Name.
  5. Set "Create a photo gallery" to Method Description.
  6. Scroll down the list of Data Types and Double-Click string.
  7. Under the "Name" column, double-click string and replace text with "galleryName" as our input parameter.

Output

  1. Select the Output tab
  2. Double-Click the Gallery option in the Client Handle Types in the lower left

Faults

  1. Select the Faults tab
  2. Set "PhotoSharingException" in the Fault Type Name near the bottom.
  3. Click the Add New Fault button.
  4. Click Done.

listGalleries


Input

  1. Click the Services tab
  2. Select the PhotoSharing (Main Service)
  3. Click the Add Method button
  4. Set listGalleries to Method Name.
  5. Set "List all galleries" to Method Description.

Output

  1. Select the Output tab
  2. Double-Click the Gallery option in the Client Handle Types.
  3. Check the "Is Array" option box for the newly added output parameter.
  4. Click Done.

getGalleryName


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set "getGalleryName" to Method Name.
  5. Set "Get the name of this gallery" to Method Description.
  6. Select the Output tab
  7. Scroll down the list of Data Types and Double-Click string

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. Click Done

addImage


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set addImage to Method Name.
  5. Set "Add an image to the gallery" to Method Description.
  6. Double-Click Image in the Data Types window

Output

  1. Select the Output tab
  2. Double-Click the ImageDescription data type from the Data Types combo box.

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. In the Fault Type Name: AuthorizationException
  5. Click the Add New Fault button
  6. Click Done

listImages


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set listImages to Method Name
  5. Set "List all images" to Method Description

Output

  1. Select the Output tab
  2. Select ImageDescription from the Data Types box
  3. Check the Is Array selection

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select AuthorizationException
  3. Click the Add Used Fault button
  4. Click Done

getImage


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set getImage to Method Name.
  5. Set "Retrieve an image from the gallery" to Method Description.
  6. Double-Click imageDescription in the Data Types window

Output

  1. Select the Output tab
  2. Double-click Image in the Data Types box.

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. From the Choose Used Fault drop down select AuthorizationException
  5. Click the Add Used Fault button
  6. Click Done

grantViewGalleryPrivileges


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set "grantViewGalleryPrivileges" to Method Name.
  5. Set "Grant privileges for a user to view the gallery" to Method Description.
  6. Double-Click User in the Data Types window

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. From the Choose Used Fault drop down select AuthorizationException
  5. Click the Add Used Fault button
  6. Click Done

revokeViewGalleryPrivileges


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set "revokeViewGalleryPrivileges" to Method Name.
  5. Set "Revoke privileges for a user to view the gallery" to Method Description.
  6. Double-Click User in the Data Types window

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. From the Choose Used Fault drop down select AuthorizationException
  5. Click the Add Used Fault button
  6. Click Done

grantAddImagePrivileges


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set "grantAddImagePrivileges" to Method Name.
  5. Set "Grant privileges for a user to add an image to the gallery" to Method Description.
  6. Double-Click User in the Data Types window

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. From the Choose Used Fault drop down select AuthorizationException
  5. Click the Add Used Fault button
  6. Click Done

revokeAddImagePrivileges


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set "revokeAddImagePrivileges" to Method Name.
  5. Set "Revoke privileges for a user to add images to the gallery" to Method Description.
  6. Double-Click User in the Data Types window

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. From the Choose Used Fault drop down select AuthorizationException
  5. Click the Add Used Fault button
  6. Click Done

listAllUsersWithViewPrivileges


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set "listAllUsersWithViewPrivileges" to Method Name.
  5. Set "List all users that have view privileges on the gallery" to Method Description

Output

  1. Select the Output tab
  2. Double-Click the User option in the Data Types box
  3. Check the "Is Array" option box for the newly added output parameter.

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. Click Done

listAllUsersWithAddPrivileges


Input

  1. Click the Services tab
  2. Select the Gallery (Service Context)
  3. Click the Add Method button
  4. Set "listAllUsersWithAddPrivileges" to Method Name.
  5. Set "List all users that have add privileges on the gallery" to Method Description

Output

  1. Select the Output tab
  2. Double-Click the User option in the Data Types box
  3. Check the "Is Array" option box for the newly added output parameter.

Faults

  1. Select the Faults Tab
  2. From the Choose Used Fault drop down select PhotoSharingException
  3. Click the Add Used Fault button
  4. Click Done

Add Service Properties


  1. Click the Service Properties tab.
  2. Set gridGrouperURL to Key
  3. Set https://grouper.training.cagrid.org:8443/wsrf/services/cagrid/GridGrouper to Default Value
  4. Set Grid Grouper service URL to Description
  5. Click Add
  6. Set serviceStemSystemName to Key
  7. Set Training:photosharingtutorial:<HOSTNAME> to Default Value. <HOSTNAME> is what you entered into the installer when installing Tomcat.
  8. Set "System name of the service stem in Grid Grouper" to Description
  9. Click Add

Save Your Service


Save Your Service!

Remember to save your service. Introduce will allow you to roll back to a save point. This can be very useful in the event that you run into problems.

Click the Save button at the bottom of the Modify Service Interface

Copying required dependencies


Copying required dependencies

The PhotoSharing service requires several jars from the GridGrouper to run. We'll need to copy the jars into the service.

  1. Open a Windows Command Prompt
  2. Change directory to your Hackathon directory:

    %> cd C:\hackathon

  3. Copy files to the service

    %> ant installJars

Copying the modified code


Copying the modified code

In the previous steps, we created all of the interfaces for the the PhotoSharing service. Introduce has produced skeleton code for those interfaces but we still need to implement the code for the service. Please run the following batch file to copy already completed code into your service.

  1. Using a Windows Command Prompt
  2. Change directory to your Hackathon directory

    %> cd C:\hackathon

  3. Copy files to the service

    %> ant copySources

Review copied code


Even though we've copied code into the service. Please take a couple minutes to review the code in the following files:

  • PhotoSharingImpl.java
  • GalleryImpl.java
  • PhotoSharingResource.java
  • GalleryResource.java

Conclusion


We have now finished creating our photoSharing service! This service should match the completed one provided in the hackathon.zip which we used earlier. Our new service should function the same way when deployed and invoked. We have also completed the analytical service tutorial! We hope that this has helped you to understand the capabilities and security of caGrid. Visit caGrid 1.3 Tutorials for other tutorials or return to caGrid for other information.

Last edited by
Sarah Honacki (381 days ago)
Adaptavist Theme Builder Powered by Atlassian Confluence