Request processing in the EJB architecture adapter
This section describes how the connector for EJB architecture
handles request processing, as illustrated in Figure 1.
The request processing scenario described here assumes that:
- The enterprise beans are deployed on a J2EE-compliant enterprise
application server, such as WebSphere Application Server.
- The application server is installed and running.
- The connector has been initialized, which loads the ProviderURL and InitialContextFactory connector-specific properties. These properties help to obtain
the JNDI initial context, which is required to initiate the connection
to the EJB server and locate the enterprise bean's home
interface. The properties are cached and re-used throughout the
connector life cycle. For details about connector-specific properties,
see Connector-specific properties. For details about how
the connector manages security, see Configuring security.
Figure 1. Request processing for the connector for EJB architecture
The connector for EJB architecture processes business object
requests in the following manner.
- The connector receives a business object request from the integration
broker. The business object contains information about the corresponding
enterprise bean, including its JNDI name and the class name of its
home and remote interfaces.
- The connector uses its InitialContextFactory and ProviderURL properties to begin the process of locating and accessing
the enterprise beans deployed on the application server. InitialContext is part of the larger JNDI API supported by the application
server. It is the starting point for any JNDI lookup by a client
(such as the connector). The ProviderURL specifies the service provider, which is a JNDI driver on
the application server used for locating the enterprise bean's
home interface. The home interface provides methods for creating
or finding the enterprise bean remote interface.
- After locating the home interface, the connector finds the remote
interface, which defines the enterprise bean business methods that
a client (in this case, the connector) can call.
For entity beans, the connector uses either a creator or finder
type method, depending on which has been implemented by the enterprise
bean developer (the connector knows which one to use based on the
metadata in the business object definition). These methods are defined
in the home interface and invoked by a client to obtain a remote/local
interface reference to an enterprise bean instance.
- Once the connector has located the remote interface, it can
begin to invoke enterprise bean methods. The parent business object
sent by the connector contains a child business object for each
method defined in the remote interface. The child business object's
attributes are mapped to parameters of the remote method of the
corresponding enterprise beans. Since enterprise beans are loaded dynamically,
its methods are discovered and called through reflection. The details of
this step are as follows:
- The connector's BO Handler checks the verb-level ASI
of the parent business object for one ore more lists of attribute
names. A list is a series of ordered, semi-colon-delimited attribute
names.
- Each attribute of the parent business object contains a child
business object that represents a method to be invoked on the remote
interface. In other words, the verb ASI is not a list of methods,
but a list of attributes, each one having as a value a child object
that represents a method to be invoked.
- The connector executes the methods listed in the verb ASI, in
the order in which they are listed.
- After the methods are executed and values are returned from
the EJB application server, the connector loads the EJB object data
into the business object.
- The connector returns the business object with populated values
from the EJB application server to the integration broker.
The connector also returns a message to the integration broker
indicating that the original object request was either successful
or unsuccessful (a FAIL status). If the request was successful,
the connector also returns the updated business object to the broker.
