Specification: Jakarta Connectors

Version: 2.0

Status: Final Release

Release: 2020-10-10T17:55:36Z

Copyright (c) 2018, 2020 Eclipse Foundation.

Eclipse Foundation Specification License

By using and/or copying this document, or the Eclipse Foundation document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:

Permission to copy, and distribute the contents of this document, or the Eclipse Foundation document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use:

  • link or URL to the original Eclipse Foundation document.

  • All existing copyright notices, or if one does not exist, a notice (hypertext is preferred, but a textual representation is permitted) of the form: "Copyright (c) [$date-of-document] Eclipse Foundation, Inc. https://www.eclipse.org/legal/efsl.php"

Inclusion of the full text of this NOTICE must be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof.

No right to create modifications or derivatives of Eclipse Foundation documents is granted pursuant to this license, except anyone may prepare and distribute derivative works and portions of this document in software that implements the specification, in supporting materials accompanying such software, and in documentation of such software, PROVIDED that all such works include the notice below. HOWEVER, the publication of derivative works of this document for use as a technical specification is expressly prohibited.

The notice is:

"Copyright (c) 2018, 2020 Eclipse Foundation. This software or document includes material copied from or derived from Jakarta™ Connectors https://jakarta.ee/specifications/connectors/2.0/"

Disclaimers

THIS DOCUMENT IS PROVIDED "AS IS," AND THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

THE COPYRIGHT HOLDERS AND THE ECLIPSE FOUNDATION WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.

The name and trademarks of the copyright holders or the Eclipse Foundation may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders.

1. Jakarta Connectors, Version 2.0

Copyright (c) 2013, 2020 Oracle and/or its affiliates

Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

2. Introduction

The Jakarta Platform, Enterprise Edition (Jakarta EE platform) provides containers for client applications, web components based on Jakarta Servlets and Jakarta Server Pages and Jakarta Enterprise Beans components. These containers provide deployment and runtime support for application components. They provide a federated view of the services provided by the underlying application server for the application components.

Containers can run on existing systems; for example, web servers for the web containers; application servers, TP monitors, and database systems for Enterprise Bean containers. This enables enterprises to leverage both the advantages of their existing systems and those of Jakarta EE. Enterprises can write, or rewrite, new applications using Jakarta EE capabilities and can also encapsulate parts of existing applications in Enterprise Beans, Jakarta Server Pages or servlets.

Enterprise applications access functions and data associated with applications running on Enterprise Information Systems (EIS). Application servers extend their containers and support connectivity to heterogeneous EISs. Enterprise tools and Enterprise Application Integration (EAI) vendors add value by providing tools and frameworks to simplify the EIS integration task.

For enterprise application integration, bi-directional connectivity between enterprise applications and EIS is essential. Jakarta Connectors defines standard contracts that allow bi-directional connectivity between enterprise applications and EISs. It also formalizes the relationships, interactions, and the packaging of the integration layer, thus enabling enterprise application integration.

2.1. Overview

Jakarta Connectors defines a standard architecture for connecting the Jakarta EE platform to heterogeneous EISs. Examples of EISs include Enterprise Resource Planning (ERP), mainframe transaction processing (TP), and database systems.

Jakarta Connectors defines a set of scalable, secure, and transactional mechanisms that enable the integration of EISs with application servers1 and enterprise applications.

Jakarta Connectors also defines a Common Client Interface (CCI) for EIS access. The CCI defines a client API for interacting with heterogeneous EISs.

Jakarta Connectora enables an EIS vendor to provide a standard resource adapter for its EIS. A resource adapter is a system-level software driver that is used by a Java application to connect to an EIS. The resource adapter plugs into an application server and provides connectivity between the EIS, the application server, and the enterprise application. The resource adapter serves as a protocol adapter that allows any arbitrary EIS communication protocol to be used for connectivity.

An application server vendor extends its system once to support the connector architecture and is then assured of seamless connectivity to multiple EISs. Likewise, an EIS vendor provides one standard resource adapter which has the capability to plug in to any application server that supports the connector architecture.

2.2. Scope

Version 2.0 of the connector architecture defines:

  • A standard set of system-level contracts between an application server and EIS. These contracts focus on the important system-level aspects of integration: connection management, transaction management, and security.

  • A Common Client Interface (CCI) that defines a client API for interacting with multiple EISs.

  • A standard deployment and packaging protocol for resource adapters.

Refer to section 2.2.2 for the rationale behind the Common Client Interface.

  • Lifecycle management contract. A contract between an application server and a resource adapter that allows an application server to manage the lifecycle of a resource adapter. This contract provides a mechanism for the application server to bootstrap a resource adapter instance during its deployment or application server startup, and to notify the resource adapter instance during its undeployment or during an orderly shutdown of the application server.

  • Work management contract. A contract between an application server and a resource adapter that allows a resource adapter to do work (monitor network endpoints, call application components, etc.) by submitting Work instances to an application server for execution. The application server dispatches threads to execute submitted Work instances. This allows a resource adapter to avoid creating or managing threads directly, and allows an application server to efficiently pool threads and have more control over its runtime environment. The resource adapter can control the security context and transaction context with which Work instances are executed.

  • Transaction inflow contract. A contract between an application server and a resource adapter that allows a resource adapter to propagate an imported transaction to an application server. This contract also allows a resource adapter to transmit transaction completion and crash recovery calls initiated by an EIS, and ensures that the ACID (Atomicity, Consistency, Isolation and Durability) properties of the imported transaction are preserved.

  • Message inflow contract. A standard, generic contract between an application server and a resource adapter that allows a resource adapter to asynchronously deliver messages to message endpoints residing in the application server independent of the specific messaging style, messaging semantics, and messaging infrastructure used to deliver messages. This contract also serves as the standard message provider pluggability contract that allows a wide range of message providers (Java Message Service (JMS), Java API for XML Messaging (JAXM), etc.) to be plugged into any Java EE compatible application server by way of a resource adapter.

  • Packaging Model. Describes the packaging model for different types of resource adapters (outbound only, inbound only, or both).

  • Generic work context contract. A generic contract that enables a resource adapter to control the execution context of a Work instance that it has submitted to the application server for execution. The Generic work contract provides the mechanism for a resource adapter to augment the runtime context of a Work instance with additional contextual information flown-in from the EIS. This contract enables a resource adapter to control, in a more flexible manner, the contexts in which the Work instances submitted by it are executed by the application server’s WorkManager .

  • Security work context. A standard contract that enables a resource adapter to establish security information while submiting a Work instance for execution to a WorkManager and while delivering messages to message endpoints residing in the application server. This contract provides a mechanism to support the execution of a Work instance in the context of an established identity. It also supports the propagation of user information/Principal information from an EIS to a MessageEndpoint during Message Inflow.

Version 2.0 of Jakarta Connectors moves the old Java Connectors Architecture specification to Jakarta EE.

2.3. Target Audience

The target audience for this specification includes:

  • EIS vendors and resource adapter providers

  • Messaging system vendors

  • Application server vendors and container providers

  • Enterprise application developers and system integrators

  • Enterprise tool and EAI vendors

The system-level contracts between an application server and an EIS are targeted towards EIS vendors (or resource adapter providers, if the two roles are different) and application server vendors. The CCI is targeted primarily towards enterprise tools and EAI vendors.

2.4. JDBC and Jakarta Connectors

The JavaTM DataBase Connectivity ("JDBCTM") API defines a standard Java API for accessing relational databases. The JDBC technology provides an API for sending SQL statements to a database and processing the tabular data returned by the database.

The connector architecture is a standard architecture for integrating Java EE applications with EISs that are not relational databases. Each of these EISs currently provides a native function call API for identifying a function to call, specifying its input data, and processing its output data. The goal of the Common Client Interface (CCI) is to provide an EIS independent API for coding these EIS function calls.

The CCI is targeted at EIS development tools and other sophisticated users of EISs. The CCI provides a way to minimize the EIS specific code required by such tools. Most Java EE developers will access EISs using these tools rather than using CCI directly.

It is expected that many Java EE applications will combine relational database access using JDBC with EIS access using EIS access tools based on CCI.

The connector architecture defines a standard SPI (Service Provider Interface) for integrating the transaction, security, and connection management facilities of an application server with those of a transactional resource manager. The JDBC 3.0 specification JDBC API Specification, version 4.1 specifies the relationship of JDBC to the SPI specified in the connector architecture.

2.5. Relationship With Other Integration Technologies (JBI and SCA)

The Enterprise Application Integration (EAI) and Business to Business integration (B2B) functional space may be considered, in an abstract sense, as forms of network service composition. That is, in a typical EAI/B2B scenario, an enterprise application may make use of network resources to realize some of its functionality. In this context, the network resource may be a REST service, a SOAP service, a database server, a JMS topic/queue, some legacy application, etc.

