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 or get 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.

To expose the properties of InteractionSpec or ConnectionSpec for input, you must 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 input.
Here are the basic steps to expose a property for input. A more detailed example for IMS™ is available here.
  1. Modify the interface and implementation classes to add a new input variable to the method signature.
  2. Add the J2C doclet tag to tie the argument to the InteractionSpec or ConnectionSpec property as applicable.
  3. Save and regenerate the J2C bean.

Example

Here's the getCustomer() method of the TADERC99 tutorial modified to take in an integer, execTimeout, as another argument and set it on the interactionSpec property. The changes to be 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
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.