Using records

The WebSphere Access Resource Adapter sends information to and receives information from a collaboration as a WebSphere business integration system business object. An application component sends information to and receives information from the Access Resource Adapter through the Java interfaces for the Record type (see Table 12).

Table 12. Server Access for J2EE CCI implementation for creating a record

CCI Interface Description Supported methods
RecordFactory Allows an application component to create an instance of a Record extension.

The getRecordFactory() method on a ConnectionFactory instance returns a RecordFactory instance.

createMappedRecord() createIndexedRecord()
CwMappedRecord The Record extension that stores data in key-value pairs. It represents a single-cardinality business object. All methods of the Record and Map interfaces are supported.
CwIndexedRecord The Record extension that stores data as an ordered, indexed list. It represents a multiple-cardinality attribute. All methods of the Record and Map interfaces are supported.

In Table 12, the Supported Methods column lists those interface methods that Server Access for J2EE implements. Interface methods not listed there fall into one of the following categories:

This section provides the following information about how to handle Record extensions:

Using extensions to record

A Record is the Java representation of a data structure that encapsulates the data exchanged between an application component and the underlying EIS. It is used as input and output in the Interaction.execute() method. Server Access for J2EE supports the Record extensions shown in Table 13.

Table 13. Record extensions that Server Access for J2EE supports

Record extension Server Access for J2EE class Description
MappedRecord CwMappedRecord Based on the Java interface:java.util.Map
IndexedRecord CwIndexedRecord Based on the Java interface:java.util.List

Note:
Server Access for J2EE does not support the ResultSet extension to the Record interface.

The MappedRecord and IndexedRecord interfaces are hierarchical; that is, they can contain other Record structures.

CwMappedRecord

To pass business data to a WebSphere Access Resource Adapter, an application component needs to create a CwMappedRecord instance and pass it to the Interaction.execute() method as an input record. A CwMappedRecord instance represents a WebSphere business integration system business object, which is an instance of the WebSphere business integration system BusObj class. It holds one or more key-value pairs in the same way that a BusObj instance holds one or more pairs of attributes and their associated values. Therefore, each key in a CwMappedRecord instance must contain a key-value pair for each of the following:

Important:
All CwMappedRecord keys must be of type java.lang.String. No other data type is valid for a key. Even if your key value is of type Integer, you must still specify the string representation instead.

Figure 9 shows the correspondence between a CwMappedRecord instance and a WebSphere business integration system business object (BusObj instance).

Figure 9. Correspondence between CwMappedRecord and a business object


To specify a single-cardinality child object, set the value of the appropriate key to another CwMappedRecord instance. To specify a multiple-cardinality child object, set the value of the appropriate key to a CwIndexedRecord instance. For more information, see "CwIndexedRecord".

CwIndexedRecord

A Java IndexedRecord represents an ordered and indexed list. A CwIndexedRecord instance represents an array of WebSphere business integration system business objects, which is an instance of the WebSphere business integration system BusObjArray class. It holds an n-cardinal list of elements in the same way that a BusObjArray instance holds a multiple-cardinality attribute (and its values). Therefore, each element in a CwIndexedRecord instance must correspond to a business object.

Figure 10 shows the correspondence between a CwIndexedRecord instance and a WebSphere business integration system business object array (BusObjArray instance).

Figure 10. Correspondence between CwIndexedRecord and a business object array


The CwIndexedRecord contains one or more elements, each of which can contain a primitive value (such as the String values in Figure 10) or a CwMappedRecord instance. However, all elements must have the same type.

Creating a record

The WebSphere Access Resource Adapter converts between Record instances and business objects. It communicates with the application component through Record instances and with InterChange Server through business objects. Table 14 shows the business objects involved in the execution of a collaboration along with their equivalents within the application component.

Table 14. Business objects involved in collaboration execution

In a collaboration In the execute() method
Triggering business object Input record
Business object returned by the collaboration Output record

To provide data to an InterChange Server-managed EIS, an application component must perform the following tasks with records:

To create a Record extension to send to an Access Resource Adapter, the application component must take the following steps:

  1. Use the ConnectionFactory.getRecordFactory() method to obtain a RecordFactory object.

    The record factory is capable of generating Record instances.

  2. Use the appropriate RecordFactory method to obtain the desired Record extension:

Copyright IBM Corp. 1997, 2004