Presentation is loading. Please wait.

Presentation is loading. Please wait.

4c1 GT 4 Services Advanced features: A very brief overview Topics: Resource home Singleton resource Multiple resources Notifications Lifecycles Copyright.

Similar presentations


Presentation on theme: "4c1 GT 4 Services Advanced features: A very brief overview Topics: Resource home Singleton resource Multiple resources Notifications Lifecycles Copyright."— Presentation transcript:

1 4c1 GT 4 Services Advanced features: A very brief overview Topics: Resource home Singleton resource Multiple resources Notifications Lifecycles Copyright B. Wilkinson, 2008. This material is the property of Professor Barry Wilkinson (UNC-Charlotte) and is for the sole and exclusive use of the students enrolled in the Fall 2008 Grid computing course broadcast on the North Carolina Research and Education Network (NCREN) to universities across North Carolina. Oct 15a, 2008

2 4c2 Stateful GT 4 Grid Services Review “Pure” Web services are stateless. Stateful web services required for Grid computing. WSRF provides stateful web services by having a Web service as a front-end to a stateful “resource.”

3 4c3 GT 4 services Key aspect is separation of (Web) service and a resource – conceptually if not actually. Provides ability to have “state” without altering the statelessness of Web service.

4 4c4 Web Service Resource Resource properties Client Web Service Resource Framework (WSRF)‏ Holds information retained between accesses.

5 Resource properties Name given to data items in the resource Can consist of: –Data values about current state of service (results of calculations etc.)‏ –Metadata: Information about data –Information about whole resource: Termination time, etc. 4c5

6 4c6 Combined Service Code Resource In Assignment 5, both service code and resource code were held in a single file. Ideally, we would like to have multiple resources for a Web service Having one file not the preferred way except for simple service examples.

7 4c7 Separate Resource More generally, resource is a (stateful) class. End Point Reference (EPR) is XML document that has URL of service and possibly a resource identification (key)‏ Classes provided for different arrangements: ReflectionResourceProperty class used in assign 5 (implementation of a simple Resource)‏

8 4c8 Resource Home Resources are managed by Resource Home's Provides resource management functions –for adding resources –for removing resources Although hidden in Assignment 5 where resource and service were in one file, a Resource Home did exist.

9 4c9 Resource Home Client Web Service Resource home Resource Manages Methods operate on resources properties create/ find resource Client only interacts with stateless web service

10 4c10 Service and resource code Client Web Service Resource home Resource Manages add() and subtract() methods operate on resource properties create/ find resource void add(int a)‏ void subtract (int a)‏ int value String lastOP

11 4c11 Resource Home Client Web Service Resource home Resource Previously, service and resource in one file and resource limited to one resource using a globus supplied resource home called ServiceResourceHome

12 4c12 Service and resource code Client Web Service Resource home “ServiceResourceHome” Resource add() and subtract() methods operate on resource properties create/ find resource void add(int a)‏ void subtract (int a)‏ int value String lastOP ServiceResourceHome returns service object

13 4c13 Separately service, resource and resource home files

14 4c14 Separate Service, Resource & Resource Home files Singleton Resources (Single resource)‏ Client Web Service Resource home Resource Three files: the service, the resource home, and the resource. void add(int a)‏ void subtract (int a)‏ int value String lastOP

15 4c15 Multiple Resources Suppose there are multiple resources that a service might interact with: Client Web Service Resources

16 4c16 Creating Resources WS-Resource Factory Pattern Traditional object-oriented approach to creating resources is to use a “factory” service: Factory service is responsible for creating instances of resources. Each resource assigned a unique “key”, which together with service URI identifies WS-resource pair. (Endpoint Reference)‏

17 4c17 Client “Instance” Service Resources WS-Resource Factory Pattern Factory service Request resource creation Request operation on resource Create Perform operation Return WS- Resource EPR

18 4c18 Relationship with Resource Home Client Service instance Resource Home Resource Manages Methods operate on resources properties Find resource Factory Service Request resource creation Use Resource Home to create resource Request operation

19 4c19 Factory service Create Resource operation endpointReference createResource()‏ Returns an EPR to the newly created WS- Resource. “Fully qualified” EPR to include URI of service and key of resource Client needs to know location of factory service.

20 4c20 WS-Addressing Terms Endpoint – the destination where the web service can be accessed. Endpoint reference, EPR –describes the destination: includes the destination location as URI, but can have other parameters like a key

21 4c21 Endpoint reference, EPR Like all WS-* specs, defined in terms of XML. Defined as complex type. Can contain: Address (a URI) (required)‏ Reference Properties Reference Parameters Port type Service name Policy elements Corresponds to portType and service of WSDL document

22 4c22 Minimum is simply service address, using tag: http://www.cs.uncc.edu/axis/abw/Myservice.jws

23 4c23 Reference Properties Used to identify resource properties in EPR: http://www.cs.uncc.edu/axis/abw/Myservice.jws 28

24 4c24 SOAP message WS-Addressing standard requires that contents of: and must appear in SOAP’s header:. http://www.cs.uncc.edu/axis/abw/Myservice.jws 28..

25 4c25 Question Q: Why would one want to have multiple resources for a Web service?

26 4c26 Lifecycle Management Lifecycle mechanisms available in WSRF. GT4 provides mechanisms to specify when a resource is automatically destroyed. Immediately by invoking destroy operation through the web service Scheduled some time in the future Leased-based lifecycle management

