Framework classes

Framework classes are used to request a connection to an EIS such as CICS, and execute commands on the EIS, passing input and retrieving output. The framework classes are:
ConnectionFactory
A ConnectionFactory object is used to manufacture connections that a Java component can use to communicate with a specific EIS. Attributes of the ConnectionFactory specify the EIS for which connections can be created. A ConnectionFactory is the factory for a Connection object.
Connection
A Connection object identifies a unique connection to a specific server. It is the factory for an Interaction object.
Interaction
The execute method of an Interaction object allows you to drive an interaction with a server. In CICS TS, the execute method takes three arguments—an InteractionSpec object that specifies the type of interaction, and two Record objects that carry the input and output data.

J2EE components use the framework classes to acquire a connection to an EIS and to send and receive data. First, a J2EE component obtains a ConnectionFactory object for the particular EIS that is to be accessed—for example, CICS. (The component may manufacture the ConnectionFactory programatically or, more likely, look it up in a JNDI namespace.) It uses the ConnectionFactory to get a Connection object. Then it uses the Connection object to create one or more Interaction objects. It executes commands on the EIS through these Interaction objects.

Figure 1 shows the CCI framework classes being used to connect to an EIS and execute a command.
Figure 1. Using the CCI framework classes to connect to an EIS and execute a command
ConnectionFactory cf = <Lookup from JNDI namespace>
Connection conn = cf.getConnection();
Interaction int = conn.createInteraction();
int.execute(<Input output data>);
int.close();
conn.close();