Service Component Architecture SCA-J Common Annotations and APIs Specification Version 1.1

Committee Draft 03 / Public Review Draft 01

4 May 2009

Specification URIs:

This Version:

http://docs.oasis-open.org/opencsa/sca-j/sca-javacaa-1.1-spec-cd03.html

http://docs.oasis-open.org/opencsa/sca-j/sca-javacaa-1.1-spec-cd03.doc

http://docs.oasis-open.org/opencsa/sca-j/sca-javacaa-1.1-spec-cd03.pdf (Authoritative)

Previous Version:

N/A

Latest Version:

http://docs.oasis-open.org/opencsa/sca-j/sca-javacaa-1.1-spec.html

http://docs.oasis-open.org/opencsa/sca-j/sca-javacaa-1.1-spec.doc

http://docs.oasis-open.org/opencsa/sca-j/sca-javacaa-1.1-spec.pdf (Authoritative)

Technical Committee:

OASIS Service Component Architecture / J (SCA-J) TC

Chair(s):

David Booz, IBM

Mark Combellack, Avaya

Editor(s):

David Booz, IBM

Mark Combellack, Avaya

Mike Edwards, IBM

Anish Karmarkar, Oracle

Related work:

This specification replaces or supersedes:

·         Service Component Architecture Java Annotations and APIs Specification Version 1.00, March 21 2007

This specification is related to:

·         Service Component Architecture Assembly Model Specification Version 1.1

·         Service Component Architecture Policy Framework Specification Version 1.1

Declared XML Namespace(s):

http://docs.oasis-open.org/ns/opencsa/sca/200903

Abstract:

The SCA-J Common Annotations and APIs specification defines a Java syntax for programming concepts defined in the SCA Assembly Model Specification. It specifies a set of APIs and annotations that can be used by Java-based artifacts described by other SCA specifications such as the POJO Component Implementation Specification [JAVA_CI]

Specifically, this specification covers:

1.     Implementation metadata for specifying component services, references, and properties

2.     A client and component API

3.     Metadata for asynchronous services

4.     Metadata for callbacks

5.     Definitions of standard component implementation scopes

6.     Java to WSDL and WSDL to Java mappings

7.     Security policy annotations

Note that other Java-based SCA specifications can choose to implement their own mappings of assembly model concepts using native APIs and idioms when appropriate.

Status:

This document was last revised or approved by the OASIS Service Component Architecture / J (SCA-J) TC on the above date. The level of approval is also listed above. Check the “Latest Version” or “Latest Approved Version” location noted above for possible later revisions of this document.

Technical Committee members should send comments on this specification to the Technical Committee’s email list. Others should send comments to the Technical Committee by using the “Send A Comment” button on the Technical Committee’s web page at http://www.oasis-open.org/committees/sca-j/.

For information on whether any patents have been disclosed that might be essential to implementing this specification, and any offers of patent licensing terms, please refer to the Intellectual Property Rights section of the Technical Committee web page (http://www.oasis-open.org/committees/sca-j/ipr.php.

The non-normative errata page for this specification is located at http://www.oasis-open.org/committees/sca-j/.

Notices

Copyright © OASIS® 2005, 2009. All Rights Reserved.

All capitalized terms in the following text have the meanings assigned to them in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). The full Policy may be found at the OASIS website.

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published, and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this section are included on all such copies and derivative works. However, this document itself may not be modified in any way, including by removing the copyright notice or references to OASIS, except as needed for the purpose of developing any document or deliverable produced by an OASIS Technical Committee (in which case the rules applicable to copyrights, as set forth in the OASIS IPR Policy, must be followed) or as required to translate it into languages other than English.

The limited permissions granted above are perpetual and will not be revoked by OASIS or its successors or assigns.

This document and the information contained herein is provided on an "AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

OASIS requests that any OASIS Party or any other party that believes it has patent claims that would necessarily be infringed by implementations of this OASIS Committee Specification or OASIS Standard, to notify OASIS TC Administrator and provide an indication of its willingness to grant patent licenses to such patent claims in a manner consistent with the IPR Mode of the OASIS Technical Committee that produced this specification.

OASIS invites any party to contact the OASIS TC Administrator if it is aware of a claim of ownership of any patent claims that would necessarily be infringed by implementations of this specification by a patent holder that is not willing to provide a license to such patent claims in a manner consistent with the IPR Mode of the OASIS Technical Committee that produced this specification. OASIS may include such claims on its website, but disclaims any obligation to do so.

OASIS takes no position regarding the validity or scope of any intellectual property or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; neither does it represent that it has made any effort to identify any such rights. Information on OASIS' procedures with respect to rights in any document or deliverable produced by an OASIS Technical Committee can be found on the OASIS website. Copies of claims of rights made available for publication and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this OASIS Committee Specification or OASIS Standard, can be obtained from the OASIS TC Administrator. OASIS makes no representation that any information or list of intellectual property rights will at any time be complete, or that any claims in such list are, in fact, Essential Claims.

The names "OASIS",  are trademarks of OASIS, the owner and developer of this specification, and should be used only to refer to the organization and its official outputs. OASIS welcomes reference to, and implementation and use of, specifications, while reserving the right to enforce its marks against misleading uses. Please see http://www.oasis-open.org/who/trademark.php for above guidance.

 

Table of Contents

1      Introduction. 7

1.1 Terminology. 7

1.2 Normative References. 7

1.3 Non-Normative References. 8

2      Implementation Metadata. 9

2.1 Service Metadata. 9

2.1.1 @Service. 9

2.1.2 Java Semantics of a Remotable Service. 9

2.1.3 Java Semantics of a Local Service. 9

2.1.4 @Reference. 10

2.1.5 @Property. 10

2.2 Implementation Scopes: @Scope, @Init, @Destroy. 10

2.2.1 Stateless Scope. 10

2.2.2 Composite Scope. 11

2.3 @AllowsPassByReference. 11

2.3.1 Marking Services and References as “allows pass by reference” 12

2.3.2 Applying “allows pass by reference” to Service Proxies. 12

2.3.3 Using “allows pass by reference” to Optimize Remotable Calls. 13

3      Interface. 14

3.1 Java Interface Element – <interface.java>. 14

3.2 @Remotable. 15

3.3 @Callback. 15

3.4 SCA Java Annotations for Interface Classes. 15

4      SCA Component Implementation Lifecycle. 16

4.1 Overview of SCA Component Implementation Lifecycle. 16

4.2 SCA Component Implementation Lifecycle State Diagram.. 16

4.2.1 Constructing State. 17

4.2.2 Injecting State. 17

4.2.3 Initializing State. 18

4.2.4 Running State. 18

4.2.5 Destroying State. 18

4.2.6 Terminated State. 19

5      Client API 20

5.1 Accessing Services from an SCA Component 20

5.1.1 Using the Component Context API 20

5.2 Accessing Services from non-SCA Component Implementations. 20

5.2.1 ComponentContext 20

6      Error Handling. 21

7      Asynchronous Programming. 22

7.1 @OneWay. 22

7.2 Callbacks. 22

7.2.1 Using Callbacks. 22

7.2.2 Callback Instance Management 24

7.2.3 Implementing Multiple Bidirectional Interfaces. 24

7.2.4 Accessing Callbacks. 25

8      Policy Annotations for Java. 26

8.1 General Intent Annotations. 26

8.2 Specific Intent Annotations. 28

8.2.1 How to Create Specific Intent Annotations. 28

8.3 Application of Intent Annotations. 29

8.3.1 Intent Annotation Examples. 29

8.3.2 Inheritance and Annotation. 31

8.4 Relationship of Declarative and Annotated Intents. 32

8.5 Policy Set Annotations. 32

8.6 Security Policy Annotations. 34

8.6.1 Security Interaction Policy. 34

9      Java API 36

9.1 Component Context 36

9.2 Request Context 37

9.3 ServiceReference. 38

9.4 ServiceRuntimeException. 38

9.5 ServiceUnavailableException. 39

9.6 InvalidServiceException. 39

9.7 Constants. 39

10     Java Annotations. 40

10.1 @AllowsPassByReference. 40

10.2 @Authentication. 41

10.3 @Callback. 42

10.4 @ComponentName. 43

10.5 @Confidentiality. 43

10.6 @Constructor 44

10.7 @Context 45

10.8 @Destroy. 45

10.9 @EagerInit 46

10.10 @Init 46

10.11 @Integrity. 47

10.12 @Intent 48

10.13 @OneWay. 48

10.14 @PolicySets. 49

10.15 @Property. 50

10.16 @Qualifier 51

10.17 @Reference. 51

10.17.1 Reinjection. 54

10.18 @Remotable. 55

10.19 @Requires. 57

10.20 @Scope. 57

10.21 @Service. 58

11     WSDL to Java and Java to WSDL. 60

11.1 JAX-WS Client Asynchronous API for a Synchronous Service. 60

12     Conformance. 62

12.1 SCA Java XML Document 62

12.2 SCA Java Class. 62

12.3 SCA Runtime. 62

A.     XML Schema: sca-interface-java.xsd. 63

B.     Conformance Items. 64

C.     Acknowledgements. 71

D.     Non-Normative Text 73

E.     Revision History. 74

 

 


1      Introduction

The SCA-J Common Annotations and APIs specification defines a Java syntax for programming concepts defined in the SCA Assembly Model Specification [ASSEMBLY]. It specifies a set of APIs and annotations that can be used by SCA Java-based specifications. 

Specifically, this specification covers:

 

1.    Implementation metadata for specifying component services, references, and properties

2.    A client and component API

3.    Metadata for asynchronous services

4.    Metadata for callbacks

5.    Definitions of standard component implementation scopes

6.    Java to WSDL and WSDL to Java mappings

7.    Security policy annotations

The goal of defining the annotations and APIs in this specification is to promote consistency and reduce duplication across the various SCA Java-based specifications. The annotations and APIs defined in this specification are designed to be used by other SCA Java-based specifications in either a partial or complete fashion.

1.1 Terminology

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC2119].

1.2 Normative References

[RFC2119]               S. Bradner, Key words for use in RFCs to Indicate Requirement Levels, http://www.ietf.org/rfc/rfc2119.txt, IETF RFC 2119, March 1997.

[ASSEMBLY]          SCA Assembly Model Specification Version 1.1,
http://docs.oasis-open.org/opencsa/sca-assembly/sca-assembly-1.1-spec-cd03.pdf

[JAVA_CI]               SCA POJO Component Implementation Specification Version 1.1

                              http://docs.oasis-open.org/opencsa/sca-j/sca-javaci-1.1-spec-cd01.pdf

[SDO]                     SDO 2.1 Specification,
http://www.osoa.org/download/attachments/36/Java-SDO-Spec-v2.1.0-FINAL.pdf

[JAX-B]                   JAXB 2.1 Specification,
http://www.jcp.org/en/jsr/detail?id=222

[WSDL]                   WSDL Specification,
WSDL 1.1: http://www.w3.org/TR/wsdl,

[POLICY]                SCA Policy Framework Version 1.1,
http://docs.oasis-open.org/opencsa/sca-policy/sca-policy-1.1-spec-cd02.pdf

[JSR-250]                Common Annotations for the Java Platform specification (JSR-250), http://www.jcp.org/en/jsr/detail?id=250

[JAX-WS]                JAX-WS 2.1 Specification (JSR-224),
http://www.jcp.org/en/jsr/detail?id=224

[JAVABEANS]        JavaBeans 1.01 Specification,
http://java.sun.com/javase/technologies/desktop/javabeans/api/

[JAAS]                    Java Authentication and Authorization Service Reference Guide

                              http://java.sun.com/javase/6/docs/technotes/guides/security/jaas/JAASRefGuide.html

1.3 Non-Normative References

[EBNF-Syntax]        Extended BNF syntax format used for formal grammar of constructs
http://www.w3.org/TR/2004/REC-xml-20040204/#sec-notation

2      Implementation Metadata

This section describes SCA Java-based metadata, which applies to Java-based implementation types.

2.1 Service Metadata

2.1.1 @Service

The @Service annotation is used on a Java class to specify the interfaces of the services provided by the implementation. Service interfaces are defined in one of the following ways:

·         As a Java interface

·         As a Java class

·         As a Java interface generated from a Web Services Description Language [WSDL] (WSDL) portType (Java interfaces generated from WSDL portTypes are always remotable)

2.1.2 Java Semantics of a Remotable Service

A remotable service is defined using the @Remotable annotation on the Java interface or Java class that defines the service. Remotable services are intended to be used for coarse grained services, and the parameters are passed by-value. Remotable Services MUST NOT make use of method overloading. [JCA20001]

The following snippet shows an example of a Java interface for a remotable service:

package services.hello;

@Remotable

public interface HelloService {

      String hello(String message);

}

2.1.3 Java Semantics of a Local Service

A local service can only be called by clients that are deployed within the same address space as the component implementing the local service.

A local interface is defined by a Java interface or a Java class with no @Remotable annotation.

The following snippet shows an example of a Java interface for a local service:

package services.hello;

public interface HelloService {

      String hello(String message);

}

 

The style of local interfaces is typically fine grained and is intended for tightly coupled interactions.

The data exchange semantic for calls to local services is by-reference.  This means that implementation code which uses a local interface needs to be written with the knowledge that changes made to parameters (other than simple types) by either the client or the provider of the service are visible to the other. 

2.1.4 @Reference

Accessing a service using reference injection is done by defining a field, a setter method, or a constructor parameter typed by the service interface and annotated with a @Reference annotation.

2.1.5 @Property

Implementations can be configured with data values through the use of properties, as defined in the SCA Assembly Model specification [ASSEMBLY]. The @Property annotation is used to define an SCA property.

2.2 Implementation Scopes: @Scope, @Init, @Destroy

Component implementations can either manage their own state or allow the SCA runtime to do so. In the latter case, SCA defines the concept of implementation scope, which specifies a visibility and lifecycle contract an implementation has with the SCA runtime. Invocations on a service offered by a component will be dispatched by the SCA runtime to an implementation instance according to the semantics of its implementation scope.

Scopes are specified using the @Scope annotation on the implementation class.

This specification defines two scopes:

·         STATELESS

·         COMPOSITE

Java-based implementation types can choose to support any of these scopes, and they can define new scopes specific to their type.

An implementation type can allow component implementations to declare lifecycle methods that are called when an implementation is instantiated or the scope is expired.

@Init denotes a method called upon first use of an instance during the lifetime of the scope (except for composite scoped implementation marked to eagerly initialize, see section Composite Scope).

@Destroy specifies a method called when the scope ends.

Note that only no-argument methods with a void return type can be annotated as lifecycle methods.

The following snippet is an example showing a fragment of a service implementation annotated with lifecycle methods:

 

            @Init

      public void start() {

            ...

      }

 

      @Destroy

      public void stop() {

            ...

      }    

 

The following sections specify the two standard scopes which a Java-based implementation type can support.

2.2.1 Stateless Scope

For stateless scope components, there is no implied correlation between implementation instances used to dispatch service requests. 

The concurrency model for the stateless scope is single threaded. This means that the SCA runtime MUST ensure that a stateless scoped implementation instance object is only ever dispatched on one thread at any one time. [JCA20002] In addition, within the SCA lifecycle of a stateless scoped implementation instance, the SCA runtime MUST only make a single invocation of one business method. [JCA20003] Note that the SCA lifecycle might not correspond to the Java object lifecycle due to runtime techniques such as pooling.

2.2.2 Composite Scope

The meaning of "composite scope" is defined in relation to the composite containing the component.

It is important to distinguish between different uses of a composite, where these uses affect the numbers of instances of components within the composite.  There are 2 cases:

