SCA and Java

download SCA and Java

of 24

  • date post

  • Category


  • view

  • download


Embed Size (px)


SCA and Java. SCA provides support for multiple Java-based component implementation types Java POJOs ( Spring Beans (implementation.spring) EJB (implementation.ejb) Common annotations and API May be used by all Java-based implementations - PowerPoint PPT Presentation

Transcript of SCA and Java

  • SCA and JavaSCA provides support for multiple Java-based component implementation typesJava POJOs ( Beans (implementation.spring)EJB (implementation.ejb)Common annotations and APIMay be used by all Java-based implementationsMetadata service contracts based on Java interfacesMetadata component type informationMetadata container-component implementation contractAsynchronous interactions and callbacks APIs (few) for accessing assembly information

  • An example Java implementation typeJust 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 PrinciplesSimplify component developmentUse POJOsMinimal container coupling to implementationsAchieved through Inversion of Control or IoCSimplify reuse through service-based designStrongly defined contracts that pass dataRemove need to interact directly with binding protocols and transports most of the timeFocus on loosely-coupled interactions

  • Metadata for Service Contracts@RemotableDefines a service that may be visible across process boundaries@Conversational, @EndsConversationDeals with conversational servicesMore on this later@OneWayDenotes a non-blocking operationMore on this later@CallbackDefines callback interface and injection

  • Metadata for defining component type information@ServiceDefines services offered by an implementation@PropertyIdentifies a component type propertySetter-based, ctor-based and field-based injection supported@ReferenceIdentifies a component type referenceSetter-based, ctor-based and field-based injection supportedSCA defines heuristics for unannotated POJOs as well

  • Container-Component Implementation Contract Metadata@AllowsPassByReferencePer-class or per-operation@ScopeSpecifies visibility and lifecycle contract STATELESS (default), REQUEST, CONVERSATION, COMPOSITEContainers may also add custom scopes Conversation semanticsAlways between two partiesMay be long-running

  • More on ConversationsMaking an implementation conversational

    @Conversationalpublic interface Counter {int getCount();void increment();@EndsConversationint 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;}}

  • Asynchronous Interactions@OneWayIndicate a non-blocking call on an interface

    public interface Counter {int getCount();@OneWayvoid increment();@EndsConversationint reset();}

  • CallbacksStateful and statelessNon-blocking or blocking

    @Callback(MyCallback.class)public interface MyService {void call();}

    public interface MyCallback {void call();}

    public class MyServiceImpl {@Callbackpublic void setCallback(MyCallback callback){//...}//...}

  • Stateful CallbacksLoanShark service

    Conversational@Callback(Borrower.class)public interface LoanShark {void borrow(double amount);@EndsConversationvoid payback();@OneWayvoid delay();


    public interface Borrower {warn();breakArm();@EndsConversationkill();


  • APIsOnly a few, deal with specific use cases, e.g.Component context, nameRequest contextsService references (may be passed) Conversation idSet callback

  • SCA - Spring Integration

  • SpringSpring application contexts can be used as component implementationsSpring beans can be wired to SCA or external services servicesSpring beans can have services exposed Other SCA components may be wired to them Beans may be bound using an SCA binding

    Spring BeansSCA ReferenceSCA Serviceimplementation.spring

  • SCA - Java EE Integration

  • www.oasis-open.orgWhy SCA With Java EE Platform?Java EE getsAdditional implementation types and bindings on the application level:BPEL, Spring,...More to expect: For example ESB style interactionsMove protocol specifics to configuration via bindingsCross-Application AssemblyDomain assembly extends Enterprise App Assembly to the cross-app levelSCA getsReuse of existing assets, know-how, tooling.

  • www.oasis-open.orgTypes of IntegrationBindingsJMS, Session Beans, JCAImplementation TypesJava EE Components (SessionBeans, WebComponents, etc) as implementation types.Java EE Archives (EARs, WARs, EJB-JARs) as implementation types.

  • www.oasis-open.orgUse Cases for BindingsBinding.ejbConsume session beans from service componentsExpose SCA services as session beans, so that they can be consumed by unmodified Java EE componentsBinding.jms, Binding.jcaSeveral other binding types relate to Java EE, but are the focus of other working groups.

  • www.oasis-open.orgUse Cases for Java EE Components as Implementation TypesJava EE components use SCAs 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 applicationSCA is the Scale-Out model for Java EE

  • www.oasis-open.orgUse Cases for Java EE Applications as Implementation Types

    Use Java EE applications as Service Component ImplementationsModified UnmodifiedAllow 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 ComponentsWill be shown during demo:

  • Composite with a session bean componentContribution is JEE Archive:Sample Assembly I





  • Including it into the domain

  • Contribution containing a Java EE archive


    Drag the side handles to change the width of the text block.







    some other composite



    a non-Java EE contribution

    a component using

  • Open QuestionsWhat is the componentType of an unmodified EAR (ie, one with no application.composite)?Can ejb-refs be rewired by SCA?