Top 29 Java Ee Connector Architecture (JCA) Interview Questions You Must Prepare 19.Mar.2024

The Work Manager tab contains the list of configured Work Managers. New Work Managers can be added, removed, and their thread pools configured here. Each Work Manager can have one short-running thread pool and an optional long-running thread pool.

The Java EE Connector Architecture defines a standard for connecting a compliant application server to an EIS. It defines a standard set of system-level contracts between the Java EE application server and a resource adapter. The system contracts defined by Version 1.0 of the Java EE Connector Architecture are described by the specification as follows:

  • Connection management : Connection management enables an application server to pool connections to the underlying EIS and enables application components to connect. This leads to a scalable application environment that can support a large number of clients.
  • Traction management : Traction management enables an application server to use a traction manager to manage tractions across multiple resource managers. This contract also supports tractions that are managed internal to an EIS resource manager without the necessity of involving an external traction manager.
  • Security management: Security management reduces security threats to the EIS and protects valuable information resources managed by the EIS. JCA Version 1.5 adds system contracts to the specification as follows:
  • Life cycle management : Life cycle management enables an application server to manage the life cycle of a resource adapter from initiation through upgrades to obsolescence. 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 dedeployment or during an orderly shutdown.
  • Work management : Work management enables a resource adapter to do work (monitor network endpoints, invoke application components, and so on) 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 traction context with which work instances are executed.
  • Traction inflow management : Traction inflow management enables a resource adapter to propagate an imported traction to an application server. This contract also allows a resource adapter to trmit traction completion and crash recovery calls initiated by an EIS, and ensures that the Atomicity, Consistency, Isolation and Durability (ACID) properties of the imported traction are preserved.
  • Message inflow management : Message inflow management enables 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), and so on) to be plugged into any Java EE compatible application server with a resource adapter.

Used for debugging connections and supporting lazy enlistment of a connection in a traction, tracking whether they are used and released properly by the application.

These days, many systems must integrate with other systems. we describe various integration types and where JCA fits into them. Integration falls into two main buckets:

  • Inbound integration: outside systems initiate data requests to your system.
  • Outbound integration: your system initiates data requests to other systems.

All of the following integration types can be applied in both an inbound and an outbound manner.

Messaging brokers, another feature common to many EAI products, usually enable both point-to-point and publish/subscribe messaging. EAI products often employ messaging as the connectivity layer to tie together disparate systems.

Currently JCA does not address connectivity to an EIS in a message-oriented manner. It is possible, however, to implement some of a message broker's feature set in an EAI product by using JMS (Java Messaging Service), which is part of J2EE.

The connection management contract describes the understanding a J2EE container has with the adapter regarding establishing, pooling, and tearing down connections. The connection management contract also allows listeners created on a connection to respond to events (for instance if the connection becomes lost or experiences an error). Also note that the underlying protocol an adapter uses to connect to an EIS is outside the scope of the JCA specification.

All JCA resource adapters must supply two implementations with the adapter. First, a ConnectionFactor provides a vehicle for creating connections. Second, the Connection class represents this particular resource adapter's underlying connection.

With that background in mind, let's consider how the current version of the JCA specification -- as well as J2EE in general -- measure up to some of the features found in EAI vendors' products.

Many EAI vendors, Vitria and Tibco for example, have either announced JCA support, or are in the process of releasing products that incorporate JCA-based adapters. Because the JCA 1.0 specification was finalized in July 2001, don't expect JCA in its initial release to match feature for feature to an EAI vendor's product, nor is that the aim. (Many features of the J2EE platform also compare to features in many EAI products.)

Workflow is the management of business processes. Think of workflow as a coordinator. In and of itself, workflow lacks the capability to do anything, but rather relies on business objects, messages, and other external entities to perform functionality (for example creating a user object in a database). Workflow coordinates the use of business objects, messages, and so on to perform business processes.

JCA does not address workflow. However, look for something in the J2EE arena to address workflow, as it serves as an important component when developing a complex system.

Having discussed how JCA (and J2EE) compare with EAI tools, it's now important to look at how JCA fits into an overall integration strategy.

To retrieve and update data, you employ JCA's CCI layer, a procedure resembling using JDBC to call stored procedures. A JCA resource adapter is not required to support the CCI layer (the resource adapter creators can choose their own API set), and, even if the resource adapter does support CCI, it may also support an API specific for that particular adapter.

The CCI APIs can be divided into four sections: First, the APIs related to establishing a connection to an EIS, also referred to as the Connection Interfaces. The second area of the CCI APIs cover command execution on an EIS, referred to as theInteraction Interfaces. Third is the Record/ResultSet Interfaces,which encapsulate the query results to an EIS. The fourth area, referred to as the Metadata Interfaces, allows EIS's metadata (the type of data) to be queried.

After this brief overview of the CCI APIs, it is useful to look at an example that shows the query of an employee count from an EIS:

intcount; 
try