a)    Where the composite containing the component using the Java implementation is the SCA Domain (i.e. a deployment composite declares the component using the implementation)

b)    Where the composite containing the component using the Java implementation is itself used as the implementation of a higher level component (any level of nesting is possible, but the component is NOT at the Domain level)

Where an implementation is used by a "domain level component", and the implementation is marked "Composite" scope, the SCA runtime MUST ensure that all consumers of the component appear to be interacting with a single runtime instance of the implementation. [JCA20004]

Where an implementation is marked "Composite" scope and it is used by a component that is nested inside a composite that is used as the implementation of a higher level component, the SCA runtime MUST ensure that all consumers of the component appear to be interacting with a single runtime instance of the implementation. There can be multiple instances of the higher level component, each running on different nodes in a distributed SCA runtime. [JCA20008]

The SCA runtime can exploit shared state technology in combination with other well known high availability techniques to provide the appearance of a single runtime instance for consumers of composite scoped components.

The lifetime of the containing composite is defined as the time it becomes active in the runtime to the time it is deactivated, either normally or abnormally.

When the implementation class is marked for eager initialization, the SCA runtime MUST create a composite scoped instance when its containing component is started. [JCA20005] If a method of an implementation class is marked with the @Init annotation, the SCA runtime MUST call that method when the implementation instance is created. [JCA20006]

The concurrency model for the composite scope is multi-threaded. This means that the SCA runtime MAY run multiple threads in a single composite scoped implementation instance object and the SCA runtime MUST NOT perform any synchronization. [JCA20007]

2.3 @AllowsPassByReference

Calls to remotable services (see section "Java Semantics of a Remotable Service") have by-value semantics.  This means that input parameters passed to the service can be modified by the service without these modifications being visible to the client.  Similarly, the return value or exception from the service can be modified by the client without these modifications being visible to the service implementation.  For remote calls (either cross-machine or cross-process), these semantics are a consequence of marshalling input parameters, return values and exceptions “on the wire” and unmarshalling them “off the wire” which results in physical copies being made.  For local method calls within the same JVM, Java language calling semantics are by-reference and therefore do not provide the correct by-value semantics for SCA remotable interfaces.  To compensate for this, the SCA runtime can intervene in these calls to provide by-value semantics by making copies of any mutable objects passed.

The cost of such copying can be very high relative to the cost of making a local call, especially if the data being passed is large.  Also, in many cases this copying is not needed if the implementation observes certain conventions for how input parameters, return values and exceptions are used.  The @AllowsPassByReference annotation allows service method implementations and client references to be marked as “allows pass by reference” to indicate that they use input parameters, return values and exceptions in a manner that allows the SCA runtime to avoid the cost of copying mutable objects when a remotable service is called locally within the same JVM.

2.3.1 Marking Services and References as “allows pass by reference”

Marking a service method implementation as “allows pass by reference” asserts that the method implementation observes the following restrictions:

·         Method execution will not modify any input parameter before the method returns.

·         The service implementation will not retain a reference to any mutable input parameter, mutable return value or mutable exception after the method returns.

·         The method will observe “allows pass by value” client semantics (see below) for any callbacks that it makes.

See section "@AllowsPassByReference" for details of how the @AllowsPassByReference annotation is used to mark a service method implementation as “allows pass by reference”.

Marking a client reference as “allows pass by reference” asserts that method calls through the reference observe the following restrictions:

·         The client implementation will not modify any of the method’s input parameters before the method returns.  Such modifications might occur in callbacks or separate client threads.

·         If the method is one-way, the client implementation will not modify any of the method’s input parameters at any time after calling the method.  This is because one-way method calls return immediately without waiting for the service method to complete.

See section "Applying “allows pass by reference” to Service Proxies" for details of how the @AllowsPassByReference annotation is used to mark a client reference as “allows pass by reference”.

2.3.2 Applying “allows pass by reference” to Service Proxies

Service method calls are made by clients using service proxies, which can be obtained by injection into client references or by making API calls.  A service proxy is marked as “allows pass by reference” if and only if any of the following applies:

·         It is injected into a reference or callback reference that is marked “allows pass by reference”.

·         It is obtained by calling ComponentContext.getService() or ComponentContext.getServices() with the name of a reference that is marked “allows pass by reference”.

·         It is obtained by calling RequestContext.getCallback() from a service implementation that is marked “allows pass by reference”.

·         It is obtained by calling ServiceReference.getService() on a service reference that is marked “allows pass by reference” (see definition below).

A service reference for a remotable service call is marked “allows pass by reference” if and only if any of the following applies:

·         It is injected into a reference or callback reference that is marked “allows pass by reference”.

·         It is obtained by calling ComponentContext.getServiceReference() or ComponentContext.getServiceReferences() with the name of a reference that is marked “allows pass by reference”.

·         It is obtained by calling RequestContext.getCallbackReference() from a service implementation that is marked “allows pass by reference”.

·         It is obtained by calling ComponentContext.cast() on a proxy that is marked “allows pass by reference”.

2.3.3 Using “allows pass by reference” to Optimize Remotable Calls

The SCA runtime MAY use by-reference semantics when passing input parameters, return values or exceptions on calls to remotable services within the same JVM if both the service method implementation and the service proxy used by the client are marked “allows pass by reference”. [JCA20009]

The SCA runtime MUST use by-value semantics when passing input parameters, return values and exceptions on calls to remotable services within the same JVM if the service method implementation is not marked “allows pass by reference” or the service proxy used by the client is not marked “allows pass by reference”. [JCA20010]

3      Interface

This section describes the SCA Java interface element and the SCA metadata for Java interfaces.

3.1 Java Interface Element – <interface.java>

The Java interface element is used in SCA Documents in places where an interface is declared in terms of a Java interface class. The Java interface element identifies the Java interface class and can also identify a callback interface, where the first Java interface represents the forward (service) call interface and the second interface represents the interface used to call back from the service to the client.

The interface.java element MUST conform to the schema defined in the sca-interface-java.xsd schema. [JCA30004]

The following is the pseudo-schema for the interface.java element

 

<interface.java interface="NCName" callbackInterface="NCName"?          
               
requires="list of xs:QName"?
               
policySets="list of xs:QName"?
               
remotable="boolean"?/>

 

The interface.java element has the following attributes:

·         interface : NCName (1..1) – the Java interface class to use for the service interface. The value of the @interface attribute MUST be the fully qualified name of the Java interface class [JCA30001]

·         callbackInterface : NCName (0..1) – the Java interface class to use for the callback interface. The value of the @callbackInterface attribute MUST be the fully qualified name of a Java interface used for callbacks [JCA30002]

·         requires : QName (0..1) – a list of policy intents. See the Policy Framework specification [POLICY] for a description of this attribute

·         policySets : QName (0..1) – a list of policy sets. See the Policy Framework specification [POLICY] for a description of this attribute.

·         remotable : boolean (0..1) – indicates whether or not the interface is remotable.  A value of “true” means the interface is remotable and a value of “false” means it is not.  This attribute does not have a default value.  If it is not specified then the remotability is determined by the presence or absence of the @Remotable annotation.  The @remotable attribute applies to both the interface and any optional callbackInterface.  The @remotable attribute is intended as an alternative to using the @Remotable annotation.  The value of the @remotable attribute on the <interface.java/> element does not override the presence of a @Remotable annotation on the interface class and so if the interface class contains a @Remotable annotation and the @remotable attribute has a value of "false", then the SCA Runtime MUST raise an error and MUST NOT run the component concerned. [JCA30005]

 

The following snippet shows an example of the Java interface element:

 

<interface.java interface="services.stockquote.StockQuoteService"

      callbackInterface="services.stockquote.StockQuoteServiceCallback"/>

 

Here, the Java interface is defined in the Java class file ./services/stockquote/StockQuoteService.class, where the root directory is defined by the contribution in which the interface exists. Similarly, the callback interface is defined in the Java class file ./services/stockquote/StockQuoteServiceCallback.class.

Note that the Java interface class identified by the @interface attribute can contain a Java @Callback annotation which identifies a callback interface. If this is the case, then it is not necessary to provide the @callbackInterface attribute. However, if the Java interface class identified by the @interface attribute does contain a Java @Callback annotation, then the Java interface class identified by the @callbackInterface attribute MUST be the same interface class. [JCA30003]

For the Java interface type system, parameters and return types of the service methods are described using Java classes or simple Java types. It is recommended that the Java Classes used conform to the requirements of either JAXB [JAX-B] or of Service Data Objects [SDO] because of their integration with XML technologies.

3.2 @Remotable

The @Remotable annotation on a Java interface indicates that the interface is designed to be used for remote communication.  Remotable interfaces are intended to be used for coarse grained services.  Operations' parameters, return values and exceptions are passed by-value. Remotable Services are not allowed to make use of method overloading.

3.3 @Callback

A callback interface is declared by using a @Callback annotation on a Java service interface, with the Java Class object of the callback interface as a parameter. There is another form of the @Callback annotation, without any parameters, that specifies callback injection for a setter method or a field of an implementation.

3.4 SCA Java Annotations for Interface Classes

A Java implementation class referenced by the @interface or the @callbackInterface attribute of an <interface.java/> element MUST NOT contain the following SCA Java annotations:

@Intent, @Qualifier. [JCA30008]

A Java interface referenced by the @interface attribute of an <interface.java/> element MUST NOT contain any of the following SCA Java annotations:

@AllowsPassByReference, @ComponentName, @Constructor, @Context, @Destroy, @EagerInit, @Init, @Intent, @Property, @Qualifier, @Reference, @Scope, @Service. [JCA30006]

A Java interface referenced by the @callbackInterface attribute of an <interface.java/> element MUST NOT contain any of the following SCA Java annotations:

@AllowsPassByReference, @Callback, @ComponentName, @Constructor, @Context, @Destroy, @EagerInit, @Init, @Intent, @Property, @Qualifier, @Reference, @Scope, @Service. [JCA30007]

 

4      SCA Component Implementation Lifecycle

This section describes the lifecycle of an SCA component implementation.

4.1 Overview of SCA Component Implementation Lifecycle

At a high level, there are 3 main phases through which an SCA component implementation will transition when it is used by an SCA Runtime:

1.    The Initialization phase. This involves constructing an instance of the component implementation class and injecting any properties and references. Once injection is complete, the method annotated with @Init is called, if present, which provides the component implementation an opportunity to perform any internal initialization it requires.

2.    The Running phase. This is where the component implementation has been initialized and the SCA Runtime can dispatch service requests to it over its Service interfaces. 

3.    The Destroying phase. This is where the component implementation’s scope has ended and the SCA Runtime destroys the component implementation instance. The SCA Runtime calls the method annotated with @Destroy, if present, which provides the component implementation an opportunity to perform any internal clean up that is required.

4.2 SCA Component Implementation Lifecycle State Diagram

The state diagram in Figure 4.1 shows the lifecycle of an SCA component implementation. The sections that follow it describe each of the states that it contains.

It should be noted that some component implementation specifications might not implement all states of the lifecycle. In this case, that state of the lifecycle is skipped over.

 

Figure 4.1 SCA - Component implementation lifecycle

4.2.1 Constructing State

The SCA Runtime MUST call a constructor of the component implementation at the start of the Constructing state. [JCA40001] The SCA Runtime MUST perform any constructor reference or property injection when it calls the constructor of a component implementation. [JCA40002]

The result of invoking operations on any injected references when the component implementation is in the Constructing state is undefined.

When the constructor completes successfully, the SCA Runtime MUST transition the component implementation to the Injecting state. [JCA40003] If an exception is thrown whilst in the Constructing state, the SCA Runtime MUST transition the component implementation to the Terminated state. [JCA40004]

4.2.2 Injecting State

When a component implementation instance is in the Injecting state, the SCA Runtime MUST first inject all field and setter properties that are present into the component implementation. [JCA40005] The order in which the properties are injected is unspecified.

When a component implementation instance is in the Injecting state, the SCA Runtime MUST inject all field and setter references that are present into the component implementation, after all the properties have been injected. [JCA40006] The order in which the references are injected is unspecified.

The SCA Runtime MUST ensure that the correct synchronization model is used so that all injected properties and references are made visible to the component implementation without requiring the component implementation developer to do any specific synchronization. [JCA40007]

The SCA Runtime MUST NOT invoke Service methods on the component implementation when the component implementation is in the Injecting state. [JCA40008]

The result of invoking operations on any injected references when the component implementation is in the Injecting state is undefined.

When the injection of properties and references completes successfully, the SCA Runtime MUST transition the component implementation to the Initializing state. [JCA40009] If an exception is thrown whilst injecting properties or references, the SCA Runtime MUST transition the component implementation to the Destroying state. [JCA40010]

4.2.3 Initializing State

When the component implementation enters the Initializing State, the SCA Runtime MUST call the method annotated with @Init on the component implementation, if present. [JCA40011]

The component implementation can invoke operations on any injected references when it is in the Initializing state. However, depending on the order in which the component implementations are initialized, the target of the injected reference might not be available since it has not yet been initialized. If a component implementation invokes an operation on an injected reference that refers to a target that has not yet been initialized, the SCA Runtime MUST throw a ServiceUnavailableException.  [JCA40012]

The SCA Runtime MUST NOT invoke Service methods on the component implementation when the component implementation instance is in the Initializing state. [JCA40013]

Once the method annotated with @Init completes successfully, the SCA Runtime MUST transition the component implementation to the Running state. [JCA40014] If an exception is thrown whilst initializing, the SCA Runtime MUST transition the component implementation to the Destroying state. [JCA40015]

4.2.4 Running State

The SCA Runtime MUST invoke Service methods on a component implementation instance when the component implementation is in the Running state and a client invokes operations on a service offered by the component. [JCA40016]

The component implementation can invoke operations on any injected references when the component implementation instance is in the Running state.

When the component implementation scope ends, the SCA Runtime MUST transition the component implementation to the Destroying state. [JCA40017]

4.2.5 Destroying State

When a component implementation enters the Destroying state, the SCA Runtime MUST call the method annotated with @Destroy on the component implementation, if present. [JCA40018]

The component implementation can invoke operations on any injected references when it is in the Destroying state. However, depending on the order in which the component implementations are destroyed, the target of the injected reference might no longer be available since it has been destroyed. If a component implementation invokes an operation on an injected reference that refers to a target that has been destroyed, the SCA Runtime MUST throw an InvalidServiceException. [JCA40019]

The SCA Runtime MUST NOT invoke Service methods on the component implementation when the component implementation instance is in the Destroying state. [JCA40020]

Once the method annotated with @Destroy completes successfully, the SCA Runtime MUST transition the component implementation to the Terminated state. [JCA40021] If an exception is thrown whilst destroying, the SCA Runtime MUST transition the component implementation to the Terminated state. [JCA40022]

4.2.6 Terminated State

The lifecycle of the SCA Component has ended.

The SCA Runtime MUST NOT invoke Service methods on the component implementation when the component implementation instance is in the Terminated state. [JCA40023]

5      Client API

This section describes how SCA services can be programmatically accessed from components and also from non-managed code, that is, code not running as an SCA component.

5.1 Accessing Services from an SCA Component

An SCA component can obtain a service reference either through injection or programmatically through the ComponentContext API. Using reference injection is the recommended way to access a service, since it results in code with minimal use of middleware APIs.  The ComponentContext API is provided for use in cases where reference injection is not possible.

5.1.1 Using the Component Context API

When a component implementation needs access to a service where the reference to the service is not known at compile time, the reference can be located using the component’s ComponentContext.

