Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team [email protected].

23
http://www.ogsadai.org.uk The OGSA-DAI Client Toolkit The OGSA-DAI Team [email protected]

Transcript of Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team [email protected].

Page 1: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

http://www.ogsadai.org.uk

The OGSA-DAI Client Toolkit

The OGSA-DAI Team

[email protected]

Page 2: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

2http://www.ogsadai.org.uk

Overview

The Client Toolkit OGSA-DAI Service Types Locating and Creating Data Services Requests and Results Delivery of Data Data Integration

Page 3: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

3http://www.ogsadai.org.uk

Why use a Client Toolkit?

Nobody wants to write XML! Users aren’t concerned about the

connection mechanism Protects developer from

– Changes in activity schema – Changes in service interfaces– Low-level APIs– DOM manipulation

Page 4: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

4http://www.ogsadai.org.uk

OGSA-DAI Services

OGSA-DAI uses three main service types– DAISGR (registry) for discovery– GDSF (factory) to represent a data resource– GDS (data service) to access a data resource

acce

sses

represents

DAISGR GDSF GDS

DataResource

locates creates

Page 5: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

5http://www.ogsadai.org.uk

ServiceFetcher

The ServiceFetcher class creates service objects from a URL

ServiceGroupRegistry registry =

ServiceFetcher.getRegistry( registryHandle );

GridDataServiceFactory factory =

ServiceFetcher.getFactory( factoryHandle );

GridDataService service =

ServiceFetcher.getGridDataService( handle );

Page 6: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

6http://www.ogsadai.org.uk

Registry

A registry holds a list of service handles and associated metadata

For example, clients can query a registry for all registered Grid Data Factory ServicesGridServiceMetaData[] services =

registry.listServices(

OGSADAIConstants.GDSF_PORT_TYPE );

The GridServiceMetaData object contains the handle and the port types that the factory implements

String handle = services[0].getHandle();

QName[] portTypes = services[0].getPortTypes();

Page 7: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

7http://www.ogsadai.org.uk

Creating Data Services

A factory object can create a new Grid Data Service.GridDataService service =

factory.createGridDataService();

Grid Data Services are transient (i.e. have finite lifetime) so they can be destroyed by the user.service.destroy();

Page 8: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

8http://www.ogsadai.org.uk

Interaction with a GDS

Client

GDSActivity

Request

Activity

Activity

Client sends a request to a data service A request contains a set of activities

Page 9: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

9http://www.ogsadai.org.uk

Interaction with a GDS

Client

GDSResult

Response

Result

Result

The Data service processes the request Returns a response document with a result

for each activity

Page 10: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

10http://www.ogsadai.org.uk

Activities and Requests

A request contains a set of activities An activity dictates an action to be

performed– Query a data resource– Transform data– Deliver results

Data can flow between activities

HTMLdata

web rowsetdata

SQLQuery

Statement

XSLTTransform

DeliverToURL

Page 11: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

11http://www.ogsadai.org.uk

Examples of Activities

SQLQuerySQLQuery query = new SQLQuery(

"select * from littleblackbook where id='3475'");

XPathQueryXPathQuery query = new XPathQuery( "/entry[@id<10]" );

XSLTransformXSLTransform transform = new XSLTransform();

DeliverToGFTPDeliverToGFTP deliver = new DeliverToGFTP(

"ogsadai.org.uk", 8080, "myresults.txt" );

Page 12: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

12http://www.ogsadai.org.uk

Simple Requests

Simple requests consist of only one activity Send the activity directly to the perform

method

SQLQuery query = new SQLQuery("select * from littleblackbook where id='3475'");

Response response = service.perform( query );

Page 13: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

13http://www.ogsadai.org.uk

Constructing an ActivityRequest

SQLQuery

Statement

XSLTTransform

DeliveryToURL

ActivityRequest

add add add

Page 14: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

14http://www.ogsadai.org.uk

Constructing a Request cont.

SQLQuery

Statement

XSLTTransform

DeliveryToURL

ActivityRequest

ActivityRequest request = new ActivityRequest();request.add( query );request.add( transform );request.add( delivery );

Page 15: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

15http://www.ogsadai.org.uk

Data Flow

Connecting activities SQLQuery query = new SQLQuery(

"select * from littleblackbook where id<=1000");DeliverToURL deliver = new DeliverToURL( url );

deliver.setInput( query.getOutput() );

SQLQuery

Statement

DeliverToURL

Page 16: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

16http://www.ogsadai.org.uk

Performing Requests

Finally… perform the request!Response response = service.perform( request );

The response contains status and results of each activity in the request.System.out.println( response.getAsString() );

Page 17: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

17http://www.ogsadai.org.uk

Processing Results

Varying formats of output data– SQLQuery

• JDBC ResultSet:

ResultSet rs = query.getResultSet();

– SQLUpdate• Integer:

int rows = update.getModifiedRows();

– XPathQuery• XML:DB ResourceSet:

ResourceSet results = query.getResourceSet();

Output can always be retrieved as a StringString output = myactivity.getOutput().getData();

Page 18: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

18http://www.ogsadai.org.uk

Delivery

Data can be pulled from or pushed to a remote location.

OGSA-DAI supports third-party transfer using FTP, HTTP, or GridFTP protocols.

DeliverToURL deliver = new DeliverToURL( url );

deliver.setInput( myactivity.getOutput() );

DeliverToGFTP deliver = new DeliverToGFTP(

“ogsadai.org.uk”, 8080, “tmp/data.out” );

deliver.setInput( myactivity.getOutput() );

Page 19: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

19http://www.ogsadai.org.uk

Delivery Methods

Web Server

GDS

GridFTP serverLocal

Filesystem

FTP server

DeliverFromURL

DeliverTo/FromURL

DeliverTo/FromGFTP

DeliverTo/FromFile

DeliverTo/FromStream

DeliverTo/FromSMTP

Page 20: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

21http://www.ogsadai.org.uk

Delivering data to another GDS

The GDT port type allows to transfer data from one data service to another.

Push: A DeliverToGDT activity of GDS1 connects to an InputStream activity of GDS2

Pull: Alternatively, an OutputStream activity can be connected to a DeliverFromGDT activity

InputStreamGDS1 GDS2DeliverToGDT

Page 21: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

22http://www.ogsadai.org.uk

Delivering Data

Transfer in blocks or in full InputStream activities wait for data to arrive at

their input – Therefore, the InputStream activity at the sink has to be started

before the DeliverToGDT activity at the source

OutputStream activity waits for data to be read from its output– OutputStream activity at the source must be started before

DeliverFromGDT at the sink

Page 22: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

23http://www.ogsadai.org.uk

Data Integration Scenario

GDS2 GDS3RelationalDatabase Relational

Database

GDS1RelationalDatabase

Clientselect +

output stream

select +output stream

deliver

deliver

deliver from GDTbulk load

join tables

Page 23: Http:// The OGSA-DAI Client Toolkit The OGSA-DAI Team info@ogsadai.org.uk.

24http://www.ogsadai.org.uk

Conclusion

Easy to use– No XML!– Less low-level APIs– Improves usability and shortens learning curve for client

development

Protects developer– Shielded from schema changes, protocols, etc– Deprecation policy needed

Limitations– Metadata and service-data not yet addressed adequately– Higher-level abstraction possible (no factory)