ConnectionSpec spec =newCciConnectionSpec(user, password);
Connection con = cf.getConnection(spec);
Interaction ix = con.createInteraction(); 
CciInteractionSpec iSpec = new CciInteractionSpec();
iSpec.setSchema(user); iSpec.setFunctionName("EMPLOYEECOUNT");
RecordFactory rf =cf.getRecordFactory(); 
IndexedRecord iRec =rf.createIndexedRecord("InputRecord"); 
Record rec =ix.execute(iSpec, iRec); 
Iterator iter =((IndexedRecord)rec).iterator();
while(iter.hasNext())

Object obj = iter.next();
if(obj instanceof Integer)

count = ((Integer)obj).intValue();


con.close(); 

catch(Exception e) 

e.printStackTrace(); 
}
System.out.println("Employee count is: " + count);...

User interface (UI) integration represents the most coarse-grain type of integration. UI-level integration implies that the data passed between systems will exist in the form of a UI representation. An outbound integration at the UI level entails requesting the UI (most likely a Webpage) from a remote system, then possibly manipulating it before displaying it as if it were part of your system's UI. An inbound integration at the UI level entails allowing an outside system to request UI pages on your system for inclusion on a remote system.

Prefer UI integration over other options when it is unimportant to distinguish the data type being retrieved. UI integration often requires the least effort to implement.

Object/RPC (remote procedure call) integration implies integrating systems using distributed objects (that is, using EJB calls to integrate). With object-level integration, data passes between systems as parameters to method calls. In an outbound object-level integration, your system invokes objects on remote systems, while in an inbound object-level integration, a remote system calls objects on your system to retrieve data.

One of an object-level integration's main advantages is that you can call detailed APIs with full type safety and easily propagate the error codes and exceptions between systems.

