Joram 5.0.8

org.objectweb.joram.client.jms
Class Message

java.lang.Object
  extended by org.objectweb.joram.client.jms.Message
All Implemented Interfaces:
javax.jms.Message
Direct Known Subclasses:
AdminMessage, BytesMessage, MapMessage, ObjectMessage, StreamMessage, TextMessage

public class Message
extends java.lang.Object
implements javax.jms.Message

Implements the javax.jms.Message interface.

A Joram message encapsulates a proprietary message which is also used for effective MOM transport facility.


Field Summary
protected  javax.jms.Destination jmsDest
          The JMSDestination field.
protected  Message momMsg
           
 boolean propertiesRO
          true if the properties are read-only.
protected  boolean RObody
          true if the message body is read-only.
protected  Session session
          If the message is actually consumed, the session that consumes it, null otherwise.
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
protected Message()
          Constructs a bright new Message.
protected Message(Session session, Message momMsg)
          Instanciates a Message wrapping a consumed MOM simple message.
 
Method Summary
 void acknowledge()
          API method.
 void clearBody()
          API method.
 void clearProperties()
          API method.
static Message convertJMSMessage(javax.jms.Message jmsMsg)
          Converts a non-Joram JMS message into a Joram message.
 boolean getBooleanProperty(java.lang.String name)
          API method.
 byte getByteProperty(java.lang.String name)
          API method.
 double getDoubleProperty(java.lang.String name)
          API method.
 float getFloatProperty(java.lang.String name)
          API method.
 int getIntProperty(java.lang.String name)
          API method.
 java.lang.String getJMSCorrelationID()
          Returns the message correlation identifier.
 byte[] getJMSCorrelationIDAsBytes()
          API method.
 int getJMSDeliveryMode()
          Returns true if the message is persistent.
 javax.jms.Destination getJMSDestination()
          Returns the message destination.
 long getJMSExpiration()
          Returns the message expiration time.
 java.lang.String getJMSMessageID()
          Returns the message identifier.
 int getJMSPriority()
          Returns the message priority.
 boolean getJMSRedelivered()
          Gets an indication of whether this message is being redelivered.
 javax.jms.Destination getJMSReplyTo()
          Gets the Destination object to which a reply to this message should be sent.
 long getJMSTimestamp()
          Returns the message time stamp.
 java.lang.String getJMSType()
          API method.
 long getLongProperty(java.lang.String name)
          API method.
 Message getMomMsg()
           
 java.lang.Object getObjectProperty(java.lang.String name)
          API method.
 void getOptionalHeader(java.util.Hashtable h)
          Copies all of the mappings from the optionalHeader of this message to the specified hashtable.
 void getProperties(java.util.Hashtable h)
          Copies all of the mappings from the properties of this message to the specified hashtable.
 java.util.Enumeration getPropertyNames()
          API method.
 short getShortProperty(java.lang.String name)
          API method.
 java.lang.String getStringProperty(java.lang.String name)
          API method.
protected  void prepare()
          Method preparing the message for sending; resets header values, and serializes the body (done in subclasses).
 boolean propertyExists(java.lang.String name)
          API method.
 void resetPropertiesRO()
          Resets the read-only flag, in order to allow the modification of message properties.
 void setBooleanProperty(java.lang.String name, boolean value)
          API method.
 void setByteProperty(java.lang.String name, byte value)
          API method.
 void setDoubleProperty(java.lang.String name, double value)
          API method.
 void setFloatProperty(java.lang.String name, float value)
          API method.
 void setIntProperty(java.lang.String name, int value)
          API method.
 void setJMSCorrelationID(java.lang.String correlationID)
          API method.
 void setJMSCorrelationIDAsBytes(byte[] correlationID)
          API method.
 void setJMSDeliveryMode(int deliveryMode)
          API method.
 void setJMSDestination(javax.jms.Destination dest)
          Set the message destination.
 void setJMSExpiration(long expiration)
          API method.
 void setJMSMessageID(java.lang.String id)
          API method.
 void setJMSPriority(int priority)
          API method.
 void setJMSRedelivered(boolean redelivered)
          API method.
 void setJMSReplyTo(javax.jms.Destination replyTo)
          API method.
 void setJMSTimestamp(long timestamp)
          API method.
 void setJMSType(java.lang.String type)
          API method.
 void setLongProperty(java.lang.String name, long value)
          API method.
 void setObjectProperty(java.lang.String name, java.lang.Object value)
          API method, sets a property value.
 void setReadOnly()
          set message read-only
 void setShortProperty(java.lang.String name, short value)
          API method.
 void setStringProperty(java.lang.String name, java.lang.String value)
          API method.
 void toString(java.lang.StringBuffer strbuf)
           