The Java Business Integration (JBI) and Service Component Architecture (SCA) are integration technologies that come to mind in the EAI/B2B space. They allow the creation and consumption of such network services. They enable the building of applications through composition of services in an enterprise by adopting a Service Oriented Architecture (SOA). These technologies can be used to implement integration with various forms of network resources that are not tied to a specific external architectural style.

The Connector architecture covers the category of network resources that expose some form of connection oriented protocol. Database servers, JMS systems, legacy apps, etc. typically fall into this category of network resource. The Connector architecture is the mechanism that the Java EE platform provides to simplify use of such network resources.

2.6. Organization

This document begins by describing the rationale and goals for creating a standard architecture to integrate an application server with multiple heterogeneous EISs. It then describes the key concepts relevant to the connector architecture. These sections provide an overview of the architecture.

This document then describes typical scenarios for using the connector architecture. This chapter introduces the various roles and responsibilities involved in the development and deployment of enterprise applications that integrate with multiple EISs.

After these descriptive sections, this document focuses on the prescriptive aspects of the connector architecture.

2.7. Document Conventions

A regular Palatino font is used for describing the connector architecture.

An italic font is used for paragraphs that contain descriptive notes providing clarifications.

A regular Courier font is used for Java source code, class, interface and method names.

The requirements section occurring in various chapters of this document highlight only the salient requirements, but do not contain all the requirements. So, this entire document must be used as a requirements specification.

Note that the scenarios described in this document are illustrative in scope. The intent of the scenarios is not to specify a prescriptive way of implementing a particular contract.

