JEE ECIDateTime sample

This sample uses the ECI resource adapter, and calls the CICS® program EC01. The program uses an enterprise bean that makes CCI calls; a client to the enterprise bean is also provided.

The ECIDateTime sample program includes the following files:
ECIDateTimeBean.java
The enterprise bean ECIDateTime implementation code
ECIDateTime.java
The enterprise bean Remote interface
ECIDateTimeHome.java
The enterprise bean Home interface
JavaStringRecord.java
The sample program record interface that wraps an ECI COMMAREA
ECIDateTimeClient.java
The client for the enterprise bean
Enterprise beans have a main body of code and two interfaces. The Remote interface contains the business methods that the bean implements (in this case, the execute() method.) The Home interface manages the life cycle of the enterprise bean.

ECIDateTimeClient looks up the enterprise bean as ECIDateTimeBean1 in Java™ Naming Directory Interface (JNDI), and then narrows the search to a specific object using the remote interface as a type-cast. When execute() is called on this interface, the method is called remotely on the enterprise bean. This remote method in turn looks up the resource adapter's connection factory (an instance of the resource adapter) under the name ECI and runs EC01 in CICS and gets the date and time back as a COMMAREA, which it then returns to the caller (the client application).

To use the sample program:
  1. Deploy the CICS ECI resource adapter; this is a file called <install_path>/deployable/cicseci.rar.
  2. Create a connection factory with parameters that are valid for your CICS server environment (on WebSphere® Application Server, these settings are on the Custom properties tab of the J2C connection factory settings), for more information, see Deploying CICS resource adapters. The connection factory must have a JNDI name of ECI for the sample program to work.
  3. Deploy the ECIDateTime sample. The sample is a file called ECIDateTime.ear and is located in the <install_path>/deployable directory. The deployment process is specific to your JEE application server, but mainly involves identifying the interfaces to the deployment tool, after setting any properties you need. The properties you are asked for might include:
    Transaction type
    This can be set to Container-managed or Bean-managed. This determines whether you want to control transactions yourself. The JEE application server manages Container-managed transactions; if prompted, select this type for the sample program.
    Enterprise bean type
    ECIDateTime is a stateless session bean.
    JNDI name
    The enterprise bean client uses JNDI to look up the enterprise bean. This allows you to find the name of the enterprise bean in the directory. The ECIDateTimeClient requires this name to be set to ECIDateTimeBean1.
    Resource references
    The enterprise bean refers to another resource, the ECI resource adapter. To enable this to happen, you need to:
    1. Deploy a ConnectionFactory for the ECI resource adapter with a JNDI name of ECI.
    2. List this ConnectionFactory as a resource reference for this enterprise bean.
  4. Run the Client application. You can run it from a command line, but if using WebSphere, use the launchClient utility, which sets up the necessary parameters to allow you to talk to the JNDI directory in WebSphere to find the ECIDateTime enterprise bean. The application returns the current date and time from CICS application EC01.

Information Information

Feedback


Timestamp icon Last updated: Tuesday, 19 November 2013


https://ut-ilnx-r4.hursley.ibm.com/tg_latest/help/topic/com.ibm.cics.tg.doc//progde/J2EEECIDateTimeSample.html