Chapter 10 Jaguar EJB Interoperability


Invoking non-EJB components from EJB clients

To invoke a non-EJB component from an EJB client, you must first create a home interface for the component, then generate EJB stubs for the component's interfaces. Then you can instantiate proxies for the non-EJB component using the standard EJB client design pattern.

Create a home interface

Non-EJB components can implement several remote interfaces. To instantiate proxies for any remote interface from EJB clients, you must use a corresponding home interface. Use Jaguar Manager to create a home interface for each IDL interface that the component implements. The home interface must have a single create method that takes no parameters and returns the remote interface.

Even with a home interface defined, Jaguar creates component instances using the standard method for the component's lifecycle model. A non-EJB component does not need to implement any additional methods to support the home interface.

Steps To create the home interface

  1. Expand the component's icon, then highlight the Interfaces folder beneath the component. Choose File | Set Home Interface.

  2. In the Home Interface dialog box, enter the home interface name as:
    module::component_interfaceHome
    where module is the IDL module where the remote interface is defined, and component_interface is the base (non-nested) name of the remote interface. For example, MyPackage::MyComponentHome.

  3. Click Add New. Jaguar creates the interface and an icon for the interface appears in the component's Interfaces folder.

  4. Highlight the home interface icon, and choose File | New Method.

  5. Enter "create" as the method name and click Create New Method.

  6. Change the following in the Method Properties dialog, leaving other fields at their default settings:

  7. Click OK to close the Method Properties dialog box.


Generate EJB stubs

Use Jaguar Manager to generate EJB stubs for the component, specifying a different package or code base for the EJB stubs than used by the existing CORBA stubs.

CORBA and EJB stubs share class names but do not share the same implementation. Therefore, each type must be in a different Java package or use a different code base.

"Generating EJB stubs" describes how to generate the stub files.

Instantiating the home interface

After defining a home interface and generating EJB stubs, you can instantiate a home interface for the component using the standard EJB technique, as described in Chapter 9, "Creating Enterprise JavaBean Clients".

The component's home interface name matches the value of the com.sybase.jaguar.component.bind.naming property. For non-EJB components, you must view the value of this property using the All Properties tab in the Component Properties dialog box. If the property is not set, the default is initial-context/package/component, where initial-context is the server's initial naming context, package is the Jaguar Manager package where the component is installed, and component is the component name as displayed in Jaguar Manager.

Calling methods in the remote interface

The methods in the Java remote interface follow the standard CORBA IDL-to-Java datatype mappings. To allow increased interoperability between EJB clients and non-EJB components, Jaguar allows use of out and inout parameters in the remote interface. In the Java remote interface, these are represented by the same holder classes as used in CORBA stubs. See "Holder classes" for more information on using holder classes.

 


Copyright © 2000 Sybase, Inc. All rights reserved.