CICS事务网关-CTG原理及操作3

2.    JCA 应用程序开发

        JCA(J2EE Connector Architecture) defines a standard architecture for connecting the Java 2 Platform Enterprise Edition (J2EE) platform to heterogeneous Enterprise Information Systems (EIS). Examples of an EIS include transaction processing systems (such as the CICS TS) and Enterprise Resource Planning systems (such as SAP).
        A resource adapter is a middle-tier between a Java application and an EIS, which enables the Java application to connect to the EIS. A resource adapter plugs into application servers supporting the JCA.
        JNDI: The Java Naming and Directory Interface (JNDI) is part of the Java platform, providing applications based on Java technology with a unified interface to multiple naming and directory services.
        J2C Connection Factory: The connection factory provides connections to the Enterprise Information System (EIS). It operates the connection management of JCA.
        Common Client Interface (CCI) : The CCI defines a common API for interacting with resource adapters. It is independent of a specific EIS. A Java application interfaces with the resource adapter using this API.
        System contracts: A set of system-level contracts between an application server and an EIS. These extend the application server to provide the following features: (Connection management, Transaction management, Security management). These system contracts are transparent to the application developer. That is, they do not implement these services themselves.
        Resource adapter deployment and packaging: A resource adapter provider includes a set of Java interfaces/classes as part of the resource adapter implementation. These Java interfaces/classes are packaged together with a deployment descriptor to create a Resource Adapter Archive (represented by a file with an extension of rar). This Resource Adapter Archive is used to deploy the resource adapter into the application server.
        1. Look up a ConnectionFactory for the ECI resource adapter.
        2. Create a Connection object using this ConnectionFactory. A Connection is a handle to the underlying network connection to the EIS. Specific connection properties, such as a user name and password, can be passed using an ECIConnectionSpec object.
        3. Create an Interaction from the Connection. Specific interaction properties such as the transaction identifier can be passed using an ECIInteractionSpec object. The call to the EIS is initiated by invoking the execute() method on the interaction, passing data as input and output records.
        4. After the required interactions have been processed, the interaction and connection should be closed.

1.5 应用举例

1.5.1 简单Java应用
public class CTGdemo {
         … Java code …

         // Program name
         String strProgram = “EC01”;
         // Port number
         int iPort = 2006;
         /*
         * Use the extended constructor to set the parameters on the
         * ECIRequest object
         */
         eciRequestObject =
         new ECIRequest(ECIRequest.ECI_SYNC,      //ECI call type
                        strChosenServer,          //CICS server
                        null,                     //CICS userid
                        null,                     //CICS password
                        strProgram,               //CICS program to be run
                        null,                     //CICS transid to be run
                        abytCommarea,             //Byte array containing the
                                                  // COMMAREA
                        iCommareaSize,            //COMMAREA length
                        ECIRequest.ECI_NO_EXTEND, //ECI extend mode
                        0);                       //ECI LUW token

… Java code …
}

          … COBOL code …
     * Initialize commarea
          MOVE SPACES TO DFHCOMMAREA.
     * Invoke api to get system time
          EXEC CICS
              ASKTIME ABSTIME(WS-RAWTIME)
          END-EXEC.
     * Format
          EXEC CICS
              FORMATTIME ABSTIME(WS-RAWTIME)
                         DDMMYY(LK-DATE-OUT)
                         DATESEP(‘/’)
                         TIME(LK-TIME-OUT)
                         TIMESEP(‘:’)

以下文章点击率最高

Loading…

     

如果这文章对你有帮助,请扫左上角微信支付-支付宝,给于打赏,以助博客运营

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注