Websphere MQ Everyplace

examples.mqbridge.transformers
Class MQeListTransformer

java.lang.Object
  |
  +--examples.mqbridge.transformers.MQeListTransformer
All Implemented Interfaces:
MQeTransformerInterface

public class MQeListTransformer
extends java.lang.Object
implements MQeTransformerInterface

A simple MQ to MQe transformer class.

This transformer does not actually understand the format of any messages it is passed.

It has an ordered list of smaller transformers. When a message needs to be transformed, this class will work through its list of transformers one by one, presenting the message to each transformer. The results of the first transformer to successfully return a converted message are returned to the user of this class.

This style of transformer could be used in conjunctions with a collection of smaller transformers, where each "small" transformer understands a limited number of message formats.

This class keeps its list of transformers in a static ordered list (array) but it could easily have read the list from a file when the activate method is called, or obtained a list through some other method (possibly using the user-defined parameters passed on the activate method to do so).


Field Summary
protected  java.lang.String[] transformerClassName
          The ordered list of names of transformers.
protected  MQeTransformerInterface[] transformerInstance
          A list of transformers which are loaded and ready for use.
static short[] version
           
 
Constructor Summary
MQeListTransformer()
           
 
Method Summary
 void activate(java.util.StringTokenizer userParameters)
          Tells the class implementing this interface any parameters that may have been supplied with the transformer definition.
 com.ibm.mq.MQMessage transform(MQeMsgObject msg, MQeMQBridgeQueue queue, com.ibm.mq.MQPutMessageOptions options)
          Converts an MQe format message into an MQ format message.
 MQeMsgObject transform(com.ibm.mq.MQMessage msg, java.lang.String remoteQMgrName, java.lang.String remoteQName)
          Converts an MQ format message into an MQe format message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static short[] version

transformerClassName

protected java.lang.String[] transformerClassName
The ordered list of names of transformers.


transformerInstance

protected MQeTransformerInterface[] transformerInstance
A list of transformers which are loaded and ready for use.

Constructor Detail

MQeListTransformer

public MQeListTransformer()
Method Detail

activate

public void activate(java.util.StringTokenizer userParameters)
              throws java.lang.Exception
Tells the class implementing this interface any parameters that may have been supplied with the transformer definition.

This example class could have used the parameters to build its list of transformers, but to keep this example short, we ignore any parameters.

Specified by:
activate in interface MQeTransformerInterface
Parameters:
userParameters - StringTokenizer containing the transformer definition parameters.
Returns:
void
Throws:
java.lang.Exception

transform

public MQeMsgObject transform(com.ibm.mq.MQMessage msg,
                              java.lang.String remoteQMgrName,
                              java.lang.String remoteQName)
                       throws java.lang.Exception
Converts an MQ format message into an MQe format message.

Specified by:
transform in interface MQeTransformerInterface
Parameters:
msg - The WMQ message object we are to transform.
remoteQMgrName - The Destination Remote Queue Manager Name (from the MQ Remote Queue Definition)
remoteQName - The Destination Remote Queue Name (from the MQ Remote Queue Definition).
Returns:
The equivalent MQe format message.
Throws:
java.lang.Exception

transform

public com.ibm.mq.MQMessage transform(MQeMsgObject msg,
                                      MQeMQBridgeQueue queue,
                                      com.ibm.mq.MQPutMessageOptions options)
                               throws java.lang.Exception
Converts an MQe format message into an MQ format message.

Specified by:
transform in interface MQeTransformerInterface
Parameters:
queue - A reference to the MQe queue the put the message. (e.g. For determining default expiry time etc...)
options - A reference to an Integer object in which any required MQPutMessageOptions.options values should be placed.
msg - The Websphere WebSphere MQ Everyplace message that is to be transformed.
Returns:
The equivalent MQ format message.
Throws:
java.lang.Exception

Websphere MQ Everyplace