com.softwareag.entirex.jms
Class TextFormatter

java.lang.Object
  extended by com.softwareag.entirex.jms.TextFormatter
All Implemented Interfaces:
JMSFormatter

public class TextFormatter
extends java.lang.Object
implements JMSFormatter

Standard implementation for a formatter class for the EntireX JMS layer. Used to format JMS messages in a standard text message format. The text of a TextMessage is send as the payload of an ACI message contained in a unit of work.


Constructor Summary
TextFormatter()
           
 
Method Summary
 byte[] fromJMSMessage(javax.jms.Session session, javax.jms.Message message)
          Formats a byte array from a JMS Message.
 javax.jms.Message toJMSMessage(javax.jms.Session session, byte[] buffer)
          Create a JMS message from the byte array received from the broker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFormatter

public TextFormatter()
Method Detail

toJMSMessage

public javax.jms.Message toJMSMessage(javax.jms.Session session,
                                      byte[] buffer)
                               throws javax.jms.JMSException
Create a JMS message from the byte array received from the broker.

Specified by:
toJMSMessage in interface JMSFormatter
Parameters:
session - the JMS session, used to create the JMS message.
buffer - the message from the broker.
Returns:
the JMS message created from the byte array.
Throws:
javax.jms.JMSException - if the message is not properly created.

fromJMSMessage

public byte[] fromJMSMessage(javax.jms.Session session,
                             javax.jms.Message message)
                      throws javax.jms.JMSException
Formats a byte array from a JMS Message. This method assumes the message is a TextMessage.

Specified by:
fromJMSMessage in interface JMSFormatter
Parameters:
session - the JMS session (currently not used).
message - the JMS message to format.
Returns:
the message formatted as a byte array.
Throws:
javax.jms.JMSException - if the message is not properly created.