Presentation is loading. Please wait.

Presentation is loading. Please wait.

SCA and Java n SCA provides support for multiple Java-based component implementation types l Java POJOs (implementation.java) l Spring Beans (implementation.spring)

Similar presentations


Presentation on theme: "SCA and Java n SCA provides support for multiple Java-based component implementation types l Java POJOs (implementation.java) l Spring Beans (implementation.spring)"— Presentation transcript:

1 SCA and Java n SCA provides support for multiple Java-based component implementation types l Java POJOs (implementation.java) l Spring Beans (implementation.spring) l EJB (implementation.ejb) n Common annotations and API l May be used by all Java-based implementations l Metadata service contracts based on Java interfaces l Metadata component type information l Metadata container-component implementation contract l Asynchronous interactions and callbacks l APIs (few) for accessing assembly information

2 An example Java implementation type n Just Java with a few (optional) annotations public class LoanServiceImpl implements LoanService { private CreditService creditService; public LoanServiceImpl(@Reference CreditService creditService) { this.creditService = creditService; } public void apply(Application application) { String id = application.getCustomerID(); int rating = creditService.getCreditScore(id); }

3 Key Principles n Simplify component development l Use POJOs l Minimal container coupling to implementations l Achieved through Inversion of Control or IoC n Simplify reuse through service-based design l Strongly defined contracts that pass data l Remove need to interact directly with binding protocols and transports most of the time l Focus on loosely-coupled interactions

4 Metadata for Service Contracts n @Remotable l Defines a service that may be visible across process boundaries n @Conversational, @EndsConversation l Deals with conversational services l More on this later n @OneWay l Denotes a non-blocking operation l More on this later n @Callback l Defines callback interface and injection

5 Metadata for defining component type information n @Service l Defines services offered by an implementation n @Property l Identifies a component type property l Setter-based, ctor-based and field-based injection supported n @Reference l Identifies a component type reference l Setter-based, ctor-based and field-based injection supported n SCA defines heuristics for unannotated POJOs as well

6 Container-Component Implementation Contract Metadata n @AllowsPassByReference l Per-class or per-operation n @Scope l Specifies visibility and lifecycle contract l STATELESS (default), REQUEST, CONVERSATION, COMPOSITE l Containers may also add custom scopes n Conversation semantics l Always between two parties l May be long-running

7 More on Conversations n Making an implementation conversational @Conversational public interface Counter { int getCount(); void increment(); @EndsConversation int reset(); } @Scope(“CONVERSATION”) public class CounterImpl implements Counter { private int count; public int getCount() { return count; } public void increment() { ++i; } public void reset() { i = 0; }

8 Asynchronous Interactions n @OneWay l Indicate a non-blocking call on an interface public interface Counter { int getCount(); @OneWay void increment(); @EndsConversation int reset(); }

9 Callbacks n Stateful and stateless n Non-blocking or blocking @Callback(MyCallback.class) public interface MyService { void call(); } public interface MyCallback { void call(); } public class MyServiceImpl { @Callback public void setCallback(MyCallback callback){ //... } //... }

10 Stateful Callbacks n LoanShark service Conversational @Callback(Borrower.class) public interface LoanShark { void borrow(double amount); @EndsConversation void payback(); @OneWay void delay(); } public interface Borrower { warn(); breakArm(); @EndsConversation kill(); }

11 APIs n Only a few, deal with specific use cases, e.g. n Component context, name n Request contexts n Service references (may be passed) n Conversation id n Set callback

12 SCA - Spring Integration www.oasis-open.org

13 Spring n Spring application contexts can be used as component implementations n Spring beans can be wired to SCA or external services services n Spring beans can have services exposed l Other SCA components may be wired to them l Beans may be bound using an SCA binding Spring Beans SCA Reference SCA Service implementation.spring

14 SCA - Java EE Integration www.oasis-open.org

15 Why SCA With Java EE Platform? Java EE gets n Additional implementation types and bindings on the application level: l BPEL, Spring,... l More to expect: For example ESB style interactions n Move protocol specifics to configuration via bindings n Cross-Application Assembly l Domain assembly extends Enterprise App Assembly to the cross-app level SCA gets n Reuse of existing assets, know-how, tooling.

16 www.oasis-open.org Types of Integration n Bindings l JMS, Session Beans, JCA n Implementation Types l Java EE Components (SessionBeans, WebComponents, etc) as implementation types. l Java EE Archives (EARs, WARs, EJB-JARs) as implementation types.

17 www.oasis-open.org Use Cases for Bindings Binding.ejb n Consume session beans from service components n Expose SCA services as session beans, so that they can be consumed by unmodified Java EE components Binding.jms, Binding.jca n Several other binding types relate to Java EE, but are the focus of other working groups.

18 www.oasis-open.org Use Cases for Java EE Components as Implementation Types n Java EE components use SCA‘s programming model to consume SCA-exposed services. n Use session beans as Service Component Implementations that may be consumed by other SCA components. n Use recursive SCA assembly in enterprise applications. n Deploy SCA Components as a part of a Java EE application SCA is the Scale-Out model for Java EE

19 www.oasis-open.org Use Cases for Java EE Applications as Implementation Types n Use Java EE applications as Service Component Implementations l Modified l Unmodified n Allow unmodified Java EE applications to be rewired by SCA. n Exposure of Java EE services at any level of recursive assembly. SCA is the level of assembly above Java EE

20 Programming Model in JEE Components n Will be shown during demo:

21 Composite with a session bean component Contribution is JEE Archive: Sample Assembly I <composite name="beancomposite" targetNamespace="http://www.sample.org" xmlns="http://www.osoa.org/xmlns/sca/1.0"> <implementation.ejb ejb-link="module.jar#RemotableAccountingBean"/>

22 Including it into the domain <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:sample="http://www.sample.org" > Declare sample:beancomposite as Deployment Composite in In META-INF/sca-contribution.xml: Contribution is JEE Archive: Sample Assembly II

23 Contribution containing a Java EE archive

24 Open Questions n What is the componentType of an unmodified EAR (ie, one with no application.composite)? n Can ejb-ref‘s be rewired by SCA?


Download ppt "SCA and Java n SCA provides support for multiple Java-based component implementation types l Java POJOs (implementation.java) l Spring Beans (implementation.spring)"

Similar presentations


Ads by Google