36
1 Model-Driven Integration Strategies Joe Berkovitz Chief Architect, Allurent Inc.

1 Model-Driven Integration Strategies Joe Berkovitz Chief Architect, Allurent Inc

Embed Size (px)

Citation preview

1

Model-Driven Integration Strategies

Joe Berkovitz

Chief Architect, Allurent Inc.

2

This talk is about…

Modelling: describing software abstractly

Integration: hooking up disparate components

Strategy: an overarching approach to a problem

Model-Driven Integration Strategy:An approach that uses abstract descriptions to drive the hookup of disparate components

3

Who…

…is using SOAP web services?

…is using HTTP/XML services?

…is using RemoteObject

…is using Flex Data Services?

…is using Flash Remoting?

…is using Cairngorm?

…is using custom transport/serialization?

4

Who hates writing burdensome,repetitive, error-prone code?

5

The Integration Problem

Many strongly-related components and assets Value Objects

Services with VO params that return more VOs

Multiple language bindings for VOs, Services

VO Serializers and Deserializers

User Documentation

Metadata

6

The Integration Problem

Many languages in play ActionScript 2

ActionScript 3

MXML

Java

C#

XSD

WSDL

7

The Integration Problem

Many transport technologies SOAP Web Services

Axis

.NET

REST Web Services

XMLRPC

Flash Remoting

Flex Data Management Services

Random Custom Stuff

8

Controller

My real (ugly) worldFlex Client

SOAP web services

CatalogService

OrderService

Views

SOAP/XML

ValueObjects

REST/XML

integration layer

Commerce APIs

REST web services

data access layer JavaModel

WSDL

CatalogDB

Catalog Server Commerce Server

Documentation

Process Support

VO, ServiceMetadataXML Marshaller

9

Controller

Commonalities

SOAP web services

CatalogService

OrderService

Views

integration layer

Commerce APIs

REST web services

data access layer JavaModel

WSDL

CatalogDB

Catalog Server Commerce Server

Documentation

Process Support

ValueObjects

Flex Client

VO, ServiceMetadataXML Marshaller

10

Commonalities (continued)

Many components encode the same information or overlap heavily

Variations: role

syntax

structure

degree of detail

11

Transformation Tools

In limited realms, transformation tools are popular

They reduce the number of parallel representations

Example: Axis WSDL2Java (.NET similar)

SOAP web services JavaModel

WSDL

WSDL2Java

12

or….. Java2WSDL!

SOAP web services JavaModel

WSDL

Java2WSDL

13

Existing transformation tools are limited

Axis, .NET stay within their platform boundaries

xdoclet, xdoclet2 rely on annotation of Java classes, interfaces: locks into standard OOP language model

XSLT doesn't work so well for very complex iterative transforms, and has limited programmability (for non-masochists)

14

Where transformations help

Across technology domains: same concept, different languages/protocols

Within technology domain: interlocking concepts, same language

15

Output FilesOutput Files

GeneratorsGenerators

What Hamachi does

Language-neutral XML model description…

…is parsed according to Metamodel into an in-memory model…

…Generators pass parts of that model…

…to Velocity templates to format them into output files

Hamachi

Metamodel Generators

ModelDescription

Output Filestemplates

16

Output FilesOutput Files

GeneratorsGenerators

Hamachi modules

Different projects need different models, different templates

Hamachi modules package the part that varies:

Hamachi

Metamodel Generators

ModelDescription

Output Filestemplates

Module

17

Harnessing Generation with Hamachi

CatalogService

OrderService

Documentation

Process Support

Hamachi

SOAP web services JavaModel

WSDL

WSDL2Java

ModelDescription

ValueObjects

VO, ServiceMetadata

18

Derived Assets for a Single Object

OrderService:OrderItemSummary addToCart()

OrderItemSummary.as

OrderItemSummary.html

Hamachi

addToCart WS endpoint OrderItemSummary.java

<complexType name="OrderItemSummary"/><wsdl:operation name="addToCart">

WSDL2Java

<ClientModelTypename=

"OrderItemSummary">

