Application Contracts

Similar to the system contracts, the JCA also defines a standardized way for an application component or an EAI tool to interact with RAs implemented by different vendors. This standard mode of communication is called the application contract. The CCI is the application contract defined by the JCA specification between an application component and an RA. The CCI is described next.

Common Client Interface (CCI)

The CCI, as its name suggests, defines a consistent and standard way for enterprise applications, enterprise application development tools, and EAI frameworks to interact with different EIS systems via RAs. The CCI is a contract between the Java application (or framework or tool), the EIS vendor, and the RA provider. A Java application will use the CCI to pass a command from the Java application to the EIS through the RA. The RA formats the command and calls the associated EIS functionality.

The CCI was created as part of the J2EE Architecture Specification to be general enough to handle the majority of interactions between the Java application and the EIS. This significantly decreases the learning curve necessary for understanding the interaction of Java applications and EISs within an organization. Java developers everywhere can uniformly apply these interfaces to their applications.

Like the "m x n" to "m + n" integration solution that the JCA specification provides for application server vendors and EIS systems, the JCA specification addresses similar issues between a Java client application and the EIS system via the resource adapter. The JCA eliminates the need for proprietary interfaces by defining generic all-in-one interfaces. Instead of having vendor-specific drivers for each specific EIS, which requires Java developers to learn vendor specific classes, the JCA has created CCI as the standard interface. Now all vendors are encouraged to create drivers called RAs that conform to this specification. These interfaces are usable regardless of the EIS system in the back end as long as a supporting RA for the EIS exists.

Connection Interfaces

The connection interfaces form part of the standard way for application servers to obtain connections using the RA.

  • javax.resource.cci.ConnectionFactory This class is based on the factory method design pattern. The user can use this class to retrieve a javax.resource.cci.Connection object from the application server's pool of connection objects. Application components retrieve this object by doing a JNDI lookup.

  • javax.resource.cci.Connection This represents the handle enabling application components to interact with the underlying EIS.

  • javax.resource.cci.ConnectionSpec This object is used by the javax.resource.cci.ConnectionFactory. When using the javax.resource.cci.ConnectionFactory to request a javax.resource.cci.Connection object from the pool, the javax.resource.cci.ConnectionSpec object is used to encapsulate properties about the type of connection being requested. The only two properties supported by default are username and password. Other proprietary variables can be added if necessary.

  • javax.resource.cci.LocalTransaction This object can define the state of a transaction that is being handled locally.

Interaction Interfaces

Interaction interfaces provide the methods and attributes necessary to facilitate communication with the EIS.

  • javax.resource.cci.Interaction This object is acquired from the javax.resource.cci.Connection object. The RA implements this interface to execute EIS functions. If you wanted to query a database, you could use this class to call a stored procedure and pass the necessary parameters.

  • javax.resource.cci.InteractionSpec Similar to a javax.resource.cci.ConnectionSpec, this class holds information used by the Interaction object to define how interaction between the component and the EIS occurs. For example, the javax.resource.cci.InteractionSpec class can indicate to the RA that the Java component will send a message to the EIS but does not require a response from the EIS.

Data Representation Interfaces

Data representation objects contain the results of EIS interaction.

  • javax.resource.cci.Record This is the parent interface for all interfaces that encapsulate the results of an EIS query. All the other interfaces defined in this section will extend this interface. The current version of the specification does not intrinsically support XML, so all data is returned in table format.

  • javax.resource.cci.ResultSet This class inherits from javax.resource.cci.Record and encapsulates the results of queries done on the EIS. It stores data using a tabular format identical to the JDBC.

  • javax.resource.cci.MappedRecord This class inherits from javax.resource.cci.Record. Data from the EIS is stored in a way similar to the java.util.Map. Data is accessed using key-value mapping.

  • javax.resource.cci.IndexedRecord This class inherits from javax.resource.cci.Record. Data is stored in this collection in an ordered and indexed manner.

  • javax.resource.cci.RecordFactory This class inherits from javax.resource.cci.Record. This class creates generic instances of the classes javax.resource.cci.MappedRecord and javax.resource.cci.IndexedRecord for use by the application. The javax.resource.cci.RecordFactory object accesses the metadata repository to create the object.

  • javax.resource.cci.Streamable This interface is implemented by the RA. The RA uses these methods to read and write streamable objects to an output stream. This interface is often used to stream javax.resource.cci.Result objects to distributed applications.

  • java.sql.ResultSetMetaData This interface defines methods that are used to inspect instances of the javax.resource.cci.ResultSet interface. This class can identify the columns in the javax.resource.cci.ResultSet object. An instance of this class is retrieved from an instance of the javax.resource.cci.ResultSet object.

Metadata Interfaces

Metadata is important for obtaining information about the EIS underlying the application. These interfaces are often used by EIS tool developers to create user interfaces to help system administrators maintain an application's infrastructure.

  • javax.resource.cci.ConnectionMetaData This interface reveals information about the underlying EIS. A javax.resource.cci.Connection object returns a reference to a javax.resource.cci.ConnectionMetaData object.

  • javax.resource.cci.ResourceAdapterMetaData This interface encapsulates information about the capabilities of the underlying RA implementation. It is useful for determining the vendor of the RA and what version is currently being used.

  • javax.resource.cci.ResultSetInfo An instance of this interface is retrieved from the javax.resource.cci.Connection object. It provides information about the javax.resource.cci.ResultSet instances being returned by the RA. For instance, it can indicate whether changes to a javax.resource.cci.ResultSet instance are detected.

Exceptions and Warnings Interfaces

There are two exceptions and warnings interfaces in the JCA specification.

  • javax.resource.ResourceException This interface is the root of the exception hierarchy used by the CCI. All exception strategies implemented by a development team will extend from this class.

  • javax.resource.cci.ResourceWarning These objects inform the application about problems that occur during component and EIS interaction.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net