GT3 Tutorial Chapter 5, 6, and 7 Lecture for Cluster and Grid Computing, CSCE 490/590 Fall 2004, University of Arkansas, Dr. Amy Apon

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming Lecture 3 Writing Java Applications, Java Development Tools.
Advertisements

Modeling Elements of Web Service State in WSDL May 12, 2003 Global Grid Forum.
Service Data in Grid Services  Service Data allows us to easily include a set of structured data to any service, which can then be processed directly.
Mark Holliday and Barry Wilkinson, 2004A2.1 Assignment 2 “Simple” Grid Services Assignment.
Written by: Dr. JJ Shepherd
This product includes material developed by the Globus Project ( Introduction to Grid Services and GT3.
7-2.1 Additional Features of WSRF/GT4 Services A brief outline © 2011 B. Wilkinson/Clayton Ferner. Fall 2011 Grid computing course. Modification date:
Assignment 2 Modifying, Compiling, and Deploying a Simple Service Presenter Information goes Here.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
A2.1 ITCS 4010/5010 Grid Computing, 2005, UNC-Charlotte, B. Wilkinson Assignment 2 “Simple” Grid Services Assignment.
Chapter 3 Data Abstraction: The Walls. © 2005 Pearson Addison-Wesley. All rights reserved3-2 Abstract Data Types Modularity –Keeps the complexity of a.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
4c1 GT 4 grid services and their implementation Advanced features: An overview Topics: Resource home Singleton resource Multiple resources Notifications.
© The McGraw-Hill Companies, 2006 Chapter 5 Arrays.
Alice in Action with Java
Globus OGSI Grid Service. Grid Computing Definition The Grid: Blueprint for a New Computing Infrastructure –A computational grid is a hardware and software.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Grid Computing, B. Wilkinson, 20046c.1 Globus III - Information Services.
Classes and objects Practice 2. Basic terms  Classifier is an element of the model, which specifies some general features for a set of objects. Features.
Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
Programming Languages and Paradigms Object-Oriented Programming.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Abstract Data Types (ADTs) and data structures: terminology and definitions A type is a collection of values. For example, the boolean type consists of.
1 Notes adapted from Barry Wilkinson Grid Computing Course UNCC Web Service Resource Framework Creating Globus 4 services.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
4c.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Creating Globus 4 services.
Java Server Pages A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format,
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
The Java Programming Language
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Chapter 2 Introducing Interfaces Summary prepared by Kirk Scott.
C#.Net Development Version 1.0. Overview Nullable Datatype Description ? HasValue Lifted Conversions null coalescing operator ?? Partial Classes Copyright.
Shannon Hastings Multiscale Computing Laboratory Department of Biomedical Informatics.
Grid Services I - Concepts
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
CSE 143 Lecture 24 Advanced collection classes (ADTs; abstract classes; inner classes; generics; iterators) read 11.1, 9.6, , slides.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
HashCode() 1  if you override equals() you must override hashCode()  otherwise, the hashed containers won't work properly  recall that we did not override.
CS 61B Data Structures and Programming Methodology July 2, 2008 David Sun.
ASP.NET Web Services.  A unit of managed code installed under IIS that can be remotely invoked using HTTP.
1 Service Creation, Advertisement and Discovery Including caCORE SDK and ISO21090 William Stephens Operations Manager caGrid Knowledge Center February.
Chapter 3 Introduction to Classes and Objects Definitions Examples.
This product includes material developed by the Globus Project ( Excercise 3 Inspection: Add Service Data.
Project Demo- Grid Notification Presentation by: Ben Zhang.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
How to Write a Grid Service  The grid service will do basic mathematical operations. The math grid service is going to have the following methods:  add:
GT3 Tutorial Chapter 3 and Chapter 4 Lecture for Cluster and Grid Computing, CSCE 490/590 Fall 2004, University of Arkansas, Dr. Amy Apon
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
WP3 OGSA Notification and RGMA Datagrid meeting 13/5/2003.
GT3 Index Services Lecture for Cluster and Grid Computing, CSCE 490/590 Fall 2004, University of Arkansas, Dr. Amy Apon.
WP3 Implementing R-GMA grid services in GT3 Abdeslem Djaoui & WP3 Grid Services Task Force 7 th EU Datagrid meeting 26/09/2003
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Kyung Hee University Class Diagramming Notation OOSD 담당조교 석사과정 이정환.
This product includes material developed by the Globus Project ( Exercise 8 Transience: Create and Destroy FileShares.
DEVELOPING WEB SERVICES WITH JAVA DESIGN WEB SERVICE ENDPOINT.
David Evans CS201J: Engineering Software University of Virginia Computer Science Lecture 5: Implementing Data Abstractions.
Net-centric Computing Web Services. Lecture Outline  What is Web Service  Web Service Architecture  Creating and using Java Web Services  Apache Axis.
November, 2006 Developing Service using GT4 Writing Your First Stateful Web Service in 5 Simple Steps Adam Belloum.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
This product includes material developed by the Globus Project ( WSDL Extensions Grid Service Description Language.
Web Services-JAX-RPC JAX-RPC enables a Web Service endpoint to be developed using either a Java Servlet or Enterprise JavaBeans (EJB) component model.
Data Modeling II XML Schema & JAXB Marc Dumontier May 4, 2004
Slides by Steve Armstrong LeTourneau University Longview, TX
Java Classes and Objects 3rd Lecture
Introduction to Data Structure
slides created by Ethan Apter and Marty Stepp
Additional Features of WSRF/GT4 Services
Presentation transcript:

GT3 Tutorial Chapter 5, 6, and 7 Lecture for Cluster and Grid Computing, CSCE 490/590 Fall 2004, University of Arkansas, Dr. Amy Apon from

Chapter 5: Service Data Service Data is one of the main improvements of Grid Services with respect to plain Web Services Can be used to classify and index services –To help advertise and then find services Is a structured collection of information that is associated to a Grid Service

Service Data is an essential part of service discovery

The logic behind Service Data Service data must be easy to query The client can choose an appropriate service by querying the Service Data associated with each Math Service Service Data and notifications are closely related

Service Data in Grid Services Any Grid Service can have any number of Service Data Elements (SDEs) associated to it Each SDE must have a name that is unique within that particular type of Grid Service An SDE is represented in XML and the structure is defined in the GWSDL file An SDE can have any number of values

Example with the MathService Two SDEs: SystemInfo and LastResults The collection of SDEs is called a ServiceData set

Example: SystemInfo SDE Could be used to store information about the system where MathService is running SystemInfo is a structure with fields –numberOfCPUs: integer –systemLoad: float –CPUBrand: string This particular SDE will have a cardinality of 1..1 (min of 1, max of 1)

LastResults SDE Could be used to store the last N internal values that have been returned by MathService The datatype would be integer The cardinality could be 0..10

At some point in time:

A slightly less simple example

SDE with complex data type  a Java bean is created See the $TUTORIAL_DIR for the complete code

Adding a single SDE to the MathService See $TUTORIAL_DIR/schema/progtutorial/MathService_sd/MathSDE.xsd for the complete definition

public class MathDataType implements java.io.Serializable { private int value; // attribute private java.lang.String lastOp; // attribute private int numOps; // attribute public MathDataType() { } public int getValue() { return value; } public void setValue(int value) { this.value = value; } public java.lang.String getLastOp() { return lastOp; } public void setLastOp(java.lang.String lastOp) { this.lastOp = lastOp; } Part of the code generated

Adding Service Data to a service is an interface issue Need to modify the GWSDL interface from $TUTORIAL_DIR/schema/progtutorial/MathService_sd/Math.gwsdl Need to specify a new target namespace –This is a Math Service with service data, so we’ll use a name that shows this for convenience We will also include two new namespaces, one for the SDE type and one for the service data-related definitions The next three slides show pieces of Math.gwsdl

Import the schema file

Add a new tag to portType s --> <sd:serviceData name="MathData“ type="data:MathDataType" minOccurs="1" maxOccurs="1" mutability="mutable" modifiable="false" nillable="false">

Attributes of the SDE minOccurs : The minimum number of values that this SDE can have. maxOccurs : The maximum number of values that this SDE can have. The value of this attribute can be unbounded, which indicates an array with no size limit. modifiable : True or false. Specifies if the value of this SDE can be changed by a client. nillable : True or false. Specifies if the value of this SDE can be NULL. mutability : This attribute can have the following values: –static: The value of the SDE is provided in the GWSDL description. –constant: The value of the SDE is set when the Grid Service is created, but remains constant after that. –extendable: New elements can be added to the SDE, but not removed. –mutable: New elements can be added and removed.

Modify namespace2package.mappings http\:// = org.globus.progtutorial.stubs.MathService_sd http\:// /bindings= org.globus.progtutorial.stubs.MathService_sd.bindings http\:// /service= org.globus.progtutorial.stubs.MathService_sd.service http\:// e_sd/MathSDE= org.globus.progtutorial.stubs.MathService_sd.servicedata

Service Implementation Class declaration is the same Need to add two private attributes: private ServiceData mathDataSDE; private MathDataType mathDataValue; The creation of the SDEs takes place in a special method called the postCreate method. This code is executed right after the service has been created.

public void postCreate(GridContext context) throws GridServiceException { // Call base class's postCreate super.postCreate(context); // Create Service Data Element mathDataSDE = this.getServiceDataSet().create("MathData"); // Create a MathDataType instance and set initial values mathDataValue = new MathDataType(); mathDataValue.setLastOp("NONE"); mathDataValue.setNumOps(0); mathDataValue.setValue(0); // Set the value of the SDE to the MathDataType instance mathDataSDE.setValue(mathDataValue); // Add SDE to Service Data Set this.getServiceDataSet().add(mathDataSDE); }

The steps to create an SDE 1.Create a new SDE. Notice how we don't create it directly: we have to call the create method of the Service Data Set. This SDE is initially empty, it has no value. Also, the name of the SDE will be MathData 2.Set a value for the SDE. The value of the SDE will be a MathDataType that we create ourselves. 3.Set the initial values of MathDataType. In our example, the last operation is "NONE" and the number of operations done is zero. 4.Add the SDE to the Service Data Set

Need to modify methods private void incrementOps() { int numOps = mathDataValue.getNumOps(); mathDataValue.setNumOps(numOps + 1); } public void add(int a) throws RemoteException { mathDataValue.setLastOp("Addition"); incrementOps(); mathDataValue.setValue(mathDataValue.getValue() + a); } The modification of the subtract method is similar.

Deployment Descriptor The deployment descriptor only changes a little to list the new class, new baseClass, and new schemaPath to correspond to the files that we just created See $TUTORIAL_DIR/org/globus/progtutorial/servic es/core/servicedata/server-deploy.wsdd

Compile and deploy Use the new GWSDL file with the build script to build the MathService_sd Deploy with ant as before, from the GT3 installation directory.

A client that accesses Service Data // Get a reference to the Math PortType MathServiceGridLocator mathServiceLocator = new MathServiceGridLocator(); MathPortType math = mathServiceLocator.getMathServicePort(GSH); // Get Service Data Element "MathData" ExtensibilityType extensibility = math.findServiceData(QueryHelper.getNamesQuery("MathData")); ServiceDataValuesType serviceData = AnyHelper.getAsServiceDataValues(extensibility); MathDataType mathData = (MathDataType) AnyHelper.getAsSingleObject(serviceData,MathDataType.class); // Write service data System.out.println("Value: " + mathData.getValue()); System.out.println("Previous operation: " + mathData.getLastOp()); System.out.println("# of operations: " + mathData.getNumOps());

findServiceData Invoke the findServiceData directly on math (which is a MathPortType). –Doesn't that portType only have an add and a subtract method? But Math portType extends from a standard portType called GridService. We can also use our math portType to invoke GridService methods (such as findServiceData).

Using an ExtensbilityType Need to cast it into a MathDataType using helper classes ServiceDataValuesType serviceData = AnyHelper.getAsServiceDataValues(extensibility) ; MathDataType mathData = (MathDataType) AnyHelper.getAsSingleObject(serviceData, MathDataType.class);

Finally, for Math portType SDE Use the MathDataType object like any other local object Compile and run the client as before

GridService Service Data There are a set of common Service Data Elements for every grid service –If portType is a grid service is must extend from the GridService portType Some examples include –gridServiceHandle –terminationTime –serviceDataNames –interfaces

Some cool things with SDEs Notifications (Chapter 6 in the tutorial) GT3 Service Data Browser fosvcs/sdbquickstart.html Monitoring and Discovery Service (MDS3) –a broad framework that includes any part of GT3 that generates, registers, indexes, aggregates, subscribes, monitors, queries, or displays Service Data in some way.

Chapter 6: Notifications A feature that is closely related to service data Allow clients to be notified of changes that occur in a Grid Service

Polling – the old-fashioned approach

Notification approach This is the pull approach – each observer gets the data after notify Alternatively, use the push approach – send the data with the notify

Notifications in GT3 Each client subscribes to be notified of a change to a particular SDE in a service Whenever a change happens the service will ask the SDE to notify its subscribers The SDE notifies the subscribers that a change has happened

Change to service implementation public void add(int a) throws RemoteException { mathDataValue.setLastOp("Addition"); incrementOps(); mathDataValue.setValue(mathDataValue.getValue() + a); mathDataSDE.notifyChange(); } Plus changes to the interface definition, mapping, …

Notification Client This is more complex Must implement a deliverNotification method

Chapter 7: Transient Services Turning a service into a factory of services is one of the easiest things to do in GT3 Is already in the server-deploy.wsdd file and gets deployed anyway