|
There are some exciting new modifications and enhancements to the latest version of the Java 2, Enterprise Edition Connector Architecture, and that's what this article is all about. Although I'll give a brief overview of the Connector Architecture, I assume you're familiar with version 1.0, especially the resource adapter. (For detailed information about version 1.0, see the specification. An overview of its resource adapter and system-level contracts can be found in a previous article). This article is the first in a two-part series that will concentrate on the resource adapter modifications and enhancements, with special focus on the new system-level contracts, particularly the lifecycle management and work management contracts. I'll cover implementation details and specification requirements, and we'll examine some pseudo-code to see how an EIS vendor might implement the new contracts for a version 1.5-compliant resource adapter. Part Two of this series (coming soon) will concentrate on the transaction inflow and message inflow contracts. Connector Architecture OverviewThe J2EE Connector Architecture defines a standard architecture for connecting the J2EE platform to heterogeneous enterprise information systems (EIS). Under the Connector Architecture, EIS vendors no longer have to customize their product for interaction with each compliant J2EE application server. Similarly, application server vendors needn't make modifications whenever they need connectivity to yet another EIS. Instead, application server vendors implement the Connector Architecture framework only once, and EIS vendors develop one standard resource adapter based on this architecture. Under these circumstances, a compliant EIS can plug into any application server that supports the Connector Architecture, and an application server can connect to any EIS that provides a standard resource adapter. This seamless integration between compliant application servers and enterprise information systems is depicted in Figure 1.
By developing a standard resource adapter, EIS vendors reduce both development time and cost. Also, as long as the adapter adheres to the specification, vendors have a scalable, secure, and transactional solution to the integration problem. Resource Adapter OverviewThe resource adapter plays a central role in the integration and connectivity between an EIS and an application server. It serves as the point of contact between application components, application servers, and enterprise information systems. The resource adapter, along with other components, must communicate based on well-defined contracts that are specified by the J2EE Connector Architecture. The different components and their interactions are depicted in Figure 2.
For seamless integration with an application server, a resource adapter must abide by guidelines -- known as system-level contracts -- that are defined by the Connector Architecture. These contracts exist between the application server and an EIS, and are implemented through the resource adapter. They specify how a system external to the J2EE platform can integrate with it by supporting basic functions that are handled by the J2EE container. The most important functions are those involved with connection management, transaction management, security, message inflow, work management, and lifecycle management. Version 1.0 ContractsIn version 1.0 of the Connector Architecture, three contracts are defined to address the functions mentioned above:
New Contracts in Version 1.5In version 1.5 of the J2EE Connector Architecture, there are more contracts that a resource adapter must support, as new functionality and features made their way into the specification. A resource adapter can support these four new contracts by implementing the required interfaces defined in the specification for each contract.
The rest of this article will focus on two of the new contracts -- lifecycle management and work management. We'll take a look at each interface and class (in relation to the two contracts), to provide a foundation for the design and implementation of a specific resource adapter within an n-tier environment. Contracts and interfaces that must be utilized for a resource adapter to be compliant with the architecture are marked as required. Code samples show how parts of the interfaces can start to be implemented. Lifecycle Management ContractAs mentioned previously, the lifecycle management contract provides a way for an application server to manage the lifecycle of the resource adapter instance, through starting and stopping the instance. During deployment of the resource adapter or during application server startup, the application server starts the resource adapter by bootstrapping the adapter in its address space. Upon undeployment or application server shutdown, the application server shuts down the resource adapter by notifying it.
This contract's functionality is provided through lifecycle management interfaces for both the application server and the resource adapter. For a resource adapter to meet the requirements of the lifecycle management contract, it must implement the
ResourceAdapter
The start
The stop
The Below is a code sample that illustrates how an EIS vendor might implement this interface.
import javax.resource.spi;
public class MyEISResourceAdapter implements ResourceAdapter {
void start(BootstrapContext appServerContext)
Work Management ContractThe work management contract allows the resource adapter to do work by submitting it to an application server for execution. The resource adapter submits work to the application server, which dispatches a thread to run the work. Although this is not a required contract, there are a variety of reasons why it is advantageous for a resource adapter to allow the application server to handle its work. An application server handles thread management efficiently, and can even forbid a resource adapter from creating its own threads. Also, when the application server handles thread management, the resource adapter becomes more portable.
This contract's functionality is provided through work management interfaces and classes for both the application server and the resource adapter. The interfaces and class that contribute to the work management contract for the resource adapter are
For a resource adapter to meet the requirements of the work management contract, it must implement the Work
The
Below is a code block containing a sample
ExecutionContext
Since WorkListener
Here is a code block containing a sample
The adapter implementation may also extend the SummaryResource adapters are an important piece of the standard integration between an EIS and an application server. Version 1.0 of the J2EE Connector Architecture revolutionized the way in which these integrations were done -- reducing the cost and time of both design and implementation, as well as creating a portable, standard solution. Version 1.5 includes powerful new enhancements in the form of new contracts, and two of them were covered in this article. The last two contracts, message inflow and transaction inflow, will be addressed in Part 2 of this series. See Also
About the authorJennifer Rodoni is an engineer at Sun Microsystems, Inc. Currently, she works in the Market Development Engineering Organization and helps evangelize Java technology. She is also the author of An Introduction to the Java Connector Architecture. You can contact her at jennifer.rodoni@sun.com. | |||||||||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||