HP-UX SNAplus2 CPI-C Programmer's Guide (June 2003)

Writing CPI-C Applications
Java CPI-C Considerations
Chapter 2 103
Returns true if the value stored in the object is equal
to the supplied integer value
int_value
.
boolean equals(
supplied_object
)
Returns true if the value stored in the object is equal
to the value stored in the supplied parameter
supplied_object
.
supplied_object
must itself be an
instance of one of the Java CPI-C parameter classes.
The class CPICReturnCode has the following additional method:
boolean isOK() The application should call this method to determine
whether the value stored in a CPICReturnCode object
is CM_OK. The class generates an exception if the
stored value is not CM_OK.
Usage Example
The following example illustrateshow to set up yourJava programto use
the Java CPI-C class, and how to make an individual CPI-C call.
To import the Java CPI-C package, include the following at the start of
your program's source code:
import COM.ibm.eNetwork.cpic.*;
To use Java CPI-C in your program, create an instance of the Java CPI-C
class:
CPIC cpicObject = new CPIC();
The following steps illustrate how to make the call to each Java CPI-C
function, using the Initialize_Conversation (cminit) function as an
example.
Step 1. Create and initialize the parameters for the function:
byte[] bConversationId = new
byte[cpicObject.CM_CID_SIZE];
String sSymbolicDestination = "testprog";
CPICReturnCode cpicReturn = new CPICReturnCode(0);
Note the use of the constant CM_CID_SIZE to set the size of the byte
array for the conversation ID, and the use of the CPICReturnCode class
to set the initial value of this parameter to zero. The last line of this
example could also be split into two lines as follows: