You can expose IMSInteractionSpec properties for output. Currently,
the only output properties that can be exposed are asyncOutputAvailable, convEnded,
and mapName. To expose these properties of IMSInteractionSpec for output,
you must create a new output class and modify the interface and implementation
files of your J2C Java bean before using it in an application.
Typically, you expose only the properties that your Java application
needs as output. The steps in this topic illustrate how to expose all the
properties of IMSInteractionSpec using the J2C Java bean in the project
PhoneBookJ2CBean that
was created in the topic,
Creating a J2C Java bean.
To
expose all the properties of IMSInteractionSpec for output, complete the following
steps:
- Expand the project PhoneBookJ2CBean and
open the interface file, PB.java in the Java editor.
- In the PB.java file, update the signature of runPB(). Add the arguments for the output properties of IMSInteractionSpec. These
arguments are used to provide output values for the exposed properties, in
the same way the argument OUTPUTMSGarg is used to provide values for
the output message of the IMS transaction. After you add the arguments in
the method runPB(), the code looks like the following:
package sample.ims;
/**
* @generated
*/
public interface PB {
/**
* @generated
*/
public sample.ims.WrapperBean runPB(sample.ims.INPUTMSG arg,
int myCommitMode,
int myExecutionTimeout,
int myImsRequestType,
int myInteractionVerb,
String myLtermName,
String myMapName,
boolean myPurgeAsyncOutput,
boolean myReRoute,
String myReRouteName,
int mySocketTimeout,
String myUserName,
String myPassword,
String myGroupName,
String myClientID
) throws javax.resource.ResourceException;
}
- Create a new class, WrapperBean, by completing the following
steps:
- Expand the project, PhoneBookBindings,
right-click the sample.ims package, and select New
> Class.
- For the name of the class, type WrapperBean.
- For the methods to create, select Inherited abstract
methods and Constructors from super class.
- Click Finish.
- Open the WrapperBean class in an editor and add an import
statement for java.io.Serializable.
- Modify the WrapperBean class so that it implements Serializable. For example:
public class WrapperBean implements Serializable {
- In the WrapperBean class, add a private variable for
the IMS Java Data binding of the output message of the IMS transaction. For example:
private OUTPUTMSG output;
- In the WrapperBean class, add private variables for the
properties of IMSInteractionSpec that you wish to expose: For
example:
private boolean convEnded;
private boolean asyncOutputAvailable;
private String mapName;
- Then, add get and set methods for the output message and each
of the exposed properties. For example:
public OUTPUTMSG getOutput(){
return output;
}
public boolean getConvEnded(){
return convEnded;
}
public boolean getAsyncOutputAvailable(){
return asyncOutputAvailable;
}
public String getMapName(){
return mapName;
}
public void setOutput(OUTPUTMSG output){
this.output = output;
}
public void setAsyncOutputAvailable(boolean asyncOutputAvailable){
this.asyncOutputAvailable = asyncOutputAvailable;
}
public void setConvEnded(boolean convEnded){
this.convEnded = convEnded;
}
public void setMapName(String mapName){
this.mapName = mapName;
}
- Save and close the WrapperBean class.
- Modify the interface file to use the new output class, WrapperBean by
expanding PhoneBookJ2CBean > sample.ims and open the
interface file, PB.java, in the Java editor.
- Change the output of the method runPB(),
which runs the IMS transaction, to return WrapperBean instead of OUTPUTMSG. For example:
public sample.ims.WrapperBean runBP(INPUTMSG arg) throws javax.resource.ResourceException;
- Modify the implementation file to use the new output class, WrapperBean by
expanding PhoneBookJ2CBean > sample.ims and opening
the implementation file, PBImpl.java in the Java editor.
- Change the output method runPB(), which
runs the IMS transaction, to return WrapperBean instead of OUTPUTMSG. For example:
public sample.ims.WrapperBean runBP(INPUTMSG arg) throws javax.resource.ResourceException {
- Update the javadoc for the runPB() method by adding doclet
tags for the output properties you wish to expose. For example,
the following javadoce for runPB() shows tags for both input and output
properties:
/**
* @j2c.interactionSpec class="com.ibm.connector2.ims.ico.IMSInteractionSpec"
* @j2c.interactionSpec-property name="commitMode" argumentBinding="myCommitMode"
* @j2c.interactionSpec-property name="executionTimeout" argumentBinding="myExecutionTimeout"
* @j2c.interactionSpec-property name="imsRequestType" argumentBinding="myImsRequestType"
* @j2c.interactionSpec-property name="interactionVerb" argumentBinding="myInteractionVerb"
* @j2c.interactionSpec-property name="ltermName" argumentBinding="myLtermName"
* @j2c.interactionSpec-property name="mapName" argumentBinding="myMapName"
* @j2c.interactionSpec-property name="purgeAsyncOutput" argumentBinding="myPurgeAsyncOutput"
* @j2c.interactionSpec-property name="reRoute" argumentBinding="myReRoute"
* @j2c.interactionSpec-property name="reRouteName" argumentBinding="myReRouteName"
* @j2c.interactionSpec-property name="socketTimeout" argumentBinding="mySocketTimeout"
* @j2c.interactionSpec-returnProperty
* name="convEnded"
* outputBinding="convEnded"
* @j2c.interactionSpec-returnProperty
* name="asyncOutputAvailable"
* outputBinding="asyncOutputAvailable"
* @j2c.interactionSpec-returnProperty
* name="mapName"
* outputBinding="mapName"
*
* @j2c.connectionSpec class="com.ibm.connector2.ims.ico.IMSConnectionSpec"
* @j2c.connectionSpec-property name="userName" argumentBinding="myUserName"
* @j2c.connectionSpec-property name="password" argumentBinding="myPassword"
* @j2c.connectionSpec-property name="groupName" argumentBinding="myGroupName"
* @j2c.connectionSpec-property name="clientID" argumentBinding="myClientID"
*
* @generated
*/
- Save and close the file. New implementation code
is generated for method runPB().
You have exposed the IMSInteractionSpec properties for output.