5.2 Accessing Services from non-SCA Component Implementations

This section describes how Java code not running as an SCA component that is part of an SCA composite accesses SCA services via references.

5.2.1 ComponentContext

Non-SCA client code can use the ComponentContext API to perform operations against a component in an SCA domain. How client code obtains a reference to a ComponentContext is runtime specific.

The following example demonstrates the use of the component Context API by non-SCA code: 

 

ComponentContext context = // obtained via host environment-specific means

HelloService helloService = 

context.getService(HelloService.class,"HelloService");

String result = helloService.hello("Hello World!");

6      Error Handling

Clients calling service methods can experience business exceptions and SCA runtime exceptions.

Business exceptions are thrown by the implementation of the called service method, and are defined as checked exceptions on the interface that types the service.

SCA runtime exceptions are raised by the SCA runtime and signal problems in management of     component execution or problems interacting with remote services. The SCA runtime exceptions are defined in the Java API section.

7      Asynchronous Programming

Asynchronous programming of a service is where a client invokes a service and carries on executing without waiting for the service to execute.  Typically, the invoked service executes at some later time.  Output from the invoked service, if any, is fed back to the client through a separate mechanism, since no output is available at the point where the service is invoked. This is in contrast to the call-and-return style of synchronous programming, where the invoked service executes and returns any output to the client before the client continues.  The SCA asynchronous programming model consists of:

·         support for non-blocking method calls

·         callbacks 

Each of these topics is discussed in the following sections.

7.1 @OneWay

Non-blocking calls represent the simplest form of asynchronous programming, where the client of the service invokes the service and continues processing immediately, without waiting for the service to execute.

Any method with a void return type and which has no declared exceptions can be marked with a @OneWay annotation.  This means that the method is non-blocking and communication with the service provider can use a binding that buffers the request and sends it at some later time.

For a Java client to make a non-blocking call to methods that either return values or throw exceptions, a Java client can use the JAX-WS asynchronous client API model that is described in the section "JAX-WS Client Asynchronous API for a Synchronous Service". It is considered to be a best practice that service designers define one-way methods as often as possible, in order to give the greatest degree of binding flexibility to deployers.

7.2 Callbacks

A callback service is a service that is used for asynchronous communication from a service provider back to its client, in contrast to the communication through return values from synchronous operations.  Callbacks are used by bidirectional services, which are services that have two interfaces:

Callbacks can be used for both remotable and local services.  Either both interfaces of a bidirectional service are remotable, or both are local.  It is illegal to mix the two, as defined in the SCA Assembly Model specification [ASSEMBLY].

A callback interface is declared by using a @Callback annotation on a service interface, with the Java Class object of the interface as a parameter. The annotation can also be applied to a method or to a field of an implementation, which is used in order to have a callback injected, as explained in the next section. 

7.2.1 Using Callbacks

Bidirectional interfaces and callbacks are used when a simple request/response pattern isn’t sufficient to capture the business semantics of a service interaction.  Callbacks are well suited for cases when a service request can result in multiple responses or new requests from the service back to the client, or where the service might respond to the client some time after the original request has completed.

The following example shows a scenario in which bidirectional interfaces and callbacks could be used.  A client requests a quotation from a supplier.  To process the enquiry and return the quotation, some suppliers might need additional information from the client.  The client does not know which additional items of information will be needed by different suppliers.  This interaction can be modeled as a bidirectional interface with callback requests to obtain the additional information.

package somepackage;

import org.oasisopen.sca.annotation.Callback;

import org.oasisopen.sca.annotation.Remotable;

@Remotable

@Callback(QuotationCallback.class)

public interface Quotation {h

    double requestQuotation(String productCode, int quantity);

}

 

@Remotable

public interface QuotationCallback {

    String getState();

    String getZipCode();

    String getCreditRating();

}

 

In this example, the requestQuotation operation requests a quotation to supply a given quantity of a specified product.  The QuotationCallBack interface provides a number of operations that the supplier can use to obtain additional information about the client making the request.  For example, some suppliers might quote different prices based on the state or the ZIP code to which the order will be shipped, and some suppliers might quote a lower price if the ordering company has a good credit rating.  Other suppliers might quote a standard price without requesting any additional information from the client.

The following code snippet illustrates a possible implementation of the example service, using the @Callback annotation to request that a callback proxy be injected.

 

@Callback

protected QuotationCallback callback;

 

public double requestQuotation(String productCode, int quantity) {

    double price = getPrice(productQuote, quantity);

    double discount = 0;

    if (quantity > 1000 && callback.getState().equals("FL")) {

        discount = 0.05;

    }

    if (quantity > 10000 && callback.getCreditRating().charAt(0) == 'A') {

        discount += 0.05;

    }

    return price * (1-discount);

}

 

The code snippet below is taken from the client of this example service.  The client’s service implementation class implements the methods of the QuotationCallback interface as well as those of its own service interface ClientService.

 

public class ClientImpl implements ClientService, QuotationCallback {

 

    private QuotationService myService;

 

    @Reference

    public void setMyService(QuotationService service) {

        myService = service;

    }

 

    public void aClientMethod() {

        ...

        double quote = myService.requestQuotation("AB123", 2000);

        ...

    }

 

    public String getState() {

        return "TX";

    }

    public String getZipCode() {

        return "78746";

    }

    public String getCreditRating() {

        return "AA";

    }

}

 

In this example the callback is stateless, i.e., the callback requests do not need any information relating to the original service request.  For a callback that needs information relating to the original service request (a stateful callback), this information can be passed to the client by the service provider as parameters on the callback request.

7.2.2 Callback Instance Management

Instance management for callback requests received by the client of the bidirectional service is handled in the same way as instance management for regular service requests.  If the client implementation has STATELESS scope, the callback is dispatched using a newly initialized instance.  If the client implementation has COMPOSITE scope, the callback is dispatched using the same shared instance that is used to dispatch regular service requests.

As described in the section "Using Callbacks", a stateful callback can obtain information relating to the original service request from parameters on the callback request.  Alternatively, a composite-scoped client could store information relating to the original request as instance data and retrieve it when the callback request is received.  These approaches could be combined by using a key passed on the callback request (e.g., an order ID) to retrieve information that was stored in a composite-scoped instance by the client code that made the original request.

7.2.3 Implementing Multiple Bidirectional Interfaces

Since it is possible for a single implementation class to implement multiple services, it is also possible for callbacks to be defined for each of the services that it implements.  The service implementation can include an injected field for each of its callbacks.  The runtime injects the callback onto the appropriate field based on the type of the callback.  The following shows the declaration of two fields, each of which corresponds to a particular service offered by the implementation.

 

@Callback

protected MyService1Callback callback1;

 

@Callback

protected MyService2Callback callback2;

 

If a single callback has a type that is compatible with multiple declared callback fields, then all of them will be set. 

7.2.4 Accessing Callbacks 

In addition to injecting a reference to a callback service, it is also possible to obtain a reference to a Callback instance by annotating a field or method of type ServiceReference with the @Callback annotation.

 

A reference implementing the callback service interface can be obtained using ServiceReference.getService()

The following example fragments come from a service implementation that uses the callback API:

 

@Callback

protected ServiceReference<MyCallback> callback;

 

public void someMethod() {

       

   MyCallback myCallback = callback.getService();    …

 

   myCallback.receiveResult(theResult);

}

 

Because ServiceReference objects are serializable, they can be stored persistently and retrieved at a later time to make a callback invocation after the associated service request has completed.  ServiceReference objects can also be passed as parameters on service invocations, enabling the responsibility for making the callback to be delegated to another service.

Alternatively, a callback can be retrieved programmatically using the RequestContext API. The snippet below shows how to retrieve a callback in a method programmatically:

@Context

ComponentContext context;

 

public void someMethod() {     

    

   MyCallback myCallback =

context.getRequestContext().getCallback();

 

       …

 

   myCallback.receiveResult(theResult);

}

 

This is necessary if the service implementation has COMPOSITE scope, because callback injection is not performed for composite-scoped implementations.

8      Policy Annotations for Java

SCA provides facilities for the attachment of policy-related metadata to SCA assemblies, which influence how implementations, services and references behave at runtime.  The policy facilities are described in the SCA Policy Framework specification [POLICY].  In particular, the facilities include Intents and Policy Sets, where intents express abstract, high-level policy requirements and policy sets express low-level detailed concrete policies.

Policy metadata can be added to SCA assemblies through the means of declarative statements placed into Composite documents and into Component Type documents.  These annotations are completely independent of implementation code, allowing policy to be applied during the assembly and deployment phases of application development.

However, it can be useful and more natural to attach policy metadata directly to the code of implementations.  This is particularly important where the policies concerned are relied on by the code itself.  An example of this from the Security domain is where the implementation code expects to run under a specific security Role and where any service operations invoked on the implementation have to be authorized to ensure that the client has the correct rights to use the operations concerned.  By annotating the code with appropriate policy metadata, the developer can rest assured that this metadata is not lost or forgotten during the assembly and deployment phases.

This specification has a series of annotations which provide the capability for the developer to attach policy information to Java implementation code.  The annotations concerned first provide general facilities for attaching SCA Intents and Policy Sets to Java code.  Secondly, there are further specific annotations that deal with particular policy intents for certain policy domains such as Security.

This specification supports using the Common Annotations for the Java Platform specification (JSR-250) [JSR-250].  An implication of adopting the common annotation for Java platform specification is that the SCA Java specification supports consistent annotation and Java class inheritance relationships. SCA policy annotation semantics follow the General Guidelines for Inheritance of Annotations in the Common Annotations for the Java Platform specification [JSR-250], except that member-level annotations in a class or interface do not have any effect on how class-level annotations are applied to other members of the class or interface.

 

8.1 General Intent Annotations

SCA provides the annotation @Requires for the attachment of any intent to a Java class, to a Java interface or to elements within classes and interfaces such as methods and fields.

The @Requires annotation can attach one or multiple intents in a single statement.

Each intent is expressed as a string.  Intents are XML QNames, which consist of a Namespace URI followed by the name of the Intent. The precise form used follows the string representation used by the javax.xml.namespace.QName class, which is as follows:

      "{" + Namespace URI + "}" + intentname

Intents can be qualified, in which case the string consists of the base intent name, followed by a ".", followed by the name of the qualifier.  There can also be multiple levels of qualification. 

This representation is quite verbose, so we expect that reusable String constants will be defined for the namespace part of this string, as well as for each intent that is used by Java code.  SCA defines constants for intents such as the following:

  public static final String SCA_PREFIX =

         "{http://docs.oasis-open.org/ns/opencsa/sca/200903}";

  public static final String CONFIDENTIALITY =

         SCA_PREFIX + "confidentiality";

  public static final String CONFIDENTIALITY_MESSAGE =

         CONFIDENTIALITY + ".message";

 

Notice that, by convention, qualified intents include the qualifier as part of the name of the constant, separated by an underscore.  These intent constants are defined in the file that defines an annotation for the intent (annotations for intents, and the formal definition of these constants, are covered in a following section).

Multiple intents (qualified or not) are expressed as separate strings within an array declaration.

An example of the @Requires annotation with 2 qualified intents (from the Security domain) follows:

@Requires({CONFIDENTIALITY_MESSAGE, INTEGRITY_MESSAGE})

 

This attaches the intents "confidentiality.message" and "integrity.message".

The following is an example of a reference requiring support for confidentiality:

package com.foo;

 

import static org.oasisopen.sca.annotation.Confidentiality.*;

import static org.oasisopen.sca.annotation.Reference;
import static org.oasisopen.sca.annotation.Requires;

 

public class Foo {

   @Requires(CONFIDENTIALITY)

   @Reference

   public void setBar(Bar bar) {

   …

}

}

 

Users can also choose to only use constants for the namespace part of the QName, so that they can add new intents without having to define new constants.  In that case, this definition would instead look like this:

package com.foo;

 

import static org.oasisopen.sca.Constants.*;

import static org.oasisopen.sca.annotation.Reference;

import static org.oasisopen.sca.annotation.Requires;

 

public class Foo {

   @Requires(SCA_PREFIX+"confidentiality")

   @Reference

   public void setBar(Bar bar) {

   …

}

}

 

The formal syntax [EBNF-Syntax] for the @Requires annotation follows:

'@Requires("' QualifiedIntent '"' (',"' QualifiedIntent '"')* ')'

where

QualifiedIntent ::= QName('.' Qualifier)*
Qualifier ::= NCName

 

See section @Requires for the formal definition of the @Requires annotation.

8.2 Specific Intent Annotations

In addition to the general intent annotation supplied by the @Requires annotation described above, it is also possible to have Java annotations that correspond to specific policy intents.  SCA provides a number of these specific intent annotations and it is also possible to create new specific intent annotations for any intent.

The general form of these specific intent annotations is an annotation with a name derived from the name of the intent itself.  If the intent is a qualified intent, qualifiers are supplied as an attribute to the annotation in the form of a string or an array of strings.

For example, the SCA confidentiality intent described in the section on General Intent Annotations using the @Requires(CONFIDENTIALITY) annotation can also be specified with the @Confidentiality specific intent annotation.  The specific intent annotation for the "integrity" security intent is:

@Integrity

An example of a qualified specific intent for the "authentication" intent is:

@Authentication( {"message", "transport"} )

This annotation attaches the pair of qualified intents: "authentication.message" and "authentication.transport" (the sca: namespace is assumed in this both of these cases – "http://docs.oasis-open.org/ns/opencsa/sca/200903").

The general form of specific intent annotations is:

'@' Intent ('(' qualifiers ')')?

where Intent is an NCName that denotes a particular type of intent.

Intent              ::= NCName

qualifiers          ::= '"' qualifier '"' (',"' qualifier '"')*

qualifier            ::= NCName ('.' qualifier)?

 

8.2.1 How to Create Specific Intent Annotations

SCA identifies annotations that correspond to intents by providing an @Intent annotation which MUST be used in the definition of a specific intent annotation. [JCA70001]

The @Intent annotation takes a single parameter, which (like the @Requires annotation) is the String form of the QName of the intent. As part of the intent definition, it is good practice (although not required) to also create String constants for the Namespace, for the Intent and for Qualified versions of the Intent (if defined).  These String constants are then available for use with the @Requires annotation and it is also possible to use one or more of them as parameters to the specific intent annotation. 

Alternatively, the QName of the intent can be specified using separate parameters for the targetNamespace and the localPart, for example:

 @Intent(targetNamespace=SCA_NS, localPart="confidentiality"). 

See section @Intent for the formal definition of the @Intent annotation.

When an intent can be qualified, it is good practice for the first attribute of the annotation to be a string (or an array of strings) which holds one or more qualifiers. 

In this case, the attribute’s definition needs to be marked with the @Qualifier annotation.  The @Qualifier tells SCA that the value of the attribute is treated as a qualifier for the intent represented by the whole annotation.  If more than one qualifier value is specified in an annotation, it means that multiple qualified forms exist.  For example:

@Confidentiality({"message","transport"})

implies that both of the qualified intents "confidentiality.message" and "confidentiality.transport" are set for the element to which the @Confidentiality annotation is attached. 

See section @Qualifier for the formal definition of the @Qualifier annotation.

Examples of the use of the @Intent and the @Qualifier annotations in the definition of specific intent annotations are shown in the section dealing with Security Interaction Policy.

8.3 Application of Intent Annotations

The SCA Intent annotations can be applied to the following Java elements:

·         Java class

·         Java interface

·         Method

·         Field

·         Constructor parameter

Intent annotations MUST NOT be applied to the following:

·         A method of a service implementation class, except for a setter method that is either annotated with @Reference or introspected as an SCA reference according to the rules in the appropriate Component Implementation specification