static Message wrapMomMessage(Session session, Message momMsg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

momMsg

protected Message momMsg

session

protected transient Session session
If the message is actually consumed, the session that consumes it, null otherwise.


jmsDest

protected transient javax.jms.Destination jmsDest
The JMSDestination field. This field is only use with non Joram destination.


RObody

protected boolean RObody
true if the message body is read-only.


propertiesRO

public boolean propertiesRO
true if the properties are read-only.

Constructor Detail

Message

protected Message()
Constructs a bright new Message.


Message

protected Message(Session session,
                  Message momMsg)
Instanciates a Message wrapping a consumed MOM simple message.

Parameters:
session - The consuming session.
momMsg - The MOM message to wrap.
Method Detail

wrapMomMessage

public static Message wrapMomMessage(Session session,
                                     Message momMsg)
                              throws javax.jms.JMSException
Throws:
javax.jms.JMSException

acknowledge

public void acknowledge()
                 throws javax.jms.JMSException
API method.

Specified by:
acknowledge in interface javax.jms.Message
Throws:
javax.jms.IllegalStateException - If the session is closed.
javax.jms.JMSException - If the acknowledgement fails for any other reason.

clearBody

public void clearBody()
               throws javax.jms.JMSException
API method.

Specified by:
clearBody in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setReadOnly

public void setReadOnly()
set message read-only


getJMSMessageID

public final java.lang.String getJMSMessageID()
                                       throws javax.jms.JMSException
Returns the message identifier. API method.

Specified by:
getJMSMessageID in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSMessageID

public final void setJMSMessageID(java.lang.String id)
                           throws javax.jms.JMSException
API method.

Specified by:
setJMSMessageID in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

getJMSPriority

public final int getJMSPriority()
                         throws javax.jms.JMSException
Returns the message priority. API method.

Specified by:
getJMSPriority in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSPriority

public final void setJMSPriority(int priority)
                          throws javax.jms.JMSException
API method.

Specified by:
setJMSPriority in interface javax.jms.Message
Throws:
javax.jms.JMSException - If the priority value is incorrect.

getJMSDestination

public final javax.jms.Destination getJMSDestination()
                                              throws javax.jms.JMSException
Returns the message destination. This field is set by Session.send(), it can be overloaded for received messages. API method.

Specified by:
getJMSDestination in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSDestination

public final void setJMSDestination(javax.jms.Destination dest)
                             throws javax.jms.JMSException
Set the message destination. This field is set when message is sent. This method can be used to change the value for a message that has been received. API method.

Specified by:
setJMSDestination in interface javax.jms.Message
Throws:
javax.jms.JMSException - If the destination id not a Joram's one.

getJMSExpiration

public final long getJMSExpiration()
                            throws javax.jms.JMSException
Returns the message expiration time. API method.

Specified by:
getJMSExpiration in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSExpiration

public final void setJMSExpiration(long expiration)
                            throws javax.jms.JMSException
API method.

Specified by:
setJMSExpiration in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

getJMSRedelivered

public final boolean getJMSRedelivered()
                                throws javax.jms.JMSException
Gets an indication of whether this message is being redelivered. API method.

Specified by:
getJMSRedelivered in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSRedelivered

public final void setJMSRedelivered(boolean redelivered)
                             throws javax.jms.JMSException
API method.

Specified by:
setJMSRedelivered in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

getJMSReplyTo

public final javax.jms.Destination getJMSReplyTo()
                                          throws javax.jms.JMSException
Gets the Destination object to which a reply to this message should be sent. API method.

Specified by:
getJMSReplyTo in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSReplyTo

public final void setJMSReplyTo(javax.jms.Destination replyTo)
                         throws javax.jms.JMSException
API method.

Specified by:
setJMSReplyTo in interface javax.jms.Message
Throws:
javax.jms.JMSException - If the destination id not a Joram's one.

getJMSTimestamp

public final long getJMSTimestamp()
                           throws javax.jms.JMSException
Returns the message time stamp. API method.

Specified by:
getJMSTimestamp in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSTimestamp

public final void setJMSTimestamp(long timestamp)
                           throws javax.jms.JMSException
API method.

Specified by:
setJMSTimestamp in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

getJMSCorrelationID

public final java.lang.String getJMSCorrelationID()
                                           throws javax.jms.JMSException
Returns the message correlation identifier. API method.

Specified by:
getJMSCorrelationID in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSCorrelationID

public final void setJMSCorrelationID(java.lang.String correlationID)
                               throws javax.jms.JMSException
API method.

Specified by:
setJMSCorrelationID in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

getJMSCorrelationIDAsBytes

public final byte[] getJMSCorrelationIDAsBytes()
                                        throws javax.jms.JMSException
API method.

Specified by:
getJMSCorrelationIDAsBytes in interface javax.jms.Message
Throws:
javax.jms.MessageFormatException - In case of a problem while retrieving the field.
javax.jms.JMSException

setJMSCorrelationIDAsBytes

public final void setJMSCorrelationIDAsBytes(byte[] correlationID)
API method.

Specified by:
setJMSCorrelationIDAsBytes in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

getJMSDeliveryMode

public final int getJMSDeliveryMode()
                             throws javax.jms.JMSException
Returns true if the message is persistent. API method.

Specified by:
getJMSDeliveryMode in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSDeliveryMode

public final void setJMSDeliveryMode(int deliveryMode)
                              throws javax.jms.JMSException
API method.

Specified by:
setJMSDeliveryMode in interface javax.jms.Message
Throws:
javax.jms.JMSException - If the delivery mode is incorrect.

getJMSType

public final java.lang.String getJMSType()
                                  throws javax.jms.JMSException
API method.

Specified by:
getJMSType in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setJMSType

public final void setJMSType(java.lang.String type)
                      throws javax.jms.JMSException
API method.

Specified by:
setJMSType in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

getOptionalHeader

public void getOptionalHeader(java.util.Hashtable h)
Copies all of the mappings from the optionalHeader of this message to the specified hashtable. These mappings will replace any mappings that this Hashtable had for any of the keys currently in the optional header.


clearProperties

public final void clearProperties()
                           throws javax.jms.JMSException
API method.

Specified by:
clearProperties in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

resetPropertiesRO

public final void resetPropertiesRO()
                             throws javax.jms.JMSException
Resets the read-only flag, in order to allow the modification of message properties.

Throws:
javax.jms.JMSException - Actually never thrown.

propertyExists

public final boolean propertyExists(java.lang.String name)
                             throws javax.jms.JMSException
API method.

Specified by:
propertyExists in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.JMSException - Actually never thrown.

getProperties

public void getProperties(java.util.Hashtable h)
Copies all of the mappings from the properties of this message to the specified hashtable. These mappings will replace any mappings that this Hashtable had for any of the keys currently in the properties.


getPropertyNames

public final java.util.Enumeration getPropertyNames()
                                             throws javax.jms.JMSException
API method.

Specified by:
getPropertyNames in interface javax.jms.Message
Throws:
javax.jms.JMSException - Actually never thrown.

setBooleanProperty

public final void setBooleanProperty(java.lang.String name,
                                     boolean value)
                              throws javax.jms.JMSException
API method.

Specified by:
setBooleanProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid.

setByteProperty

public final void setByteProperty(java.lang.String name,
                                  byte value)
                           throws javax.jms.JMSException
API method.

Specified by:
setByteProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid.

setShortProperty

public final void setShortProperty(java.lang.String name,
                                   short value)
                            throws javax.jms.JMSException
API method.

Specified by:
setShortProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid.

setIntProperty

public final void setIntProperty(java.lang.String name,
                                 int value)
                          throws javax.jms.JMSException
API method.

Specified by:
setIntProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid.

setLongProperty

public final void setLongProperty(java.lang.String name,
                                  long value)
                           throws javax.jms.JMSException
API method.

Specified by:
setLongProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid.

setFloatProperty

public final void setFloatProperty(java.lang.String name,
                                   float value)
                            throws javax.jms.JMSException
API method.

Specified by:
setFloatProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid.

setDoubleProperty

public final void setDoubleProperty(java.lang.String name,
                                    double value)
                             throws javax.jms.JMSException
API method.

Specified by:
setDoubleProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid.

setStringProperty

public final void setStringProperty(java.lang.String name,
                                    java.lang.String value)
                             throws javax.jms.JMSException
API method.

Specified by:
setStringProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid.

setObjectProperty

public final void setObjectProperty(java.lang.String name,
                                    java.lang.Object value)
                             throws javax.jms.JMSException
API method, sets a property value.

Specified by:
setObjectProperty in interface javax.jms.Message
Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.
javax.jms.MessageFormatException - If the value is not a Java primitive object.
java.lang.IllegalArgumentException - If the key name is illegal (null or empty string).
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.MessageNotWriteableException - If the message is read-only.
javax.jms.JMSException - If the property name is invalid, or if the object is invalid.

getBooleanProperty

public final boolean getBooleanProperty(java.lang.String name)
                                 throws javax.jms.JMSException
API method.

Specified by:
getBooleanProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.JMSException - If the name is invalid.

getByteProperty

public final byte getByteProperty(java.lang.String name)
                           throws javax.jms.JMSException
API method.

Specified by:
getByteProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.JMSException - If the name is invalid.

getShortProperty

public final short getShortProperty(java.lang.String name)
                             throws javax.jms.JMSException
API method.

Specified by:
getShortProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.JMSException - If the name is invalid.

getIntProperty

public final int getIntProperty(java.lang.String name)
                         throws javax.jms.JMSException
API method.

Specified by:
getIntProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.JMSException - If the name is invalid.

getLongProperty

public final long getLongProperty(java.lang.String name)
                           throws javax.jms.JMSException
API method.

Specified by:
getLongProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.JMSException - If the name is invalid.

getFloatProperty

public final float getFloatProperty(java.lang.String name)
                             throws javax.jms.JMSException
API method.

Specified by:
getFloatProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.JMSException - If the name is invalid.

getDoubleProperty

public final double getDoubleProperty(java.lang.String name)
                               throws javax.jms.JMSException
API method.

Specified by:
getDoubleProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.JMSException - If the name is invalid.

getStringProperty

public final java.lang.String getStringProperty(java.lang.String name)
                                         throws javax.jms.JMSException
API method.

Specified by:
getStringProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.MessageFormatException - If the property type is invalid.
javax.jms.JMSException - If the name is invalid.

getObjectProperty

public final java.lang.Object getObjectProperty(java.lang.String name)
                                         throws javax.jms.JMSException
API method.

Specified by:
getObjectProperty in interface javax.jms.Message
Parameters:
name - The property name.
Throws:
javax.jms.JMSException - If the name is invalid.

convertJMSMessage

public static Message convertJMSMessage(javax.jms.Message jmsMsg)
                                 throws javax.jms.JMSException
Converts a non-Joram JMS message into a Joram message.

Throws:
javax.jms.JMSException - If an error occurs while building the message.

prepare

protected void prepare()
                throws javax.jms.JMSException
Method preparing the message for sending; resets header values, and serializes the body (done in subclasses).

Throws:
javax.jms.MessageFormatException - If an error occurs while serializing.
javax.jms.JMSException

getMomMsg

public Message getMomMsg()
Returns:
the momMsg

toString

public void toString(java.lang.StringBuffer strbuf)

Joram 5.0.8

Copyright © 2005 Scalagent - All rights reserved