Java Reference
In-Depth Information
Chapter 24. The Resource Adapter Example
The mailconnector example shows how you can use a resource adapter, a message-
driven bean (MDB), and JavaServer Faces technology to create an application that can send
email messages and browse for messages. This example uses a sample implementation of
the JavaMail API called mock-javamail . The resource adapter is deployed separately,
while the MDB and the web application are packaged in an EAR file.
The following topics are addressed here:
• “ The Resource Adapter on page 463
• “ The Message-Driven Bean on page 464
• “ The Web Application on page 464
• “ Running the mailconnector Example ” on page 465
The Resource Adapter
The mailconnector resource adapter enables the MDB to receive email messages that
are delivered to a specific mailbox folder on a mail server. It also provides connection fact-
ory objects clients can use to obtain connection objects that allow them to synchronously
query email servers for new messages in a specific mailbox folder.
In this example, the MDB activates the resource adapter, but it does not receive email mes-
sages. Instead, this example allows users to synchronously query an email server for new
messages.
The components of the resource adapter are as follows:
mailconnector.ra : Base class of the mailconnector resource adapter
mailconnector.ra/inbound : Classes that implement the inbound resource
adapter, which supports delivery of JavaMail messages to MDBs
mailconnector.ra/outbound : Classes that implement the outbound re-
source adapter, which supports synchronous queries to email servers
mailconnector.api : Interfaces that are implemented by MDBs associated
with this resource adapter and by the Connection and ConnectionFactory-
interface s provided by the outbound resource adapter
mailconnector.share : JavaBeans class that implements the Connec-
tionSpec interface, allowing properties to be passed to the outbound resource ad-
apter
Search WWH ::




Custom Search