·         A service implementation class field that is not either annotated with @Reference or introspected as an SCA reference according to the rules in the appropriate Component Implementation specification

·         A service implementation class constructor parameter that is not annotated with @Reference

[JCA70002]

Intent annotations can be applied to classes, interfaces, and interface methods.  Applying an intent annotation to a field, setter method, or constructor parameter allows intents to be defined at references.  Intent annotations can also be applied to reference interfaces and their methods.

Where multiple intent annotations (general or specific) are applied to the same Java element, the SCA runtime MUST compute the combined intents for the Java element by merging the intents from all intent annotations on the Java element according to the SCA Policy Framework [POLICY] rules for merging intents at the same hierarchy level. [JCA70003] 

An example of multiple policy annotations being used together follows:

@Authentication
@Requires({CONFIDENTIALITY_MESSAGE, INTEGRITY_MESSAGE})

In this case, the effective intents are "authentication", "confidentiality.message" and "integrity.message".

If intent annotations are specified on both an interface method and the method's declaring interface, the SCA runtime MUST compute the effective intents for the method by merging the combined intents from the method with the combined intents for the interface according to the SCA Policy Framework [POLICY] rules for merging intents within a structural hierarchy, with the method at the lower level and the interface at the higher level. [JCA70004]  This merging process does not remove or change any intents that are applied to the interface.

8.3.1 Intent Annotation Examples

The following examples show how the rules defined in section 8.3 are applied.

Example 8.1 shows how intents on references are merged.  In this example, the intents for myRef are "authentication" and "confidentiality.message".

@Authentication

@Requires(CONFIDENTIALITY)

@Confidentiality("message")

@Reference

protected MyService myRef;

Example 8.1.  Merging intents on references.

Example 8.2 shows that mutually exclusive intents cannot be applied to the same Java element.  In this example, the Java code is in error because of contradictory mutually exclusive intents "managedTransaction" and "noManagedTransaction".

@Requires({SCA_PREFIX+"managedTransaction",

           SCA_PREFIX+"noManagedTransaction"})

@Reference

protected MyService myRef;

Example 8.2.  Mutually exclusive intents.

Example 8.3 shows that intents can be applied to Java service interfaces and their methods.  In this example, the effective intents for MyService.mymethod() are "authentication" and "confidentiality".

@Authentication

public interface MyService {

    @Confidentiality

    public void mymethod();

}

@Service(MyService.class)

public class MyServiceImpl {

    public void mymethod() {...}

}

Example 8.3.  Intents on Java interfaces, interface methods, and Java classes.

Example 8.4 shows that intents can be applied to Java service implementation classes.  In this example, the effective intents for MyService.mymethod() are "authentication", "confidentiality", and "managedTransaction".

@Authentication

public interface MyService {

    @Confidentiality

    public void mymethod();

}

@Service(MyService.class)

@Requires(SCA_PREFIX+"managedTransaction")

public class MyServiceImpl {

    public void mymethod() {...}

}

Example 8.4.  Intents on Java service implementation classes.

Example 8.5 shows that intents can be applied to Java reference interfaces and their methods, and also to Java references.  In this example, the effective intents for the method mymethod() of the reference myRef are "authentication", "integrity", and "confidentiality".

@Authentication

public interface MyRefInt {

    @Integrity

    public void mymethod();

}

@Service(MyService.class)

public class MyServiceImpl {

    @Confidentiality

    @Reference

    protected MyRefInt myRef;

}

Example 8.5.  Intents on Java references and their interfaces and methods.

Example 8.6 shows that intents cannot be applied to methods of Java implementation classes.  In this example, the Java code is in error because of the @Authentication intent annotation on the implementation method MyServiceImpl.mymethod().

public interface MyService {

    public void mymethod();

}        

@Service(MyService.class)

public class MyServiceImpl {

    @Authentication

    public void mymethod() {...}

}

Example 8.6.  Intent on implementation method.

Example 8.7 shows one effect of applying the SCA Policy Framework rules for merging intents within a structural hierarchy to Java service interfaces and their methods.  In this example a qualified intent overrides an unqualified intent, so the effective intent for MyService.mymethod() is "confidentiality.message".

@Confidentiality("message")

public interface MyService {

    @Confidentiality

    public void mymethod();

}

Example 8.7.  Merging qualified and unqualified intents on Java interfaces and methods.

Example 8.8 shows another effect of applying the SCA Policy Framework rules for merging intents within a structural hierarchy to Java service interfaces and their methods.  In this example a lower-level intent causes a mutually exclusive higher-level intent to be ignored, so the effective intent for mymethod1() is "managedTransaction" and the effective intent for mymethod2() is "noManagedTransaction".

@Requires(SCA_PREFIX+"managedTransaction")

public interface MyService {

    public void mymethod1();

    @Requires(SCA_PREFIX+"noManagedTransaction")

    public void mymethod2();

}

Example 8.8.  Merging mutually exclusive intents on Java interfaces and methods.

8.3.2 Inheritance and Annotation

The following example shows the inheritance relations of intents on classes, operations, and super classes.

package services.hello;

import org.oasisopen.sca.annotation.Authentication;

import org.oasisopen.sca.annotation.Integrity;

 

@Integrity("transport")

@Authentication

public class HelloService {

      @Integrity

      @Authentication("message")

      public String hello(String message) {...}

 

      @Integrity

      @Authentication("transport")

      public String helloThere() {...}

}

 

package services.hello;

import org.oasisopen.sca.annotation.Authentication;

import org.oasisopen.sca.annotation.Confidentiality;

 

@Confidentiality("message")

public class HelloChildService extends HelloService {

      @Confidentiality("transport")

      public String hello(String message) {...}

      @Authentication

      String helloWorld() {...}

}

Example 8.9.  Usage example of annotated policy and inheritance.

 

The effective intent annotation on the helloWorld method of HelloChildService is @Authentication and @Confidentiality("message").

The effective intent annotation on the hello method of HelloChildService is @Confidentiality("transport"),

The effective intent annotation on the helloThere method of HelloChildService is @Integrity and @Authentication("transport"), the same as for this method in the HelloService class.

The effective intent annotation on the hello method of HelloService is @Integrity and @Authentication("message")

 

Table 8.1 below shows the equivalent declarative security interaction policy of the methods of the HelloService and HelloChildService implementations corresponding to the Java classes shown in Example 8.9.

 

 

Method

Class

hello()

helloThere()

helloWorld()

HelloService

integrity

authentication.message

integrity

authentication.transport

N/A

HelloChildService

confidentiality.transport

integrity

authentication.transport

authentication

confidentiality.message

 

Table 8.1.  Declarative intents equivalent to annotated intents in Example 8.9.

8.4 Relationship of Declarative and Annotated Intents

Annotated intents on a Java class cannot be overridden by declarative intents in a composite document which uses the class as an implementation.  This rule follows the general rule for intents that they represent requirements of an implementation in the form of a restriction that cannot be relaxed.

However, a restriction can be made more restrictive so that an unqualified version of an intent expressed through an annotation in the Java class can be qualified by a declarative intent in a using composite document.

8.5 Policy Set Annotations

The SCA Policy Framework uses Policy Sets to capture detailed low-level concrete policies. For example, a concrete policy is the specific encryption algorithm to use when encrypting messages when using a specific communication protocol to link a reference to a service.

Policy Sets can be applied directly to Java implementations using the @PolicySets annotation.  The @PolicySets annotation either takes the QName of a single policy set as a string or the name of two or more policy sets as an array of strings:

'@PolicySets({' policySetQName (',' policySetQName )* '})'

 

As for intents, PolicySet names are QNames – in the form of "{Namespace-URI}localPart".

An example of the @PolicySets annotation:

 

@Reference(name="helloService", required=true)

@PolicySets({ MY_NS + "WS_Encryption_Policy",
              MY_NS + "WS_Authentication_Policy" })

public setHelloService(HelloService service) {

      . . .

}         

 

In this case, the Policy Sets WS_Encryption_Policy and WS_Authentication_Policy are applied, both using the namespace defined for the constant MY_NS.

PolicySets need to satisfy intents expressed for the implementation when both are present, according to the rules defined in the Policy Framework specification [POLICY].

The SCA Policy Set annotation can be applied to the following Java elements:

·         Java class

·         Java interface

·         Method

·         Field

·         Constructor parameter

The @PolicySets annotation MUST NOT be applied to the following:

·         A method of a service implementation class, except for a setter method that is either annotated with @Reference or introspected as an SCA reference according to the rules in the appropriate Component Implementation specification

·         A service implementation class field that is not either annotated with @Reference or introspected as an SCA reference according to the rules in the appropriate Component Implementation specification

·         A service implementation class constructor parameter that is not annotated with @Reference

[JCA70005]

The @PolicySets annotation can be applied to classes, interfaces, and interface methods.  Applying a @PolicySets annotation to a field, setter method, or constructor parameter allows policy sets to be defined at references.  The @PolicySets annotation can also be applied to reference interfaces and their methods.

If the @PolicySets annotation is specified on both an interface method and the method's declaring interface, the SCA runtime MUST compute the effective policy sets for the method by merging the policy sets from the method with the policy sets from the interface. [JCA70006]  This merging process does not remove or change any policy sets that are applied to the interface.

8.6 Security Policy Annotations

This section introduces annotations for SCA’s security intents, as defined in the SCA Policy Framework specification [POLICY]

8.6.1 Security Interaction Policy

The following interaction policy Intents and qualifiers are defined for Security Policy, which apply to the operation of services and references of an implementation: 

·         @Integrity

·         @Confidentiality

·         @Authentication

All three of these intents have the same pair of Qualifiers:

·         message

·         transport

The formal definitions of the @Authentication, @Confidentality and @Integrity annotations are found in the sections @Authentication, @Confidentiality and @Integrity.

The following example shows an example of applying an intent to the setter method used to inject a reference.   Accessing the hello operation of the referenced HelloService requires both "integrity.message" and "authentication.message" intents to be honored.

 

package services.hello;

// Interface for HelloService

public interface HelloService {

      String hello(String helloMsg);

}

 

package services.client;

// Interface for ClientService

public interface ClientService {

      public void clientMethod();

}

 

// Implementation class for ClientService

package services.client;

 

import services.hello.HelloService;

import org.oasisopen.sca.annotation.*;

 

@Service(ClientService.class)

public class ClientServiceImpl implements ClientService {

     

      private HelloService helloService;


      @Reference(name="helloService", required=true)

      @Integrity("message")

      @Authentication("message")

      public void setHelloService(HelloService service) {

            helloService = service;

      }    

 

      public void clientMethod() {

            String result = helloService.hello("Hello World!");

            …

      }

}

 

Example 8.10.  Usage of annotated intents on a reference.

9      Java API

This section provides a reference for the Java API offered by SCA.

9.1 Component Context

The following Java code defines the ComponentContext interface:

 

package org.oasisopen.sca;

   import java.util.Collection;

public interface ComponentContext {

 

       String getURI();

 

   <B> B getService(Class<B> businessInterface, String referenceName);

 

   <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,

                                                    String referenceName);

<B> Collection<B> getServices(Class<B> businessInterface,

String referenceName);

 

<B> Collection<ServiceReference<B>> getServiceReferences(Class<B>

businessInterface, String referenceName);

 

<B> ServiceReference<B> createSelfReference(Class<B>

businessInterface);

 

<B> ServiceReference<B> createSelfReference(Class<B> businessInterface,

                                            String serviceName);

 

<B> B getProperty(Class<B> type, String propertyName);

 

RequestContext getRequestContext();

 

<B> ServiceReference<B> cast(B target) throws IllegalArgumentException;

 

}

 

·         getURI() - returns the absolute URI of the component within the SCA domain

·         getService(Class<B> businessInterface, String referenceName) – Returns a proxy for the reference defined by the current component. The getService() method takes as its input arguments the Java type used to represent the target service on the client and the name of the service reference. It returns an object providing access to the service. The returned object implements the Java interface the service is typed with. The ComponentContext.getService method MUST throw an IllegalArgumentException if the reference identified by the referenceName parameter has multiplicity of 0..n or 1..n.[JCA80001]

·         getServiceReference(Class<B> businessInterface, String referenceName) – Returns a ServiceReference defined by the current component. This method MUST throw an IllegalArgumentException if the reference has multiplicity greater than one.

·         getServices(Class<B> businessInterface, String referenceName) – Returns a list of typed service proxies for a business interface type and a reference name.

·         getServiceReferences(Class<B> businessInterface, String referenceName) –Returns a list of typed service references for a business interface type and a reference name.

·         createSelfReference(Class<B> businessInterface) – Returns a ServiceReference that can be used to invoke this component over the designated service.

·         createSelfReference(Class<B> businessInterface, String serviceName) – Returns a ServiceReference that can be used to invoke this component over the designated service. The serviceName parameter explicitly declares the service name to invoke

·         getProperty (Class<B> type, String propertyName) - Returns the value of an SCA property defined by this component.

·         getRequestContext() - Returns the context for the current SCA service request, or null if there is no current request or if the context is unavailable. The ComponentContext.getRequestContext method MUST return non-null when invoked during the execution of a Java business method for a service operation or a callback operation, on the same thread that the SCA runtime provided, and MUST return null in all other cases. [JCA80002]

·         cast(B target) - Casts a type-safe reference to a ServiceReference

A component can access its component context by defining a field or setter method typed by org.oasisopen.sca.ComponentContext and annotated with @Context. To access a target service, the component uses ComponentContext.getService(..).

The following shows an example of component context usage in a Java class using the @Context annotation.  

private ComponentContext componentContext;

 

@Context

public void setContext(ComponentContext context) {

   componentContext = context;

}

 

public void doSomething() {

HelloWorld service =                   componentContext.getService(HelloWorld.class,"HelloWorldComponent");

service.hello("hello");

}

 

Similarly, non-SCA client code can use the ComponentContext API to perform operations against a component in an SCA domain. How the non-SCA client code obtains a reference to a ComponentContext is runtime specific.

9.2 Request Context

The following shows the RequestContext interface:

 

package org.oasisopen.sca;

 

import javax.security.auth.Subject;

 

public interface RequestContext {

 

      Subject getSecuritySubject();

     

      String getServiceName();

      <CB> ServiceReference<CB> getCallbackReference();      

      <CB> CB getCallback();

      <B> ServiceReference<B> getServiceReference();

 

}

 

The RequestContext interface has the following methods:

·         getSecuritySubject() – Returns the JAAS Subject of the current request (see the JAAS Reference Guide [JAAS] for details of JAAS)

·         getServiceName() – Returns the name of the service on the Java implementation the request came in on

·         getCallbackReference() – Returns a service reference to the callback as specified by the caller. This method returns null when called for a service request whose interface is not bidirectional or when called for a callback request.

·         getCallback() – Returns a proxy for the callback as specified by the caller. Similar to the getCallbackReference() method, this method returns null when called for a service request whose interface is not bidirectional or when called for a callback request.

·         getServiceReference()When invoked during the execution of a service operation, the getServiceReference method MUST return a ServiceReference that represents the service that was invoked. When invoked during the execution of a callback operation, the getServiceReference method MUST return a ServiceReference that represents the callback that was invoked. [JCA80003]

9.3 ServiceReference

ServiceReferences can be injected using the @Reference annotation on a field, a setter method, or constructor parameter taking the type ServiceReference.  The detailed description of the usage of these methods is described in the section on Asynchronous Programming in this document.

The following Java code defines the ServiceReference interface:

package org.oasisopen.sca;

 

