1 / 35

Sticky Note Service: Building, Deploying, and Creating Notes

This resource provides instructions for building and deploying the Sticky Note Service, as well as creating new notes. It uses the Java GT4 core and requires JDK and Apache Ant.

grhonda
Download Presentation

Sticky Note Service: Building, Deploying, and Creating Notes

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Web Service Resource Framework Notes on “sticky note” assignment Grid Computing, B. Wilkinson, 2005

  2. Environment • Uses the Java GT4 core, which can be installed directly on a PC. • Needs: • jdk, Java software development kit • ant, open source tool for building java code

  3. Sticky Note Service • Represents a “sticky note as one might stick on the wall to give reminders. • Resource property: a string containing the sticky note text Assignment due tomorrow

  4. Sticky Note Operations • Operations: • Write text into a note – “write-note” • Display the text of a note – “show-note” • Create a note (introduced in Exercise 2)

  5. Exercise 1 • Build sticky note service • Deploy sticky note service. (Uses ant, not GT4 deploy command) • Start GT4 container • Execute a “show-note” client to use the show-note operation

  6. Building/Deploying service • Uses command: ant deploy where deploy is an xml build file.

  7. Starting container $ bin/globus-start-container -nosec No Security -- Do not use GT 4 security mechanisms

  8. Starting SOAP server at: http://192.168.123.100:8080/wsrf/services/ With the following services:[1]: http://192.168.123.100:8080/wsrf/services/InMemoryServiceGroupEntry[2]: http://192.168.123.100:8080/wsrf/services/TriggerFactoryService[3]: http://192.168.123.100:8080/wsrf/services/IndexFactoryService[4]: http://192.168.123.100:8080/wsrf/services/Version[5]: http://192.168.123.100:8080/wsrf/services/IndexService[6]: http://192.168.123.100:8080/wsrf/services/NotificationConsumerService[7]: http://192.168.123.100:8080/wsrf/services/DefaultTriggerServiceEntry[8]: http://192.168.123.100:8080/wsrf/services/TriggerServiceEntry[9]: http://192.168.123.100:8080/wsrf/services/IndexServiceEntry[10]: http://192.168.123.100:8080/wsrf/services/StickyNoteService[11]: http://192.168.123.100:8080/wsrf/services/AdminService[12]: http://192.168.123.100:8080/wsrf/services/DefaultIndexService[13]: http://192.168.123.100:8080/wsrf/services/DefaultIndexServiceEntry[14]: http://192.168.123.100:8080/wsrf/services/DefaultTriggerService[15]: http://192.168.123.100:8080/wsrf/services/ShutdownService[16]: http://192.168.123.100:8080/wsrf/services/ContainerRegistryService[17]: http://192.168.123.100:8080/wsrf/services/TriggerService[18]: http://192.168.123.100:8080/wsrf/services/gsi/AuthenticationService[19]: http://192.168.123.100:8080/wsrf/services/InMemoryServiceGroupFactory[20]: http://192.168.123.100:8080/wsrf/services/InMemoryServiceGroup[21]: http://192.168.123.100:8080/wsrf/services/ContainerRegistryEntryService[22]: http://192.168.123.100:8080/wsrf/services/SubscriptionManagerService All https if security used The deployed StickyNote Servicce

  9. Executing show-note client Command: $GLOBUS_LOCATION/bin/show-note -s http://localhost:8080/wsrf/services/StickyNoteService Get: <ns1:message xmlns:ns1=http://tutorial.globus.org/stickynote >hello.</ns1:message> This is the message on the sticky note

  10. Executing write-note client $GLOBUS_LOCATION/bin/write-note -s http://localhost:8080/wsrf/services/StickyNoteServicecheeseMessage written. This is the text to be written in sticky note

  11. Exercise 2Creating a Resource • In this exercise, you are asked to modify files to introduce the “create note” operation. • Files to modify: • sticky note service wsdl file, to include the create note operation • Sticky note service code, to include the create note operation • jndi deployment configuration file • Also create a “create-note” client

  12. Resource Home • For managing resources. • Must modify Resource Home from Exercise 1 so as to handle multiple resources. • Done in deploy-jndi-conf.xml, by changing type of resource from “SingleNoteHome” to “ManyNoteHome” and associated details changed also.

  13. Creating a new note $GLOBUS_LOCATION/bin/create-note -s http://localhost:8080/wsrf/services/StickyNoteServicenew note created...EPR written to file: note--1947556620.epr To see note: $GLOBUS_LOCATION/bin/show-note -e note--1947556620.epr<ns1:message xmlns:ns1=http://tutorial.globus.org/stickynote >hello.</ns1:message> Endpoint Reference

  14. Sample file containing Endpoint Reference <StickyNoteEndpoint xsi:type="ns1:EndpointReferenceType" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/03/addressing"> <ns1:Address xsi:type="ns1:AttributedURI">http://192.168.1.100:8080/wsrf/ services/ StickyNoteService </ns1:Address> <ns1:ReferenceProperties “xsi:type="ns1:ReferencePropertiesType"> <ns1:NoteKey xmlns:ns1="http://sticky.com">25781085 </ns1:NoteKey> </ns1:ReferenceProperties> <ns1:ReferenceParameters xsi:type="ns1:ReferenceParametersType"/> </StickyNoteEndpoint> Resource “key”

  15. Sticky Note EPR Endpoint reference = EPR1 + resource “key” EPR1 (service URI) StickyNote service Resource Key Resource property “cheese” With multiple resources, each resource assigned a unique key identifying it

  16. Exercise 3Destroying Resources • Add an operation “destroy” in service wsdl file • Add “DestroyProvider operation provider” in wsdd file • Test by creating Sticky note and using GT4 “wsrf-destroy” command.

  17. Exercise 4Adding a resource property • A “lastModified” resource property is added which records the time that the sticky note message was last altered. • Requires 4 files to be modified: • wsdl file • Service code • A file containing constants • Client code to test it

  18. Exercise 5Register with a Local Index Service • GT 4 provided with an index service that can maintain a list of available services. • Index service acts as local service registry. • In Exercise 5, the service is registered with the local GT 4 index service.

  19. Container Index service Multiple Sticky notes (resources with resource properties) Note, the exercises asks each person to start their own container

  20. Details to use index service • When resource created, “add” method of ResourceHome called. • Need to override this method to include registering Resource with local index service. • Need to modify ManyNoteHome.java

  21. Querying Index Servicewsrf-query Browse index service with the GT4 wsrf-query command: $GLOBUS_LOCATION/bin/wsrf-query -s http://localhost:8080/wsrf/services/DefaultIndexService '/*' which will list the services in an XML format.

  22. Exercise 6Register with a “Community” Index Service • A remote index service is used, which holds all the services of the “virtual organization.” • For our purposes, the community index service is at: http://beowulf.bear.uncw.edu:8080/wsrf/ services/DefaultIndexService

  23. Community index service beowulf.bear.uncw.edu:8080/wsrf/services/ DefaultIndexService Local Index service Sticky note resources client StickyNote service

  24. Implementation • Configure local index to register with community index service. • All local information, including service resource properties, copied to community index service.

  25. Implementation Modify the file: $GLOBUS_LOCATION/etc/globus_wsrf_mds_ index/hierarchy.xml to include the URL of the community index service (<upstream> parameter)

  26. Querying Community Index Service Have Community Index Service running. Use wsrf-query command: $GLOBUS_LOCATION/bin/wsrf-query -s http://beowulf.bear.uncw.edu:8080/wsrf/services/DefaultIndexService '/*' Should see contents of all local index services.

  27. Community index service Student 1 Index entry Student 2 Index entry Student 1 container Local Index service Resources Local Index service Resources client Service client Service Student 2 container Only container and GT 4 core needed at each site to handle services.

  28. Exercise 7Lease-based Lifetime • In lease-based model, resources must be kept alive by interested parties, otherwise resource dies. • Set a lifetime for a service after which the service is destroyed. • Clean up without having to use a destroy operation explicitly.

  29. Termination Time Termination time exposed as a resource property. Can be set with GT4 wsrf-set-termination-time command. Example $GLOBUS_LOCATION/bin/wsrf-set-termination-time -e note--1234.epr 100 Termination time in seconds File containing EPR of resource (StickyNote)

  30. Implementation • Add subscribe operation to wsdl file. • Add SubscribeProvider to wsdd file. • Modify StickyNote.java • Modify post-deploy.xml file See exercise write-up for more details

  31. Exercise 8Notifications • Notifications, generally, are a means by which a client can be informed of changes that have occurred such as: • Changes to resource property values. • Methods added • Methods removed • Resources destroyed

  32. In exercise 8, a second service, called watch-note, is used to display changes to the value of the StickyNote. watch-note Notification that note changed StickyNote resource property Different container Client Write note StickyNote Service

  33. In Exercise 8, a second service, called watch-note, is used to inform the client of changes to the value of the StickyNote. • Need the client to “subscribe” to receive notifications. • Subscriptions are for a particular topic.

  34. Exercise 9Resource Discovery • In this exercise, the local and community index services are searched for a particular StickyNote message. • Since Resources properties are XML, can use “XPath” queries for searching and retrieval. • Uses a “XPath” query (apparently embedded in a script called search-note in this exercise)

  35. XML Path Language (XPath) • W3C recommendation, 1999 • A query language for search XML documents. • Queries formed by identifying a route to the desired data. • For details: http://www.w3.org/TR/xpath

More Related