SCA :Assembly Model Specification 摘记

来源:互联网 发布:cp1200对讲机写频软件 编辑:程序博客网 时间:2024/05/29 04:36

1 Assembly Model

1.1 Introduction

A model for the assembly of services

A model for applying infrastructure capabilities to services and to service interactions, including Security and Transactions

1.2 Overview

composite也能作为一个component整合到其它composite中,形成层次结构。

1.2.1 Diagrams used to Represent SCA Artifacts

1.3 Component

There can be zero or more component elements within a composite.

The component element has the following attributes:

--name (required):在composite内是唯一的

--autowire (optional):默认为false

--requires (optional) – a list of policy intents.

--policySets (optional) – a list of policy sets.

--constrainingType (optional)

A component element has zero or one implementation element as its child

未提供implementation的component是不能运行的,但可以作为桩模块。

The component element can have zero or more service elements as children

The service element has the following attributes:

--name (required):与implementation的要一致

--requires (optional)

--policySets (optional)

A service has zero or one interface

The interface is described by an interface element which is a child element of the service element.注意与implementation的兼容性

A service element has one or more binding elements as children。

The component element can have zero or more reference elements as children

The reference element has the following attributes:

--name (required)

--autowire (optional)

--requires (optional)

--policySets (optional)

--multiplicity (optional) - defines the number of wires that can connect the    reference to target services。以reference为源能出来的连线数目

--target (optional)– a list of one or more of target service URI’s, depending on
multiplicity setting

--wiredByImpl (optional)-"false" by default,indicates that the implementation wires this reference dynamically。"true" it indicates that the target of the reference is set at runtime by the implementation code。If "true" is set, then the reference should not be wired statically within a composite, but left unwired.

The component element has zero or more property elements as its children,which are used to configure data values of properties of the implementation

The property value can be specified in one of three ways:

--As a value, supplied as the content of the property element

--By referencing a Property value of the composite which contains the component.用source attribute指定

--By specifying a dereferencable URI to a file containing the property value through the file attribute

the type of the property can be specified in one of two ways:

--by the qualified name of a type defined in an XML schema, using the type attribute

--by the qualified name of a global element in an XML schema, using the element attribute

The property element has the following attributes:

--name (required)

--type (optional)

--element (optional)

--source (optional) an XPath expression

--file (optional)

--many (optional)whether the property is single-valued (false) or multi valued (true)

1.3.1 Example Component

1.4 Implementation

implementation.composite java bpel spring ejp

The characteristics of services, references and properties are described in the Component section. Component type

Java, provide annotations which can be used to declare services, references and properties inline in the code.

1.4.1 Component Type

Component type represents the configurable aspects of an implementation. consists of services that are offered, references to other services that can be wired and properties that can be set.

component type is calculated in two steps.Step one is introspecting the implementation (if possible),including the inspection of implementation annotations (if available). Step two covers the cases where introspection of the implementation is not possible or where it does not provide complete information and it involves looking for an SCA component type file.

component type file(XX.componentType)存储 component type 信息,必须与在implementation中检测到的一致

The componentType element can contain Service elements, Reference elements and Property elements,Implementation elements

1.4.1.1 Example ComponentType

1.4.1.2 Example Implementation

1.5 Interface

Interfaces define one or more business functions. These business functions are provided by Services and are used by References.

request (input) message , response (output) message.

1.5.1 Local and Remotable Interfaces

@Remotable  WSDL defined interfaces are always remotable

Remotable service Interfaces MUST NOT make use of method or operation overloading

the default data exchange semantics for remote interfaces are by-value

It is possible for the implementation of a remotable service to indicate that it can be called using by-reference data exchange semantics when it is called from a component in the same process.This can be done using the @AllowsPassByReference annotation

In the case of Java a local service is defined by a Java interface definition without a @Remotable annotation

Local service interfaces can make use of method or operation overloading

The data exchange semantic for calls to services typed by local interfaces is by-reference

1.5.2 Bidirectional Interfaces

This is especially the case when the interactions are based on asynchronous messaging

The notion of bidirectional interfaces is used in SCA to directly model peer-to-peer bidirectional business service relationships.

If a callback interface is specified SCA refers to the interface as a whole as a bidirectional interface.

A bidirectional service MUST NOT mix local and remote services

1.5.3 Conversational Interfaces

Instead, there is a sequence of operations that must be called in order to achieve some higher level goal. SCA calls this sequence of operations a conversation.

If the service uses a bidirectional interface, the conversation may include both operations and callbacks.

conversational services are typically managed by using conversation identifiers that are communicated separately from application data (possibly in headers).

SCA introduces the concept of conversational interfaces for describing the interface contract for conversational services

Conversational services typically involve state data that relates to the conversation that is taking place

要写conversational services必须:

--choose or define a protocol to communicate conversational (correlation) information between the client & provider

--route conversational messages in the provider to a machine that can handle that conversation, while handling concurrent data access issues

--write code in the client to use/encode the conversational information

--maintain state that is specific to the conversation, sometimes persistently and
transactionally, both in the implementation and the client.

number of roles

--Application Developer:Declares that a service interface is conversational,Uses lifecycle semantics, APIs or other programmatic mechanisms to manage conversational state.

--Application Assembler: chooses a binding that can support conversations

--Implementation-Type Provider: defines APIs

in Java, the conversation is new on the first use of an injected reference; in BPEL, the conversation is new when the client’s partnerLink comes into scope

When a conversation ending operation is called, it indicates to both the client and the service provider that the conversation is complete

1.5.4 SCA-Specific Aspects for WSDL Interfaces