public interface ServiceReference<B> extends java.io.Serializable {

  

    B getService();

    Class<B> getBusinessInterface();

}

 

The ServiceReference interface has the following methods:

·         getService()  - Returns a type-safe reference to the target of this reference.  The instance returned is guaranteed to implement the business interface for this reference.  The value returned is a proxy to the target that implements the business interface associated with this reference.

·         getBusinessInterface() – Returns the Java class for the business interface associated with this reference.

9.4 ServiceRuntimeException

The following snippet shows the ServiceRuntimeException.

 

package org.oasisopen.sca;

 

public class ServiceRuntimeException extends RuntimeException {

     

}

 

This exception signals problems in the management of SCA component execution.

9.5 ServiceUnavailableException

The following snippet shows the ServiceUnavailableException.

 

package org.oasisopen.sca;

 

public class ServiceUnavailableException extends ServiceRuntimeException {

     

}

 

This exception signals problems in the interaction with remote services.  These are exceptions that can be transient, so retrying is appropriate.  Any exception that is a ServiceRuntimeException that is not a ServiceUnavailableException is unlikely to be resolved by retrying the operation, since it most likely requires human intervention

9.6 InvalidServiceException

The following snippet shows the InvalidServiceException.

 

package org.oasisopen.sca;

 

public class InvalidServiceException extends ServiceRuntimeException {

     

}

 

This exception signals that the ServiceReference is no longer valid. This can happen when the target of the reference is undeployed.  This exception is not transient and therefore is unlikely to be resolved by retrying the operation and will most likely require human intervention.

9.7 Constants

The SCA Constants interface defines a number of constant values that are used in the SCA Java APIs and Annotations.  The following snippet shows the Constants interface:

package org.oasisopen.sca;

 

public interface Constants {

   String SCA_NS="http://docs.oasis-open.org/ns/opencsa/sca/200903";

   String SCA_PREFIX = "{"+SCA_NS+"}";

}

 

10 Java Annotations

This section provides definitions of all the Java annotations which apply to SCA.

This specification places constraints on some annotations that are not detectable by a Java compiler.  For example, the definition of the @Property and @Reference annotations indicate that they are allowed on parameters, but the sections "@Property" and "@Reference" constrain those definitions to constructor parameters. An SCA runtime MUST verify the proper use of all SCA annotations and if an annotation is improperly used, the SCA runtime MUST NOT run the component which uses the invalid implementation code. [JCA90001]

SCA annotations MUST NOT be used on static methods or on static fields. It is an error to use an SCA annotation on a static method or a static field of an implementation class and the SCA runtime MUST NOT instantiate such an implementation class. [JCA90002]

10.1 @AllowsPassByReference

The following Java code defines the @AllowsPassByReference annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.PARAMETER;

import static java.lang.annotation.ElementType.TYPE;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target({TYPE, METHOD, FIELD, PARAMETER})

@Retention(RUNTIME)

public @interface AllowsPassByReference {

     

      boolean value() default true;

}

 

The @AllowsPassByReference annotation allows service method implementations and client references to be marked as “allows pass by reference” to indicate that they use input parameters, return values and exceptions in a manner that allows the SCA runtime to avoid the cost of copying mutable objects when a remotable service is called locally within the same JVM.

The @AllowsPassByReference annotation has the following attribute:

·         value – specifies whether the “allows pass by reference” marker applies to the service implementation class, service implementation method, or client reference to which this annotation applies; if not specified, defaults to true.

The @AllowsPassByReference annotation MAY be placed on an individual method of a remotable service implementation, on a service implementation class, or on an individual reference for a remotable service.  When applied to a reference, it MAY appear anywhere that the @Remotable annotation MAY appear.  It MUST NOT appear anywhere else. [JCA90052]

The “allows pass by reference” marking of a method implementation of a remotable service is determined as follows:

1.    If the method has an @AllowsPassByReference annotation, the method is marked “allows pass by reference” if and only if the value of the method’s annotation is true.

2.    Otheriwse, if the class has an @AllowsPassByReference annotation, the method is marked “allows pass by reference” if and only if the value of the class’s annotation is true.

3.    Otherwise, the method is not marked “allows pass by reference”.

The “allows pass by reference” marking of a reference for a remotable service is determined as follows:

1.    If the reference has an @AllowsPassByReference annotation, the reference is marked “allows pass by reference” if and only if the value of the reference’s annotation is true.

2.    Otherwise, if the service implementation class containing the reference has an @AllowsPassByReference annotation, the reference is marked “allows pass by reference” if and only if the value of the class’s annotation is true.

3.    Otherwise, the reference is not marked “allows pass by reference”.

 

The following snippet shows a sample where @AllowsPassByReference is defined for the implementation of a service method on the Java component implementation class.

 

@AllowsPassByReference

public String hello(String message) {

      …

}

 

The following snippet shows a sample where @AllowsPassByReference is defined for a client reference of a Java component implementation class.

@AllowsPassByReference

@Reference

private StockQuoteService stockQuote;

 

10.2 @Authentication

The following Java code defines the @Authentication annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.PARAMETER;

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import static org.oasisopen.sca.Constants.SCA_PREFIX;

 

import java.lang.annotation.Inherited;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Inherited

@Target({TYPE, FIELD, METHOD, PARAMETER})

@Retention(RUNTIME)

@Intent(Authentication.AUTHENTICATION)

public @interface Authentication {

    String AUTHENTICATION = SCA_PREFIX + "authentication";

    String AUTHENTICATION_MESSAGE = AUTHENTICATION + ".message";

    String AUTHENTICATION_TRANSPORT = AUTHENTICATION + ".transport";

 

    /**

     * List of authentication qualifiers (such as "message"

     * or "transport").

     *

     * @return authentication qualifiers

     */

    @Qualifier

    String[] value() default "";

}

The @Authentication annotation is used to indicate that the invocation requires authentication.
See the
section on Application of Intent Annotations for samples and details.

10.3 @Callback

The following Java code defines the @Callback annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target({TYPE, METHOD, FIELD})

@Retention(RUNTIME)

public @interface Callback {

 

      Class<?> value() default Void.class;

}

 

 

The @Callback annotation is used to annotate a service interface or to annotate a Java class (used to define an interface) with a callback interface by specifying the Java class object of the callback interface as an attribute. 

The @Callback annotation has the following attribute:

·         value – the name of a Java class file containing the callback interface

 

The @Callback annotation can also be used to annotate a method or a field of an SCA implementation class, in order to have a callback object injected. When used to annotate a method or a field of an implementation class for injection of a callback object, the@Callback annotation MUST NOT specify any attributes. [JCA90046]

An example use of the @Callback annotation to declare a callback interface follows:

package somepackage;

import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Remotable;

@Remotable

@Callback(MyServiceCallback.class)

public interface MyService {

 

    void someMethod(String arg);

}

 

@Remotable

public interface MyServiceCallback {

 

    void receiveResult(String result);

}

 

In this example, the implied component type is:

<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" >

 

      <service name="MyService">

<interface.java interface="somepackage.MyService"

                     callbackInterface="somepackage.MyServiceCallback"/>

      </service>

</componentType>

10.4 @ComponentName

The following Java code defines the @ComponentName annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.TYPE;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target({METHOD, FIELD})

@Retention(RUNTIME)

public @interface ComponentName {

 

}

 

The @ComponentName annotation is used to denote a Java class field or setter method that is used to inject the component name.

The following snippet shows a component name field definition sample.

 

@ComponentName

private String componentName;

 

The following snippet shows a component name setter method sample.

 

@ComponentName

public void setComponentName(String name) {

 //…

}

10.5 @Confidentiality

The following Java code defines the @Confidentiality annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.PARAMETER;

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import static org.oasisopen.sca.Constants.SCA_PREFIX;

 

import java.lang.annotation.Inherited;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Inherited

@Target({TYPE, FIELD, METHOD, PARAMETER})

@Retention(RUNTIME)

@Intent(Confidentiality.CONFIDENTIALITY)

public @interface Confidentiality {

    String CONFIDENTIALITY = SCA_PREFIX + "confidentiality";

    String CONFIDENTIALITY_MESSAGE = CONFIDENTIALITY + ".message";

    String CONFIDENTIALITY_TRANSPORT = CONFIDENTIALITY + ".transport";

 

    /**

     * List of confidentiality qualifiers such as "message" or

     * "transport".

     *

     * @return confidentiality qualifiers

     */

    @Qualifier

    String[] value() default "";

}

The @Confidentiality annotation is used to indicate that the invocation requires confidentiality.

See the section on Application of Intent Annotations for samples and details.

10.6 @Constructor

The following Java code defines the @Constructor annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.CONSTRUCTOR;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target(CONSTRUCTOR)

@Retention(RUNTIME)

public @interface Constructor { }

 

The @Constructor annotation is used to mark a particular constructor to use when instantiating a Java component implementation. If a constructor of an implementation class is annotated with @Constructor and the constructor has parameters, each of these parameters MUST have either a @Property annotation or a @Reference annotation. [JCA90003]

The following snippet shows a sample for the @Constructor annotation.

 

public class HelloServiceImpl implements HelloService {

      public HelloServiceImpl(){
   ...
   }

   @Constructor
   public HelloServiceImpl(@Property(name="someProperty")
                           String someProperty ){

   ...
   }

        public String hello(String message) {
                ...
     }

}

10.7 @Context

The following Java code defines the @Context annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target({METHOD, FIELD})

@Retention(RUNTIME)

public @interface Context {

     

}

 

The @Context annotation is used to denote a Java class field or a setter method that is used to inject a composite context for the component. The type of context to be injected is defined by the type of the Java class field or type of the setter method input argument; the type is either ComponentContext or RequestContext.

The @Context annotation has no attributes.

The following snippet shows a ComponentContext field definition sample.

 

@Context

protected ComponentContext context;

 

The following snippet shows a RequestContext field definition sample.

 

@Context

protected RequestContext context;

10.8 @Destroy

The following Java code defines the @Destroy annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target(METHOD)

@Retention(RUNTIME)

public @interface Destroy {

 

}

 

The @Destroy annotation is used to denote a single Java class method that will be called when the scope defined for the implementation class ends. A method annotated with @Destroy MAY have any access modifier and MUST have a void return type and no arguments. [JCA90004]

If there is a method annotated with @Destroy that matches the criteria for the annotation, the SCA runtime MUST call the annotated method when the scope defined for the implementation class ends. [JCA90005]

The following snippet shows a sample for a destroy method definition.

 

@Destroy

public void myDestroyMethod() {

   …

}

10.9 @EagerInit

The following Java code defines the @EagerInit annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target(TYPE)

@Retention(RUNTIME)

public @interface EagerInit {

 

}

 

The @EagerInit annotation is used to mark the Java class of a COMPOSITE scoped implementation for eager initialization. When marked for eager initialization with an @EagerInit annotation, the composite scoped instance MUST be created when its containing component is started. [JCA90007]

10.10 @Init

The following Java code defines the @Init annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target(METHOD)

@Retention(RUNTIME)

public @interface Init {

     

       

}

 

The @Init annotation is used to denote a single Java class method that is called when the scope defined for the implementation class starts. A method marked with the @Init annotation MAY have any access modifier and MUST have a void return type and no arguments. [JCA90008]

If there is a method annotated with @Init that matches the criteria for the annotation, the SCA runtime MUST call the annotated method after all property and reference injection is complete. [JCA90009]

The following snippet shows an example of an init method definition.

 

@Init

public void myInitMethod() {

   …

}

10.11 @Integrity

The following Java code defines the @Integrity annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.PARAMETER;

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import static org.oasisopen.sca.Constants.SCA_PREFIX;

 

import java.lang.annotation.Inherited;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Inherited

@Target({TYPE, FIELD, METHOD, PARAMETER})

@Retention(RUNTIME)

@Intent(Integrity.INTEGRITY)

public @interface Integrity {

    String INTEGRITY = SCA_PREFIX + "integrity";

    String INTEGRITY_MESSAGE = INTEGRITY + ".message";

    String INTEGRITY_TRANSPORT = INTEGRITY + ".transport";

 

    /**

     * List of integrity qualifiers (such as "message" or "transport").

     *

     * @return integrity qualifiers

     */

    @Qualifier

    String[] value() default "";

}

 

The @Integrity annotation is used to indicate that the invocation requires integrity (i.e. no tampering of the messages between client and service).

See the section on Application of Intent Annotations for samples and details.

10.12 @Intent

The following Java code defines the @Intent annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.ANNOTATION_TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target({ANNOTATION_TYPE})

@Retention(RUNTIME)

public @interface Intent {

    /**

     * The qualified name of the intent, in the form defined by

     * {@link javax.xml.namespace.QName#toString}.

     * @return the qualified name of the intent

     */

    String value() default "";

 

    /**

     * The XML namespace for the intent.

     * @return the XML namespace for the intent

     */

    String targetNamespace() default "";

 

    /**

     * The name of the intent within its namespace.

     * @return name of the intent within its namespace

     */

    String localPart() default "";

}

 

The @Intent annotation is used for the creation of new annotations for specific intents.  It is not expected that the @Intent annotation will be used in application code.

See the section "How to Create Specific Intent Annotations" for details and samples of how to define new intent annotations.

10.13 @OneWay

The following Java code defines the @OneWay annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target(METHOD)

@Retention(RUNTIME)

public @interface OneWay {

     

       

}

 

The @OneWay annotation is used on a Java interface or class method to indicate that invocations will be dispatched in a non-blocking fashion as described in the section on Asynchronous Programming.

The @OneWay annotation has no attributes.

The following snippet shows the use of the @OneWay annotation on an interface.

package services.hello;

 

import org.oasisopen.sca.annotation.OneWay;

 

public interface HelloService {

    @OneWay

    void hello(String name);

}

10.14 @PolicySets

The following Java code defines the @PolicySets annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.PARAMETER;

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

 

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target({TYPE, FIELD, METHOD, PARAMETER})

@Retention(RUNTIME)

public @interface PolicySets {

    /**

     * Returns the policy sets to be applied.

     *

     * @return the policy sets to be applied

     */

    String[] value() default "";

}

 

The @PolicySets annotation is used to attach one or more SCA Policy Sets to a Java implementation class or to one of its subelements.

See the section "Policy Set Annotations" for details and samples.

10.15 @Property

The following Java code defines the @Property annotation:

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.PARAMETER;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target({METHOD, FIELD, PARAMETER})

@Retention(RUNTIME)

public @interface Property {

 

      String name() default "";

      boolean required() default true;

}

 

The @Property annotation is used to denote a Java class field, a setter method, or a constructor parameter that is used to inject an SCA property value. The type of the property injected, which can be a simple Java type or a complex Java type, is defined by the type of the Java class field or the type of the input parameter of the setter method or constructor.

The @Property annotation MUST NOT be used on a class field that is declared as final. [JCA90011]

Where there is both a setter method and a field for a property, the setter method is used.

The @Property annotation has the following attributes:

·         name (optional) – the name of the property.  For a field annotation, the default is the name of the field of the Java class.  For a setter method annotation, the default is the JavaBeans property name [JAVABEANS] corresponding to the setter method name.  For a @Property annotation applied to a constructor parameter, there is no default value for the name attribute and the name attribute MUST be present. [JCA90013]

·         required (optional) – a boolean value which specifies whether injection of the property value is required or not, where true means injection is required and false means injection is not required. Defaults to true. For a @Property annotation applied to a constructor parameter, the required attribute MUST have the value true.  [JCA90014]

 

The following snippet shows a property field definition sample.

 

@Property(name="currency", required=true)

protected String currency;

 