27 4d.27 Immediate Destruction Destruction is requested through the web service by the client: math.destroy(new Destroy()); Notice that the factory is responsible for creating a Resource, but the service instance destroys it. Command line: globus-wsrf-destroy -e EPR1234.epr File containing EPR of resource

28 4d.28 Scheduled Termination Time Termination time exposed as a resource property. Can be set with GT4 command: wsrf-set-termination-time Example wsrf-set-termination-time -e EPR1234.epr 100 File containing EPR of resource Termination time in seconds

29 4d.29 Lease-based Lifetime In lease-based model, resources must be kept alive by interested parties, otherwise resource dies. A lifetime for a service is set after which the service is destroyed. Interested parties (clients) must renew the lease (reset the termination time) or it will be destroyed. Clean up without having to use a destroy operation explicitly.

30 4c30 Question Q: Why would one want to have a termination time set for a resource?

31 4c31 Resource Properties

32 Resource Properties are declared in the WSDL file This is a schema because it describes how the properties must be exchanged in XML (between clients, services, etc.)‏

33 Contents of Math.xml Schema...

34 Resource Properties MathService_rp has Resource Properties implemented the correct way Do globus-build-service.py rp deploy the gar restart the container

35 Client Code Examples MathPortType math = locator.getMathPortTypePort(endpoint); math.add(10); updateRP(endpoint, MathConstanst.RP_VALUE,“100”); printResourceProperties(math);

36 Client Code Examples valueRP = math.getResourceProperty( MathQNames.RP_VALUE); value = valueRP.get_any()[0].getValue(); System.out.println("Value RP: " + value);

37 Resource Properties from the Command Line C:\> wsrf-query -s http//localhost/wsrf/ services/examples/core/rp/MathService <ns1:MathResourceProperties xmlns:ns1=”http://www.globus.org/namespaces/ examples/mathService_instance_rp”> 100 ADDITION

38 Resource Properties from the Command Line C:\>wsrf-get-property -s http//localhost/wsrf/services/examples/ core/rp/MathService {http://www.globus.org/namespaces/ examples/mathService_instance_rp}Value <ns1:Value xmlns:ns1=”http...”>100

39 4c39 Notifications

40 4c40 Notifications Notifying clients when something interesting happens. Example might be when a resource property reaches a certain value Could use polling but this is very inefficient. WS-notification defines mechanisms.

41 4d.41 Resource property changes Examples: –Changes to resource property values. –Methods added –Methods removed –Resources destroyed

42 4d.42 Subscribe for notifications Need client to “subscribe” to receive notifications. Subscriptions are for a particular topic. Resource implemented with GT 4 classes that provide for automatic notifications whenever property changes.

43 4d.43 Automatic notifications Client Service Resource property Write value Notification that value changed value Subscribed for notification Resource Listening client

44 4c44 GT 4 Information Services Monitoring and Discovery Services (MDS) Principal components: Index service Trigger service WebMDS

45 4c45 Index service WebMDS Trigger service Information services

46 Globus core does not include information services such as index services. When installed, would see it in list of services, e.g.: 4c46 Index service Trigger service

47 4d.47 Container Index service (resources with resource properties)‏ Index Service GT 4 provided with an index service that can maintain a list of available resources.

48 4c48 ResourceHome add method Register resource in index service Remove destroy Resource Index service Resource properties XML Index Service “add” method of ResourceHome used to create resource. Override method to include registering resource with lindex service.

49 4d.49 Querying Index Service wsrf-query Browse index service with the GT4 command: wsrf-query Example wsrf-query –s http://localhost:8080/wsrf/services/ DefaultIndexService '/*' which will list resource properties in an XML format.

50 4d.50 “Community” Index Service A remote index service that holds all the index services of the “virtual organization.” For example a community index service might be at: https://torvalds.cis.uncw.edu/wsrf/ services/DefaultIndexService

51 4d.51 Local Index service Resources Community index service torvalds.cis.uncw.edu/wsrf/ services/DefaultIndexService Service Client

52 4d.52 Querying Community Index Service Have Community Index Service running. Use wsrf-query command: $GLOBUS_LOCATION/bin/wsrf-query -s https://torvalds.cis.uncw.edu/wsrf/serv ices/DefaultIndexService '/*' Should see contents of all local index services.

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

54 4d.54 Resource Discovery The local and community index services can be searched for a particular resource property. Since Resources properties are XML, can use “XPath” queries for searching and retrieval.

55 4d.55 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

56 MDS4 Trigger Service Subscribe to a set of resource properties Evaluate that data against a set of pre- configured conditions (triggers) When a condition matches, action occurs –Email is sent to pre-defined address –Website updated 4c56 From: Monitoring and Discovery in a Web Services Framework: Functionality and Performance of Globus Toolkit MDS4 Jennifer M. Schopf, Sept 11, 2006

57 WebMDS Web-based interface to display resource property information. Front-end to index services. Sample: http://mds.globus.org:8080/webmds/ webmds?info=indexinfo&xsl=servicegroupxsl 4c57

58 4c58 More Information Book Globus Toolkit 4 Programming Java Services Borja Sotomayor and Lisa Childer Morgan Kaufmann, 2006. On-line GT4 services: http://gdp.globus.org/gt4- tutorial/


Download ppt "4c1 GT 4 Services Advanced features: A very brief overview Topics: Resource home Singleton resource Multiple resources Notifications Lifecycles Copyright."

Similar presentations


Ads by Google