SCA Tutorial Part1 Asia-Updated

download SCA Tutorial Part1 Asia-Updated

of 48

Transcript of SCA Tutorial Part1 Asia-Updated

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    1/48

    SCA

    OSOA Collaboration | 30th May 2007 | SOA Roadmap

    Service Component Architecture(SCA) Tutorial : Part 1

    Mike Edwards - IBMAnish Karmarkar OracleJim Marino BEA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    2/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Service Component Architecture

    A model for building components, assembling them intoapplications, and deploying them to various runtimeenvironments

    Components can be built from new or existing code usingSOA principles

    vendor-neutral supported across the industry

    language-neutral components written using any language

    technology-neutral use any communication protocols andinfrastructure to link components

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    3/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Part 1 Outline Composite example

    Implementation using Java component implementation

    Introduction to SCA concepts

    Advanced composition nested composites

    Packaging and deployment

    Extension points

    Component Implementation types Spring Framework

    BPEL

    Demonstrations

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    4/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Part 2 Outline

    Bindings

    Web service binding

    JMS binding

    EJB session bean binding

    Policies Intents and Policy Sets

    Security

    Reliable Messaging

    Transactions

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    5/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Warehouse

    Service

    WarehouseComposite

    WarehouseBroker

    Component

    Warehouse

    Component

    EventLog

    Component

    OrderProcessing

    Service

    OrderProcessingComponent

    EventLogReference

    ExternalWarehouse

    Reference

    Payments

    Component

    PaymentService

    AccountsComposite

    ExternalBanking

    Reference

    Accounts

    Ledger

    Component

    Example SCA assembly

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    6/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Service

    AccountService

    ReferenceStockQuote

    Service

    AccountData

    ServiceComponent

    bigbank.accountcomposite

    AccountService

    Component

    Service

    AccountService

    ReferenceStockQuote

    Service

    AccountData

    ServiceComponent

    Simple Example

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    7/48

    SCA

    OSOA Collaboration | SOA Roadmap

    XML Representation

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    8/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Java Implementation Example:Service Interface

    package org.example.services.account;

    @Remotable

    public interface AccountService {

    public AccountReport getAccountReport(String customerID);}

    Interface is callable

    remotelyeg. as a Web service

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    9/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Java Implementation Example Implementation (part 1)package org.example.services.account;

    import org.osoa.sca.annotations.*;

    @Service(AccountService.class)

    public class AccountServiceImpl implements AccountService {

    private String currency = "USD";

    private AccountDataService accountDataService;

    private StockQuoteService stockQuoteService;

    public AccountServiceImpl(@Property("currency") String currency,

    @Reference("accountDataService") AccountDataService dataService,

    @Reference("stockQuoteService") StockQuoteService stockService) {

    this.currency = currency;

    this.accountDataService = dataService;

    this.stockQuoteService = stockService;

    } // end constructor

    Defines theservice interface

    Defines a propertycurrency

    Defines referencesaccountDataServiceandstockQuoteService

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    10/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Java Implementation Example Implementation (part 2)

    public AccountReport getAccountReport(int customerID)

    throws AccountDataUnavailableException {

    AccountReport accountReport =

    accountDataService.getAccountReport(customerID);

    List stocks = accountReport.getStocks();

    List stockValues =

    stockQuoteService.getValues( stocks, currency );

    accountReport.setStockValues( values );

    return accountReport;

    }

    } // end class

    Get the basic accountreport using theaccount data service

    Obtain up to datestock values using thestock quote service

    Update the accountreport with the latest

    stock values

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    11/48

    SCA

    OSOA Collaboration | SOA Roadmap

    SCA Java Implementation principles

    Code only to business interfaces

    Dont program to SCA, just program

    Use Java idioms Minimal middleware APIs used only in special cases

    Principles apply to other languages

    Components declare both the servicesthey offer and referencesto other services they need

    Injection of required service References and Property values

    via constructor

    via setter methods

    via direct field injection

    Java annotations for SCA elements

    services, references, properties

    + more advanced features such as intents, bindings

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    12/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Component

    SCA Concepts: Component

    Services

    Business functionprovided to clientsthrough an interfacecontract

    ReferencesImplementationdependency on an

    external service

    PropertiesImplementationconfiguration attribute

    ImplementationThe implementation codefor the component. In anyone of many languages,eg. Java, BPEL, C++, PHP,Composite.

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    13/48

    SCA

    OSOA Collaboration | SOA Roadmap

    SCA Concepts: Wire, Interface, Binding

    Component

    WireConnects services to references

    Component

    BindingAccess mechanism used by services andreferences. For example, Web services binding,JMS binding, EJB Session bean binding

    InterfaceDescription of business functions of services& references. For example, Java interface,WSDL 1.1 portType, WSDL 2.0 interface

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    14/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Bigbank Composite - multiple components,service, reference & property

    bigbank.accountcomposite

    AccountService

    Component

    Service

    AccountService

    ReferenceStockQuoteService

    AccountDataServiceComponent

    ReferenceStockQuoteService

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    15/48

    SCA

    OSOA Collaboration | SOA Roadmap

    StockQuotebigbank.accountcomposite

    AccountServiceComponent

    ServiceAccountService

    ReferenceStockQuoteService

    AccountDataServiceComponent

    ReferenceStockQuoteService

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    16/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Reuse in SCA

    Inclusion Recursive composition

    Implementation reuse through configurable components Reusable services through composite references

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    17/48

    SCA

    OSOA Collaboration | SOA Roadmap

    ComponentType

    Describes component implementation type details

    Services

    References

    Properties

    Extensibility elements

    Can be introspected from the implementationor specified inan XML sidefile

    Typically will be introspected from the implementation

    Component implementations may use annotations to specify

    componentType information eg Java

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    18/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Java Implementation Example: componentType

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    19/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Top-Down Design: constrainingType

    constrainingType

    Implementation independent

    Specifies the shape -- constraints in terms ofservices/references/properties

    composites, components, componentType and implementations canbe constrained using the constrainingType attribute

    Allows an architect to specify constrainingTypes which can be usedby developers as a template

    SCA provides runtime validation of artifacts with its constrainingType

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    20/48

    SCA

    OSOA Collaboration | SOA Roadmap

    constrainingType Example

    EURO

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    21/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Recursive Composition

    Composites and Implementations look the same

    services

    references

    properties

    composites have associated ComponentType

    Recursive composition = nesting of composites composite can be a component implementation in a higher level

    composite

    promotes reuse of assemblies

    as component implementation

    component can be implemented by atomic implementation or bycomposite

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    22/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Implementing AccountDataService Using AComposite

    bigbank.accountcomposite

    AccountServiceComponent

    ServiceAccountService

    ReferenceStockQuoteService

    AccountDataServiceComponent

    bigbank.accountcomposite

    AccountServiceComponent

    ServiceAccountService

    ReferenceStockQuoteService

    AccountDataServiceComponent

    implements

    Service

    AccountDataServiceAccountData Logging

    bigbank.accountdata

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    23/48

    SCA

    OSOA Collaboration | SOA Roadmap

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    24/48

    SCA

    OSOA Collaboration | SOA Roadmap

    AccountDataService ComponentType

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    25/48

    SCA

    OSOA Collaboration | SOA Roadmap

    bigbank.account Composite (recursion)

    EURO

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    26/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Packaging and Deployment: Domains Composites deployed, configured into SCA Domain

    Defines the boundary of visibility for SCA

    Typically an area of functionality controlled by single

    organization/division E.g.: accounts

    Configuration represented by virtual composite

    potentially distributedacross a network of nodes

    contains components, services, references, wires

    configured using composites

    Composites make deployment simpler

    individual composites created, deployed independently

    may contain only wires or components or externally providedservices or references

    Abstract services provided for management of the domain

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    27/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Packaging and Deployment: Contributions

    Contributions hold artifacts available for use in the Domain

    Package containing artifacts necessary for SCA

    SCA defined artifacts

    E.g.: composites, constrainingType, etc

    Non-SCA defined artifacts

    E.g.: WSDL, XML schema, Java classes, object code etc

    Packaging must be hierarchical Metadata included in the META-INF directory

    *

    *

    *

    Interoperable packaging format: ZIP Other formats possible: filesystem directory, OSGi bundle, JAR file

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    28/48

    SCA

    OSOA Collaboration | SOA Roadmap

    SCA Runtime Example

    SCA PHP Container

    Assigned to be

    hosted by SCAJava container Assigned to be

    hosted by SCACPP container

    Runtime Topology

    DeploymentMapping

    Service Compositions

    SCA Domain

    bigbank.accountmanagement

    bigbank.stockquote

    SCA JEE Containers SCA CPP Containers

    SCA Java Containers

    SCA BPEL Container

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    29/48

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    30/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Assembly: Summary

    SCA Assembly models systems composed of reusable services

    A model for service-based system:

    construction

    assembly

    deployment

    Heterogeneity

    Multiple languages

    Multiple container technologies

    Service access methods

    Metadata driven

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    31/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Component Implementation Types

    SCA supports a number of programming models and technologies

    for authoring components

    The SCA Java Implementation type based on POJOs

    Spring

    EJB

    BPEL C++

    PHP

    In the future, potentially others

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    32/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Spring Framework Component Implementation

    SCA = integration at coarse-grained level

    Spring = integration at fine grained level

    Spring application context used as component implementation SCA component implemented by a collection of Spring beans

    Two ways:

    1. No SCA-related metadata in Spring

    2. SCA-related metadata specified as Spring beans

    sca:service

    sca:reference

    sca:property

    Uses

    ...

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    33/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Bigbank implementation using SpringAccountService component

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    34/48

    SCA

    OSOA Collaboration | SOA Roadmap

    BPEL Component Implementation

    SCA and BPEL are complementary

    BPEL provides business sequencing & orchestration of services

    SCA provides a compositional view of interconnection of service components

    Supports WS-BPEL 1.1 and 2.0

    Uses WSDL interfaces

    SCA service = partnerLink with single role belonging to the BPEL process

    SCA reference = partnerLink with single role belonging to partner

    When partnerLink defines two roles, directionality defines whether it is a serviceor a reference

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    35/48

    SCA

    OSOA Collaboration | SOA Roadmap

    BPEL Component Implementation (cont.)

    SCA extensions for BPEL (not mandatory)

    Attribute sca:property on a variable declaration defines a property

    Element sca:multiReference on a variable declaration defines a multivaluedreference (multiple partners for one partnerLink, called in sequence)

    Uses

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    36/48

    SCA

    OSOA Collaboration | SOA Roadmap

    SCA models systems built using a Service Oriented

    Architecture

    supports Service Implementation, Service Assembly

    open to many kinds of service implementation

    open to many types of service access

    declarative intent & policy approach to application of

    Security & Transaction

    Summary

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    37/48

    SCA

    OSOA Collaboration | SOA Roadmap

    Demonstrations

    IBM Demo: HelloWorld sample with a callback (SCA V0.95)

    Oracle Demos: Oracle Fusion Middleware (SCA 0.95) Overview

    Simple SayHello Example Using Jdeveloper (Synchronous)

    Simple HelloWorld Example (Asynchronous)

    OrderBooking Application

    BEA Demo Based on the Fabric3 open source SCA implementation

    (www.fabric3.org)

    Component provisioning in distributed SCA domain across multipleJVMs

    Java SCA 1.0 programming model support

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    38/48

    SCA

    OSOA Collaboration | SOA Roadmap

    IBM Demo: HelloWorld Sample with CallbackHelloWorldWSClient

    HelloWorldService

    Component ReferenceHello Service

    BindingWeb Service

    Implementation- Java

    JSP

    HelloWorldWS

    HelloWorldServiceComponent

    Implementation- Java

    ServiceHello Service

    Service

    WSDL PortType

    Binding

    Web Service

    Service

    PortTypeWSDL

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    39/48

    SC

    OSOA Collaboration | SOA Roadmap

    IBM Demo: HelloWorld Sample with Callback - Client

    HelloWorldService

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    40/48

    OSOA Collaboration | SOA Roadmap

    IBM Demo: HelloWorld Sample with Callback - Service

    HelloWorldServiceComponent

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    41/48

    OSOA Collaboration | SOA Roadmap

    Oracle Demo: Fusion (SCA 0.95) Overview

    JCA

    JMS

    HTTP SCA Runtime(Fusion Middleware)

    Normalized message busComponent lifecycle managementInter-component wiringPolicy enforcement (binding

    independent)Monitoring

    MDS

    UDDI

    BPEL Routing RulesScheduler

    J2EE + Spring

    Bindings

    Service Engines

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    42/48

    OSOA Collaboration | SOA Roadmap

    Oracle Demo: SayHello Example

    (Synchronous)

    SayHello

    SayHelloComponentServiceSoapService1

    Binding

    Web Service

    Service

    WSDL PortType

    Implementation- BPEL

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    43/48

    OSOA Collaboration | SOA Roadmap

    Oracle Demo: HelloWorld Example

    (Asynchronous)

    HelloWorld

    HelloWorldComponentServiceSoapService1

    Binding

    Web Service

    Service

    WSDL PortType

    Implementation- BPEL

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    44/48

    OSOA Collaboration | SOA Roadmap

    Oracle Demo: OrderBooking Application

    OrderProcessor

    Component

    OrderFulfillment

    ComponentApproveOrder

    Component

    ApprovalRequired

    Component

    SelectManufacturerComponent

    EventLoggerComponent

    Order

    .

    .

    ....

    binding.ws

    binding.jca

    Implementation.eventAgent

    Implementation.workflow Implementation.mediator

    Implementation.bpel

    Implementation.decision

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    45/48

    OSOA Collaboration | SOA Roadmap

    ...

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    46/48

    OSOA Collaboration | SOA Roadmap

    BEA/Fabric3 Demo Open source CodeHaus Foundation project (www.fabric3.org) Apache Licensed

    Built around a small embeddable kernel that is highly extensible

    Less than 1MB

    Extension ecosystem, e.g. Spring, OpenJPA

    Focused on

    Implementation quality

    SCA 1.0 support

    Agile development experience and SDK

    Management of distributed SCA domains

    Federated deployment to multiple runtime types

    WebLogicCluster

    SCA DomainController

    Servlet

    Engine

    OSGi

    OtherContainers

    Domains are heterogenous

    Fabric3 may be embedded in avariety of containers

    Manage and provisioncomponents

    SCA

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    47/48

    OSOA Collaboration | SOA Roadmap

    BEA/Fabric3 Demo

    Provision and deploy a Calculator Composite

    Calculator service wired to Add, Subtract, Multiply and Divide services

    SCA Domain

    SCA Composite

    Service Node

    Process the composite,

    resolve wires andallocate to runtimenodes

    Provision componentsto multiple runtimenodes

    Instantiate componentson runtime nodes

    1

    2

    3

    4

    Deploy the SCAcomposite

  • 8/8/2019 SCA Tutorial Part1 Asia-Updated

    48/48

    SCA

    OSOA Collaboration | 30th May 2007 | SOA Roadmap

    Thank you!

    Questions?