The following snippet shows a property setter sample

 

@Property(name="currency", required=true)

public void setCurrency( String theCurrency ) {

    ....

}

 

For a @Property annotation, if the type of the Java class field or the type of the input parameter of the setter method or constructor is defined as an array or as any type that extends or implements java.util.Collection, then the SCA runtime MUST introspect the component type of the implementation with a <property/> element with a @many attribute set to true, otherwise @many MUST be set to false.[JCA90047]

The following snippet shows the definition of a configuration property using the @Property annotation for a collection.

...

private List<String> helloConfigurationProperty;

 

@Property(required=true)

public void setHelloConfigurationProperty(List<String> property) {

         helloConfigurationProperty = property;

}

...

10.16 @Qualifier

The following Java code defines the @Qualifier annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

 

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target(METHOD)

@Retention(RUNTIME)

public @interface Qualifier {

}

 

The @Qualifier annotation is applied to an attribute of a specific intent annotation definition, defined using the @Intent annotation, to indicate that the attribute provides qualifiers for the intent. The @Qualifier annotation MUST be used in a specific intent annotation definition where the intent has qualifiers. [JCA90015]

See the section "How to Create Specific Intent Annotations" for details and samples of how to define new intent annotations.

10.17 @Reference

The following Java code defines the @Reference annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.PARAMETER;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

@Target({METHOD, FIELD, PARAMETER})

@Retention(RUNTIME)

public @interface Reference {

 

      String name() default "";

      boolean required() default true;

}

 

The @Reference annotation type is used to annotate a Java class field, a setter method, or a constructor parameter that is used to inject a service that resolves the reference. The interface of the service injected is defined by the type of the Java class field or the type of the input parameter of the setter method or constructor.

The @Reference annotation MUST NOT be used on a class field that is declared as final.  [JCA90016]

Where there is both a setter method and a field for a reference, the setter method is used.

The @Reference annotation has the following attributes:

·         name : String (optional) – the name of the reference. For a field annotation, the default is the name of the field of the Java class.  For a setter method annotation, the default is the JavaBeans property name corresponding to the setter method name.  For a @Reference annotation applied to a constructor parameter, there is no default for the name attribute and the name attribute MUST be present. [JCA90018]

·         required (optional)  – a boolean value which specifies whether injection of the service reference is required or not, where true means injection is required and false means injection is not required. Defaults to true. For a @Reference annotation applied to a constructor parameter, the required attribute MUST have the value true.  [JCA90019]

 

The following snippet shows a reference field definition sample.

 

@Reference(name="stockQuote", required=true)

protected StockQuoteService stockQuote;

 

The following snippet shows a reference setter sample

 

@Reference(name="stockQuote", required=true)

public void setStockQuote( StockQuoteService theSQService ) {

    ...

}

 

The following fragment from a component implementation shows a sample of a service reference using the @Reference annotation. The name of the reference is “helloService” and its type is HelloService. The clientMethod() calls the “hello” operation of the service referenced by the helloService reference.

           

package services.hello;

 

private HelloService helloService;


@Reference(name="helloService", required=true)

public setHelloService(HelloService service) {

   helloService = service;

 

public void clientMethod() {

         String result = helloService.hello("Hello World!");

         …

}

 

The presence of a @Reference annotation is reflected in the componentType information that the runtime generates through reflection on the implementation class.  The following snippet shows the component type for the above component implementation fragment.

 

<?xml version="1.0" encoding="ASCII"?>

<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903">

 

   <!-- Any services offered by the component would be listed here -->

   <reference name="helloService" multiplicity="1..1">

         <interface.java interface="services.hello.HelloService"/>

   </reference>

 

</componentType>

     

If the type of a reference is not an array or any type that extends or implements java.util.Collection, then the SCA runtime MUST introspect the component type of the implementation with a <reference/> element with @multiplicity= 0..1 if the @Reference annotation required attribute is false and with @multiplicity=1..1 if the @Reference annotation required attribute is true. [JCA90020]

If the type of a reference is defined as an array or as any type that extends or implements java.util.Collection, then the SCA runtime MUST introspect the component type of the implementation with a <reference/> element with @multiplicity=0..n if the @Reference annotation required attribute is false and with @multiplicity=1..n if the @Reference annotation required attribute is true. [JCA90021]

The following fragment from a component implementation shows a sample of a service reference definition using the @Reference annotation on a java.util.List. The name of the reference is “helloServices” and its type is HelloService. The clientMethod() calls the “hello” operation of all the services referenced by the helloServices reference.  In this case, at least one HelloService needs to be present, so required is true.

 

            @Reference(name="helloServices", required=true)

      protected List<HelloService> helloServices;

 

      public void clientMethod() {

           

for (int index = 0; index < helloServices.size(); index++) {

                  HelloService helloService =

(HelloService)helloServices.get(index);

                  String result = helloService.hello("Hello World!");

            }

            …

      }

 

The following snippet shows the XML representation of the component type reflected from for the former component implementation fragment. There is no need to author this component type in this case since it can be reflected from the Java class.

 

<?xml version="1.0" encoding="ASCII"?>

<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903">

 

   <!-- Any services offered by the component would be listed here -->

   <reference name="helloServices" multiplicity="1..n">

         <interface.java interface="services.hello.HelloService"/>

   </reference>

 

</componentType>

 

An unwired reference with a multiplicity of 0..1 MUST be presented to the implementation code by the SCA runtime as null  [JCA90022] An unwired reference with a multiplicity of 0..n MUST be presented to the implementation code by the SCA runtime as an empty array or empty collection [JCA90023]

10.17.1 Reinjection

References MAY be reinjected by an SCA runtime after the initial creation of a component if the reference target changes due to a change in wiring that has occurred since the component was initialized.   [JCA90024]

In order for reinjection to occur, the following MUST be true:

1.         The component MUST NOT be STATELESS scoped.

2.         The reference MUST use either field-based injection or setter injection. References that are injected through constructor injection MUST NOT be changed.

[JCA90025]  

Setter injection allows for code in the setter method to perform processing in reaction to a change.

If a reference target changes and the reference is not reinjected, the reference MUST continue to work as if the reference target was not changed. [JCA90026]

If an operation is called on a reference where the target of that reference has been undeployed, the SCA runtime SHOULD throw an InvalidServiceException. [JCA90027]  If an operation is called on a reference where the target of the reference has become unavailable for some reason, the SCA runtime SHOULD throw a ServiceUnavailableException. [JCA90028] If the target service of the reference is changed, the reference MUST either continue to work or throw an InvalidServiceException when it is invoked. [JCA90029] If it doesn't work, the exception thrown will depend on the runtime and the cause of the failure.

A ServiceReference that has been obtained from a reference by ComponentContext.cast() corresponds to the reference that is passed as a parameter to cast().  If the reference is subsequently reinjected, the ServiceReference obtained from the original reference MUST continue to work as if the reference target was not changed. [JCA90030] If the target of a ServiceReference has been undeployed, the SCA runtime SHOULD throw a InvalidServiceException when an operation is invoked on the ServiceReference. [JCA90031] If the target of a ServiceReference has become unavailable, the SCA runtime SHOULD throw a ServiceUnavailableException when an operation is invoked on the ServiceReference. [JCA90032] If the target service of a ServiceReference is changed, the reference MUST either continue to work or throw an InvalidServiceException when it is invoked. [JCA90033] If it doesn't work, the exception thrown will depend on the runtime and the cause of the failure.

A reference or ServiceReference accessed through the component context by calling getService() or getServiceReference() MUST correspond to the current configuration of the domain. This applies whether or not reinjection has taken place.  [JCA90034] If the target of a reference or ServiceReference accessed through the component context by calling getService() or getServiceReference() has been undeployed or has become unavailable, the result SHOULD be a reference to the undeployed or unavailable service, and attempts to call business methods SHOULD throw an InvalidServiceException or a ServiceUnavailableException.  [JCA90035] If the target service of a reference or ServiceReference accessed through the component context by calling getService() or getServiceReference() has changed, the returned value SHOULD be a reference to the changed service. [JCA90036]

The rules for reference reinjection also apply to references with a multiplicity of 0..n or 1..n. This means that in the cases where reference reinjection is not allowed, the array or Collection for a reference of multiplicity 0..n or multiplicity 1..n MUST NOT change its contents when changes occur to the reference wiring or to the targets of the wiring. [JCA90037]  In cases where the contents of a reference array or collection change when the wiring changes or the targets change, then for references that use setter injection, the setter method MUST be called by the SCA runtime for any change to the contents. [JCA90038]  A reinjected array or Collection for a reference MUST NOT be the same array or Collection object previously injected to the component. [JCA90039]

 

 

Effect on

Change event

Injected Reference or ServiceReference

Existing ServiceReference Object**

Subsequent invocations of ComponentContext.getServiceReference() or getService()

Change to the target of the reference

can be reinjected (if other conditions* apply). If not reinjected, then it continues to work as if the reference target was not changed.

continue to work as if the reference target was not changed.

Result corresponds to the current configuration of the domain.

Target service undeployed

Business methods throw InvalidServiceException.

Business methods throw InvalidServiceException.

Result is a reference to the undeployed service. Business methods throw InvalidServiceException.

Target service becomes unavailable

Business methods throw ServiceUnavailableException

Business methods throw ServiceUnavailableException

Result is be a reference to the unavailable  service. Business methods throw ServiceUnavailableException.

Target service changed

might continue to work, depending on the runtime and the type of change that was made. If it doesn't work, the exception thrown will depend on the runtime and the cause of the failure.

might continue to work, depending on the runtime and the type of change that was made. If it doesn't work, the exception thrown will depend on the runtime and the cause of the failure.

Result is a reference to the changed service.

* Other conditions:

The component cannot be STATELESS scoped.

The reference has to use either field-based injection or setter injection. References that are injected through constructor injection cannot be changed.

** Result of invoking ComponentContext.cast() corresponds to the reference that is passed as a parameter to cast().

 

10.18 @Remotable

The following Java code defines the @Remotable annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

 

@Target(TYPE)

@Retention(RUNTIME)

public @interface Remotable {

 

}

 

The @Remotable annotation is used to annotate a Java service interface or to annotate a Java class (used to define an interface) as remotable. A remotable service can be published externally as a service and MUST be translatable into a WSDL portType. [JCA90040]

The @Remotable annotation has no attributes.

The following snippet shows the Java interface for a remotable service with its @Remotable annotation.

package services.hello;

 

import org.oasisopen.sca.annotation.*;

 

@Remotable

public interface HelloService {

 

      String hello(String message);

}

 

The style of remotable interfaces is typically coarse grained and intended for loosely coupled interactions. Remotable service interfaces are not allowed to make use of method overloading.

Complex data types exchanged via remotable service interfaces need to be compatible with the marshalling technology used by the service binding.  For example, if the service is going to be exposed using the standard Web Service binding, then the parameters can be JAXB [JAX-B] types or they can be Service Data Objects (SDOs) [SDO].

Independent of whether the remotable service is called from outside of the composite that contains it or from another component in the same composite, the data exchange semantics are by-value.

Implementations of remotable services can modify input data during or after an invocation and can modify return data after the invocation. If a remotable service is called locally or remotely, the SCA container is responsible for making sure that no modification of input data or post-invocation modifications to return data are seen by the caller.

The following snippet shows a remotable Java service interface.

 

package services.hello;

 

import org.oasisopen.sca.annotation.*;

 

@Remotable

public interface HelloService {

 

      String hello(String message);

}

 

package services.hello;

 

import org.oasisopen.sca.annotation.*;

 

@Service(HelloService.class)

public class HelloServiceImpl implements HelloService {

 

      public String hello(String message) {

            ...

      }

}

10.19 @Requires

The following Java code defines the @Requires annotation:

 

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.FIELD;

import static java.lang.annotation.ElementType.METHOD;

import static java.lang.annotation.ElementType.PARAMETER;

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

 

import java.lang.annotation.Inherited;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Inherited

@Retention(RUNTIME)

@Target({TYPE, METHOD, FIELD, PARAMETER})

public @interface Requires {

    /**

     * Returns the attached intents.

     *

     * @return the attached intents

     */

    String[] value() default "";

}

 

The @Requires annotation supports general purpose intents specified as strings. Users can also define specific intent annotations using the @Intent annotation.

See the section "General Intent Annotations" for details and samples.

10.20 @Scope

The following Java code defines the @Scope annotation:

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target(TYPE)

@Retention(RUNTIME)

public @interface Scope {

 

      String value() default "STATELESS";

}

The @Scope annotation MUST only be used on a service's implementation class. It is an error to use this annotation on an interface. [JCA90041]

The @Scope annotation has the following attribute:

·         value – the name of the scope.
SCA defines the following scope names, but others can be defined by particular Java-based implementation types:
STATELESS
COMPOSITE

The default value is STATELESS.

The following snippet shows a sample for a COMPOSITE scoped service implementation:

package services.hello;

 

import org.oasisopen.sca.annotation.*;

 

@Service(HelloService.class)

@Scope("COMPOSITE")

public class HelloServiceImpl implements HelloService {

 

      public String hello(String message) {

            ...

      }

}

 

10.21 @Service

The following Java code defines the @Service annotation:

package org.oasisopen.sca.annotation;

 

import static java.lang.annotation.ElementType.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;

 

@Target(TYPE)

@Retention(RUNTIME)

public @interface Service {

 

      Class<?>[] interfaces() default { Void.class };

      String name() default "";

      String[] names() default {};

      Class<?> value() default Void.class;

}

 

The @Service annotation is used on a component implementation class to specify the SCA services offered by the implementation. An implementation class need not be declared as implementing all of the interfaces implied by the services declared in its @Service annotation, but all methods of all the declared service interfaces MUST be present. [JCA90042] A class used as the implementation of a service is not required to have a @Service annotation.  If a class has no @Service annotation, then the rules determining which services are offered and what interfaces those services have are determined by the specific implementation type. 

The @Service annotation has the following attributes:

·         interfaces (1..1) – The value is an array of interface or class objects that are exposed as services by this implementation. 

·         name (0..1) -  A string which is used as the service name.  If the name attribute is specified on the @Service annotation, the value attribute MUST also be specified.  [JCA90048]

·         names (0..1) -  Contains an array of Strings which are used as the service names for each of the interfaces declared in the interfaces array. If the names attribute is specified for an @Service annotation, the interfaces attribute MUST also be specified. [JCA90049] The number of Strings in the names attributes array of the @Service annotation MUST match the number of elements in the interfaces attribute array.  [JCA90050]

·         value – A shortcut for the case when the class provides only a single service interface - contains a single interface or class object that is exposed as a service by this component implementation.

A @Service annotation MUST only have one of the interfaces attribute or value attribute specified. [JCA90043]

A @Service annotation that specifies a single class object Void.class either explicitly or by default is equivalent to not having the annotation there at all - such a @Service annotation MUST be ignored. [JCA90044] The @Service annotation MUST NOT specify Void.class in conjunction with any other service class or interface. [JCA90051]

The service names of the defined services default to the names of the interfaces or class, without the package name.  If the names parameter is specified, the service name for each interface in the interfaces attribute array is the String declared in the corresponding position in the names attribute array.

A component implementation MUST NOT have two services with the same Java simple name. [JCA90045] If a Java implementation needs to realize two services with the same Java simple name then this can be achieved through subclassing of the interface.

The following snippet shows an implementation of the HelloService marked with the @Service annotation.

package services.hello;

 

import org.oasisopen.sca.annotation.Service;

 

@Service(HelloService.class)

public class HelloServiceImpl implements HelloService {

 

    public void hello(String name) {

        System.out.println("Hello " + name);

    }

}

 

11  WSDL to Java and Java to WSDL

This specification applies the WSDL to Java and Java to WSDL mapping rules as defined by the JAX-WS specification [JAX-WS] for generating remotable Java interfaces from WSDL portTypes and vice versa.

For the purposes of the Java-to-WSDL mapping algorithm, the SCA runtime MUST treat a Java interface as if it had a @WebService annotation on the class, even if it doesn't. [JCA100001] The SCA runtime MUST treat an @org.oasisopen.sca.annotation.OneWay annotation as a synonym for the @javax.jws.OneWay annotation. [JCA100002] For the WSDL-to-Java mapping, the SCA runtime MUST take the generated @WebService annotation to imply that the Java interface is @Remotable. [JCA100003]

For the mapping from Java types to XML schema types, SCA permits both the JAXB 2.1 [JAX-B] mapping and the SDO 2.1 [SDO] mapping. SCA runtimes MUST support the JAXB 2.1 mapping from Java types to XML schema types. [JCA100004] SCA runtimes MAY support the SDO 2.1 mapping from Java types to XML schema types. [JCA100005] Having a choice of binding technologies is allowed, as noted in the first paragraph of section 5 of the JSR 181 (version 2) specification, which is referenced by the JAX-WS specification.

11.1 JAX-WS Client Asynchronous API for a Synchronous Service

The JAX-WS specification defines a mapping of a synchronous service invocation, which provides a client application with a means of invoking that service asynchronously, so that the client can invoke a service operation and proceed to do other work without waiting for the service operation to complete its processing. The client application can retrieve the results of the service either through a polling mechanism or via a callback method which is invoked when the operation completes.

For SCA service interfaces defined using interface.java, the Java interface MUST NOT contain the additional client-side asynchronous polling and callback methods defined by JAX-WS. [JCA100006]  For SCA reference interfaces defined using interface.java, the Java interface MAY contain the additional client-side asynchronous polling and callback methods defined by JAX-WS. [JCA100007]  If the additional client-side asynchronous polling and callback methods defined by JAX-WS are present in the interface which declares the type of a reference in the implementation, SCA Runtimes MUST NOT include these methods in the SCA reference interface in the component type of the implementation.  [JCA100008]

The additional client-side asynchronous polling and callback methods defined by JAX-WS are recognized in a Java interface as follows:

For each method M in the interface, if another method P in the interface has

a.     a method name that is M's method name with the characters "Async" appended, and

b.    the same parameter signature as M, and

c.     a return type of Response<R> where R is the return type of M

then P is a JAX-WS polling method that isn't part of the SCA interface contract.

For each method M in the interface, if another method C in the interface has

a.     a method name that is M's method name with the characters "Async" appended, and

b.    a parameter signature that is M's parameter signature with an additional final parameter of type AsyncHandler<R> where R is the return type of M, and

c.     a return type of Future<?>

then C is a JAX-WS callback method that isn't part of the SCA interface contract.

As an example, an interface can be defined in WSDL as follows:

<!-- WSDL extract -->

<message name="getPrice">

 <part name="ticker" type="xsd:string"/>

</message>

 

<message name="getPriceResponse">

 <part name="price" type="xsd:float"/>

</message>

 

<portType name="StockQuote">

 <operation name="getPrice">

    <input message="tns:getPrice"/>

    <output message="tns:getPriceResponse"/>

 </operation>

</portType>

 

The JAX-WS asynchronous mapping will produce the following Java interface:

// asynchronous mapping

@WebService

public interface StockQuote {

 float getPrice(String ticker);

 Response<Float> getPriceAsync(String ticker);

 Future<?> getPriceAsync(String ticker, AsyncHandler<Float>);

}

 

For SCA interface definition purposes, this is treated as equivalent to the following:

// synchronous mapping

@WebService

public interface StockQuote {

 float getPrice(String ticker);

}

 

SCA runtimes MUST support the use of the JAX-WS client asynchronous model. [JCA100009] In the above example, if the client implementation uses the asynchronous form of the interface, the two additional getPriceAsync() methods can be used for polling and callbacks as defined by the JAX-WS specification.

12  Conformance

The XML schema pointed to by the RDDL document at the namespace URI, defined by this specification, are considered to be authoritative and take precedence over the XML schema defined in the appendix of this document.

For code artifacts related to this specification, the specification text is considered to be authoritative and takes precedence over the code artifacts.

There are three categories of artifacts for which this specification defines conformance:

a)     SCA Java XML Document,

