Exposing InteractionSpec and ConnectionSpec properties for input

You can expose the properties of InteractionSpec and ConnectionSpec for input as data so that your Java™ application can set the property values. For example, you may want to expose the execution timeout property of ECIInteractionSpec to provide a timeout value based on user input.
Typically, you expose only the properties that your Java application needs as input.
Here are the basic steps to expose a property for input.
  1. Launch the Adding or Editing a Java method Wizard.
  2. Click on Add... or Edit... to add a new method or edit an existing one.
  3. Navigate through the wizard, past the name page, and the input/output type page until you get to the summary page.
  4. In the summary page for the Add Java Method wizard, select Show Advanced.
  5. Expand the Connection Spec field.

    Exposing connection spec

  6. Select the properties you want to expose.
  7. You can change the value of a variable name by clicking on the value and typing in a new value:
  8. Using the Up Up button and Down Down button buttons to reorder your properties.
  9. Click Finish .

Example

Here's the getCustomer() method of the tader99 tutorial modified to take in an integer, execTimeout, as another argument and set it on the interactionSpec property. The changes that have been made are marked in bold. The changed generated code is in italics:

/**
	 * @j2c.interactionSpec class="com.ibm.connector2.cics.ECIInteractionSpec"
	 * @j2c.interactionSpec-property name="functionName" value="TADERC99"
	 * @j2c.interactionSpec-property
	 *   name="executeTimeout"
	 *   argumentBinding="execTimeout"
	 * 
	 * @generated
	 */
	public sample.cics.data.CustomerInfo getCustomer(
			sample.cics.data.CustomerInfo arg,
			int execTimeout) throws javax.resource.ResourceException {
				ConnectionSpec cs = getConnectionSpec();
				InteractionSpec is = interactionSpec;
				if (is == null) {
					is = new com.ibm.connector2.cics.ECIInteractionSpec();
					((com.ibm.connector2.cics.ECIInteractionSpec) is).setFunctionName("TADERC99");
					((com.ibm.connector2.cics.ECIInteractionSpec) is).setExecuteTimeout(execTimeout);
				}
				sample.cics.data.CustomerInfo output = new sample.cics.data.CustomerInfo();
				invoke(cs, is, arg, output);
				return output;
			}

To make a ConnectionSpec property exposed for input, use the @j2c.connectionSpec-property doclet tag instead.


Feedback