WebSphere brand IBM WebSphere Sensor Events, Version 6.2

Creating a Reusable Component and a back-end implementation

Use the steps in this topic to create a custom Reusable Component and a custom back-end implementation.

About this task

A Reusable Component provides many interfaces to a set of services, and can also include the implementation logic. Alternatively, the separation of the implementation logic into an enterprise application known as the back-end implementation is also supported with the Reusable Component framework. This separation allows the Reusable Component framework to perform flexible coupling at runtime between a Reusable Component and its back-end implementation. In many situations, you might develop a custom Reusable Component and a custom back-end implementation to include the desired implementation logic. In certain situations, you might develop only a custom Reusable Component, which can include all of its own required implementation logic or make calls out to an existing back-end implementation. In other situations, you might develop only a custom back-end implementation that will provide a new implementation for an existing Reusable Component interface.

For sample code for creating a Reusable Component and a back-end implementation, look for projects that begin with ibmruc_sample in the WebSphere® Sensor Events Toolkit.

There is also a Sample Reusable Component task agent available in the WebSphere Sensor Events Administrative Console.

Creating a custom Reusable Component

Procedure
  1. Create an enterprise application project (EAR project).
  2. Add the required libraries to the EAR project.
  3. Optional: If your Reusable Component will call an existing back-end implementation, also add the ibmruc_backendimpl_ejbClient library to be able to call back-end implementation by EJB reference.
  4. Create an EJB project to contain the Reusable Component.
  5. Add the required libraries to the EJB project as J2EE dependencies.
  6. For each Reusable Component that you develop in this project, do the following:
    1. Create an Agent class, whose superclass is AbstractRUCAgent, for the Reusable Component logic.
    2. Implement methods and business logic in this class, including calls to AbstractRUCAgent to access Reusable Component agent properties, call back-end interfaces, and pass agent properties to the back-end interface as required.
    3. Create an EJB (SLSB), whose superclass is AccessorBaseHelper, for the Reusable Component to be developed, and add public methods.
    4. Implement these methods to call to the Reusable Component agent to perform logic.
    5. Promote public methods to the Reusable Component's remote interface and service interface.
    6. Create an EJB (MDB), whose superclass is AccessorHelper, for the Reusable Component to be developed, and implement the inherited method, onIBMSensorEvent, while commenting out the usual MDB method, onMessage.
    7. Generate a Web service for the Reusable Component using the service interface defined from the SLSB

Creating a custom back-end implementation

Procedure
  1. Add the required libraries to the EAR project.
  2. Create an EJB project to contain the Reusable Component.
  3. Add the required libraries to the EJB project as J2EE dependencies.
  4. For each back-end implementation that you develop in this project, do the following:
    1. Create an EJB (SLSB) for the back-end implementation and add public methods.
    2. Implement these methods as desired to perform back-end logic.
      Important: Do not promote public methods to the back-end implementation's remote interface directly.
    3. Edit the remote interface and have it extend back-end interfaces. The back-end implementation can extend (support) existing back-end interfaces from the ibmruc_common_utils project, or it can define its own back-end interfaces in its ejbClient project. If you are defining new back-end interfaces, the ejbClient project will have to be shared as a library and used by the calling Reusable Component.

Library | Support | Terms of use

(c) Copyright IBM Corporation 2004, 2009. All rights reserved.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.