This document uses the Jakarta Enterprise Beans component model to describe some scenarios. The Jakarta Enterprise Beans specification (see Jakarta Enterprise Beans Specification, version 3.2 provides the latest details of the component model.

3. Overview

This chapter introduces key concepts that are required to understand Jakarta Connectors. It lays down a reference framework to facilitate a formal specification of the connector architecture in the subsequent chapters of this document.

3.1. Definitions

3.1.1. Enterprise Information System (EIS)

An EIS provides the information infrastructure for an enterprise. An EIS offers a set of services to its clients. These services are exposed to clients as local and/or remote interfaces. Examples of an EIS include:

  • Enterprise Resource Planning (ERP) system

  • Mainframe transaction processing (TP) system

  • Legacy database system

There are two aspects of an EIS:

  • System level services - for example, SAP RFC, CICS ECI

  • An application specific interface - for example, the table schema and specific stored procedures of a database, the specific CICS TP program

3.1.2. Connector Architecture

An architecture for integrating Jakarta EE servers with EISs. There are two parts to this architecture: an EIS vendor-provided resource adapter and an application server that allows this resource adapter to be plugged in. This architecture defines a set of contracts (such as transactions, security, connection management) that a resource adapter has to support to plug in to an application server.

These contracts support bi-directional communication (outbound and inbound) between an application server and an EIS by way of a resource adapter. That is, the application server may use the resource adapter for outbound communication to the EIS, and it may also use the resource adapter for inbound communication from the EIS.

3.1.3. EIS Resource

An EIS resource provides EIS-specific functionality to its clients. Examples are:

  • A record or set of records in a database system

  • A business object in an ERP system

  • A transaction program in a transaction processing system

3.1.4. Resource Manager (RM)

A resource manager manages a set of shared EIS resources. A client requests access to a resource manager to use its managed resources. A transactional resource manager can participate in transactions that are externally controlled and coordinated by a transaction manager.

In the context of the connector architecture, a client of a resource manager can either be a middle-tier application server or a client-tier application. A resource manager is typically in a different address space or on a different machine from the client that accesses it.

This document refers to an EIS as a resource manager when it is mentioned in the context of transaction management. Examples of resource managers are a database system, a mainframe TP system, and an ERP system.

3.1.5. Managed Environment

A managed environment defines an operational environment for a Jakarta EE-based, multi-tier, web-enabled application that accesses EISs. The application consists of one or more application components—Jakarta Enterprise Beans, Jakarta Server Pages, servlets—which are deployed on containers. These containers can be one of the following:

  • Web containers that host Jakarta Server Pages, servlets, and static HTML pages

  • Enterprise Bean containers that host Enterprise Bean components

  • Application client containers that host standalone application clients

3.1.6. Non-Managed Environment

A non-managed environment defines an operational environment for a two-tier application. An application client directly uses a resource adapter to access the EIS, which defines the second tier of a two-tier application.

3.1.7. Connection

A connection provides connectivity to a resource manager. It enables an application client to connect to a resource manager, perform transactions, and access services provided by that resource manager. A connection can be either transactional or non-transactional. Examples include a database connection and an SAP R/3 connection. A connection to a resource manager may be used by a client for bi-directional communication, depending on the capabilities of the resource manager.

3.1.8. Application Component

An application component can be a server-side component, such as an Jakarta Enterprise Bean, Jakarta Server Page, or servlet, that is deployed, managed, and executed on an application server. It can also be a component executed on the web-client tier but made available to the web-client by an application server. Examples of the latter type of application component include a Java applet, and a DHTML page.

3.1.9. Container

A container is a part of an application server that provides deployment and runtime support for application components. It provides a federated view of the services provided by the underlying application server for the application components. For more details on different types of standard containers, refer to the Jakarta Enterprise Beans (see Jakarta™ Enterprise Beans Specification, Version 3.2, Jakarta Server Pages, and servlet specifications.

3.2. Rationale

This section describes the rationale behind Jakarta Connectors.

3.2.1. System Contracts

A standard architecture is needed to integrate various EISs with an application server. Without a standard, EIS vendors and application server vendors may have to use vendor-specific architectures to provide EIS integration.

Jakarta Connectors provides a Java solution to the problem of bi-directional connectivity between the multitude of application servers and EISs. By using the Jakarta Connectors, it is no longer necessary for EIS vendors to customize their product for each application server. An application server vendor who conforms to the Jakarta Connectors also does not need to add custom code whenever it wants to extend its application server to support connectivity to a new EIS.

Jakarta Connectors enables an EIS vendor to provide a standard resource adapter for its EIS. The resource adapter plugs into an application server and provides the underlying infrastructure for the integration between an EIS and the application server.

An application server vendor extends its system only once to support Jakarta Connectors and is then assured of connectivity to multiple EISs. Likewise, an EIS vendor provides one standard resource adapter and it has the capability to plug in to any application server that supports Jakarta Connectors.

The following figure shows that a standard EIS resource adapter can plug into multiple application servers. Similarly, multiple resource adapters for different EISs can plug into an application server. This system-level pluggability is made possible through Jakarta Connectors.

If there are m application servers and n EISs, Jakarta Connectors reduces the scope of the integration problem from an m x n problem to an m + n problem.

Figure System Level Pluggability Between Application Servers and EISs

image

3.2.2. Common Client Interface

An enterprise tools vendor provides tools that lead to a simple application programming model for EIS access, thereby reducing the effort required in EIS integration. An EAI vendor provides a framework that supports integration across multiple EISs. Both types of vendors need to integrate across heterogeneous EISs.

Each EIS typically has a client API that is specific to the EIS. Examples of EIS client APIs are RFC for SAP R/3 and ECI for CICS.

An enterprise tools vendor adapts different client APIs for target EISs to a common client API. The adapted API is typically specific to a tools vendor and supports an application programming model common across all EISs. Adapting the API requires significant effort on the part of a tools vendor. In this case, the m x n integration problem applies to tools vendors.

Jakarta Connectors provides a solution for the m x n integration problem for tools and EAI vendors. Jakarta Connectors specifies a standard Common Client Interface (CCI) that supports a common client API across heterogeneous EISs.

All EIS resource adapters that support CCI are capable of being plugged into enterprise tools and EAI frameworks in a standard way. A tools vendor need not do any API adoption; the vendor can focus on providing its added value of simplifying EIS integration.

The CCI drastically reduces the effort and learning requirements for tools vendor by narrowing the scope of an m x n problem to an m + n problem if there are m tools and n EISs.

3.3. Goals

Jakarta Connectors has been designed with the following goals:

  • Simplify the development of scalable, secure, and transactional resource adapters for a wide range of EISs—ERP systems, database systems, mainframe-based transaction processing systems.

  • Be sufficiently general to cover a wide range of heterogeneous EISs. The sufficient generality of Jakarta Connectors ensures that there are various implementation choices for different resource adapters; each choice is based on the characteristics and mechanisms of an underlying EIS.

  • Be not tied to a specific application server implementation, but applicable to all Jakarta EE platform compliant application servers from multiple vendors.

  • Provide a standard client API for enterprise tools and EAI vendors. The standard API will be common across heterogeneous EISs.

  • Express itself in a manner that allows an organization to unambiguously determine whether or not an implementation is compatible.

  • Be simple to understand and easy to follow, regardless of whether one is designing a resource adapter for a particular EIS or developing/deploying application components that need to access multiple EISs. This simplicity means Jakarta Connectors introduces only a few new concepts, and places minimal implementation requirements so that it can be leveraged across different integration scenarios and environments.

  • Define contracts and responsibilities for various roles that provide pieces for standard bi-directional connectivity to an EIS. This enables a standard resource adapter from a EIS vendor to be pluggable across multiple application servers.

  • Enable an enterprise application programmer in a non-managed application environment to directly use the resource adapter to access the underlying EIS. This is in addition to managed access to an EIS, with the resource adapter deployed in the middle-tier application server.

4. Architecture of Jakarta Connectors

This chapter gives an overview of the architecture.

Multiple resource adapters—that is, one resource adapter per type of EIS—are pluggable into an application server. This capability enables application components deployed on the application server to access the underlying EISs.

An application server and an EIS collaborate to keep all system-level mechanisms—transactions, security, and connection management—transparent from the application components. As a result, an application component provider focuses on the development of business and presentation logic for its application components and need not get involved in the system-level issues related to EIS integration. This leads to an easier and faster cycle for the development of scalable, secure, and transactional enterprise applications that require connectivity with multiple EISs.

Figure Overview of the Jakarta Connectors architecture

image

4.1. System Contracts

To achieve a standard system-level pluggability between application servers and EISs, Jakarta Connectors defines a standard set of system-level contracts between an application server and an EIS. The EIS side of these system-level contracts are implemented in a resource adapter.

A resource adapter is specific to an underlying EIS. It is a system-level software driver that is used by an application server or an application component to connect to an EIS.

A resource adapter plugs into an application server. The resource adapter and application server collaborate to provide the underlying mechanisms—transactions, security, connection pooling, and dispatch to application components.

A resource adapter is used within the address space of the application server. Examples of resource adapters are:

  • A JDBC driver to connect to a relational database, as specified in the JDBC specification. For more information on JDBC, see JDBC API Specification, version 4.1

  • A resource adapter to connect to an ERP system

  • A resource adapter to connect to a TP system

  • A resource adapter to plug-in a messaging system

A resource adapter may provide different types of connectivity between an application and an EIS.

  • Outbound communication. The resource adapter allows an application to connect to an EIS system and perform work. All communication is initiated by the application. In this case, the resource adapter serves as a passive library for connecting to an EIS, and executes in the context of the application threads.

  • Inbound communication. The resource adapter allows an EIS to call application components and perform work. All communication is initiated by the EIS. The resource adapter may request threads from the application server or create its own threads.

  • Bi-directional communication. The resource adapter supports both outbound and inbound communication.

Jakarta Connectors defines the following set of standard contracts between an application server and EIS:

  • A connection management contract that enables an application server to pool connections to an underlying EIS, and enables application components to connect to an EIS. This leads to a scalable application environment that can support a large number of clients requiring access to EISs.

  • A transaction management contract between the transaction manager and an EIS that supports transactional access to EIS resource managers. This contract enables an application server to use a transaction manager to manage transactions across multiple resource managers. This contract also supports transactions that are managed internal to an EIS resource manager without the necessity of involving an external transaction manager.

  • A security contract that enables secure access to an EIS. This contract provides support for a secure application environment that reduces security threats to the EIS and protects valuable information resources managed by the EIS.

  • A lifecycle management contract that allows an application server to manage the lifecycle of a resource adapter. This contract provides a mechanism for the application server to bootstrap a resource adapter instance during its deployment or application server startup, and to notify the resource adapter instance during its undeployment or during an orderly shutdown of the application server.

  • A work management contract that allows a resource adapter to do work (monitor network endpoints, call application components, etc.) by submitting Work instances to an application server for execution. The application server dispatches threads to execute submitted Work instances. This allows a resource adapter to avoid creating or managing threads directly, and allows an application server to efficiently pool threads and have more control over its runtime environment. The resource adapter can control the security context and transaction context with which Work instances are executed.

  • A generic work context contract that enables a resource adapter to control the execution context of a Work instance that it has submitted to the application server for execution. The Generic Work Context Contract provides the mechanism for a resource adapter to augment the runtime context of a Work instance with additional contextual information flown-in from the EIS. This contract enables a resource adapter to control, in a more flexible manner, the contexts in which the Work instances submitted by it are executed by the application server’s WorkManager .

  • A transaction inflow contract that allows a resource adapter to propagate an imported transaction to an application server. This contract also allows a resource adapter to transmit transaction completion and crash recovery calls initiated by an EIS, and ensures that the ACID properties of the imported transaction are preserved.

  • A security work context that enables a resource adapter to establish security information while submiting a Work instance for execution to a WorkManager and while delivering messages to message endpoints residing in the application server. This contract provides a mechanism to support the execution of a Work instance in the context of an established identity. It also supports the propagation of user information/Principal information from an EIS to a MessageEndpoint during Message Inflow.

  • A message inflow contract that allows a resource adapter to asynchronously deliver messages to message endpoints residing in the application server independent of the specific messaging style, messaging semantics, and messaging infrastructure used to deliver messages. This contract also serves as the standard message provider pluggability contract that allows a wide range of message providers (Jakarta Messaging, Jakarta XML Web Services, etc.) to be plugged into any Jakarta EE compatible application server by way of a resource adapter.

Overview of Jakarta Connectors Architecture does not illustrate any contracts that are internal to an application server implementation. The specific mechanisms and contracts within an application server are outside the scope of the connector architecture specification. This specification focuses on the system-level contracts between the application server and the EIS.

Overview of Jakarta Connectors Architecture, the application server, application component and resource adapter are shown as separate entities. This is done to illustrate that there is a logical separation of the respective roles and responsibilities defined for the support of the system level contracts. However, this separation does not imply a physical separation, as in an application server, application component and a resource adapter running in separate processes.

4.2. Client API

The client API used by application components for EIS access may be defined as:

  • The standard Common Client Interface (CCI) as specified in Common Client Interface.

  • A client API specific to the type of a resource adapter and its underlying EIS. An example of such an EIS specific client API is JDBC for relational databases.

The Common Client Interface (CCI) defines a common client API for accessing EISs. The CCI is targeted towards Enterprise Application Integration (EAI) and enterprise tools vendors.

4.3. Requirements

Jakarta Connectors requires that the Jakarta Connectors-compliant resource adapter and the application server support the system contracts. Detailed requirements for each system contract are specified in later chapters.

Jakarta Connectors recommends, though it does not mandate, that a resource adapter support CCI as the client API. The recommendation enables Jakarta Connectors to provide a solution for the m x n integration problem for application development tools and EAI vendors.

Jakarta Connectors allows a resource adapter with an EIS-specific client API to support system contracts and to be capable of standard Jakarta Connectors-based pluggability into an application server.

4.4. Non-Managed Environment

Jakarta Connectors supports access to EISs from non-managed application clients; for example, Java applications and applets.

In a non-managed two-tier application environment, an application client directly uses a resource adapter library. A resource adapter, in this case, exposes its low-level transactions and security APIs to its clients. An application client has to take responsibility for managing security and transactions (and rely on connection pooling if done by the resource adapter internally) by using the low-level APIs exposed by the resource adapter. This model is similar to the way a two-tier JDBC application client accesses a database system in a non-managed environment.

4.5. Standalone Container Environment

Server Providers can provide a Connector container within a product that implements the Jakarta EE Full Profile or within a subset profile such as the Jakarta EE Web Profile. The complete set of application server requirements in this specification is required for a compliant Jakarta EE Connectors container within an implementation of the Jakarta EE Full Profile. The minimum set, listed below, must be supported for a compliant Jakarta EE Connectors container within an implementation of any subset of the Jakarta EE Full Profile. Overall profile requirements are described within the Jakarta™ EE Platform Specification Version 9.

Non-”Full Profile” implementations may only support a subset of the component specifications that were mandated to be present in a full Jakarta EE platform product implementation. An implementation of the Connector specification bundled in such a managed environment is described as standalone connector container below.

Based on the availability of other dependent component specification implementations, the following requirements must be satisfied by a standalone connector container.

  • If a MessageEndpointFactory implementation (such as support for message-driven beans) is available, the Message Inflow requirements specified in Message Inflow must be satisfied by it.

  • If an implementation of the Bean Validation specification is provided, the requirements in Jakarta™ Bean Validation Specification, Version 2.0 must be supported.

An existing resource adapter archive RAR may not be fully functional in a standalone implementation, though. For example a bi-directional resource adapter archive deployed on a standalone implementation that does not support Message Inflow would not have the corresponding Message Inflow support ( endpointActivation ) provided to the resource adapter.

A standalone connector container implementation that does not support one of the dependent component specification implementations listed above must not fail the deployment of a resource adapter that uses the capabilities in the unsupported specifications. For instance, if a bi-directional resource adapter is deployed to a standalone connector container that does not support Message Inflow, the container will not be able to make calls to the endpointActivation method in the ResourceAdapter JavaBean because the implementation does not support Message Inflow (and therefore MessageEndpoint deployment). However, the container must support the deployment of a bi-directional resource adapter and support other capabilities of the resource adapter that do not rely on support for Message Inflow (outbound communication, use of the WorkManager etc.).

The standalone connector container must support the baseline compatibility requirements as defined by the Jakarta™ Authentication specification and support the Security Inflow requirements specified in Security Inflow. See Jakarta™ Authentication Specification, Version 1.1 for more information on the Jakarta™ Authentication specification.

This specification does not define new application components or require any particular existing application component to be supported in the standalone connector container environment.

5. Roles and Scenarios

This chapter describes a set of roles specific to the connector architecture. The goal of this chapter is to specify contracts that ensure that the output of each role is compatible with the input of the other role. Later chapters specify a detailed set of responsibilities for each role, relative to the system-level contracts.

5.1. Roles

This section describes the roles and responsibilities specific to the connector architecture.

5.1.1. Resource Adapter Provider

The resource adapter provider is an expert in the technology related to an EIS and is responsible for providing a resource adapter for an EIS. Since this role is highly EIS specific, an EIS vendor typically provides the resource adapter for its system.

A third-party vendor (who is not an EIS vendor) may also provide an EIS resource adapter and its associated set of application development tools. Such a provider typically specializes in writing resource adapters and related tools for a large number of EISs.

5.1.2. Application Server Vendor

The application server vendor provides an implementation of a Jakarta EE-compliant application server that provides support for component based enterprise applications. A typical application server vendor is an OS vendor, middleware vendor, or database vendor. The role of an application server vendor is typically the same as that of a container provider.

The Jakarta EE platform specification (see Jakarta Platform, Enterprise Edition (Jakarta EE) Specification, version 9) specifies requirements for a Jakarta EE platform provider.

5.1.3. Container Provider

The container provider is responsible for providing a container implementation for a specific type of application component. For example, the container provider may provide a container for Jakarta Enterprise Beans components. Each type of application component—Jakarta Enterprise Bean, Jakarta Servlet, Server Pages—has its own set of responsibilities for its container provider. The respective specifications outline these responsibilities.

A container implementation typically provides the following functionality:

  • It provides deployed application components with transaction and security management, distribution of clients, scalable management of resources, and other services that are generally required as part of a managed server platform.

  • It provides application components with connectivity to an EIS by transparently managing security, resources, and transactions using the system-level contracts with the EIS-specific resource adapter.

  • It insulates application components from the specifics of the underlying system-level mechanisms by supporting a simple, standard contract with the application component. Refer to the Jakarta Enterprise Beans specification (Jakarta Enterprise Beans Specification, version 4.0) for more details on the Jakarta Enterprise Beans component contract.

The expertise of the container provider is system-level programming, with its focus on the development of a scalable, secure, and transaction-enabled container.

The container provider is also responsible for providing deployment tools necessary for the deployment of application components and resource adapters. It is also required to provide runtime support for the deployed application components.

The container provider typically provides tools that allow the system administrator to monitor and manage a container and application components during runtime.

5.1.4. Application Component Provider

In the context of the connector architecture, the application component provider produces an application component that accesses one or more EISs to provide its application functionality.

The application component provider is an application domain expert. In the case of application components targeted towards integration with multiple EISs, various business tasks and entities are implemented based on access to EIS data and functions.

The application component provider typically programs against easy-to-use Java abstractions produced by application development tools. These Java abstractions are based on the Common Client interface (CCI).

The application component provider is not required to be an expert at system level programming. The application component provider does not program transactions, security, concurrency, or distribution, but relies on a container to provide these services transparently.

The application component provider is responsible for specifying structural information for an application component and its external dependencies. This information includes, for example, the name and type of the connection factories, and security information.

The output of an application component provider is a Java™ Archive (JAR) file that contains the application components and any additional Java classes required to connect to EISs.

5.1.5. Enterprise Tools Vendors

The application component provider relies on tools to simplify application development and EIS integration. Since programming client access to EIS data and functions is a complex application development task, an application development tool reduces the effort and complexity involved in this task.

Enterprise tools serve different roles in the application development process, as follows:

  • Data and function mining tool - enables application component providers to look at the scope and structure of data and functions existing in an EIS

  • Analysis and design tool - enables application component providers to design an application in terms of EIS data and functions

  • Code generation tool - generates Java classes for accessing EIS data and functions. A mapping tool that bridges across two different programming models (object to relational or vice-versa) falls into this category of tools.

  • Application composition tool - enables application component providers to compose application components from Java classes generated by a code generation tool. This type of tool typically uses the JavaBeans™ component model to enhance the ease of programming and composition.

  • Deployment tool - used by application component providers and deployers to set transaction, security, and other deployment time requirements.

A number of these tools may be integrated together to form an end-to-end application development environment.

In addition, various tools and middleware vendors offer EAI frameworks that simplify integration across heterogeneous EISs.

5.1.6. Application Assembler

The application assembler combines various application components into a larger set of deployable units. The input of the application assembler is one or more JAR files produced by an application component provider and the output is one or more JAR files with a deployment descriptor. A deployment descriptor may not be provided by the application assembler if metadata annotations (see Metadata Annotations) are used to describe deployment information.

The application assembler is typically a domain expert who assembles application components to produce an enterprise application. To achieve this goal, the application assembler takes application components, possibly from multiple application component providers, and assembles these components.

5.1.7. Deployer

The deployer takes one or more deployable units of application components, produced by the application assembler or component provider, and deploys the application components in a target operational environment. An operational environment is comprised of an application server and multiple connected EISs.

The deployer is responsible for resolving all external dependencies declared by the application component provider. For example, the deployer ensures that all connection factories used by the application components are present in an operational environment. To perform its role, the deployer typically uses the application server-provided deployment tools.

The deployer is also responsible for the deployment of resource adapters. Since an operational environment may include multiple EISs, the role of the deployer is more intensive and complex than that in a non-EIS scenario. The deployer has to understand security, transaction, and connection management-related aspects of multiple EISs that are configured in an operational environment.

5.1.8. System Administrator

The system administrator is responsible for the configuration and administration of a complete enterprise infrastructure that includes multiple containers and EISs.

In an operational environment that has multiple EISs, the deployer should manage the operational environment by working closely with the system administrators of respective EISs. This enables the deployer to resolve deployment issues while deploying application components and resource adapters in a target operational environment.

This chapter introduced the roles involved in the connector architecture. The later chapters specify responsibilities for each role in more detail.

5.2. Scenario: Integrated Purchase Order System

This section describes a scenario that illustrates the use of the connector architecture. The following description is kept at a high level. Specific scenarios related to transaction management, security, connection management, and inbound communications are described in subsequent chapters.

The following diagram shows the different pieces that comprise this scenario:

5.2.1. Illustration of a Scenario Based on the Connector Architecture

image

ERP Software Inc. is an enterprise system vendor that provides an enterprise resource planning (ERP) system. ERP Software wants to integrate its ERP system with various application servers. It achieves this goal by providing a standard resource adapter for its ERP system. The resource adapter for ERP systems supports the standard inbound communication, transaction, connection management and security contracts. The resource adapter also supports the Common Client Interface (CCI) as its client API.

TPSoft Inc. is another enterprise system vendor that provides a transaction processing (TP) system. TPSoft has also developed a standard resource adapter for its TP system. The resource adapter library supports CCI as part of its implementation.

AppServer Inc. is a system vendor that has an application server product which supports the development and deployment of component-based enterprise applications. This application server product has an Jakarta Enterprise Beans container that provides deployment and runtime support for Jakarta Enterprise Bean components. The application server supports the system-level contracts that enable a resource adapter, which also supports these contracts, to plug into the application server and provide bi-directional connectivity to the underlying EIS. The Jakarta Enterprise Beans container insulates Jakarta Enterprise Bean components from the communication, transaction, security, and connection management mechanisms required for connecting to the EIS.

Manufacturer Corp. is a big manufacturing firm that uses a purchase order processing system based on the ERP system for its business processes. Recently, Manufacturer has acquired a firm that uses TPSoft’s TP system for its purchase order processing. Manufacturer aims to integrate these two systems together into a single integrated purchase order system. It requires a scalable, multi-user, secure, transaction-enabled integrated purchase order system that is not tied to a specific computing platform. Manufacturer plans to deploy the middle-tier of this system on the application server from AppServer Inc.

The MIS department of Manufacturer develops a PurchaseOrder Jakarta Enterprise Bean that provides an integrated view of the two underlying purchase order systems. While developing PurchaseOrder Jakarta Enterprise Bean, the bean provider does not program the transactions, security, connection management or inbound communication mechanisms required for connectivity to the ERP and TP systems; it relies on the Jakarta Enterprise Beans container and application server to provide these services.

The bean provider uses an application programming model based on the CCI to access the business objects and function modules for purchase order processing in the ERP system. The bean provider uses a similar application programming model based on the CCI to access the purchase order processing programs in the TP system.

The MIS department of Manufacturer assembles an integrated web-based purchase order application using PurchaseOrder Jakarta Enterprise Bean with other types of application components, such as Jakarta Server Pages and Jakarta Servlets.

The MIS department installs and configures the application server, ERP, and TP system as part of its operational environment. It then deploys the integrated purchase order application on this operational environment. As part of the deployment, the MIS department configures the operational environment based on the deployment requirements for the various application components that have been assembled into the integrated enterprise application.

After deploying and successfully testing the integrated purchase order system, the MIS department makes the system available for other departments to use.

5.3. Scenario: Business Integration

This scenario illustrates the use of the connector architecture in a business integration scenario.

Wombat Systems is a manufacturing firm that aims to adopt an e-business strategy. Wombat has huge existing investments in its EIS systems. The EISs include ERP systems, mainframe transaction processing systems, and message providers.

Wombat requires to interact with its various partners. In order to do this, it requires support for different interaction mechanisms. It also requires a mechanism to involve all its EIS systems in the interaction. Further, it requires an application sever to host its business applications which participate in the various interactions.

Wombat buys a Jakarta EE based application server from EComm, Inc. to host its business applications which interact with its EISs and its various partners. The application server supports the connector architecture contracts which make it possible to use appropriate resource adapters to drive interactions with its partners and its EISs.

The connector architecture enables Wombat to integrate its existing infrastructure with the application server. Wombat buys off-the-shelf resource adapters for its existing set of EISs and to support interactions with its partners and uses them to integrate its business applications (deployed on the application server).

5.3.1. Connector Architecture Usage in Business Integration Scenario

image

6. Lifecycle Management

This chapter specifies a contract between an application server and a resource adapter that allows an application server to manage the lifecycle of a resource adapter. This contract provides a mechanism for the application server to bootstrap a resource adapter instance during its deployment or application server startup, and to notify the resource adapter instance during its undeployment or during an orderly shutdown of the application server.

6.1. Overview

A resource adapter is a system component which is deployed in an application server. When a resource adapter is deployed, or during application server startup, an application server requires to bootstrap an instance of the resource adapter in its address space. When a resource adapter is undeployed, or during application server shutdown, the application server requires a mechanism to notify the resource adapter instance to stop functioning so that it can be safely unloaded.

The lifecycle management contract provides such a mechanism for an application server to manage the lifecycle of a resource adapter instance. This allows an application server to bootstrap a resource adapter instance during resource adapter deployment or application server startup and also to expose some of its useful facilities to the resource adapter instance. It also provides a mechanism to notify the resource adapter instance while it is undeployed or during an orderly shutdown of the application server.

6.2. Goals

  • Provide a mechanism for an application server to manage the lifecycle of a resource adapter instance.

6.3. Lifecycle Management Model

Lifecycle Management Contract (Interfaces)

image

Lifecycle Management (Object Diagram)

image

 package jakarta.resource.spi;

 import jakarta.resource.spi.work.WorkManager;

 public interface ResourceAdapter {

     void start(BootstrapContext) // startup notification
          throws ResourceAdapterInternalException;

     void stop(); // shutdown notification
     ... // other operations
 }

public interface BootstrapContext {

    WorkManager getWorkManager();
    ... // other operations
}

An application server implements the BootstrapContext and WorkManager interfaces. A resource adapter implements the ResourceAdapter interface.

6.3.1. ResourceAdapter JavaBean and Bootstrapping a Resource Adapter Instance

The implementation class name of the ResourceAdapter interface is specified in the resource adapter deployment descriptor or through the Connector annotation described in @Connector. The ResourceAdapter class must be a JavaBean. Refer to JavaBean Requirements. During resource adapter deployment, the resource adapter deployer creates a ResourceAdapter JavaBean and configures it with the appropriate properties.

When a resource adapter is deployed, or during application server startup, an application server bootstraps an instance of the resource adapter in its address space. In order to bootstrap a resource adapter instance, the application server must use the configured ResourceAdapter JavaBean and call its start method. The start method call is a startup notification from the application server, and this method is called by an application server thread.

During the start method call the ResourceAdapter JavaBean is responsible for initializing the resource adapter instance. This may involve creating resource adapter instance specific objects, creating threads (refer to Work Management), and setting up network endpoints. A ResourceAdapter JavaBean represents exactly one functional resource adapter unit or instance. The application server must instantiate exactly one ResourceAdapter JavaBean per functional resource adapter instance. The application server must create at least one functional resource adapter instance per resource adapter deployment. An application server may create more than one functional resource adapter instance per resource adapter deployment, in order to create replicas of a single functional resource adapter instance on multiple Java™ Virtual Machines (2). In general, however, there should be just one functional resource adapter instance per deployment.

The application server is allowed to have multiple instances of a ResourceAdapter JavaBean active simultaneously, in the same JVM™ instance, provided the instances are not equal. Their equality is determined using the equals method, and therefore, the ResourceAdapter JavaBean is required to implement the equals method.

During the start method call, an application server must provide a BootstrapContext instance containing references to some of the application server facilities (for example, WorkManager ) for use by the resource adapter instance. The application server facilities exposed through the BootstrapContext instance may be used by the resource adapter instance during its lifetime.

During the start method call, the resource adapter instance initializes itself, and may use the WorkManager to submit Work instances for execution (see Work Management). The start method call should return in a timely manner, and should avoid blocking calls, such as use of doWork method call on the WorkManager instance. The application server may throw a WorkRejectedException in response to any or all doWork method calls on the WorkManager instance, in order to enforce that a start method call does not block. Resource adapter implementations are strongly recommended to use startWork and scheduleWork methods on the WorkManager , instead of the doWork method.

Any exception thrown during the start method call indicates an error condition, and the attempt by the application server to create a resource adapter instance fails. A future version of the specification may add a two-phase startup procedure.

A resource adapter instance at runtime may contain several objects that may be created and discarded during its lifetime. Such objects include ManagedConnectionFactory JavaBean (refer to Connection Management), ActivationSpec JavaBean (refer to Message Inflow), various connection objects, resource adapter private objects, and other resource adapter specific objects that are exposed to applications.

The ResourceAdapter JavaBean represents a resource adapter instance and contains the configuration information pertaining to that resource adapter instance. This configuration information may also be used as global defaults for ManagedConnectionFactory and ActivationSpec JavaBeans. That is, when ManagedConnectionFactory or ActivationSpec JavaBeans are created they may inherit the global defaults (ResourceAdapter JavaBean configuration information), which make it easier to configure them.

A resource adapter instance may provide bi-directional connectivity to multiple EIS instances. A ManagedConnectionFactory JavaBean can be used to provide outbound connectivity to a single EIS instance. An ActivationSpec JavaBean can be used to provide inbound connectivity from an EIS instance. A resource adapter instance may contain several such ManagedConnectionFactory and ActivationSpec JavaBeans. The following figure describes the association between a resource adapter instance and its various ManagedConnectionFactory and ActivationSpec JavaBeans.

Resource Adapter Instance (Composition)

image

6.3.2. ManagedConnectionFactory JavaBean and Outbound Communication

A ManagedConnectionFactory JavaBean represents outbound connectivity information to an EIS instance from an application by way of a specific resource adapter instance. This contains the configuration information pertaining to outbound connectivity to an EIS instance. Refer to Connection Management for more details on the ManagedConnectionFactory JavaBean.

When a ManagedConnectionFactory JavaBean is created, it may inherit the ResourceAdapter JavaBean (which represents the resource adapter instance) configuration information, and overrides specific global defaults, if any, and may add other configuration information specific to outbound connectivity.

That is, in the case of outbound communication, the outbound connectivity configuration is a union of ResourceAdapter JavaBean and ManagedConnectionFactory JavaBean configuration, with the intersecting configuration properties based on the ManagedConnectionFactory JavaBean settings.

Outbound communication is initiated by an application and the communication occurs in the context of an application thread, even though resource adapter threads may be involved in the interaction. Note, a resource adapter may use the work management contract (refer to Work Management) to request threads to do work.

import jakarta.resource.spi.ResourceAdapterAssociation;
import jakarta.resource.spi.ManagedConnectionFactory;

public class ManagedConnectionFactoryImpl
         implements ManagedConnectionFactory,
         ResourceAdapterAssociation {

   ResourceAdapter getResourceAdapter();

   void setResourceAdapter(ResourceAdapter) throws ResourceException;

   ... // other methods
}

The ResourceAdapterAssociation interface specifies the methods to associate a ManagedConnectionFactory JavaBean with a ResourceAdapter JavaBean.

Prior to using a ManagedConnectionFactory JavaBean, the application server must create an association between the ManagedConnectionFactory JavaBean and a ResourceAdapter JavaBean, by calling the setResourceAdapter method on the ManagedConnectionFactory JavaBean. A successful association is established only when the setResourceAdapter method on the ManagedConnectionFactory JavaBean returns without throwing an exception.

The setResourceAdapter method on the ManagedConnectionFactory JavaBean must be called exactly once; that is, the association must not change during the lifetime of a ManagedConnectionFactory JavaBean.

6.3.3. ActivationSpec JavaBean and Inbound Communication

An ActivationSpec JavaBean represents inbound connectivity information from an EIS instance to an application by way of a specific resource adapter instance. This contains the configuration information pertaining to inbound connectivity from an EIS instance. Refer to Message Inflow for more details on the ActivationSpec JavaBean.

When an ActivationSpec JavaBean is created, it may inherit the ResourceAdapter JavaBean (which represents the resource adapter instance) configuration information, and overrides specific global defaults, if any, and may add other configuration information specific to inbound connectivity.

That is, in the case of inbound communication, the inbound connectivity configuration is a union of ResourceAdapter JavaBean and ActivationSpec JavaBean configuration, with the intersecting configuration properties based on the ActivationSpec JavaBean settings.

Inbound communication is initiated by an EIS instance and the communication occurs in the context of a resource adapter thread. There are no application threads involved. Note, a resource adapter may use the work management contract (refer to Work Management) to request threads to do work.

import jakarta.resource.spi.ActivationSpec;

// ActivationSpec interface extends ResourceAdapterAssociation interface.

public class ActivationSpecImpl implements ActivationSpec {

    ResourceAdapter getResourceAdapter();

    void setResourceAdapter(ResourceAdapter) throws ResourceException;

    ... // other methods
}

The ResourceAdapterAssociation interface specifies the methods to associate an ActivationSpec JavaBean with a ResourceAdapter JavaBean.

Prior to using an ActivationSpec JavaBean, the application server must create an association between the ActivationSpec JavaBean and a ResourceAdapter JavaBean, by calling the setResourceAdapter method on the ActivationSpec JavaBean. A successful association is established only when the setResourceAdapter method on the ActivationSpec JavaBean returns without throwing an exception.

The setResourceAdapter method on the ActivationSpec JavaBean must be called exactly once; that is, the association must not change during the lifetime of an ActivationSpec JavaBean.

6.3.4. Resource Adapter Shutdown Procedure

The following are some likely situations during which an application server would shutdown a resource adapter instance:

  • The application server is being shutdown.

  • The resource adapter is being undeployed.

Irrespective of what causes a resource adapter instance to be shutdown, the application server must use the following two phases to shutdown a resource adapter instance.

6.3.4.1. Phase One

Before calling the stop method on the ResourceAdapter JavaBean, the application server must ensure that all dependant applications using the specific resource adapter instance are stopped. This includes deactivating all message endpoints receiving messages by way of the specific resource adapter. Note, however, since dependant applications typically cannot be stopped until they are undeployed, the application server may have to delay stopping the resource adapter instance, until all such dependant applications are undeployed.

Completion of phase one guarantees that application threads will not use the resource adapter instance, even though the resource adapter instance specific objects may still be in the memory heap. This ensures that all application activities including transactional activities are completed.

Thus, phase one ensures that even if a resource adapter instance does not properly shutdown during phase two, the resource adapter instance is practically unusable.

6.3.4.2. Phase Two

The application server calls the stop method on the ResourceAdapter JavaBean to notify the resource adapter instance to stop functioning so that it can be safely unloaded. This is a graceful shutdown notification from the application server, and this method is called by an application server thread.

The ResourceAdapter JavaBean is responsible for performing an orderly shutdown of the resource adapter instance during the stop method call. This may involve closing network endpoints, relinquishing threads, releasing all active Work instances, allowing resource adapter internal in-flight transactions to complete if they are already in the process of doing a commit, and flushing any cached data to the EIS.

The resource adapter instance is considered fully functional until the application server calls the stop method on the ResourceAdapter JavaBean.

Any unchecked exception thrown by the stop method call does not alter the processing of the application server shutdown or resource adapter undeployment that caused the stop method call. The application server may log the exception information for error reporting purposes.

Note, it is possible for a resource adapter instance to become non-functional during its lifetime even before the stop method is called, due to EIS failure or other reasons. In such cases, the resource adapter instance should throw exceptions to indicate the failure condition, when it is accessed by an application (during outbound communication) or the application server.

A future version of the specification may add a forced shutdown method in addition to the current graceful stop method.

6.3.5. Requirements

  • The application server must use a new ResourceAdapter JavaBean for managing the lifecycle of each resource adapter instance and must discard the ResourceAdapter JavaBean after its stop method has been called. That is, the application server must not reuse the same ResourceAdapter JavaBean object to manage multiple instances of a resource adapter, since the ResourceAdapter JavaBean object may contain resource adapter instance specific state information.

  • The application server must call the start method on the ResourceAdapter JavaBean (in order to create a functional resource adapter instance), before accessing other methods on the ResourceAdapter JavaBean instance or before using other objects that belong to the same resource adapter instance.

  • The application server thread which calls the start and the stop method on the ResourceAdapter JavaBean executes in an unspecified context. However, the application server thread must have at least the same level of security permissions as that of the resource adapter instance.

Resource Adapter Lifecycle (State Diagram)

image

6.3.6. Resource Adapter Implementation Guidelines

The ResourceAdapter JavaBean should be treated as a central authority or registry for resource adapter instance specific information, and it should have access to the overall state of the resource adapter instance (network endpoints, etc.). This helps in the manageability of the resource adapter instance, and in performing an orderly shutdown.

Some conventions to follow:

  • Any resource adapter specific object (for example, ManagedConnectionFactory JavaBean, ActivationSpec JavaBean, or others) which creates network endpoints should register them with the ResourceAdapter JavaBean.

  • The resource adapter threads should periodically scan the ResourceAdapter JavaBean state and behave accordingly. It is desirable that such threads avoid boundless blocking on I/O calls, and instead use a bounded blocking duration. This helps in resource adapter shutdown, and also potentially avoids deadlock situations during shutdown.

The above conventions enable a ResourceAdapter JavaBean to effectively manage the resource adapter instance and to perform an orderly shutdown of the resource adapter instance.

6.3.7. JavaBean Configuration and Deployment

There is at most one ResourceAdapter JavaBean instance per resource adapter instance. But there can be many ManagedConnectionFactory, ActivationSpec or administered object instances (Administered Objects) per resource adapter instance.

The ResourceAdapter JavaBean instance is created and configured during resource adapter deployment. The ManagedConnectionFactory, ActivationSpec and administered object instances are created and configured during the lifetime of a resource adapter instance.

At runtime, the resource adapter internally uses a union of the configured ResourceAdapter and ManagedConnectionFactory JavaBean properties, to represent outbound communication configuration.

Similarly, at runtime, the resource adapter internally uses a union of the configured ResourceAdapter and ActivationSpec JavaBean properties, to represent inbound communication configuration.

6.3.7.1. ResourceAdapter JavaBean Instance Configuration
  • Create a ResourceAdapter JavaBean instance. This will initialize the instance with the defaults specified by way of the JavaBean mechanism.

  • Apply the ResourceAdapter class configuration properties specified in the resource adapter deployment descriptor, on the ResourceAdapter instance. This may override some of the default values specified through the JavaBean mechanism. The application server is required to merge values specified by way of annotations and deployment descriptors as specified in Deployment Descriptors and Annotations, before applying the ResourceAdapter class configuration properties.

  • The ResourceAdapter deployer may further override the values of the ResourceAdapter instance before deployment.

6.3.7.2. Resource Adapter Deployment

The ResourceAdapter instance property values may be stored separately and reused later while configuring ManagedConnectionFactory, ActivationSpec, or administered object instances.

6.3.7.3. ManagedConnectionFactory JavaBean Instance Configuration
  • Create a ManagedConnectionFactory JavaBean instance. This will initialize the instance with the defaults specified by way of the JavaBean mechanism.

  • Apply the ResourceAdapter instance property values, that were stored earlier, on the ManagedConnectionFactory instance. Note, that the ManagedConnectionFactory JavaBean may have none, some or all of the properties of the ResourceAdapter JavaBean.

  • Apply the ManagedConnectionFactory class configuration properties specified in the resource adapter deployment descriptor, on the ManagedConnectionFactory instance.

  • The application server is required to merge values specified by way of annotations and deployment descriptors as specified in Deployment Descriptors and Annotations, before applying the ManagedConnectionFactory class configuration properties.

  • The ManagedConnectionFactory deployer may further override the values of the ManagedConnectionFactory instance before deployment.

At runtime, the resource adapter internally uses a union of the configured ResourceAdapter and ManagedConnectionFactory JavaBean properties, to represent outbound communication configuration. Note, the ManagedConnectionFactory instance and the ResourceAdapter instance may have intersecting property names. In such a situation, the values specified in the ManagedConnectionFactory instance takes precedence.

6.3.7.4. ActivationSpec JavaBean Instance Configuration
  • Create an ActivationSpec JavaBean instance. This will initialize the instance with the defaults specified by way of the JavaBean mechanism.

  • Apply the ResourceAdapter instance property values, that were stored earlier, on the ActivationSpec instance. Note, that the ActivationSpec JavaBean may have none, some, or all of the properties of the ResourceAdapter JavaBean.

  • Apply the ActivationSpec class configuration properties specified in the application deployment descriptor, on the ActivationSpec instance.

  • The application server is required to merge values specified by way of annotations and deployment descriptors as specified in Deployment Descriptors and Annotations, before applying the ActivationSpec class configuration properties.

  • The ActivationSpec deployer may further override the values of the ActivationSpec instance before deployment.

At runtime, the resource adapter internally uses a union of the configured ResourceAdapter and ActivationSpec JavaBean properties, to represent inbound communication configuration. Note, the ActivationSpec instance and the ResourceAdapter instance may have intersecting property names. In such a situation, the values specified in the ActivationSpec instance takes precedence.

6.3.7.5. JavaBean Validation

The Jakarta Bean Validation specification (see Jakarta Bean Validation Specification, version 3.0) defines “a metadata model and API for JavaBean validation. The default metadata source is annotations, with the ability to override and extend the meta-data through the use of XML validation descriptors.”

The JavaBeans provided by the resource adapter implementation, like ResourceAdapter , ManagedConnectionFactory etc, may use the annotations or the XML validation descriptor facilities defined by the Jakarta Bean Validation specification to express their validation requirements of its configuration properties to the application server. A constraint annotation, can be applied to a JavaBean type, on any of the type’s fields or on any of the JavaBeans-compliant properties.The use of Jakarta Bean Validation constraint annotations by the resource adapter implementation as a self-validation check behavior is optional.

The Jakarta Bean Validation specification defines a set of standard built-in constraints. The resource adapter implementation is encouraged to use them instead of redefining custom annotations for the same use cases. The resource adapter implementation may (but is not limited to) use the Jakarta Bean Validation facilities for the following use cases:

  • Range or limits specification. To ensure that the value provided by a deployer for a configuration property falls within prescribed limits. The resource adapter implementation may use @Min , @Max , @Size constraints for this purpose.

  • Mandatory attributes. To require the deployer to provide a value for a configuration property. The resource adapter implementation may use the @NotNull constraint for this use case.

In the Jakarta EE 9 environment, as specified in the Jakarta EE platform specification, the Jakarta Bean Validation facilities are available. The application server must check the validity of the configuration settings provided by the deployer for a JavaBean, using the capabilities provided by the Jakarta Bean Validation specification. This validation must be performed before using the JavaBean. This helps to catch configuration errors earlier on without having to wait until the JavaBean is put to use. As the application server may check the validation of the configuration settings at deployment time and runtime, the constraint validation implementation must not make any assumptions of the availability of a live resource adapter instance. The application server must support the decoration of the following JavaBeans with constraint annotations:

  • ResourceAdapter

  • ManagedConnectionFactory

  • ActivationSpec

  • Administered Objects

The application server must, by default, target the jakarta.validation.groups.Default group for validation. The application server must validate the JavaBean by obtaining a Validator instance from its ValidatorFactory and invoking the validate method with the targeted groups. If the set of ConstraintViolation objects returned by the validate method is not empty, the application server must fail validation by throwing the jakarta.validation.ConstraintValidationException containing a reference to the returned set of ConstraintViolation objects, and must not put the JavaBean in use. The application server must treat all JavaBean properties as “reachable” and “cascadable” as defined by the BeanValidation Specification. For more details on reachability and cascaded validation, see Section 3.5 of the Jakarta Bean Validation Specification, version 3.0.

Application server configuration tools and third-party tools are recommended to leverage the constraint metadata request API defined in the Jakarta Bean Validation specification to provide a richer interaction model during configuration of the JavaBeans.

6.3.7.6. Configuration Property Attributes
Dynamic Reconfigurable Configuration Properties

Configuration properties whose values could be configured dynamically during the lifetime of the JavaBean are referred to as dynamically reconfigurable configuration properties. A resource adapter may indicate that a configuration property is dynamically reconfigurable through the config-property-supports-dynamic-updates attribute in the deployment descriptor (see Resource Adapter XML Schema Definition) or the supportsDynamicUpdates annotation element in the ConfigProperty annotation (see @ConfigProperty).

Neither the application server nor the resource adapter must support the dynamic reconfiguration of configuration properties. If an application server supports this feature and the resource adapter employs JavaBean Validation (see JavaBean Validation), the application server must perform JavaBean Validation after reconfiguring all the modified values of the JavaBean. When the JavaBean is validated, the resource adapter can deduce that the reconfiguration has been completed by the deployer or administrator.

Invalid reconfiguration of the state of a JavaBean by an application server may be indicated by the resource adapter through the following means:

Throwing an exception when the field is updated

For configuration properties that can only be validated based on the state of other configuration properties, throwing an exception during the validation phase.

Confidential Properties

Certain configuration properties of a JavaBean, such as Password (see Standard Properties for more information on Password), may be confidential and must not be presented as clear text in configuration tools. The resource adapter may indicate such properties as “Confidential Properties” through the config-property-confidential attribute in the deployment descriptor (see Resource Adapter XML Schema Definition ) or the confidentialProperty annotation element in the ConfigProperty annotation (see @ConfigProperty). The application server’s configuration tool may use this attribute to use special visual aids denoting confidentiality.

6.3.7.7. Resource Adapter Implementation Guidelines

A resource adapter implementation may choose to use common properties, that is, a ManagedConnectionFactory or an ActivationSpec JavaBean, may contain some or all of the properties of the ResourceAdapter JavaBean. The choice is up to the resource adapter implementation.

In general, there is no need for common properties, since these various objects are associated at runtime with the ResourceAdapter JavaBean. However, there may be situations, for example, a ManagedConnectionFactory JavaBean may need to override the ResourceAdapter JavaBean values in order to successfully connect to a different EIS. In such a scenario, providing common properties between the ResourceAdapter and ManagedConnectionFactory JavaBeans, allows the ManagedConnectionFactory deployer to override the ResourceAdapter property values and configure the ManagedConnectionFactory appropriately.

6.3.8. Lifecycle Management in a Non-Managed Environment

Although the lifecycle management contract is primarily intended for a managed environment, it may still be used in a non-managed environment provided that the application that bootstraps a resource adapter instance is capable of managing its lifecycle.

6.3.9. A Sample Resource Adapter Implementation

Sample Resource Adapter
package com.xyz.adapter;

import jakarta.resource.spi.ResourceAdapter;
import jakarta.resource.spi.BootstrapContext;
import jakarta.resource.spi.work.*;

public class MyResourceAdapterImpl implements ResourceAdapter {

    void start(BootstrapContext serverCtx) {
        // 1. setup network endpoints
        ...

        // 2. get WorkManager reference
        WorkManager wm = serverCtx.getWorkManager();

       // 3. provide Work objects to WorkManager
       for (i = 0; i < 10; i++) {
           Work work = new MyWork(...);
           try {
               wm.startWork(work);
          } catch (WorkException we) {
              // handle the exception
          }
      }
   }

   void stop() {
       // release Work instances, do cleanup and return.
   }
}

public class MyWork implements Work {

    void release() {
        // set a flag to hint the Work instance to complete.
        // Note, the calling thread is different from
        // the active thread in which this instance is executing.
    }

    void run() {
        // do work (call application components, monitor
        // network ports, etc.).

    }
}

Lifecycle Management Model (Sequence Diagram)

image

7. Connection Management

This chapter specifies the connection management contract between an application server and a resource adapter. It introduces the concepts and mechanisms relevant to this contract, and delineates the responsibilities of the roles of the resource adapter provider and application server vendor in terms of their system-level support for the connection management contract. To complete the description of the connection management contract, this chapter also refers to the responsibilities of the application component provider and deployer. The chapter includes scenarios to illustrate the connection management contract.

7.1. Overview

An application component uses a connection factory to access a connection instance, which the component then uses to connect to the underlying EIS. A resource adapter acts as a factory of connections. Examples of connections include database connections, Jakarta Messaging connections, and SAP R/3 connections.

Connection pooling manages connections that are expensive to create and destroy. Connection pooling of expensive connections leads to better scalability and performance in an operational environment. The connection management contract provides support for connection pooling.

7.2. Goals

The connection management contract has been designed with the following goals:

  • To provide a consistent application programming model for connection acquisition for both managed and non-managed (two-tier) applications.

  • To enable a resource adapter to provide a connection factory and connection interfaces based on the CCI specific to the type of resource adapter and EIS. This enables JDBC drivers to be aligned with the connector architecture with minimum impact on the existing JDBC APIs.

  • To provide a generic mechanism by which an application server can provide different services—transactions, security, advanced pooling, error tracing/logging—for its configured set of resource adapters.

  • To provide support for connection pooling.

The goal of the Jakarta Connector Architecture is to enable efficient, scalable, and extensible connection pooling mechanisms, not to specify a mechanism or implementation for connection pooling. The goal is accomplished by defining a standard contract for connection management with the providers of connections—that is, resource adapters. An application server should use the connection management contract to implement a connection pooling mechanism in its own implementation-specific way.

7.3. Architecture: Connection Management

The connection management contract specifies an architected contract between an application server and a resource adapter. This connection management contract is shown with bold flow lines in Architecture Diagram: Managed Application scenario. It includes the set of interfaces shown in the architecture diagram.

7.3.1. Overview: Managed Application Scenario

The application server uses the deployment information specified by way of the deployment descriptor mechanism (specified in section Requirements) and metadata annotations (specified in Deployment Descriptors and Annotations) to configure the resource adapter in the operational environment.

The resource adapter provides connection and connection factory interfaces. A connection factory acts as a factory for EIS connections. For example, javax.sql.DataSource and java.sql.Connection interfaces are JDBC-based interfaces for connecting to a relational database.

The CCI (specified in Common Client Interface) defines jakarta.resource.cci.ConnectionFactory and jakarta.resource.cci.Connection as interfaces for a connection factory and a connection, respectively.

The application component does a lookup of a connection factory in the Java Naming and Directory Interface™ (JNDI) name space. It uses the connection factory to get a connection to the underlying EIS. The connection factory instance delegates the connection creation request to the ConnectionManager instance.

The ConnectionManager enables the application server to provide different quality-of-services in the managed application scenario. These quality-of-services include transaction management, security, error logging and tracing, and connection pool management. The application server provides these services in its own implementation-specific way. The connector architecture does not specify how the application server implements these services.

The ConnectionManager instance , on receiving a connection creation request from the connection factory , does a lookup in the connection pool provided by the application server. If there is no connection in the pool that can satisfy the connection request, the application server uses the ManagedConnectionFactory interface (implemented by the resource adapter) to create a new physical connection to the underlying EIS. If the application server finds a matching connection in the pool, it uses the matching ManagedConnection instance to satisfy the connection request.

If a new ManagedConnection instance is created, the application server adds the new ManagedConnection instance to the connection pool.

The application server registers a ConnectionEventListener with the ManagedConnection instance. This listener enables the application server to get event notifications related to the state of the ManagedConnection instance. The application server uses these notifications to manage connection pooling, manage transactions, cleanup connections, and handle any error conditions.

The application server uses the ManagedConnection instance to get a connection instance that acts as an application-level handle to the underlying physical connection. An instance of type jakarta.resource.cci.Connection is an example of such a connection handle. An application component uses the connection handle to access EIS resources.

The resource adapter implements the XAResource interface to provide support for transaction management. The resource adapter also implements the LocalTransaction interface so that the application server can manage transactions internal to a resource manager. The chapter on transaction management describes this transaction management contract between the application server (and its transaction manager) and the resource adapter (and its underlying resource manager).

Architecture Diagram: Managed Application scenario

image

7.4. Application Programming Model

The application programming model for getting an EIS connection is similar across both managed (application server based) and non-managed scenarios. The following sections explain a typical application programming model scenario.

7.4.1. Managed Application Scenario

The following steps are involved in a managed scenario:

1 The application assembler or component provider specifies connection factory requirements for an application component using a deployment descriptor mechanism. For example, a bean provider specifies the following elements in the deployment descriptor for a connection factory reference. Note that the connection factory reference is part of the deployment descriptor for Jakarta Enterprise Bean components and not the resource adapter. Refer Jakarta Enterprise Beans specification (see Jakarta Enterprise Beans Specification, version 4.0) for details on the deployment mechanism for Jakarta Enterprise Bean components:

  • res-ref-name: eis/MyEIS

  • res-type: jakarta.resource.cci.ConnectionFactory

  • res-auth: Application or Container

2 During resource adapter deployment, the deployer sets the configuration information (example: server name, port number) for the resource adapter. The application server uses a configured resource adapter to create physical connections to the underlying EIS. Refer to API Requirements for details on packaging and deployment of a resource adapter.

3 The application component looks up a connection factory instance in the component’s environment using the JNDI interface.

// obtain the initial JNDI Naming context
Context initctx = new InitialContext();

// perform JNDI lookup to obtain the connection factory
jakarta.resource.cci.ConnectionFactory cxf =
   (jakarta.resource.cci.ConnectionFactory)
      initctx.lookup(java:comp/env/eis/MyEIS);

The JNDI name passed in the method NamingContext.lookup is the same as that specified in the res-ref-name element of the deployment descriptor. The JNDI lookup results in a connection factory instance of type jakarta.resource.cci.ConnectionFactory as specified in the res-type element.

4 The application component invokes the getConnection method on the connection factory to get an EIS connection. The returned connection instance represents an application-level handle to an underlying physical connection.

An application component obtains multiple connections by calling the method getConnection on the connection factory multiple times.

jakarta.resource.cci.Connection cx = cxf.getConnection();

5 The application component uses the returned connection to access the underlying EIS by way of the resource adapter. Common Client Interface specifies in detail the application programming model for EIS access.

The JNDI context of an accessing application is available to a resource adapter through the application thread that uses its connection object. The resource adapter may use the JNDI context to access other resources.

6 After the component finishes with the connection, it closes the connection using the close method on the Connection interface.

cx.close();

7 If an application component fails to close an allocated connection after its use, that connection is considered an unused connection. The application server manages the cleanup of unused connections. When a container terminates a component instance, the container cleans up all connections used by that component instance. Refer section ManagedConnection and Scenario: Connection Event Notifications and Connection Close for details on the cleanup of connections.

7.4.2. Non-Managed Application Scenario

In a non-managed application scenario, the application developer follows a similar programming model to the managed application scenario. The non-managed case involves looking up of a connection factory instance, getting an EIS connection, using the connection for EIS access, and finally closing the connection.

7.4.3. Guidelines

Connection handles are application level handles to underlying physical connections and are light-weight objects, especially when dissociated from the ManagedConnection . Creation of a connection handle does not necessarily result in the creation of a new physical connection to the EIS. The ManagedConnection , which represents the actual underlying physical connection, should maintain any session or transaction state data associated with that connection to the EIS. An application component may not derive much benefit from caching these handles, although this is allowed in this specification. Application components are recommended to obtain and cache the Connection Factory objects instead. For more information, see ConnectionFactory and Connection.

An application component is recommended to obtain a connection handle from the connection factory, use the connection handle to interact with the EIS by way of the resource adapter, and close the connection handle after finishing with it.

 //recommended: connection handle creation, use and close
 Connection con = null;
 try {
     con = cf.getConnection();
    //use the con handle to interact with the EIS
 } finally {
    if (con != null){
        con.close();
    }
 }

The application component is recommended to explicitly close the connection handle as soon as the handle has been used and is not required later. This reduces the possibility of connection leaks and enhances the application server’s ability to pool physical connections to the EIS (see Connection Pool Implementation).

7.5. Interface/Class Specification

This section specifies the Java classes and interfaces defined as part of the connection management contract. For a complete specification of these classes and interfaces, refer to the API documentation distributed with this document.

The following figure shows the class hierarchy for the connection management contract. The diagram also illustrates the responsibilities for the definition of an interface and its implementation:

Class Diagram: Connection Management Architecture