300 likes | 411 Views
SCA Assembly Model Anish Karmarkar – Oracle Michael Rowley – BEA . What is SCA Assembly?. SCA Assembly has been alternately described as: Vendor-, technology- and language-neutral representation of the composition of services into business solutions
E N D
SCAAssembly Model Anish Karmarkar – Oracle Michael Rowley – BEA
What is SCA Assembly? • SCA Assembly has been alternately described as: • Vendor-, technology- and language-neutral representation of the composition of services into business solutions • Unified declarative model for describing and deploying service assemblies • Deployment descriptors on steroids • Component implementation technology for configuring and deploying other component implementation technologies • supports recursion of components to create hierarchical composition
Outline • Bigbank composite example • Java implementation example • Interaction models • Interfaces: local, remote, bidirectional, conversational • ComponentType • Recursive composition • Top-down design: constrainingType • Autowiring • Packaging & deployment • Reuse • Extensibility • Summary
AccountsComposite Example SCA assembly External Banking Reference Payments Component Payment Service OrderProcessing Component Order Processing Service Accounts Ledger Component EventLog Component WarehouseComposite External Warehouse Reference Warehouse Broker Component Warehouse Component Warehouse Service EventLog Reference
Bigbank Composite – multiple components, service, reference & property bigbank.accountcomposite Reference Reference StockQuote StockQuote Service Service AccountService Service Component AccountService AccountData Service Component
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://example.org" name="bigbank.accountcomposite"> <composite> <service name="AccountService" promote="AccountServiceComponent"> <interface.java interface="services.account.AccountService"/> <binding.ws port="http://www.example.org/AccountService# wsdl.endpoint(AccountService/AccountServiceSOAP)"/> </service> <component name="AccountServiceComponent"> <implementation.java class="services.account.AccountServiceImpl"/> <reference name="StockQuoteService"/> <reference name="AccountDataService" target="AccountDataServiceComponent/AccountDataService"/> <property name="currency">EURO</property> </component> bigbank.accountcomposite StockQuote Reference Reference StockQuote StockQuote Service Service <component name="AccountDataServiceComponent"> <implementation.bpel process=“QName"/> <service name="AccountDataService"> <interface.java interface="services.accountdata.AccountDataService"/> </service> </component> AccountService Service Component AccountService AccountData Service Component <reference name=“StockQuoteService" promote="AccountServiceComponent/StockQuoteService"> <interface.java interface="services.stockquote.StockQuoteService"/> <binding.ws port="http://example.org/StockQuoteService# wsdl.endpoint(StockQuoteService/StockQuoteServiceSOAP)"/> </reference>
Java Implementation Example: Service Interface Interface is callable remotely eg. as a Web service package org.example.services.account; @Remotable public interface AccountService { public AccountReport getAccountReport(String customerID); }
Java Implementation Example – Implementation 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 the serviceinterface Defines a property“currency” Defines references “accountDataService” and “stockQuoteService”
SCA Interaction Model • Synchronous & Asynchronous service relationships • Conversational services • stateful service interactions • Asynchronous support • “non-blocking” invocation • asynchronous client to synchronous service • callbacks
Interfaces: Local v. Remotable • Supports multiple components within a single process or separate processes • Local interface • Pass-by-reference • Tightly-coupled • Fine-grained • Remote interface • Pass-by-value (with pass-by-reference override) • Loosely-coupled • Coarse-grained • Java interface • Local: default • Remotable: using @remotable annotation • WSDL portType/interface: always remote • ‘local’ attribute override on the <composite> element
Bidirectional Interfaces (Callbacks) • Useful for asynchronous messaging • Support for callbacks using Java interfaces <interface.java interface="services.invoicing.ComputePrice" callbackInterface="services.invoicing.InvoiceCallback"/> • Support for callbacks using WSDL portTypes/interfaces <interface.wsdl interface="http://example.org/inv# wsdl.interface(ComputePrice)" callbackInterface="http://example.org/inv# wsdl.interface(InvoiceCallback)"/>
Conversational Interfaces • Frees application programmer from conversation/correlation management • Imposes requirements on bindings • Interfaces marked as conversational using SCA Policy intent • Specific operations can be marked as “endsConversation” • WSDL extensions for “conversational” and “endsConversation” <portType name="LoanService" sca:requires="conversational"> <operation name="apply"> <input message="tns:ApplicationInput"/> <output message="tns:ApplicationOutput"/> </operation> <operation name="cancel" sca:endsConversation="true"> </operation> ... </portType>
ComponentType • Describes component implementation type details • Services • References • Properties • Extensibility elements • Can be introspected from the implementation or specified in an XML sidefile • Typically will be introspected from the implementation • Component implementations may use annotations to specify componentType information • eg Java
Java Implementation Example: componentType <componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <service name="AccountService"> <interface.java interface="services.account.AccountService"/> </service> <reference name="accountDataService"> <interface.java interface="services.accountdata.AccountDataService"/> </reference> <reference name="stockQuoteService"> <interface.java interface="services.stockquote.StockQuoteService"/> </reference> <property name="currency" type="xsd:string"/> </componentType>
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 • <implementation.composite../> as component implementation • component can be implemented by “atomic” implementation or by composite
Implementing AccountDataService Using a Composite bigbank.accountcomposite bigbank.accountcomposite Reference Reference StockQuote StockQuote Service Service AccountService AccountService Service Service Component Component AccountService AccountService AccountData AccountData Service Service Component Component implements bigbank.accountdata Service AccountData Logging AccountDataService
AccountDataService ComponentType <componentType> <service name="AccountDataService"> <interface.java interface="services.accountdata.AccountDataService"/> </service> </componentType>
bigbank.AccountData Composite <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://example.org" name="bigbank.AccountData"> <service name="AccountDataService" promote="AccountData"> <interface.java interface="services.accountdata.AccountService"/> </service> <component name="AccountDataServiceComponent"> <implementation.bpel process=“..."/> <reference name=“LoggingService" target=“LoggingServiceComponent"/> </component> <component name=“LoggingServiceComponent"> <implementation.spring location=“..."/> </component> <composite>
bigbank.account Composite (recursion) <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://example.org" name="bigbank.accountcomposite"> <service name="AccountService" promote="AccountServiceComponent"> <interface.java interface="services.account.AccountService"/> <binding.ws port="http://..."/> </service> <component name="AccountServiceComponent"> <implementation.java class="services.account.AccountServiceImpl"/> <reference name="StockQuoteService"/> <reference name="AccountDataService" target="AccountDataServiceComponent/AccountDataService"/> <property name="currency">EURO</property> </component> <component name="AccountDataServiceComponent"> <implementation.bpel process=“QName"/> <service name="AccountDataService"> <interface.java interface="services.accountdata.AccountDataService"/> </service> </component> <reference name="" promote="AccountServiceComponent/StockQuoteService"> <interface.java interface="services.stockquote.StockQuoteService"/> <binding.ws port="http://..."/> </reference> <composite> <implementation.composite name=“bb:bigBank.AccountData"/>
Top-Down Design: constrainingType • constrainingType • Implementation independent • Specifies the shape -- constraints in terms of services/references/properties • composites, components, componentType and implementations can be constrained using the “constrainingType” attribute • Allows an architect to specify constrainingTypes which can be used by developers as a template • SCA provides runtime validation of artifacts with its constrainingType
constrainingType Example <constrainingType name=“myCT” ... > <service name="MyValueService"> <interface.java interface="services.myvalue.MyValueService"/> </service> <reference name="customerService"> <interface.java interface="services.customer.CustomerService"/> </reference> <property name="currency" type="xsd:string"/> </constrainingType> <component name="MyValueServiceComponent" constrainingType="myns:myCT”> <implementation.bpel process=“..."/> <service name=“MyValueService”> <interface.java interface="services.myvalue.MyValueService"/> <binding.jms .../> </service> <reference name="customerService" target="CustomerService"> <binding.ws ...> </reference> <property name="currency">EURO</property> </component>
Autowiring • Allows component references to be wired to component services automatically (without explicit wires) • Matches references to services based on compatible interfaces, bindings, policy intents/sets AccountsComposite External Banking Payment Service Service Payments Component Customer Account Component Product Pricing Component Accounts Ledger Component
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 distributed across a network of nodes • containscomponents, services, references, wires • configured using composites • Composites make deployment simpler • individual composites created, deployed independently • may contain only wires or components or externally provided services or references • Abstract services provided for management of the domain
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 <contribution xmlns=http://www.osoa.org/xmlns/sca/1.0> <deployable composite="xs:QName"/>* <import namespace="xs:String" location=”xs:AnyURI”?/>* <export namespace="xs:String"/>* </contribution> • Interoperable packaging format: ZIP • Other formats possible: filesystem directory, OSGi bundle, JAR file
SCA Runtime Example Runtime Topology SCA Java Containers SCA JEE Containers SCA CPP Containers … SCA BPEL Container SCA PHP Container Assigned to be hosted by SCA Java container Deployment Mapping Assigned to be hosted by SCA CPP container SCA Domain bigbank.accountmanagement bigbank.stockquote Service Compositions
Reuse in SCA • Inclusion • Recursive composition • Implementation reuse through configurable components • Reusable services through composite references
Extensibility in SCA • Designed for extensibility • Extensible artifacts: • Implementation types • <implementation.*> • Interface types • <interface.*> • Binding types • <binding.*>
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
Questions? OpenCSA Member Section: http://www.oasis-opencsa.org/ Archived Presentations: http://www.oasis-open.org/events/webinars/
Additions to consider • Multiplicity • Overriding • Inclusion • Domain deployment ops (e.g. addToDomainComposite)