First, SCA defines a global attribute in the SCA namespace which provides a mechanism to attach policy intents - @requires.

requires="conversational"

1.6 Composite

An SCA composite contains a set of components, services, references and the wires that interconnect them, plus a set of properties which can be used to configure components.

the higher-level composites can have components that are implemented by composites

The content of a composite may be used within another composite through inclusion.

A composite can be used as a unit of deployment

Wires describe the connections between component services and component references within the composite

1.6.1 Property – Definition and Configuration

Properties allow for the configuration of an implementation with externally set data values.

1.6.1.1 Property Examples

1.6.2 References

The references of a composite are defined by promoting references defined by components contained in the composite.

interface-provide a superset of the operations defined by the component for the reference

The value specified for the multiplicity attribute has to be compatible with the multiplicity specified on the component reference, i.e. it has to be equal or further restrict.

If one or more bindings are specified they override any and all of the bindings defined for the promoted component reference from the composite reference perspective.

The bindings defined on the component reference are still in effect for local wires within the composite

If the target attribute is set, then binding elements can only list one or more binding types that can be used for the wires identified by the target attribute.

The same component reference maybe promoted more than once, using different composite references

Two or more component references may be promoted by one composite reference.满足条件:1 component接口一样,或在composite中有接口定义时,均与之兼容。2 multiplicities 兼容 3 intents兼容,composite中是component的union

1.6.2.1 Example Reference

1.6.3 Service

The services of a composite are defined by promoting services defined by components contained in the composite.

If an interface is specified it must be the same or a compatible subset of the interface provided by the promoted component service,

1.6.3.1 Service Examples

1.6.4 Wire

SCA wires within a composite connect source component references to target component services.

One way of defining a wire is by configuring a reference of a component using its target attribute.

An alternative way of defining a Wire is by means of a wire element which is a child of the composite element

Deploying the wiring separately from the components allows the wiring to be created or modified with minimum effort.

A wire may only connect a source to a target if the target implements an interface that is compatible with the interface required by the source.

The source and the target are compatible if:

1.6.4.1 Wire Examples

1.6.4.2 Autowire

Autowire, which can help to simplify the assembly of composites

Autowire enables component references to be automatically wired to component services which will satisfy those references

Compatible here means:

the target service interface must be a compatible superset of the reference interface

the intents, bindings and policies applied to the service must be compatible on the
referenc

1.6.4.3 Autowire Examples

1.6.5 Using Composites as Component Implementations

The concept of completeness of the composite implies:

the composite must have at least one service or at least one reference

each service offered by the composite must be wired to a service of a component or to a composite reference.

implementation.composite

1.6.5.1 Example of Composite used as a Component Implementation

1.6.6 Using Composites through Inclusion

A composite is defined in an xxx.composite file and the composite may receive additional content through the inclusion of other composite files.

the text content of the included composite is placed into the using composite in place of the include statement.

1.6.6.1 Included Composite Examples

1.6.7 Composites which Include Component Implementations of Multiple Types

1.6.8 ConstrainingType

A constrainingType is expressed as an element which has services, reference and properties as child elements and which can have intents applied to it.

it cannot contain bindings, policySets, property values or default wiring information.

When an implementation is constrained by a constrainingType it must define all the services,references and properties specified in the corresponding constrainingType.

an additional service provided by the implementation which is not in the constrainingType associated with the component cannot be promoted by the containing composite.

1.6.8.1 Example constrainingType

1.7 Binding

References use bindings to describe the access mechanism used to call a service

binding type:SCA service,Web service, stateless session EJB, data base stored procedure, EIS service.

When multiple bindings exist for an service, it means that the service is available by any of the specified bindings.

1.7.1 Messages containing Data not defined in the Service Interface

1.7.2 Form of the URI of a Deployed Binding

1.7.2.1 Constructing Hierarchical URIs

Base System URI for a scheme / Component URI / Service Binding URI

Where a component has only a single service, the default value of the Service Binding URI is null

Base Domain URI for a scheme / Component URI

Services deployed into the Domain  have a URI that does not include a component name

1.7.2.2 Non-hierarchical URIs

1.7.2.3 Determining the URI scheme of a deployed binding

1.7.3 SCA Binding

<binding.sca />

The SCA binding can be used for service interactions between references and services contained within the SCA domain、

实现方式由SCA runtimes指定

The SCA binding type is not intended to be an interoperable binding type

A service or reference definition with no binding element specified uses the SCA binding.

1.7.3.1 Example SCA Binding

1.7.4 Web Service Binding

1.7.5 JMS Binding

1.8 SCA Definitions

1.9 Extension Model

1.10 Packaging and Deployment

1.10.1 Domains

An SCA Domain represents a complete runtime configuration, potentially distributed over a series of interconnected runtime nodes.

SCA wires can only be used to connect components within a single SCA domain.

Connections to services outside the domain must use binding specific mechanisms for addressing services

SCA mechanisms such as intents and policySets can only be used in the context of a single domain

1.10.2 Contributions

The SCA-defined artifact types are all XML documents.

Non-XML artifacts are also required within an SCA domain,like java

SCA defines an interoperable packaging format for contributions (ZIP)

a Java EE based SCA runtime may convert the ZIP package to an EAR package.

1.10.2.1 SCA Artifact Resolution

1.10.2.2 SCA Contribution Metadata Document

1.10.2.3 Contribution Packaging using ZIP

1.10.3 Installed Contribution

2 Appendix 1
2.1 XML Schemas

2.2 SCA Concepts

 
原创粉丝点击