Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop SCA composites > Use existing Java EE modules and components as SCA implementations


Rewiring EJB references to SCA references

We can rewire an EJB reference to a Service Component Architecture (SCA) reference that provides the same named operations. The rewiring does not require a change to existing code.

Identify the Java EE application that contains business logic in EJB or web modules to enable in the SCA environment. A Java EE application is also called an enterprise application or enterprise archive (EAR) file.

Identify the SCA components and services to replace the EJB references in EJB and web modules.

The SCA programming model supports Java EE integration. We can rewire EJB references to SCA references without changing existing code that uses the EJB reference. Thus, you can use the SCA programming model without changing the implementation code.


Procedure

  1. Create a file named application.composite that defines components with component types of web and EJB modules of the enterprise application. Save the file to the enterprise application META-INF directory.

    Use the implementation.web element to declare a service component that is implemented by the web component. The component contains information for the annotations.

    To configure a web component implementation, use the following schema:

    <implementation.web web-uri="web_module_name"/> 

    Use the implementation.ejb element to declare a service component that is implemented by a session bean component.

    To configure an EJB component implementation, use the following schema:

    <implementation.ejb ejb-link="EJB_module_name"/> 

    To rewire an EJB reference to an SCA service in an SCA component, add a <reference> element to the jee module component. For example, to rewire an EJB reference named MyEJBRef to an SCA service named MySCASvc in an SCA component named MyComponent, the <reference> element resembles the following:

    
    <reference name="MyEJBRef" target="MyComponent/MySCASvc">
    
    <interface.java .... /> 
    </reference>
    
    

    The reference names must match the name of the EJB reference. The contract of operations supported must also match. Because references must be promoted in the composite, the names of the references must be unique. After the EJB reference is promoted, all matching instances of the EJB reference in the module are rewired to the SCA service.

  2. Create a component in an SCA composite definition that has the implementation.jee component type and the archive attribute set to the name of the enterprise application asset object.

    For an enterprise application named MyEAR.ear, create a component such as the following:

    
    <component name="ImplJeeComponent">
    <implementation.jee archive="MyEAR.ear"/>
    </component>
    


Results

The EJB references are rewired to SCA references enabling Java EE modules to use SCA features without changing its implementation.


What to do next

Deploy the enterprise application and the SCA composite that uses the application as composition units of the same business-level application. We can use the admin console or wsadmin commands to create the business-level application and add the enterprise application and the SCA composite as composition units.
Use existing Java EE modules and components as SCA implementations
Import assets
Create SCA business-level applications


Related


Service Component Architecture specifications and APIs

+

Search Tips   |   Advanced Search