Show TOC

Procedure documentationImplementing Interaction Functions Locate this document in the navigation structure

 

A resource adapter that implements the interaction-related interfaces from the javax.resource.cci package enables an application component to call functions of the underlying EIS.

Procedure

The connector API provides a set of interfaces, whose implementation enables a resource adapter to support interactions. These interfaces are:

  • javax.resource.cci.Interaction

    The Interaction interface enables a component to drive an interaction with the EIS. An interaction instance is obtained using the createInteraction() method of the javax.resource.cci.Connection interface. The interaction instance then maintains an association to the connection instance, which you use to obtain the interaction.

    The interface provides two execute() methods invoked with different parameters:

    • execute(InteractionSpec ispec, Record input) — returns a newly created output record

    • execute(InteractionSpec ispec, Record input, Record output) — updates the output record and returns a Boolean value, which indicates if the operation has been successful

    You may choose to implement only one of the methods, in which case the other one must throw a javax.resource.NotSupportedException.

    The Interaction interface uses a javax.resource.cci.InteractionSpec to define the parameters of the function, which is invoked on the EIS. The result of an interaction is returned as a javax.resource.cci.Record (or its subinterfaces).

  • javax.resource.cci.InteractionSpec

    The InteractionSpec is used to provide the properties for driving an interaction with the underlying EIS. The interface must be implemented as a JavaBean and the implementation class must provide a set of getter and setter methods for each property, following the rules specified for getter and setter methods in the Java Beans specification. In addition, the implementation of the InteractionSpec interface must also implement java.io.Serializable.

    The JCA specification defines standard properties, whose implementation is not obligatory provided that they are not relevant for the EIS. You may provide any additional properties in your implementation as well.

    The standard properties are:

    • FunctionName

    • InteractionVerb

    • ExecutionTimeout

    In addition, if the you use a result set to represent the output of an interaction, the specification defines a set of properties, which define the requirements for the result set:

    • FetchSize

    • FetchDirection

    • MaxFieldSize

    • ResultSetType

    • ResultSetConcurrency

    For more information about the standard properties, see the JCA specification at SUN Microsystems' official website http://java.sun.com/.

To represent the input and output to the execute method of the Interaction, the resource adapter may use one of the following data representation-related interfaces:

  • javax.resource.cci.Record

    This is the basic interface for the input and output to the execute method of an Interaction. It is extended by the following interfaces:

    • javax.resource.cci.IndexedRecord — the record is presented as an ordered and indexed collection; this interface also extends java.util.List

    • javax.resource.cci.MappedRecord — the record is presented as a key-value collection; this interface also extends java.util.Map

    • javax.resource.cci.ResultSet — this interface is used to present tabular data; it also extends java.sql.ResultSet

    You can use a custom Record, a MappedRecord or an IndexedRecord to create a hierarchical structure of unlimited depth, since they may contain other records.

    To create instances of MappedRecord or IndexedRecord, the resource adapter uses an implementation of the javax.resource.cci.RecordFactory interface.