The SCA Java Common Annotations and APIs specification defines annotations and APIs that can be used in the implementation of a SCA component written in Java. Some of the APIs can also be used in code that is only the client of services provided by SCA components. These annotations and APIs are intended to be usable in conjunction with existing Java-based programming models, such as Spring or EJBs. However, these annotations and APIs can also be used with just the capabilities of Java SE, as described in the separate specification titled: SCA Java Component Implementation Specification.
When these annotations and APIs are used in conjunction with other programming models, it is likely that not all of them will be supported. In that case, the developer needs to look to the documentation of that hybrid programming model for a description of which of the annotations and APIs are supported.
The Java Client and Implementation specification covers:
- Java mappings for assembly model concepts such as "component" "component type", "service", "reference", and "property"
- Java mappings for implementing asynchronous and conversational services
- Java mappings for specifying component lifecycle notifications
- Java mappings for specifying service scopes
- Java mappings for standard intents and other policy configuration.
What's New? - Java Common Annotations and APIs
In V0.95 and earlier versions of SCA, this specification text was combined with the description of the programming model that could be used to implement SCA components without depending on anything outside of Java SE. The SCA Java Component Implementation material has been split out into a specification of that name. The material that remained in this specification is limited to features that could be layered onto other Java-based programming models.
The specification also has a large new section that deals with policies and intents. This section describes how SCA policy mechanisms can be represented in a Java class. It also defines specific annotations that can be used to define security intents (e.g. confidentiality, integrity, authentication).
The APIs have also changed somewhat since v0.95. The following are some of the more noteworthy changes:
- Greater use of generics.
- CompositeContext is gone and most of its methods are now instead on ComponentContext.
- CurrentCompositeContext is gone. The mechanism for accessing a component context (or anything else) from code that does not represent an SCA component or can't have a context injected on it is now implementation dependent.
- Injected callbacks are now implementations of a new CallableReference interface, which is a parent interface of ServiceReference. In 0.95 the ServiceReference object was used for both the client and service perspective in a way that caused confusion and potential errors.
- ServiceReference methods of getSessionID() and endSession() have been moved to a new Conversation object with two methods (getConversationID() and end()).
- The "session" scope is now called "conversational". The @Session annotation is replaced by an @Conversational annotation on interfaces and an @ConversationAttributes annotation on classes.
- Constructor-based injection is now supported via the new @Constructor annotation.