GT4 WS Core Tutorial Sam Meder Jarek Gawor 6/11/04.

Slides:



Advertisements
Similar presentations
Chapter 6 Server-side Programming: Java Servlets
Advertisements

WS-Resource Framework: Globus Alliance Perspectives Ian Foster Argonne National Laboratory University of Chicago Globus Alliance
1 Java WS Core for Developers Rachana Ananthakrishnan Jarek Gawor.
GT4 Architectural Security Review December 17th, 2004.
Experiences with Converting my Grid Web Services to Grid Services Savas Parastatidis & Paul Watson
JSP and web applications
E-Science Data Information and Knowledge Transformation Eldas Building Service Grids with Enterprise Level Data Access Services Alan Gray
Eldas 1.0 Enterprise Level Data Access Services Design Issues, Implementation and Future Development Davy Virdee.
WEB SERVICES. FIRST AND FOREMOST - LINKS Tomcat AXIS2 -
Apache Struts Technology
Web Services Web Services are the basic fundamental building blocks of invoking features that can be accessed by an application program. The accessibility.
Web Service Resource Framework (WSRF) Alexander Wöhrer und Peter Brezany
State and Events for Web Services: A comparison of Five WS-Resource Framework and WS-Notification Implementations Marty Humphrey, Glenn Wasson, JarekGawor,
BiodiversityWorld GRID Workshop NeSC, Edinburgh – 30 June and 1 July 2005 Resource wrappers, web services, grid services Jaspreet Singh School of Computer.
This product includes material developed by the Globus Project ( Introduction to Grid Services and GT3.
Lightweight Preservation Environment Gary Jackson.
1 CENTER FOR PARALLEL COMPUTERS An Introduction to Globus Toolkit® 3 -Developing Interoperable Grid services.
7-2.1 Additional Features of WSRF/GT4 Services A brief outline © 2011 B. Wilkinson/Clayton Ferner. Fall 2011 Grid computing course. Modification date:
4d.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Notes on “sticky note” assignment.
4a.1 Grid Computing Standards ITCS 4010 Grid Computing, 2005, UNC-Charlotte, B. Wilkinson, slides 4a.
Persistent State Service 1 CORBA Component  Component model  Container programming model  Component implementation framework  Component packaging and.
4c1 GT 4 grid services and their implementation Advanced features: An overview Topics: Resource home Singleton resource Multiple resources Notifications.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
4c1 GT 4 Services Advanced features: A very brief overview Topics: Resource home Singleton resource Multiple resources Notifications Lifecycles Copyright.
1 Java Server Programming zLecture 1 focuses on: yIntroduction to web services y Web Services using Axis y The bigger Picture: Introduction to J2EE y Java.
Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.
1 Modeling Stateful Resources with Web Services ICE Ph.D lecture Byung-sang Kim.
Java Frameworks Indy Java Users Group January 29, 2003.
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
Presented by Robert Zaremba.  Remote messages must be sent to a message queue so that components are decoupled  Both sides of a communication must be.
1 Session Bean Chuyên đề Lập trình Java & J2EE Chương 14 Biên soạn: Th.S Nguyễn văn Lành.
Data Management Kelly Clynes Caitlin Minteer. Agenda Globus Toolkit Basic Data Management Systems Overview of Data Management Data Movement Grid FTP Reliable.
4c.1 Grid Computing, B. Wilkinson, 2005 Web Service Resource Framework Creating Globus 4 services.
M i SMob i S Mob i Store - Mobile i nternet File Storage Platform Chetna Kaur.
Entity Java Beans Jorg Janke Open Source ERP & CRM.
USC Viterbi School of Engineering Web and Grid Services Slides taken from a variety of sources: GT4 tutorial, by Borja Sotomayor
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
WSRF & WSRF’s Application in VO-DAS Haijun Tian ChinaVO
Data Structure & File Systems Hun Myoung Park, Ph.D., Public Management and Policy Analysis Program Graduate School of International Relations International.
Ch 2 – Application Assembly and Deployment COSC 617 Jeff Schmitt September 14, 2006.
The Anatomy of the Grid Introduction The Nature of Grid Architecture Grid Architecture Description Grid Architecture in Practice Relationships with Other.
Shannon Hastings Multiscale Computing Laboratory Department of Biomedical Informatics.
The Globus Toolkit 4 (GT4) A brief introduction. Web Services, WSRF, OGSA and GT4.
Introduce Grid Service Authoring Toolkit Shannon Hastings, Scott Oster, Stephen Langella, David Ervin Ohio State University Software Research Institute.
Wrapping Scientific Applications As Web Services Using The Opal Toolkit Wrapping Scientific Applications As Web Services Using The Opal Toolkit Sriram.
1 Java EE Programming Enterprise JavaBeans. 2 Topics J2EE Overview Enterprise JavaBeans Overview Enterprise Entity Beans Case Study How to build them.
Grid Services I - Concepts
Performance Measurement Points Sockets, plain text and grid services Paul Mealor.
Prof S.Ramachandram Dept of CSE,UCE Osmania University
Registries, ebXML and Web Services in short. Registry A mechanism for allowing users to announce, or discover, the availability and state of a resource:
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Data Manipulation with Globus Toolkit Ivan Ivanovski TU München,
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
OGSA. Introduction Built next generation of service Based on web service technology 3 main areas: – Manage creation, destruction & lifecycle management.
13 Copyright © 2004, Oracle. All rights reserved. Managing Persistent Data in the Business Tier Entity EJBs.
Office of Science U.S. Department of Energy Globus World Python WS Core Joshua R. Boverhof Lawrence Berkeley National Laboratory.
CEDPS Services Area Update CEDPS Face-to-Face Meeting ANL October 2007.
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
DataGrid is a project funded by the European Commission EDG Conference, Heidelberg, Sep 26 – Oct under contract IST OGSI and GT3 Initial.
This product includes material developed by the Globus Project ( Exercise 8 Transience: Create and Destroy FileShares.
Orion Contextbroker PROF. DR. SERGIO TAKEO KOFUJI PROF. MS. FÁBIO H. CABRINI PSI – 5120 – TÓPICOS EM COMPUTAÇÃO EM NUVEM
October 2014 HYBRIS ARCHITECTURE & TECHNOLOGY 01 OVERVIEW.
WEB SERVICES.
Web Service Resource Framework (WSRF)
Services-based Systems Architecture, Design and Implementation
Final Review Bina Ramamurthy 1/13/2019 BR.
Large Scale Distributed Computing
Enterprise Java Beans.
Additional Features of WSRF/GT4 Services
Presentation transcript:

GT4 WS Core Tutorial Sam Meder Jarek Gawor 6/11/04

Disclaimer l Everything GT4 related is subject to change l Dont expect to be able to do more than prototype with current code

GT 4 WS Core Architecture l Grid Service vs. Web Service + Resource l Operation Providers l Service Properties vs. JNDI Directory l Service State Management vs. Resource State Management l Client side support l Service Data vs. Resource Properties l Notifications l Security

GT3 Grid Service l Implements the OGSI grid service port type u Persistent/Transient lifecycle u Provides operations for l Service lifetime management l Inspecting and changing Service Data

GT4 Web Service + Resource l The service bit is just a plain web service l Resources are managed/discovered via a Resource Home: l ResourceHome implementations provide: u Custom create() methods u Methods that operate on a set of resources

Resource Discovery

Resource Discovery in Practice l The simple case: Counter counter = (Counter) ResourceContext.getResource(); l The complicated case: ResourceContext ctx = null; ResourceHome home = null; ResourceKey key = null; Counter counter = null; try { ctx = ResourceContext.getResourceContext(); home = ctx.getResourceHome(); key = ctx.getResourceKey(); counter = (Counter)home.find(key); } catch (Exception e) { throw new RemoteException("", e); }

GT4 Web Service + Resource l Service and resource in the same object u One resource per service l Service and resource as separate entity u Any number of resources per service

Available Resource Homes l SimpleResourceHome u Basic hash table based implementation l SoftResourceHome u Uses soft references for storing resources l ServiceResourceHome u Service/Resource singleton home l PersistentResourceHome u For use with resources that can be persisted We may introduce a more generic home to replace some of these implementations

Operation Provider Model l Introduced in GT3 u Provides a web service composition framework u Enables reusable components l In GT4 u Any service can be an operation provider u No special interface required u Currently implemented: l Destroy l Set Termination Time l Get Current Message l Notification Consumer l Pause/Resume Subscription l Subscribe l Get/Set Resource Property l Get Multiple Resource Properties l Query Resource Properties

GT3 Service Properties l Allows services to store/checkpoint configuration properties u Flat Table (key, value) u Values can be persisted to deployment descriptor u Works for simple things

GT4 Directory l Uses JNDI code from Apache Tomcat u Hierarchical u Object Factories l Resource Homes l DataSource l Etc. u Entries can be linked u For more information see: doc/jndi-resources-howto.html doc/jndi-resources-howto.html l Note: Configuration file format slightly different

JNDI Examples l Environment entry: <environment name="subscriptionManagerServiceName type="java.lang.String" value="SubscriptionManagerService"/> l Resource Link entry: <resourceLink name="home" target="java:comp/env/notificationConsumerHome"/>

JNDI Examples Continued l Resource entry: <resource name="subscriptionHome" type="org.globus.wsrf.impl.notification.SimpleSubscriptionHome"> factory org.globus.wsrf.tools.jndi.BeanFactory

GT3 Service State Management l Persistent vs. Transient Service u Persistent service - created through container configuration entry u Transient service – created at runtime l Persistent vs. Transient Lifecycle u Persistent – Service can checkpoint and recover properties u Transient – Service Properties are volatile

GT4 Resource State Management l Resource State Management u Will provide implementations for common patterns: l Soft references u Good when state is easily recreated l Persistent Resources l Design your service with scalability in mind u Dont keep long lived references to your resources

Persistent Resources in GT4 l Must implement PersistentResource interface l Must have a default constructor l Must define at least one create() operation l Up to implementation to call store() when appropriate l Currently, can only be used with PersistentResourceHome

Client Side Model l No more Grid Service Handle to Grid Service Reference resolution u Similar step likely in GT4 l Needed for below l Discovery of remote security policy and certificates l Cant really pass WS-A Endpoint References on command line u Factory returns human readable string as well as EPR u Discover EPR via Service Group lookup

Security l Model remains unchanged u Clients will have to set security properties on stub u Service/Resource security policy via deployment descriptor l Security settings will be per resource l New Features in 4.0 u Better GSI Secure Message support l Encryption l Replay Attack Prevention u Flexible Authorization Support l Based on Work in OGSA AuthZ WG u (Rebase on Apache WSS4J code)

GT3 Service Data

GT4 Resource Properties

l Resources implement the Resource Properties interface: l The Resource Property Set manages properties:

GT4 Resource Properties l Every Resource Property implements:

Resource Property Implementations l SimpleResourceProperty u Basic resource property implementation u Stores the resource property values l ReflectionResourceProperty u Relies on reflection to get/set values

GT Query Framework l Supports multiple query dialects u New dialects can be added at runtime u Evaluation engine is chosen using dialect in query

Resource Properties Summary

GT3 Notification l Notifications are coupled to Service Data changes u Flat namespace l Notification interfaces are added via operation providers l Often required one notification sink per subscription u Disambiguation of source

GT4 Notification l Main change: Notifications are no longer coupled to service data u Parallel code structure u Hierarchy of topics u Topic can represent anything you want l Default notification consumer (sink) service per hosting environment u Individual sinks are represented by resources l Default subscription manager service per hosting environment u Subscriptions are resources l Still uses operation providers model

GT4 Notification Overview

GT4 Notification Interfaces

l Topic List Accessor u Allows for different TopicList implementations u Usually implemented by a Resource l Topic List u List of root topics l Topic u Represents a topic u May have child topics

GT4 Notification Interfaces l Topic Listener u Interface for propagating Topic changes u Used to connect subscriptions to topics\ u Used for creating the topics RP l Subscription u Interface to subscription state

Current Topic Implementations l SimpleTopic u Your basic no-frills implementation l ResourcePropertyTopic u Creates a topic from a object that implements the Resource Property Interface

Topic Expression Framework l Similar to Query Engine l You will also need to register dialect with Axis

GT4 Threads and Timers l Based on J2EE APIs proposed by IBM & BEA u Royalty free u More information at ibm.com/developerworks/java/library/j -commonj-sdowmt/ l WorkManager & Timer interfaces u Using thread/timer pools u Container provides default WorkManager and Timer objects via JNDI lookup l Replaces SweeperPool in GT3

Timer Example l Get the TimeManager and schedule: Context initialContext = new InitialContext(); TimerManager timerManager = (TimerManager) initialContext.lookup(WSRFConstants.DEFAULT_TIMER); timerManager.schedule(new TerminationTimerListener(), period, period); l Each timer task needs to implement TimerListener: protected class TerminationTimerListener implements TimerListener { public void timerExpired(Timer timer) { … }

WorkManager Example l Get the WorkManager and schedule: Context initialContext = new InitialContext(); WorkManager workManager = (WorkManager) initialContext.lookup(WSRFConstants.DEFAULT_WORK_MANAGER); WorkItem item1 = workManager.schedule(work1); l Each work task needs to implement Work: private class TestWork implements Work { public void release() { … } public void run() { … }

Base Faults l You should define your service faults l Helper API (FaultHelper) u Methods for populating and inspecting Base Faults l Currently have a handler that fills in some of the fields (timestamp etc.)

GT3 vs. GT4 Summary l What has fundamentally changed: u No long lived address anymore (GSH) u doc/literal (GT4) instead of wrapped/literal u Decoupled notification framework Not that much

Counter Service II: The Revenge l What is required to implement a new service? u WSDL u Service u Resource u Resource Home u Client u Configuration

Counter Service Interaction

The Code: WSDL <xsd:schema targetNamespace=" xmlns:tns=" xmlns:xsd=" … <xsd:element ref="tns:Value" minOccurs="1" maxOccurs="1"/>

The Code - WSDL <portType name="CounterPortType" gtwsdl:implements="wsnt:NotificationProducer wsrl:ImmediateResourceTermination" wsrp:ResourceProperties ="tns:CounterRP">

The Code: Service public _createCounterResponse createCounter(_createCounterRequest request) throws RemoteException { ResourceContext ctx = null; CounterHome home = null; ResourceKey key = null; try { ctx = ResourceContext.getResourceContext(); home = (CounterHome) ctx.getResourceHome(); key = home.create(); } catch(RemoteException e) { throw e; } catch(Exception e) { throw new RemoteException("", e); }

The Code: Service EndpointReferenceType epr = null; try { epr = AddressingUtils.createEndpointReference(ctx, key); } catch(Exception e) { throw new RemoteException("", e); } _createCounterResponse response = new _createCounterResponse(); response.setEndpointReference(epr); return response; }

The Code: Service public int add(int arg0) throws RemoteException { Object resource = null; try { resource = ResourceContext.getResourceContext().getResource(); } catch(RemoteException e) { throw e; } catch(Exception e) { throw new RemoteException("", e); } Counter counter = (Counter) resource; int result = counter.getValue(); result += arg0; counter.setValue(result); return result; }

The Code: Resource public class PersistentCounter extends Counter implements RemoveCallback, PersistentResource, ResourceLifetime { public void setValue(int value) { super.setValue(value); try { store(); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } public void setTerminationTime(Calendar time) { super.setTerminationTime(time); try { store(); } catch (Exception e) { throw new RuntimeException(e.getMessage()); }

The Code: Resource /** * User-defined function. * the resource key */ public Object create() throws Exception { Object key = super.create(); store(); return key; }

/** * Called when activating a Counter resource by PersistentResourceHome */ public void load(ResourceKey key) throws ResourceException { File file = getKeyAsFile(key.getValue()); if (!file.exists()) { throw new NoSuchResourceException(); } FileInputStream fis = null; int value = 0; try { fis = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(fis); value = ois.readInt(); this.terminationTime = (Calendar)ois.readObject(); } catch (Exception e) { throw new ResourceException("Failed to load resource", e); } finally { if (fis != null) { try { fis.close(); } catch (Exception ee) {} } initialize(key.getValue()); this.value.set(0, new Integer(value)); }

The Code: Resource public void store() throws ResourceException { FileOutputStream fos = null; try { fos = new FileOutputStream(getKeyAsFile(this.key)); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeInt(((Integer) this.value.get(0)).intValue()); oos.writeObject(this.terminationTime); } catch (Exception e) { throw new ResourceException("Failed to store resource", e); } finally { if (fos != null) { try { fos.close(); } catch (Exception ee) {} }

The Code: Resource private static File getKeyAsFile(Object key) throws InvalidResourceKeyException { if (key instanceof Integer) { return new File(key.toString()); } else { throw new InvalidResourceKeyException(); } public void remove() throws ResourceException { File f = getKeyAsFile(this.key); f.delete(); }

The Code: Resource Home public class CounterHome extends PersistentResourceHome { static Log logger = LogFactory.getLog(CounterHome.class.getName()); public ResourceKey create() throws Exception { Counter counter = (Counter)createNewInstance(); counter.create(); ResourceKey key = new SimpleResourceKey(keyTypeName, counter.getID()); this.resources.put(key, counter); return key; }

The Code: Configuration <resource name="home" type="org.globus.wsrf.samples.counter.CounterHome"> factory org.globus.wsrf.tools.jndi.BeanFactory resourceClass org.globus.wsrf.samples.counter.PersistentCounter resourceKeyName { resourceKeyType java.lang.Integer

The Code: Configuration <deployment name="defaultServerConfig" xmlns=" xmlns:java=" xmlns:xsd=" <service name="CounterService" provider="Handler" use="literal" style="document"> <parameter name="allowedMethodsClass" value="com.counter.CounterPortType"/> <parameter name="handlerClass" value="org.globus.axis.providers.RPCProvider"/> <parameter name="className" value="org.globus.wsrf.samples.counter.CounterService"/> share/schema/core/samples/counter/counter_service.wsdl <parameter name="providers" value=" DestroyProvider SetTerminationTimeProvider GetRPProvider SubscribeProvider GetCurrentMessageProvider"/>

The Code: Client public class CounterClient implements NotifyCallback { public static void main(String [] args) { CounterServiceAddressingLocator locator = new CounterServiceAddressingLocator(); NotificationConsumerManager consumer = null; try { EndpointReferenceType endpoint = new EndpointReferenceType(); endpoint.setAddress( new Address( " CounterPortType port = locator.getCounterPortTypePort(endpoint); // Create counter resource _createCounterResponse createResponse = port.createCounter(new _createCounter()); endpoint = createResponse.getEndpointReference(); port = locator.getCounterPortTypePort(endpoint); _Subscribe request = new _Subscribe(); request.setUseNotify(Boolean.TRUE);

The Code: Client // Create client side notification consumer consumer = NotificationConsumerManager.getInstance(); consumer.startListening(); EndpointReferenceType consumerEPR = consumer.createNotificationConsumer(new CounterClient()); request.setConsumerReference(consumerEPR); TopicExpressionType topicExpression = new TopicExpressionType(); topicExpression.setDialect(WSRFConstants.SIMPLE_TOPIC_DIALECT); topicExpression.setValue(Counter.VALUE); request.setTopicExpression(topicExpression); // Subscribe to value port.subscribe(request);

The Code: Client // Add 3 port.add(3); // Sleep so we actually get the notification Thread.sleep(5000); // Get the value RP _GetResourcePropertyResponse getRPResponse = port.getResourceProperty(Counter.VALUE); System.out.println("Counter has value: " + getRPResponse.get_any()[0].getValue()); // Destroy the counter resource port.destroy(new _Destroy()); } catch(Exception e) { e.printStackTrace(); } finally { if (consumer != null) { try { consumer.stopListening(); } catch (Exception ee) {} }

The Code: Client // Notification callback public void deliver( List topicPath, EndpointReferenceType producer, Object message) { ResourcePropertyValueChangeNotificationType changeMessage = ((ResourcePropertyValueChangeNotificationElementType) message). getResourcePropertyValueChangeNotification(); if(changeMessage != null) { System.out.println("Got notification with value: " + changeMessage.getNewValue().get_any()[0].getValue()); }

What is still missing? l GT3 Compatibility Layer l More Helper APIs l Performance Work l Lots of examples l Lots of polish l Service Group

Take A Look l Anonymous CVS: u cvs \ packages \ login u When asked for a password, please enter your . u cvs \ packages \ checkout \ wsrf u unset GLOBUS_LOCATION ; cd wsrf ; ant all u Installation will end up in wsrf/install u Take a look at test services in wsrf/java/core/test/interop