Device format algorithm

The device format algorithm is used to determine the appropriate JSP to use as the response for a particular request. When a request is received and the message mapper is used to convert the request into a CommandProperty object, the message mapper and adapter used to process the request determine the appropriate device format for generating the content of the response. The ID of the message mapper is added to the device format ID of the adapter to determine the overall device format ID of the response. This overall device format ID and the VIEWNAME are used to get the appropriate JSP from the VIEWREG table, which generates the content of the response.

Each adapter accepting requests and using the message mapper is given a device format ID. This ID is defined in the adapter's instance_name.xml configuration file. This ID is defined in the adapter's configuration found in the instance_name.xml configuration file. The default device format ID for each receiving adapter using the message mapper is in intervals of -10000. An  program adapter has a device format ID of -10000 and the WebSphere MQ adapter has a device format ID of -20000. The adapter that supports legacy messages uses the device format ID of -30000. When determining the appropriate JSP and view command to call the JSP, the message mapper ID is added to the adapter's device format ID to determine the device format ID for the response view. However, if the view of the calculated device format ID does not exist, the default view of the adapter's interval is used. Thus, for an XML over HTTP request, the default device format ID is -10000 and for WebSphere MQ adapter requests, the default device format ID is -20000.  Differentiating the response view is necessary so that an HTTP response will use the HttpForwardViewCommand interface while a response from the WebSphere MQ adapter will use the MessagingViewCommand interface.

This algorithm allows a maximum of 9999 possible message mappers to be defined with one adapter. The configuration file for each message mapper contains an ID number in intervals of 1. To configure additional adapters that use the message mapper should be given a device format ID that is an interval of 10000. For example, a new request mechanism could be given a device format interval of 40000.

Notes:

  1. If the calculated device format ID cannot be found, the default device format ID of the adapter is used to obtain the result. This number is configurable in the HTTP adapter configuration.
  2. The size of the interval is not important. For example, if only 2 message mappers exist, then the interval can be of size 3. The interval 10000 is used by default.

Examples

  1. An inbound message is handled by a message mapper with an ID of -1 and by the program adapter which has a device format ID of -10000. Following the device format algorithm, the device format ID generated for a response to that inbound message would be -10001. The JSP file defined in the VIEWREG table for the VIEWNAME and the device format ID of -10001 is used for creating the response.
  2. Alternatively, an inbound message is handled by the same message mapper with the ID of -1, but is handled by the WebSphere MQ adapter, which has a device format ID of -20000. The generated device format ID for the response to that message would be -20001. Thus, the JSP file defined in the VIEWREG table for the VIEWNAME and the device format ID of -20001 is used for creating the response. Note that even though the request can use the same JSP for responding to the request, the class used to call the JSP may differ.