b)    SCA Java Class

c)     SCA Runtime.

12.1 SCA Java XML Document

An SCA Java XML document is an SCA Composite Document, an SCA ComponentType Document or an SCA ConstrainingType Document, as defined by the SCA Assembly Model specification [ASSEMBLY], that uses the <interface.java> element. Such an SCA Java XML document MUST be a conformant SCA Composite Document or SCA ComponentType Document or SCA ConstrainingType Document, as defined by the SCA Assembly Model specification [ASSEMBLY], and MUST comply with the requirements specified in the Interface section of this specification.

12.2 SCA Java Class

An SCA Java Class is a Java class or interface that complies with Java Standard Edition version 5.0 and MAY include annotations and APIs defined in this specification. An SCA Java Class that uses annotations and APIs defined in this specification MUST comply with the requirements specified in this specification for those annotations and APIs.

12.3 SCA Runtime

The APIs and annotations defined in this specification are meant to be used by Java-based component implementation models in either partial or complete fashion. A Java-based component implementation specification that uses this specification specifies which of the APIs and annotations defined here are used. The APIs and annotations an SCA Runtime has to support depends on which Java-based component implementation specification the runtime supports. For example, see the SCA POJO Component Implementation Specification [JAVA_CI].

An implementation that claims to conform to this specification MUST meet the following conditions:

  1. The implementation MUST meet all the conformance requirements defined by the SCA Assembly Model Specification [ASSEMBLY].
  2. The implementation MUST support <interface.java> and MUST comply with all the normative statements in Section 3.
  3. The implementation MUST reject an SCA Java XML Document that does not conform to the sca-interface-java.xsd schema.
  4. The implementation MUST support and comply with all the normative statements in Section 10.

A.  XML Schema: sca-interface-java.xsd

<?xml version="1.0" encoding="UTF-8"?>

<!-- Copyright(C) OASIS(R) 2005,2009. All Rights Reserved.

     OASIS trademark, IPR and other policies apply.  -->

<schema xmlns="http://www.w3.org/2001/XMLSchema"

   targetNamespace="http://docs.oasis-open.org/ns/opencsa/sca/200903"

   xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903"

   elementFormDefault="qualified">

  

   <include schemaLocation="sca-core-1.1-cd03.xsd"/>

  

   <!-- Java Interface -->

   <element name="interface.java" type="sca:JavaInterface"

            substitutionGroup="sca:interface"/>

   <complexType name="JavaInterface">

      <complexContent>

         <extension base="sca:Interface">

            <sequence>

               <any namespace="##other" processContents="lax" minOccurs="0"

                    maxOccurs="unbounded"/>

            </sequence>

            <attribute name="interface" type="NCName" use="required"/>

            <attribute name="callbackInterface" type="NCName"

                       use="optional"/>

            <anyAttribute namespace="##other" processContents="lax"/>

         </extension>

      </complexContent>

   </complexType>

  

</schema>

 

B.  Conformance Items

This section contains a list of conformance items for the SCA-J Common Annotations and APIs specification.

 

Conformance ID

Description

[JCA20001]

Remotable Services MUST NOT make use of method overloading.

[JCA20002]

the SCA runtime MUST ensure that a stateless scoped implementation instance object is only ever dispatched on one thread at any one time.

[JCA20003]

within the SCA lifecycle of a stateless scoped implementation instance, the SCA runtime MUST only make a single invocation of one business method.

[JCA20004]

Where an implementation is used by a "domain level component", and the implementation is marked "Composite" scope, the SCA runtime MUST ensure that all consumers of the component appear to be interacting with a single runtime instance of the implementation.

[JCA20005]

When the implementation class is marked for eager initialization, the SCA runtime MUST create a composite scoped instance when its containing component is started.

[JCA20006]

If a method of an implementation class is marked with the @Init annotation, the SCA runtime MUST call that method when the implementation instance is created.

[JCA20007]

the SCA runtime MAY run multiple threads in a single composite scoped implementation instance object and the SCA runtime MUST NOT perform any synchronization.

[JCA20008]

Where an implementation is marked "Composite" scope and it is used by a component that is nested inside a composite that is used as the implementation of a higher level component, the SCA runtime MUST ensure that all consumers of the component appear to be interacting with a single runtime instance of the implementation. There can be multiple instances of the higher level component, each running on different nodes in a distributed SCA runtime.

[JCA20009]

The SCA runtime MAY use by-reference semantics when passing input parameters, return values or exceptions on calls to remotable services within the same JVM if both the service method implementation and the service proxy used by the client are marked “allows pass by reference”.

[JCA20010]

The SCA runtime MUST use by-value semantics when passing input parameters, return values and exceptions on calls to remotable services within the same JVM if the service method implementation is not marked “allows pass by reference” or the service proxy used by the client is not marked “allows pass by reference”.

[JCA30001]

The value of the @interface attribute MUST be the fully qualified name of the Java interface class

[JCA30002]

The value of the @callbackInterface attribute MUST be the fully qualified name of a Java interface used for callbacks

[JCA30003]

if the Java interface class identified by the @interface attribute does contain a Java @Callback annotation, then the Java interface class identified by the @callbackInterface attribute MUST be the same interface class.

[JCA30004]

The interface.java element MUST conform to the schema defined in the sca-interface-java.xsd schema.

[JCA30005]

The value of the @remotable attribute on the <interface.java/> element does not override the presence of a @Remotable annotation on the interface class and so if the interface class contains a @Remotable annotation and the @remotable attribute has a value of "false", then the SCA Runtime MUST raise an error and MUST NOT run the component concerned.

[JCA30008]

A Java implementation class referenced by the @interface or the @callbackInterface attribute of an <interface.java/> element MUST NOT contain the following SCA Java annotations:

@Intent, @Qualifier.

[JCA30006]

A Java interface referenced by the @interface attribute of an <interface.java/> element MUST NOT contain any of the following SCA Java annotations:

@AllowsPassByReference, @ComponentName, @Constructor, @Context, @Destroy, @EagerInit, @Init, @Intent, @Property, @Qualifier, @Reference, @Scope, @Service.

[JCA30007]

A Java interface referenced by the @callbackInterface attribute of an <interface.java/> element MUST NOT contain any of the following SCA Java annotations:

@AllowsPassByReference, @Callback, @ComponentName, @Constructor, @Context, @Destroy, @EagerInit, @Init, @Intent, @Property, @Qualifier, @Reference, @Scope, @Service.

[JCA40001]

The SCA Runtime MUST call a constructor of the component implementation at the start of the Constructing state.

[JCA40002]

The SCA Runtime MUST perform any constructor reference or property injection when it calls the constructor of a component implementation.

[JCA40003]

When the constructor completes successfully, the SCA Runtime MUST transition the component implementation to the Injecting state.

[JCA40004]

If an exception is thrown whilst in the Constructing state, the SCA Runtime MUST transition the component implementation to the Terminated state.

[JCA40005]

When a component implementation instance is in the Injecting state, the SCA Runtime MUST first inject all field and setter properties that are present into the component implementation.

[JCA40006]

When a component implementation instance is in the Injecting state, the SCA Runtime MUST inject all field and setter references that are present into the component implementation, after all the properties have been injected.

[JCA40007]

The SCA Runtime MUST ensure that the correct synchronization model is used so that all injected properties and references are made visible to the component implementation without requiring the component implementation developer to do any specific synchronization.

[JCA40008]

The SCA Runtime MUST NOT invoke Service methods on the component implementation when the component implementation is in the Injecting state.

[JCA40009]

When the injection of properties and references completes successfully, the SCA Runtime MUST transition the component implementation to the Initializing state.

[JCA40010]

If an exception is thrown whilst injecting properties or references, the SCA Runtime MUST transition the component implementation to the Destroying state.

[JCA40011]

When the component implementation enters the Initializing State, the SCA Runtime MUST call the method annotated with @Init on the component implementation, if present.

[JCA40012]

If a component implementation invokes an operation on an injected reference that refers to a target that has not yet been initialized, the SCA Runtime MUST throw a ServiceUnavailableException.

[JCA40013]

The SCA Runtime MUST NOT invoke Service methods on the component implementation when the component implementation instance is in the Initializing state.

[JCA40014]

Once the method annotated with @Init completes successfully, the SCA Runtime MUST transition the component implementation to the Running state.

[JCA40015]

If an exception is thrown whilst initializing, the SCA Runtime MUST transition the component implementation to the Destroying state.

[JCA40016]

The SCA Runtime MUST invoke Service methods on a component implementation instance when the component implementation is in the Running state and a client invokes operations on a service offered by the component.

[JCA40017]

When the component implementation scope ends, the SCA Runtime MUST transition the component implementation to the Destroying state.

[JCA40018]

When a component implementation enters the Destroying state, the SCA Runtime MUST call the method annotated with @Destroy on the component implementation, if present.

[JCA40019]

If a component implementation invokes an operation on an injected reference that refers to a target that has been destroyed, the SCA Runtime MUST throw an InvalidServiceException.

[JCA40020]

The SCA Runtime MUST NOT invoke Service methods on the component implementation when the component implementation instance is in the Destroying state.

[JCA40021]

Once the method annotated with @Destroy completes successfully, the SCA Runtime MUST transition the component implementation to the Terminated state.

[JCA40022]

If an exception is thrown whilst destroying, the SCA Runtime MUST transition the component implementation to the Terminated state.

[JCA40023]

The SCA Runtime MUST NOT invoke Service methods on the component implementation when the component implementation instance is in the Terminated state.

[JCA70001]

SCA identifies annotations that correspond to intents by providing an @Intent annotation which MUST be used in the definition of a specific intent annotation.

[JCA70002]

Intent annotations MUST NOT be applied to the following:

·         A method of a service implementation class, except for a setter method that is either annotated with @Reference or introspected as an SCA reference according to the rules in the appropriate Component Implementation specification

·         A service implementation class field that is not either annotated with @Reference or introspected as an SCA reference according to the rules in the appropriate Component Implementation specification

·         A service implementation class constructor parameter that is not annotated with @Reference

[JCA70003]

Where multiple intent annotations (general or specific) are applied to the same Java element, the SCA runtime MUST compute the combined intents for the Java element by merging the intents from all intent annotations on the Java element according to the SCA Policy Framework [POLICY] rules for merging intents at the same hierarchy level.

[JCA70004]

If intent annotations are specified on both an interface method and the method's declaring interface, the SCA runtime MUST compute the effective intents for the method by merging the combined intents from the method with the combined intents for the interface according to the SCA Policy Framework [POLICY] rules for merging intents within a structural hierarchy, with the method at the lower level and the interface at the higher level.

[JCA70005]

The @PolicySets annotation MUST NOT be applied to the following:

·         A method of a service implementation class, except for a setter method that is either annotated with @Reference or introspected as an SCA reference according to the rules in the appropriate Component Implementation specification

·         A service implementation class field that is not either annotated with @Reference or introspected as an SCA reference according to the rules in the appropriate Component Implementation specification

·         A service implementation class constructor parameter that is not annotated with @Reference

[JCA70006]

If the @PolicySets annotation is specified on both an interface method and the method's declaring interface, the SCA runtime MUST compute the effective policy sets for the method by merging the policy sets from the method with the policy sets from the interface.

