IBM WebSphere Application ServerTM
Release 8

com.ibm.websphere.sca.mq.data
Interface MQBodyDataBinding

All Superinterfaces:
commonj.connector.runtime.DataBinding, java.io.Serializable
All Known Subinterfaces:
MQBodyObjectBinding

public interface MQBodyDataBinding
extends commonj.connector.runtime.DataBinding

A DataBinding represents the mapping between a native data format and an SDO DataObject, and vice-versa.

This interface is an extension of commonj.connector.runtime.DataBinding, and presents a WMQ-specific view which should be implemented for use in WMQ Exports and Imports.

It exposes methods which read and write to and from a WMQ message, as well as exporting which format of WMQ message is supported.

See Also:
DataBinding

Field Summary
static java.lang.String COPYRIGHT
           
 
Method Summary
 java.lang.String getFormat()
          Called by the runtime to determine the WMQ header format supported by this DataBinding.
 boolean isBusinessException()
          Queries the DataBinding to determine whether the received message contains a fault (carried within a BusinessException).
 void read(MQMD md, java.util.List headers, MQDataInputStream input)
          Read the contents of the incoming WMQ message components into a DataObject.
 void setBusinessException(boolean isBusinessException)
          This method is called by the runtime if the outgoing message contains a BusinessException.
 void setFormat(java.lang.String format)
          Called before both the read and write methods, and contains the MQ format string identifying the format of the WMQ message body.
 void write(MQMD md, java.util.List headers, MQDataOutputStream output)
          Write the DataObject into an outgoing WMQ message.
 
Methods inherited from interface commonj.connector.runtime.DataBinding
getDataObject, setDataObject
 

Field Detail

COPYRIGHT

static final java.lang.String COPYRIGHT
See Also:
Constant Field Values
Method Detail

read

void read(MQMD md,
          java.util.List headers,
          MQDataInputStream input)
          throws java.io.IOException
Read the contents of the incoming WMQ message components into a DataObject. Called before the getDataObject method is called by the runtime. An implementation of this method will process the payload of the incoming WMQ message (as well as the headers, if required) by reading from the supplied input stream. It will then parse the data into the appropriate DataObject, created like this:

BOFactory bof =
(BOFactory)ServiceManager.INSTANCE.locateService("com/ibm/websphere/bo/BOFactory");
sampleBO = bof.create("http://namespace", "BOName");

Parameters:
md - The SDO representation of the MQMD of the incoming WMQ message.
headers - The list (possibly empty) of SDO representations of other WMQ headers in the incoming WMQ message, e.g. RFH, RFH2.
input - The input stream wrapping the payload of the incoming WMQ message.
Throws:
java.io.IOException - Thrown if an error occurs during reading of the WMQ message.

write

void write(MQMD md,
           java.util.List headers,
           MQDataOutputStream output)
           throws java.io.IOException
Write the DataObject into an outgoing WMQ message. Called after the setDataObject method is called by the runtime.

This method will be the converse of the read method, and will serialize the contents of the DataObject the the wire format in the WMQ message by writing to the supplied output stream.

Parameters:
md - The SDO representation of the MQMD to be written to the outgoing WMQ message.
headers - The list (possibly empty) of SDO representations of other WMQ headers to be written to the outgoing WMQ message, e.g. RFH, RFH2.
output - The output stream wrapping the outgoing WMQ message.
Throws:
java.io.IOException - Thrown if an error occurs during writing of the WMQ message.

setBusinessException

void setBusinessException(boolean isBusinessException)
This method is called by the runtime if the outgoing message contains a BusinessException. An implementation of this method may set some internal state if this information is important to propagate - and in this case, the interanl state will be acted on by the write() method.

Parameters:
isBusinessException - True or false, specified by the caller.

isBusinessException

boolean isBusinessException()
Queries the DataBinding to determine whether the received message contains a fault (carried within a BusinessException).

Returns:
A boolean value stating whether the message payload is a fault.

setFormat

void setFormat(java.lang.String format)
Called before both the read and write methods, and contains the MQ format string identifying the format of the WMQ message body. It is used by the runtime to correctly parse the incoming WMQ message body data when reading, and to ensure that the WMQ header format is correctly populated when going outbound.

Parameters:
format - The WMQ body format.

getFormat

java.lang.String getFormat()
Called by the runtime to determine the WMQ header format supported by this DataBinding. Will have already been specified by the runtime using the setFormat method below.

Returns:
A String containing the WMQ message format.

IBM WebSphere Application ServerTM
Release 8