new ClassDescriptor("OrderItemSummary")

19

What is a metamodel?

Models describe parts of your application OrderItemSummary is a ClientModelType in the model

OrderItemSummary.price is a Property in the model of type decimal

CatalogService is a ClientService in the model

Metamodels describe parts of your model: ClientModelType is a Class in the metamodel

ClientModelType.properties is a Property of type PropertyList

20

21

22

Adding an Attribute to the ARC Model

23

Model-Driven SOAP Support

24

Why not just use <mx:WebService>?

Operations and request/response not strongly typed

No access to returned SOAP fault information

High overhead from parsing WSDL

Performance penalty for generality of SOAP document type support

25

Model-Driven MVCS SOAP support

IOrderService:type-safe Service interface

OrderItemSummary.as

new ClassDescriptor("OrderItemSummary")

OrderService:Service Implementation

AddToCartOperation:Operation Implementation

SOAP Marshaller/Unmarshaller

Controller

SOAP/XML(follows document/literal

conventions only)

per-class metadata

drives XML parsing/

generation

populate value objectfrom response

invoke API to obtain operation

Order line item view

change eventscause data binding

update in view

executeoperation

create operation

26

Model-Driven REST Support

27

REST: accessing a data web

Each distinct entity is served from a stable URL

All relationships are represented as hyperlinks

A relationship may be: lazy (only a hyperlink in referent)

eager (target object details included in referent)

anywhere in between

Very suitable for read-only data

28

REST data web

<Category uri="/cat/1" name="Widgets"> <products> <Product uri="/product/11" title="Cool Widget"/>

<Product uri="/product/12" title="Cooler Widget"/> </products></Category>

http://example.com/cat/1:

<Product uri="/product/11" title="Cool Widget" price="33.00"> <images> <Asset type="large" href="/images/11large.png"> <Asset type="small" href="/images/11small.png"> </images></Product>

http://example.com/product/11:

<Product uri="/product/11" title="Cooler Widget" price="66.00"> <images> <Asset type="large" href="/images/12large.png"> </images></Product>

http://example.com/product/12:

29

ContentService:REST entity cache

Product.as

new ClassDescriptor("Product")

REST Unmarshaller

Controller

impl-dependentREST/XML

document format

per-class metadata

drives XML parsing/

generation

create/populateentity instances

request entity by URIon behalf of view

Product display view

change eventscause data bindingupdate in view

Model-Driven MVCS REST support

request formissing propertytriggers loading

populate objectsfrom XML responses

load entitieson demand

Category.as

30

OzoneLayer:model-driven client/client

integration

31

Conventional single-user outliner app

modifications

Flex Client

OutlineView

actionsdata,events

IOutlineController

OutlineController

Outline

IOutline

32

Add OzoneLayer and stir: multiuser outliner

OutlineControllerProxy

Flex Client

OutlineView

actionsdata,events

IOutlineController

OutlineController

SharedScope

Flash Media Server(or moral equivalent)

Shared Object Services

Outline

IOutline

OutlineProxymod

ificati

on

s OutlineControllerProxy

Flex Client

OutlineView

actionsdata,events

IOutlineController

OutlineController

SharedScope Outline

IOutline

OutlineProxymod

ificati

on

s

33

OzoneLayer: What Hamachi generates

OutlineControllerProxy

Flex Client

OutlineView

actionsdata,events

IOutlineController

OutlineController

SharedScope Outline

IOutline

OutlineProxymod

ificati

on

s OutlineControllerProxy

Flex Client

OutlineView

actionsdata,events

IOutlineController

OutlineController

SharedScope Outline

IOutline

OutlineProxymod

ificati

on

s

34

Pros

+ One change in model expresses many in system

+ Eliminates many tedious, error-prone changes

+ Enabling technology for custom networking approaches

+ Change to module can affect the "way it works" with no distrubance to the model

35

Cons

- Longer "curve to liftoff"

- More complex system, harder to learn

- Models, metamodels not fully standardized

36

Some caveats

Approaches, not turnkey tools

Not all source code available yet

Limited documentation