Exposing InteractionSpec output properties as data

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:

  1. Expand the project PhoneBookJ2CBean and open the interface file, PB.java in the Java editor.
  2. 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;
    }
  3. Create a new class, WrapperBean, by completing the following steps:
    1. Expand the project, PhoneBookBindings, right-click the sample.ims package, and select New > Class.
    2. For the name of the class, type WrapperBean.
    3. For the methods to create, select Inherited abstract methods and Constructors from super class.
    4. Click Finish.
    5. Open the WrapperBean class in an editor and add an import statement for java.io.Serializable.
    6. Modify the WrapperBean class so that it implements Serializable. For example:
      public class WrapperBean implements Serializable {
    7. 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;
    8. 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;
    9. 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;
          }
    10. Save and close the WrapperBean class.
  4. 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.
  5. 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;
  6. 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.
  7. 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 {
    
  8. 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
         */  
    
  9. Save and close the file. New implementation code is generated for method runPB().
You have exposed the IMSInteractionSpec properties for output.
Related tasks
Creating IMS Java data bindings
Creating a J2C Java bean
Exposing InteractionSpec and ConnectionSpec properties for input as data
Creating a web page, web service, or EJB from a J2C Java bean
Using IMS data bindings in a CCI application
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.