An enterprise bean benefits from many services—such as lifecycle
management and security—that are provided implicitly by the EJB container,
based on settings in the deployment descriptor. This leaves the bean provider
free to concentrate on the bean's business logic. This section looks at
some of the things a bean can do.
- Look up JNDI entries
- A bean can use JNDI calls to retrieve:
- References to resources
- Environment variables
- References to other beans.
- Access resource managers
- A bean can:
- Obtain a connection to a resource manager
- Use the resources of the resource manager
- Close the connection.
- Link to CICS® programs
- A bean can use JCICS or the CCI Connector for CICS TS to link to a CICS program, that
may be written in any of the CICS-supported languages and be either local
or remote. The bean provider can use the CCI Connector for CICS TS to build beans that make
use of the power of existing (non-Java™) CICS programs.
The CCI Connector for CICS TS is
described in The CCI Connector for CICS TS.
- Access files
- A bean can use JCICS to read and write to files.
- Call other beans
- A bean can:
- Obtain references to the home and component interfaces of other
bean objects
- Invoke the methods of another bean object
- Be called from another bean object.
A bean can act as the client of another bean object, as the server
of another bean object, or as both.
Bear in mind that
a single CICS task (one instance of a transaction) cannot contain more than
one enterprise bean, because CICS treats an execution of an enterprise bean
as the start of a new task. You can create an application that includes more
than one enterprise bean, but the application will not operate as a single
CICS task.
- Manage transactions
- Optionally, a session bean can manage its own OTS transactions, rather
than use container-managed transactions. Alternatively, it may have its
transaction managed by its caller.