The Common Config tab contains settings for the cached connection manager, archive validation and bean validation ((JSR-303). Each of these is contained in their own tab as well. These settings can be changed by opening the appropriate tab, clicking the edit button, making the required changes, and then clicking on the save button.

Message-level integration, all the rage with the advent of Web services, implies that the data passed between systems will be in the form of a message (a defined, data-driven text format). An outbound message integration involves requesting data from a remote system in a message form (most likely a SOAP (Simple Object Access Protocol) message). With an inbound integration, your system receives a request for data via a message and responds with a message.

Message-oriented integration lends itself to loose coupling between systems because the systems remain unaware of the object types that exist on the remote system. That type of loose coupling works well with applications that wish to communicate over the Internet.

The JCA subsystem in the JBoss Enterprise Application Platform 6 configuration file controls the general settings for the JCA container and resource adapter deployments.

  • Key elements of the JCA subsystem
  • Archive validation.
  • This setting whether archive validation will be performed on the deployment units.
  • The following table describes the attributes you can set for archive validation.

JCA adapters can be built to integrate with various Enterprise Information System such as Siebel Systems, SAP AG, Great Plains Systems, Oracle Applications, etc. Siebel provides API to integrate with various platforms like Java, C++, .Net, Visual Basic, etc. For Java it provides an interface called 'Java Data Bean' (JDB). The Siebel adaptor provides data access via the JDB API. Great Plains Systems provides an interface called eConnect to integrate with other platforms. SAP provides an interface for Java called SAP Java Connector (SAP JCo).

In order to use JCA in a J2EE container, you first must have a JCA resource adapter, which resembles a JDBC driver. A JCA adapter is specific to an EIS (for example SAP or PeopleSoft) and is contained in a Resource Adapter Archive (RAR) file composed of the jar files and native libraries necessary to deploy the resource adapter on a J2EE container. A JCA adapter interacts with a J2EE server with system contracts. They enable the J2EE server to propagate the context in which a JCA adapter is being called.

You'll find three types of system contracts:

  1. Connection management
  2. Traction management
  3. Security

Lastly, data-level integration implies that the data passed between systems will be in a data/record-oriented manner. In an outbound data-level integration, your system requests data in a record-oriented fashion from other systems. With an inbound data-level integration, a remote system requests data from your system in a record-oriented manner.

The advantage of a data level integration: it lends itself to data mapping from one system onto the business objects in another system. JCA falls into the data-level integration category and therefore has the strengths and weaknesses of this integration type.

Now that we've covered where JCA fits into the overall integration puzzle, we are ready to discuss the JCA's structure.

With the next EAI feature -- data mapping -- data acquired in one format (for instance in the EIS's native format) by the resource adapter must be trformed into the format required for the business object. Mapping data from one system to another often proves the most time consuming aspect of system integration because you must map each business object in both systems. In response, most EAI vendors provide visual tools to enable a developer to set up such mapping.

This setting determines whether bean validation (JSR-303) will be performed on the deployment units.

The security contract enables the application server to connect to an EIS system using security properties. The application server authenticates with the EIS system by using security properties composed of a principle (a user id) and credentials (a password, a certificate, and so on). An application server can employ two methods to authenticate to an EIS system (via a resource adapter). With the first method, container-managed sign-on, the security credentials configure when the resource adapter is deployed on the application server. You can choose from several ways to configure security properties when using container-managed sign-on. First, with Configured Identity, all resource adapter connections use the same identity when connecting to the EIS system.

Second, with Principal Mapping, the principal used when connecting to the EIS system is based on a combination of the current principal in the application server and the mapping (which maps how the principal in the application server will map to a principal in the EIS system). The third is Caller Impersonation, where the principal used in the EIS system exactly matches the principal in the application server. The fourth is Credentials Mapping, which is similar to Caller Impersonation, except the type of credentials must be mapped from application server credentials to EIS credentials.

While it's easiest to configure the security properties at deployment time, such a strategy proves slightly less flexible because the security properties cannot change at runtime. As an alternative, you can configure security properties by component-managed sign-on, which allows you to pass security properties each time a connection is acquired from the resource adapter.

  • allow-core-timeout:Boolean setting that determines whether core threads may time out. The default value is false.
  • core-threads:The core thread pool size. This must be smaller than the maximum thread pool size.
  • queue-length:The maximum queue length.
  • max-thread:The maximum thread pool size.
  • keepalive-time:Specifies the amount of time that pool threads should be kept after doing work.
  • thread-factory:Reference to the thread factory .

JCA overview: Its main components include the resource adapter, system contracts, and the Common Client Interface (CCI), which together give JCA the power to access data in enterprise systems.

(JCA) is a Java-based technology solution for connecting application servers and enterprise information systems (EIS) as part of enterprise application integration (EAI) solutions. While JDBC is specifically used to connect Java EE applications to databases, JCA is a more generic architecture for connection to legacy systems. JCA was developed under the Java Community Process as JSR 16 (JCA 1.0), JSR 112 (JCA 1.5) and JSR 322 (JCA 1.6).

The JCA, as its single biggest weakness, lacks an asynchronous communication vehicle. As a consequence, pulling information out of an EIS proves straightforward, but having an EIS send information (for instance data updates) to your system is not currently in the JCA specification.

In another major weakness, the JCA specification lacks a common API for data access. The CCI mentioned above is optional, so no dependable mechanism exists that a developer can use to access data using JCA (only the system contracts are guaranteed to be consistent).

The good news is that most of the current JCA's limitations will be addressed in the specification's next version, JCA 2.0, currently in development as JSR (Java Specification Request) 1@Version 2.0 will address asynchronous capabilities, JMS integration with JCA, metadata for the CCI layer, and XML use in the CCI layer.

The Bootstrap Contexts tab contains the list of configured Bootstrap Contexts. New Bootstrap Context objects can be added, removed, and configured. Each Bootstrap Context must be assigned a Work Manager.

The JCA subsystem of JBoss Enterprise Application Platform 6 can be configured in the Management Console. The JCA configuration options are located in slightly different places in the Management Console depending on how the server is being run.

If the server is running as a Standalone Server, follow these steps:

  • Click on the Profile link on the top right to switch to the Profile view.
  • Ensure the Profile section in the navigation panel to the left is expanded.
  • Click on Connector to expand it, and then click on JCA.
  • If the server is running as part of a Managed Domain, follow these steps:
  • Click on the Profile link on the top right to switch to the Profile view
  • Select the profile you are modifying from the Profile menu at the top of the navigation panel on the left.
  • Click on Connector to expand it, and then click on JCA.
  • Configure the settings for the JCA subsystem using the three tabs.

Most EAI vendors include proprietary adapters built to work with their products. Most proprietary adapters allow for synchronous and asynchronous communication to an EIS. JCA adapters closely resemble those adapters, except JCA adapters include only a synchronous communication channel. Resource adapters represent the EAI feature JCA most directly matches, although most EAI vendors' adapters offer a larger feature set (for instance asynchronous capability) than JCA adapters.

Bootstrap contexts: Used to define custom bootstrap contexts.

Attributes:

  • name:Specifies the name of the bootstrap context.
  • workmanager:Specifies the name of the work manager to use for this context.

The traction management contract controls tractions in two different ways. First, it allows distributed tractions, which provide a mechanism to propagate tractions that originate from inside an application server to an EIS system.

For example: in an EJB, a traction may be created. If this EJB then employs a JCA resource adapter, the traction management contract enables the traction to propagate to the EIS (via the application server invoking the resource adapter's X/Open XA interfaces). In that situation, the traction manager on the application server would control multiple resources to conduct distributed traction coordination (i.e., two-phase commit).

Second, the traction management contract can control tractions by creating local tractions. Local tractions are local in the sense that they exist only on a particular EIS resource. The traction contract allows these tractions to be controlled, but they are related to any traction that exists on the application server where the JCA resource adapter is running.

Also note that the resource adapter need not implement the the traction management contract. Making this optional allows for resource adapters in non traction resources.