256 WebSphere Business Integration Adapters
16.1 Extending the business-object-handler base class
In the Java connector library, the base class for a business object handler is
named CWConnectorBOHandler. The CWConnectorBOHandler class provides
methods for defining and accessing a business object handler. To implement
your own business object handler, extend this business-object-handler base
class to create your own business-object-handler class.
To derive a business-object-handler class for a Java connector, do the following:
1. Create a class that extends the CWConnectorBOHandler class, and name
this class as follows:
connectorNameBOHandler.java
Let connectorName uniquely identify the application or technology with which
the connector communicates. For example, to create a business object
handler for the RedMaintenance application, create a business object handler
class called RMBOHandler. If your connector design implements multiple
business object handlers, include the name of the business objects in the
name of the business object handler class.
2. Implement the doVerbFor() method to define the behavior of the business
object handler.
The following example shows the basic structure of our class:
Example 16-1 Basic structure of the out custom business object
public class RMBOHandler extends CWConnectorBOHandler {
public int doVerbFor(CWConnectorBusObj bo)
throws ConnectionFailureException, VerbProcessingFailedException {
}
}
16.2 Implementing the doVerbFor() method
The doVerbFor() method provides the functionality for the business object
handler. When the Adapter Framework receives a request business object, it
calls the doVerbFor() method for the appropriate business object handler to
perform the action of this verb. For a Java connector, the
CWConnectorBOHandler class defines the doVerbFor() method in which you
define the verb processing.
However, the actual doVerbFor() method that the Adapter Framework invokes is
the low-level version, which the CWConnectorBOHandler class inherits from the
Chapter 16. Implementing a business object handler 257
BOHandlerBase class of the low-level Java connector library. This low-level
doVerbFor() method calls the user-implemented doVerbFor() method.
Therefore, as part of the business-object-handler class (an extension of
CWConnectorBOHandler), you must provide an implementation of the
doVerbFor() method.
The business object handler:
1. Receives business objects from the Adapter Framework.
2. Processes each business object based on the active verb.
3. Sends requests for operations to the application.
4. Returns status to the Adapter Framework.
16.2.1 Obtaining the active verb
To determine which actions to take, the doVerbFor() method must first retrieve
the verb from the business object that it receives as an argument. This incoming
business object is called the
request business object. The verb that this business
object contains is the
active verb, which must be one of the verbs that the
business object definition supports.
Obtaining the active verb from the request business object generally involves the
following steps:
1. Verifying that the request business object is valid.
Before the connector calls the getVerb() method, it verifies that the incoming
request business object is not null. The incoming business object is passed
into the doVerbFor() method as a CWConnectorBusObj object.
2. Obtaining the active verb with the getVerb() method.
After the request business object is validated, you can use the getVerb()
method that is inherited from the CWConnectorBusObj class to obtain the
active verb from this business object.
Note: Java connectors must be thread-safe. For Java connectors, the Adapter
Framework uses separate threads to call into the doVerbFor() method.
Important: If the business integration system uses InterChange Server and
collaborations are coded to be multi-threaded, the Adapter Framework might
call into the doVerbFor() method with multiple threads representing request
processing.

Get WebSphere Business Integration Adapters: An Adapter Development and WebSphere Business Integration Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.