[JCA80001]

The ComponentContext.getService method MUST throw an IllegalArgumentException if the reference identified by the referenceName parameter has multiplicity of 0..n or 1..n.

[JCA80002]

The ComponentContext.getRequestContext method MUST return non-null when invoked during the execution of a Java business method for a service operation or a callback operation, on the same thread that the SCA runtime provided, and MUST return null in all other cases.

[JCA80003]

When invoked during the execution of a service operation, the getServiceReference method MUST return a ServiceReference that represents the service that was invoked. When invoked during the execution of a callback operation, the getServiceReference method MUST return a ServiceReference that represents the callback that was invoked.

[JCA90001]

An SCA runtime MUST verify the proper use of all SCA annotations and if an annotation is improperly used, the SCA runtime MUST NOT run the component which uses the invalid implementation code.

[JCA90002]

SCA annotations MUST NOT be used on static methods or on static fields. It is an error to use an SCA annotation on a static method or a static field of an implementation class and the SCA runtime MUST NOT instantiate such an implementation class.

[JCA90003]

If a constructor of an implementation class is annotated with @Constructor and the constructor has parameters, each of these parameters MUST have either a @Property annotation or a @Reference annotation.

[JCA90004]

A method annotated with @Destroy MAY have any access modifier and MUST have a void return type and no arguments.

[JCA90005]

If there is a method annotated with @Destroy that matches the criteria for the annotation, the SCA runtime MUST call the annotated method when the scope defined for the implementation class ends.

 

 

[JCA90007]

When marked for eager initialization with an @EagerInit annotation, the composite scoped instance MUST be created when its containing component is started.

[JCA90008]

A method marked with the @Init annotation MAY have any access modifier and MUST have a void return type and no arguments.

[JCA90009]

If there is a method annotated with @Init that matches the criteria for the annotation, the SCA runtime MUST call the annotated method after all property and reference injection is complete.

 

 

[JCA90011]

The @Property annotation MUST NOT be used on a class field that is declared as final.

 

 

[JCA90013]

For a @Property annotation applied to a constructor parameter, there is no default value for the name attribute and the name attribute MUST be present.

[JCA90014]

For a @Property annotation applied to a constructor parameter, the required attribute MUST have the value true.

[JCA90015]

The @Qualifier annotation MUST be used in a specific intent annotation definition where the intent has qualifiers.

[JCA90016]

The @Reference annotation MUST NOT be used on a class field that is declared as final.

 

 

[JCA90018]

For a @Reference annotation applied to a constructor parameter, there is no default for the name attribute and the name attribute MUST be present.

[JCA90019]

For a @Reference annotation applied to a constructor parameter, the required attribute MUST have the value true.

[JCA90020]

If the type of a reference is not an array or any type that extends or implements java.util.Collection, then the SCA runtime MUST introspect the component type of the implementation with a <reference/> element with @multiplicity= 0..1 if the @Reference annotation required attribute is false and with @multiplicity=1..1 if the @Reference annotation required attribute is true.

[JCA90021]

If the type of a reference is defined as an array or as any type that extends or implements java.util.Collection, then the SCA runtime MUST introspect the component type of the implementation with a <reference/> element with @multiplicity=0..n if the @Reference annotation required attribute is false and with @multiplicity=1..n if the @Reference annotation required attribute is true.

[JCA90022]

An unwired reference with a multiplicity of 0..1 MUST be presented to the implementation code by the SCA runtime as null (either via injection or via API call).

[JCA90023]

An unwired reference with a multiplicity of 0..n MUST be presented to the implementation code by the SCA runtime as an empty array or empty collection (either via injection or via API call).

[JCA90024]

References MAY be reinjected by an SCA runtime after the initial creation of a component if the reference target changes due to a change in wiring that has occurred since the component was initialized.

[JCA90025]

In order for reinjection to occur, the following MUST be true:

1.     The component MUST NOT be STATELESS scoped.

2.     The reference MUST use either field-based injection or setter injection. References that are injected through constructor injection MUST NOT be changed.

[JCA90026]

If a reference target changes and the reference is not reinjected, the reference MUST continue to work as if the reference target was not changed.

[JCA90027]

If an operation is called on a reference where the target of that reference has been undeployed, the SCA runtime SHOULD throw an InvalidServiceException.

[JCA90028]

If an operation is called on a reference where the target of the reference has become unavailable for some reason, the SCA runtime SHOULD throw a ServiceUnavailableException.

[JCA90029]

If the target service of the reference is changed, the reference MUST either continue to work or throw an InvalidServiceException when it is invoked.

[JCA90030]

A ServiceReference that has been obtained from a reference by ComponentContext.cast() corresponds to the reference that is passed as a parameter to cast().  If the reference is subsequently reinjected, the ServiceReference obtained from the original reference MUST continue to work as if the reference target was not changed.

[JCA90031]

If the target of a ServiceReference has been undeployed, the SCA runtime SHOULD throw a InvalidServiceException when an operation is invoked on the ServiceReference.

[JCA90032]

If the target of a ServiceReference has become unavailable, the SCA runtime SHOULD throw a ServiceUnavailableException when an operation is invoked on the ServiceReference.

[JCA90033]

If the target service of a ServiceReference is changed, the reference MUST either continue to work or throw an InvalidServiceException when it is invoked.

[JCA90034]

A reference or ServiceReference accessed through the component context by calling getService() or getServiceReference() MUST correspond to the current configuration of the domain. This applies whether or not reinjection has taken place.

[JCA90035]

If the target of a reference or ServiceReference accessed through the component context by calling getService() or getServiceReference() has been undeployed or has become unavailable, the result SHOULD be a reference to the undeployed or unavailable service, and attempts to call business methods SHOULD throw an InvalidServiceException or a ServiceUnavailableException.

[JCA90036]

If the target service of a reference or ServiceReference accessed through the component context by calling getService() or getServiceReference() has changed, the returned value SHOULD be a reference to the changed service.

[JCA90037]

in the cases where reference reinjection is not allowed, the array or Collection for a reference of multiplicity 0..n or multiplicity 1..n MUST NOT change its contents when changes occur to the reference wiring or to the targets of the wiring.

[JCA90038]

In cases where the contents of a reference array or collection change when the wiring changes or the targets change, then for references that use setter injection, the setter method MUST be called by the SCA runtime for any change to the contents.

[JCA90039]

A reinjected array or Collection for a reference MUST NOT be the same array or Collection object previously injected to the component.

[JCA90040]

A remotable service can be published externally as a service and MUST be translatable into a WSDL portType.

[JCA90041]

The @Scope annotation MUST only be used on a service's implementation class. It is an error to use this annotation on an interface.

[JCA90042]

An implementation class need not be declared as implementing all of the interfaces implied by the services declared in its @Service annotation, but all methods of all the declared service interfaces MUST be present.

[JCA90043]

A @Service annotation MUST only have one of the interfaces attribute or value attribute specified.

[JCA90044]

A @Service annotation that specifies a single class object Void.class either explicitly or by default is equivalent to not having the annotation there at all - such a @Service annotation MUST be ignored.

[JCA90045]

A component implementation MUST NOT have two services with the same Java simple name.

[JCA90046]

When used to annotate a method or a field of an implementation class for injection of a callback object, the@Callback annotation MUST NOT specify any attributes.

[JCA90047]

For a @Property annotation, if the type of the Java class field or the type of the input parameter of the setter method or constructor is defined as an array or as any type that extends or implements java.util.Collection, then the SCA runtime MUST introspect the component type of the implementation with a <property/> element with a @many attribute set to true, otherwise @many MUST be set to false.

[JCA90048]

If the name attribute is specified on the @Service annotation, the value attribute MUST also be specified.

[JCA90049]

If the names attribute is specified for an @Service annotation, the interfaces attribute MUST also be specified.

[JCA90050]

The number of Strings in the names attributes array of the @Service annotation MUST match the number of elements in the interfaces attribute array.

[JCA90051]

The @Service annotation MUST NOT specify Void.class in conjunction with any other service class or interface.

[JCA90052]

The @AllowsPassByReference annotation MAY be placed on an individual method of a remotable service implementation, on a service implementation class, or on an individual reference for a remotable service.  When applied to a reference, it MAY appear anywhere that the @Remotable annotation MAY appear.  It MUST NOT appear anywhere else.

[JCA100001]

For the purposes of the Java-to-WSDL mapping algorithm, the SCA runtime MUST treat a Java interface as if it had a @WebService annotation on the class, even if it doesn't.

[JCA100002]

The SCA runtime MUST treat an @org.oasisopen.sca.annotation.OneWay annotation as a synonym for the @javax.jws.OneWay annotation.

[JCA100003]

For the WSDL-to-Java mapping, the SCA runtime MUST take the generated @WebService annotation to imply that the Java interface is @Remotable.

[JCA100004]

SCA runtimes MUST support the JAXB 2.1 mapping from Java types to XML schema types.

[JCA100005]

SCA runtimes MAY support the SDO 2.1 mapping from Java types to XML schema types.

[JCA100006]

For SCA service interfaces defined using interface.java, the Java interface MUST NOT contain the additional client-side asynchronous polling and callback methods defined by JAX-WS.

[JCA100007]

For SCA reference interfaces defined using interface.java, the Java interface MAY contain the additional client-side asynchronous polling and callback methods defined by JAX-WS.

[JCA100008]

If the additional client-side asynchronous polling and callback methods defined by JAX-WS are present in the interface which declares the type of a reference in the implementation, SCA Runtimes MUST NOT include these methods in the SCA reference interface in the component type of the implementation.

[JCA100009]

SCA runtimes MUST support the use of the JAX-WS client asynchronous model.

 

 

 

C.  Acknowledgements

The following individuals have participated in the creation of this specification and are gratefully acknowledged:

Participants:

Participant Name

Affiliation

Bryan Aupperle

IBM

Ron Barack

SAP AG*

Michael Beisiegel

IBM

Henning Blohm

SAP AG*

David Booz

IBM

Martin Chapman

Oracle Corporation

Graham Charters

IBM

Shih-Chang Chen

Oracle Corporation

Chris Cheng

Primeton Technologies, Inc.

Vamsavardhana Reddy Chillakuru

IBM

Roberto Chinnici

Sun Microsystems

Pyounguk Cho

Oracle Corporation

Eric Clairambault

IBM

Mark Combellack

Avaya, Inc.

Jean-Sebastien Delfino

IBM

Mike Edwards

IBM

Raymond Feng

IBM

Bo Ji

Primeton Technologies, Inc.

Uday Joshi

Oracle Corporation

Anish Karmarkar

Oracle Corporation

Michael Keith

Oracle Corporation

Rainer Kerth

SAP AG*

Meeraj Kunnumpurath

Individual

Simon Laws

IBM

Yang Lei

IBM

Mark Little

Red Hat

Ashok Malhotra

Oracle Corporation

Jim Marino

Individual

Jeff Mischkinsky

Oracle Corporation

Sriram Narasimhan

TIBCO Software Inc.

Simon Nash

Individual

Sanjay Patil

SAP AG*

Plamen Pavlov

SAP AG*

Peter Peshev

SAP AG*

Ramkumar Ramalingam

IBM

Luciano Resende

IBM

Michael Rowley

Active Endpoints, Inc.

Vladimir Savchenko

SAP AG*

Pradeep Simha

TIBCO Software Inc.

Raghav Srinivasan

Oracle Corporation

Scott Vorthmann

TIBCO Software Inc.

Feng Wang

Primeton Technologies, Inc.

Robin Yang

Primeton Technologies, Inc.

 

 

D.  Non-Normative Text

E.  Revision History

 

Revision

Date

Editor

Changes Made

1

2007-09-26

Anish Karmarkar

Applied the OASIS template + related changes to the Submission

2

2008-02-28

Anish Karmarkar

Applied resolution of issues: 4, 11, and 26

3

2008-04-17

Mike Edwards

Ed changes

4

2008-05-27

Anish Karmarkar

David Booz

Mark Combellack

Added InvalidServiceException in Section 7

Various editorial updates

WD04

2008-08-15

Anish Karmarkar

* Applied resolution of issue 9 (it was applied before, not sure by whom, but it was applied incorrectly)

* Applied resolution of issue 12, 22, 23, 29, 31, 35, 36, 37, 44, 45

* Note that issue 33 was applied, but not noted, in a previous version

* Replaced the osoa.org NS with the oasis-open.org NS

WD05

2008-10-03

Anish Karmarkar

* Fixed the resolution of issue 37 but re-adding the sentence: "However, the @... annotation must be used in order to inject a property onto a non-public field. -- in the @Property and @Reference section

* resolution of issue 9 was applied incorrectly. Fixed that -- removed the requirement for throwing an exception on ComponentContext.getServiceReferences() when multiplicity of references > 1

* minor ed changes

cd01-rev1

2008-12-11

Anish Karmarkar

* Fixed reference style to [RFC2119] instead of [1].

* Applied resolutions of issues 20, 21, 41, 42, 43, 47, 48, 49.

cd01-rev2

2008-12-12

Anish Karmarkar

* Applied resolutions of issues 61, 71, 72, 73,  79, 81, 82, 84, 112

cd01-rev3

2008-12-16

David Booz

* Applied resolution of issues 56, 75, 111

cd01-rev4

2009-01-18

Anish Karmarkar

* Applied resolutions of issues 28, 52, 94, 96, 99, 101

cd02

2009-01-26

Mike Edwards

Minor editorial cleanup.

All changes accepted.

All comments removed.

cd02-rev1

2009-02-03

Mike Edwards

Issues 25+95

Issue 120

cd02-rev2

2009-02-08

Mike Edwards

Merge annotation definitions contained in section 10 into section 8

Move remaining parts of section 10 to section 7.

Accept all changes.

cd02-rev3

2009-03-16

Mike Edwards

Issue 104 - RFC2119 work and formal marking of all normative statements - all sections

- Completion of Appendix B (list of all normative statements)

Accept all changes

cd02-rev4

2009-03-20

Mike Edwards

Editorially removed sentence about componentType side files in Section1

Editorially changed package name to org.oasisopen from org.osoa in lines 291, 292

Issue 6 -  add Section 2.3, modify section 9.1

Issue 30 - Section 2.2.2

Issue 76 - Section 6.2.4

Issue 27 - Section 7.6.2, 7.6.2.1

Issue 77 - Section 1.2

Issue 102 - Section 9.21

Issue 123 - conersations removed

Issue 65 - Added a new Section 4

** Causes renumbering of later sections **

** NB new numbering is used below **

Issue 119 - Added a new section 12

Issue 125 - Section 3.1

Issue 130 - (new number) Section 8.6.2.1

Issue 132 - Section 1

Issue 133 - Section 10.15, Section 10.17

Issue 134 - Section 10.3, Section 10.18

Issue 135 - Section 10.21

Issue 138 - Section 11

Issue 141 - Section 9.1

Issue 142 - Section 10.17.1

cd02-rev5

2009-04-20

Mike Edwards

Issue 154 - Appendix A

Issue 129 - Section 8.3.1.1

cd02-rev6

2009-04-28

Mike Edwards

Issue 148 - Section 3

Issue 98 - Section 8

cd02-rev7

2009-04-30

Mike Edwards

Editorial cleanup throughout the spec

cd02-rev8

2009-05-01

Mike Edwards

Further extensive editorial cleanup throughout the spec

Issue 160 - Section 8.6.2 & 8.6.2.1 removed

cd02-rev8a

2009-05-03

Simon Nash

Minor editorial cleanup

cd03

2009-05-04

Anish Karmarkar

Updated references and front page clean up