Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
SCA and Java SCA provides support for multiple Java-based component implementation types Java POJOs (implementation.java) Spring Beans (implementation.spring) EJB (implementation.ejb) Common annotations and API May be used by all Java-based implementations Metadata service contracts based on Java interfaces Metadata component type information Metadata container-component implementation contract Asynchronous interactions and callbacks APIs (few) for accessing assembly information An example Java implementation type 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); } } Key Principles Simplify component development Use POJOs Minimal container coupling to implementations Achieved through Inversion of Control or IoC Simplify reuse through service-based design Strongly defined contracts that pass data Remove need to interact directly with binding protocols and transports most of the time Focus on loosely-coupled interactions Metadata for Service Contracts @Remotable @Conversational, @EndsConversation Deals with conversational services More on this later @OneWay Defines a service that may be visible across process boundaries Denotes a non-blocking operation More on this later @Callback Defines callback interface and injection Metadata for defining component type information @Service @Property Identifies a component type property Setter-based, ctor-based and field-based injection supported @Reference Defines services offered by an implementation Identifies a component type reference Setter-based, ctor-based and field-based injection supported SCA defines heuristics for unannotated POJOs as well Container-Component Implementation Contract Metadata @AllowsPassByReference @Scope Per-class or per-operation Specifies visibility and lifecycle contract STATELESS (default), REQUEST, CONVERSATION, COMPOSITE Containers may also add custom scopes Conversation semantics Always between two parties May be long-running Asynchronous Interactions @OneWay Indicate a non-blocking call on an interface public interface Counter { int getCount(); @OneWay void increment(); @EndsConversation int reset(); } Callbacks Stateful and stateless 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){ //... } //... } Stateful Callbacks 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(); } APIs Only a few, deal with specific use cases, e.g. Component context, name Request contexts Service references (may be passed) Conversation id Set callback www.oasis-open.org SCA - Spring Integration Spring Spring application contexts can be used as component implementations Spring beans can be wired to SCA or external services services Spring beans can have services exposed Other SCA components may be wired to them Beans may be bound using an SCA binding Spring Beans SCA Service SCA Reference implementation.spring www.oasis-open.org SCA - Java EE Integration www.oasis-open.org Why SCA With Java EE Platform? Java EE gets Additional implementation types and bindings on the application level: BPEL, Spring,... More to expect: For example ESB style interactions Move protocol specifics to configuration via bindings Cross-Application Assembly Domain assembly extends Enterprise App Assembly to the cross-app level SCA gets Reuse of existing assets, know-how, tooling. www.oasis-open.org Types of Integration Bindings JMS, Session Beans, JCA Implementation Types Java EE Components (SessionBeans, WebComponents, etc) as implementation types. Java EE Archives (EARs, WARs, EJB-JARs) as implementation types. www.oasis-open.org Use Cases for Bindings Binding.ejb Consume session beans from service components Expose SCA services as session beans, so that they can be consumed by unmodified Java EE components Binding.jms, Binding.jca Several other binding types relate to Java EE, but are the focus of other working groups. www.oasis-open.org Use Cases for Java EE Components as Implementation Types Java EE components use SCA‘s programming model to consume SCA-exposed services. Use session beans as Service Component Implementations that may be consumed by other SCA components. Use recursive SCA assembly in enterprise applications. Deploy SCA Components as a part of a Java EE application SCA is the Scale-Out model for Java EE www.oasis-open.org Use Cases for Java EE Applications as Implementation Types Use Java EE applications as Service Component Implementations Modified Unmodified Allow unmodified Java EE applications to be rewired by SCA. Exposure of Java EE services at any level of recursive assembly. SCA is the level of assembly above Java EE Programming Model in JEE Components Will be shown during demo: Contribution is JEE Archive: Sample Assembly I module.jar Composite with a session bean component RemotableAccountingBean sample:beancomposite <?xml version="1.0" encoding="UTF-8"?> org.sample.Accounting <composite name="beancomposite" targetNamespace="http://www.sample.org" xmlns="http://www.osoa.org/xmlns/sca/1.0"> <component name="org.sample.Accounting"> <implementation.ejb ejb-link="module.jar#RemotableAccountingBean"/> </component> </composite> Contribution is JEE Archive: Sample Assembly II App1 module.jar Including it into the domain Declare sample:beancomposite as Deployment Composite in In META-INF/sca-contribution.xml: RemotableAccountingBean sample:beancomposite org.sample.Accounting <?xml version="1.0" encoding="UTF-8"?> <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:sample="http://www.sample.org" > <deployable composite=“sample:beancomposite"/> </contribution> org.sample.Accounting domain composite Contribution containing a Java EE archive a non-Java EE contribution Contribution application.ear module.jar RemotableBean accounting_application binding.ws beancomponent some other composite some_component a component using <implementation.jee archive=“application.ear“/> othercomponent Open Questions What is the componentType of an unmodified EAR (ie, one with no application.composite)? Can ejb-ref‘s be rewired by SCA?