com.j_spaces.jms
Class GSMessageImpl

java.lang.Object
  extended by com.j_spaces.jms.GSMessageImpl
All Implemented Interfaces:
Serializable, Comparable, Message
Direct Known Subclasses:
GSBytesMessageImpl, GSMapMessageImpl, GSObjectMessageImpl, GSStreamMessageImpl, GSTextMessageImpl

public class GSMessageImpl
extends Object
implements Message, Serializable, Comparable

GigaSpaces platform implementation of the javax.jms.Message interface.

See Also:
Serialized Form

Field Summary
static int BODY_NUM
           
static String BODY_STR_NAME
           
static String BOOLEAN_CLASS_NAME
           
static String BYTES
          A bytes message carries an array of bytes.
static String CONTROL_MESSAGE
          A control message that is used for Keeping the Destination alive.
static String DESTINATION_CLASS_NAME
           
static String HASHMAP_CLASS_NAME
           
static String INTEGER_CLASS_NAME
           
static String JMS_CORRELATION_ID
           
static int JMS_CORRELATION_ID_NUM
           
static String JMS_DELIVERY_MODE
           
static int JMS_DELIVERY_MODE_NUM
           
static String JMS_DESTINATION
           
static int JMS_DESTINATION_NUM
           
static String JMS_EXPIRATION
           
static int JMS_EXPIRATION_NUM
           
static String JMS_GSPRODUCER_KEY_PROP_NAME
          The producer key that is set in the send method and is kept in the optional message properties and used in the consumer receive or onMessage, while ack for instance.
static int JMS_GSPRODUCER_KEY_PROP_NUM
           
static String JMS_GSTTL_KEY_PROP_NAME
          The TimeToLive of the JMSMessage which is the lease used to write() the ExternalEntry.
static int JMS_GSTTL_PROP_NUM
           
static String JMS_MESSAGE_ID
           
static int JMS_MESSAGE_ID_NUM
           
static String JMS_PRIORITY
           
static int JMS_PRIORITY_NUM
           
static String JMS_REDELIVERED
           
static int JMS_REDELIVERED_NUM
           
static String JMS_REPLY_TO
           
static int JMS_REPLY_TO_NUM
           
static String JMS_TIMESTAMP
           
static int JMS_TIMESTAMP_NUM
           
static String JMS_TYPE
           
static int JMS_TYPE_NUM
           
static String JMSX_APPID
           
static String JMSX_GROUPID
           
static int JMSX_GROUPID_PROP_NUM
           
static String JMSX_GROUPSEQ
           
static int JMSX_GROUPSEQ_PROP_NUM
           
static String JMSX_RCV_TIMESTEMP
           
static String JMSX_USERID
           
static int JMSX_USERID_PROP_NUM
           
static String LONG_CLASS_NAME
           
 boolean m_deletedDest
          true if the message target destination was deleted.
 boolean m_denied
          true if the message has been denied at least once by a consumer.
 boolean m_expired
          true if the message has expired.
static String[] m_ExtEntryFieldsNames
          Holds the field names array for the usage as params in the ExternalEntry. - The Message Body is the first, - Then all the Message Headers, - Then come all the JMS Properties, - Then the JMS_GS application specific properties, as detailed in GSConnectionMetaDataImpl. - The Message Properties which were set by the client currently these props cannot be used via the selector
static String[] m_ExtEntryFieldsTypes
          Holds the field m_type names array for the usage as params in the ExternalEntry.
 boolean m_notWriteable
          true if the message could not be written on the dest.
 String m_replyToId
          The reply to destination identifier. the name of the destination that the message got from.
 int m_totalNumOfValues
           
 boolean m_undeliverable
          true if the message is considered as undeliverable.
static String MAP
          A map message carries an hashtable.
static String OBJECT
          An object message carries a serializable object.
static String OBJECT_CLASS_NAME
           
static int PROPERTIES_NUM
           
static String PROPERTIES_STR_NAME
           
static int reservedNumOfValues
           
static String SIMPLE
          A simple message carries a simple empty body.
static String STREAM
          A stream message carries a bytes stream.
static String STRING_CLASS_NAME
           
static String TEXT
          A text message carries a String body.
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
GSMessageImpl(GSSessionImpl session, String msgType)
          Constructor: Constructs also an empty ExternalEntry that is embeded inside the JMSMessage and will hold all the JMSMessage elements- Body, Header and Properties and then sent/received via space.
 
Method Summary
 void acknowledge()
          Note that the acknowledge method of Message acknowledges all messages received on that message’s session.
 void buildBodyFromBytes()
          Builds the message body from data
 void clearBody()
          Clear out the message body.
 void clearProperties()
          Empties the properties table.
 int compareTo(Object o)
           
 void convertBodyToBytes()
          Convert the message body to data
 com.j_spaces.jms.utils.ByteArray getBodyAsBytes()
          Returns the array of bytes body of the message.
 boolean getBooleanProperty(String name)
          Returns a property as a boolean value.
 byte getByteProperty(String name)
          Returns a property as a byte value.
 double getDoubleProperty(String name)
          Returns a property as a double.
 float getFloatProperty(String name)
          Returns a property as a float value.
 int getIntProperty(String name)
          Returns a property as an int.
 String getJMSCorrelationID()
          Sets the correlation ID for the message.
 byte[] getJMSCorrelationIDAsBytes()
           
 int getJMSDeliveryMode()
          Gets the DeliveryMode value specified for this message.
 Destination getJMSDestination()
          Gets the message destination.
 long getJMSExpiration()
           
 String getJMSMessageID()
           
 int getJMSPriority()
           
 boolean getJMSRedelivered()
           
 Destination getJMSReplyTo()
           
 long getJMSTimestamp()
           
 String getJMSType()
          API method.
 long getLongProperty(String name)
          Returns a property as a long.
 HashMap getMapBody()
          Returns the hashmap based body of the message.
 Object getObjectProperty(String name)
          API method.
 Object getObjProp(String name)
           
 Object getOptionalHeader(String name)
          Returns an optional Message Header field value according to its name.
 HashMap getProperties()
           
 Enumeration getPropertyNames()
          Returns an enumeration of the properties names.
 short getShortProperty(String name)
          Returns a property as a short.
 com.j_spaces.jms.utils.ByteArray getStreamBody()
          Returns the stream of bytes body of the message.
 String getStringProperty(String name)
          Returns a property as a String.
 String getTextBody()
          Gets the String body of the message.
 Destination getToDestination()
           
 boolean isBodyRO()
           
 boolean isValid()
          Returns true if the message is valid and is not expired.
 boolean propertyExists(String name)
          Returns true if a given property exists.
 void readBody(DataInput dataIn)
          Used to help build the body from an input stream
 void setBodyAsBytes(byte[] data, int offset, int length)
           
 void setBodyAsBytes(com.j_spaces.jms.utils.ByteArray bytes)
          Sets the message body as an array of bytes.
 void setBooleanProperty(String name, boolean value)
          Sets a property as a boolean value.
 void setByteProperty(String name, byte value)
          Sets a property as a byte value.
 void setDoubleProperty(String name, double value)
          Sets a property as a double value.
 void setFloatProperty(String name, float value)
          Sets a property as a float value.
 void setIntProperty(String name, int value)
          Sets a property as a int value.
 void setJMSCorrelationID(String correlationID)
          a null value for the JMSCorrelationID can be assigned to JMSCorrelationID when: - a message is initially constructed - a message is received with a non-null JMSCorrelationID
 void setJMSCorrelationIDAsBytes(byte[] correlationID)
           
 void setJMSDeliveryMode(int deliveryMode)
          The default Delivery Mode is DeliveryMode.PERSISTENT
 void setJMSDestination(Destination destination)
          Sets the message destination.
 void setJMSExpiration(long expiration)
          long expiration - the time to live
 void setJMSMessageID(String id)
          update the jms message id, if there is none, then generate it.
 void setJMSPriority(int priority)
           
 void setJMSRedelivered(boolean redelivered)
          API method.
 void setJMSReplyTo(Destination replyTo)
           
 void setJMSTimestamp(long timestamp)
           
 void setJMSType(String type)
          API method.
 void setLongProperty(String name, long value)
          Sets a property as a long value.
 void setMapBody(HashMap<String,Object> map)
          Sets a map as the body of the message.
 void setObjectProperty(String name, Object value)
          Sets a property value.
 void setOptionalHeader(String name, Object value)
          Sets an optional header field value.
 void setShortProperty(String name, short value)
          Sets a property as a short value.
 void setStreamBody(com.j_spaces.jms.utils.ByteArray bytes)
          Sets the message body as a stream of bytes.
 void setStringProperty(String name, String value)
          Sets a property as a String.
 void setTextBody(String text)
          Sets a String as the body of the message.
 void setToDestination(Destination toDest)
           
 String toString()
           
 void writeBody(DataOutput dataOut)
          Used serialize the message body to an output stream
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

HASHMAP_CLASS_NAME

public static final String HASHMAP_CLASS_NAME

STRING_CLASS_NAME

public static final String STRING_CLASS_NAME

INTEGER_CLASS_NAME

public static final String INTEGER_CLASS_NAME

LONG_CLASS_NAME

public static final String LONG_CLASS_NAME

DESTINATION_CLASS_NAME

public static final String DESTINATION_CLASS_NAME

BOOLEAN_CLASS_NAME

public static final String BOOLEAN_CLASS_NAME

OBJECT_CLASS_NAME

public static final String OBJECT_CLASS_NAME

BODY_STR_NAME

public static final String BODY_STR_NAME
See Also:
Constant Field Values

PROPERTIES_STR_NAME

public static final String PROPERTIES_STR_NAME
See Also:
Constant Field Values

reservedNumOfValues

public static final int reservedNumOfValues
See Also:
Constant Field Values

m_totalNumOfValues

public int m_totalNumOfValues

m_ExtEntryFieldsNames

public static final String[] m_ExtEntryFieldsNames
Holds the field names array for the usage as params in the ExternalEntry. - The Message Body is the first, - Then all the Message Headers, - Then come all the JMS Properties, - Then the JMS_GS application specific properties, as detailed in GSConnectionMetaDataImpl. - The Message Properties which were set by the client currently these props cannot be used via the selector

See Also:
GSConnectionMetaDataImpl.getJMSXPropertyNames()

m_ExtEntryFieldsTypes

public static final String[] m_ExtEntryFieldsTypes
Holds the field m_type names array for the usage as params in the ExternalEntry. Currently it holds the following: - The Message Body is the first, - Then all the Message Headers, - Then come all the JMS Properties, - Then the JMS_GS application specific properties, as detailed in GSConnectionMetaDataImpl.

See Also:
GSConnectionMetaDataImpl.getJMSXPropertyNames()

CONTROL_MESSAGE

public static final String CONTROL_MESSAGE
A control message that is used for Keeping the Destination alive.

See Also:
Constant Field Values

SIMPLE

public static final String SIMPLE
A simple message carries a simple empty body.

See Also:
Constant Field Values

TEXT

public static final String TEXT
A text message carries a String body.

See Also:
Constant Field Values

OBJECT

public static final String OBJECT
An object message carries a serializable object.

See Also:
Constant Field Values

MAP

public static final String MAP
A map message carries an hashtable.

See Also:
Constant Field Values

STREAM

public static final String STREAM
A stream message carries a bytes stream.

See Also:
Constant Field Values

BYTES

public static final String BYTES
A bytes message carries an array of bytes.

See Also:
Constant Field Values

JMS_DELIVERY_MODE

public static final String JMS_DELIVERY_MODE
See Also:
Constant Field Values

JMS_DESTINATION

public static final String JMS_DESTINATION
See Also:
Constant Field Values

JMS_PRIORITY

public static final String JMS_PRIORITY
See Also:
Constant Field Values

JMS_MESSAGE_ID

public static final String JMS_MESSAGE_ID
See Also:
Constant Field Values

JMS_TIMESTAMP

public static final String JMS_TIMESTAMP
See Also:
Constant Field Values

JMS_TYPE

public static final String JMS_TYPE
See Also:
Constant Field Values

JMS_CORRELATION_ID

public static final String JMS_CORRELATION_ID
See Also:
Constant Field Values

JMS_EXPIRATION

public static final String JMS_EXPIRATION
See Also:
Constant Field Values

JMS_REPLY_TO

public static final String JMS_REPLY_TO
See Also:
Constant Field Values

JMS_REDELIVERED

public static final String JMS_REDELIVERED
See Also:
Constant Field Values

JMS_GSPRODUCER_KEY_PROP_NAME

public static final String JMS_GSPRODUCER_KEY_PROP_NAME
The producer key that is set in the send method and is kept in the optional message properties and used in the consumer receive or onMessage, while ack for instance.

See Also:
Constant Field Values

JMS_GSTTL_KEY_PROP_NAME

public static final String JMS_GSTTL_KEY_PROP_NAME
The TimeToLive of the JMSMessage which is the lease used to write() the ExternalEntry. When consuming the message we get the TTL value and pass it into the JMSMessage m_TimeToLive field.

See Also:
Constant Field Values

JMSX_GROUPID

public static final String JMSX_GROUPID
See Also:
Constant Field Values

JMSX_GROUPSEQ

public static final String JMSX_GROUPSEQ
See Also:
Constant Field Values

JMSX_USERID

public static final String JMSX_USERID
See Also:
Constant Field Values

JMSX_APPID

public static final String JMSX_APPID
See Also:
Constant Field Values

JMSX_RCV_TIMESTEMP

public static final String JMSX_RCV_TIMESTEMP
See Also:
Constant Field Values

BODY_NUM

public static final int BODY_NUM
See Also:
Constant Field Values

JMS_DESTINATION_NUM

public static final int JMS_DESTINATION_NUM
See Also:
Constant Field Values

JMS_DELIVERY_MODE_NUM

public static final int JMS_DELIVERY_MODE_NUM
See Also:
Constant Field Values

JMS_EXPIRATION_NUM

public static final int JMS_EXPIRATION_NUM
See Also:
Constant Field Values

JMS_PRIORITY_NUM

public static final int JMS_PRIORITY_NUM
See Also:
Constant Field Values

JMS_MESSAGE_ID_NUM

public static final int JMS_MESSAGE_ID_NUM
See Also:
Constant Field Values

JMS_TIMESTAMP_NUM

public static final int JMS_TIMESTAMP_NUM
See Also:
Constant Field Values

JMS_CORRELATION_ID_NUM

public static final int JMS_CORRELATION_ID_NUM
See Also:
Constant Field Values

JMS_REPLY_TO_NUM

public static final int JMS_REPLY_TO_NUM
See Also:
Constant Field Values

JMS_TYPE_NUM

public static final int JMS_TYPE_NUM
See Also:
Constant Field Values

JMS_REDELIVERED_NUM

public static final int JMS_REDELIVERED_NUM
See Also:
Constant Field Values

JMS_GSPRODUCER_KEY_PROP_NUM

public static final int JMS_GSPRODUCER_KEY_PROP_NUM
See Also:
Constant Field Values

JMS_GSTTL_PROP_NUM

public static final int JMS_GSTTL_PROP_NUM
See Also:
Constant Field Values

JMSX_GROUPID_PROP_NUM

public static final int JMSX_GROUPID_PROP_NUM
See Also:
Constant Field Values

JMSX_GROUPSEQ_PROP_NUM

public static final int JMSX_GROUPSEQ_PROP_NUM
See Also:
Constant Field Values

JMSX_USERID_PROP_NUM

public static final int JMSX_USERID_PROP_NUM
See Also:
Constant Field Values

PROPERTIES_NUM

public static final int PROPERTIES_NUM
See Also:
Constant Field Values

m_replyToId

public String m_replyToId
The reply to destination identifier. the name of the destination that the message got from.


m_deletedDest

public volatile boolean m_deletedDest
true if the message target destination was deleted.


m_expired

public volatile boolean m_expired
true if the message has expired.


m_notWriteable

public volatile boolean m_notWriteable
true if the message could not be written on the dest.


m_undeliverable

public volatile boolean m_undeliverable
true if the message is considered as undeliverable.


m_denied

public volatile boolean m_denied
true if the message has been denied at least once by a consumer.

Constructor Detail

GSMessageImpl

public GSMessageImpl(GSSessionImpl session,
                     String msgType)
              throws JMSException
Constructor: Constructs also an empty ExternalEntry that is embeded inside the JMSMessage and will hold all the JMSMessage elements- Body, Header and Properties and then sent/received via space.

Parameters:
session - The consuming session.
Throws:
JMSException
Method Detail

getJMSMessageID

public String getJMSMessageID()
                       throws JMSException
Specified by:
getJMSMessageID in interface Message
Returns:
jmsMessageID
Throws:
JMSException
See Also:
Message.getJMSMessageID()

setJMSMessageID

public void setJMSMessageID(String id)
                     throws JMSException
update the jms message id, if there is none, then generate it. Verifies that JMSMessageID is prefixed with 'ID:' otherwise add such prefix to the JMSMessageID

Specified by:
setJMSMessageID in interface Message
Parameters:
id -
Throws:
JMSException

getJMSTimestamp

public long getJMSTimestamp()
                     throws JMSException
Specified by:
getJMSTimestamp in interface Message
Returns:
timestamp
Throws:
JMSException
See Also:
Message.getJMSTimestamp()

setJMSTimestamp

public void setJMSTimestamp(long timestamp)
                     throws JMSException
Specified by:
setJMSTimestamp in interface Message
Parameters:
timestamp -
Throws:
JMSException
See Also:
Message.setJMSTimestamp(long)

getJMSCorrelationIDAsBytes

public byte[] getJMSCorrelationIDAsBytes()
                                  throws JMSException
Specified by:
getJMSCorrelationIDAsBytes in interface Message
Throws:
JMSException - if JMSCorrelationID is a string
See Also:
Message.getJMSCorrelationIDAsBytes()

setJMSCorrelationIDAsBytes

public void setJMSCorrelationIDAsBytes(byte[] correlationID)
                                throws JMSException
Specified by:
setJMSCorrelationIDAsBytes in interface Message
Throws:
JMSException
See Also:
Message.setJMSCorrelationIDAsBytes(byte[])

setJMSCorrelationID

public void setJMSCorrelationID(String correlationID)
                         throws JMSException
a null value for the JMSCorrelationID can be assigned to JMSCorrelationID when: - a message is initially constructed - a message is received with a non-null JMSCorrelationID

Specified by:
setJMSCorrelationID in interface Message
Throws:
JMSException
See Also:
Message.setJMSCorrelationID(java.lang.String)

getJMSCorrelationID

public String getJMSCorrelationID()
                           throws JMSException
Sets the correlation ID for the message.

A client can use the JMSCorrelationID header field to link one message with another. A typical use is to link a response message with its request message.

JMSCorrelationID can hold one of the following:

Since each message sent by a JMS provider is assigned a message ID value, it is convenient to link messages via message ID. All message ID values must start with the 'ID:' prefix.

In some cases, an application (made up of several clients) needs to use an application-specific value for linking messages. For instance, an application may use JMSCorrelationID to hold a value referencing some external information. Application-specified values must not start with the 'ID:' prefix; this is reserved for provider-generated message ID values.

If a provider supports the native concept of correlation ID, a JMS client may need to assign specific JMSCorrelationID values to match those expected by clients that do not use the JMS API. A byte[] value is used for this purpose. JMS providers without native correlation ID values are not required to support byte[] values. The use of a byte[] value for JMSCorrelationID is non-portable.

Specified by:
getJMSCorrelationID in interface Message
Returns:
m_correlationIdStr
Throws:
JMSException - if the JMS provider fails to set the correlation ID due to some internal error.
JMSException - if JMSCorrelationID is is an array
See Also:
Message.getJMSCorrelationID(), Message.getJMSCorrelationIDAsBytes(), Message.setJMSCorrelationIDAsBytes(byte[])

getJMSReplyTo

public Destination getJMSReplyTo()
                          throws JMSException
Specified by:
getJMSReplyTo in interface Message
Throws:
JMSException
See Also:
Message.getJMSReplyTo()

setJMSReplyTo

public void setJMSReplyTo(Destination replyTo)
                   throws JMSException
Specified by:
setJMSReplyTo in interface Message
Throws:
JMSException
See Also:
Message.setJMSReplyTo(javax.jms.Destination)

getJMSDestination

public Destination getJMSDestination()
                              throws JMSException
Gets the message destination.

Specified by:
getJMSDestination in interface Message
Throws:
JMSException
See Also:
Message.getJMSDestination()

setJMSDestination

public void setJMSDestination(Destination destination)
                       throws JMSException
Sets the message destination.

Specified by:
setJMSDestination in interface Message
Throws:
JMSException
See Also:
Message.setJMSDestination(javax.jms.Destination)

getJMSDeliveryMode

public int getJMSDeliveryMode()
                       throws JMSException
Gets the DeliveryMode value specified for this message. Having the values 'PERSISTENT' and 'NON_PERSISTENT'.

Specified by:
getJMSDeliveryMode in interface Message
Throws:
JMSException
See Also:
Message.getJMSDeliveryMode()

setJMSDeliveryMode

public void setJMSDeliveryMode(int deliveryMode)
                        throws JMSException
The default Delivery Mode is DeliveryMode.PERSISTENT

Specified by:
setJMSDeliveryMode in interface Message
Throws:
JMSException
See Also:
Message.setJMSDeliveryMode(int)

getJMSRedelivered

public boolean getJMSRedelivered()
                          throws JMSException
Specified by:
getJMSRedelivered in interface Message
Throws:
JMSException
See Also:
Message.getJMSRedelivered()

setJMSRedelivered

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

Specified by:
setJMSRedelivered in interface Message
Throws:
JMSException
See Also:
Message.setJMSRedelivered(boolean)

getJMSType

public String getJMSType()
                  throws JMSException
API method.

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

setJMSType

public void setJMSType(String type)
                throws JMSException
API method.

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

getJMSExpiration

public long getJMSExpiration()
                      throws JMSException
Specified by:
getJMSExpiration in interface Message
Throws:
JMSException
See Also:
Message.getJMSExpiration()

setJMSExpiration

public void setJMSExpiration(long expiration)
                      throws JMSException
long expiration - the time to live

Specified by:
setJMSExpiration in interface Message
Throws:
JMSException

getJMSPriority

public int getJMSPriority()
                   throws JMSException
Specified by:
getJMSPriority in interface Message
Throws:
JMSException
See Also:
Message.getJMSPriority()

setJMSPriority

public void setJMSPriority(int priority)
                    throws JMSException
Specified by:
setJMSPriority in interface Message
Throws:
JMSException
See Also:
Message.setJMSPriority(int)

getBooleanProperty

public boolean getBooleanProperty(String name)
                           throws JMSException
Returns a property as a boolean value.

Specified by:
getBooleanProperty in interface Message
Parameters:
name - The property name.
Throws:
JMSException
See Also:
Message.getBooleanProperty(java.lang.String)

getByteProperty

public byte getByteProperty(String name)
                     throws JMSException
Returns a property as a byte value.

Specified by:
getByteProperty in interface Message
Parameters:
name - The property name.
Throws:
JMSException
See Also:
Message.getByteProperty(java.lang.String)

getShortProperty

public short getShortProperty(String name)
                       throws JMSException
Returns a property as a short.

Specified by:
getShortProperty in interface Message
Throws:
JMSException
See Also:
Message.getShortProperty(java.lang.String)

getIntProperty

public int getIntProperty(String name)
                   throws JMSException
Returns a property as an int.

Specified by:
getIntProperty in interface Message
Throws:
JMSException
See Also:
Message.getIntProperty(java.lang.String)

getLongProperty

public long getLongProperty(String name)
                     throws JMSException
Returns a property as a long.

Specified by:
getLongProperty in interface Message
Throws:
JMSException
See Also:
Message.getLongProperty(java.lang.String)

getFloatProperty

public float getFloatProperty(String name)
                       throws JMSException
Returns a property as a float value.

Specified by:
getFloatProperty in interface Message
Parameters:
name - The property name.
Throws:
JMSException
See Also:
Message.getFloatProperty(java.lang.String)

getDoubleProperty

public double getDoubleProperty(String name)
                         throws JMSException
Returns a property as a double.

Specified by:
getDoubleProperty in interface Message
Parameters:
name - The property name.
Throws:
JMSException

getStringProperty

public String getStringProperty(String name)
                         throws JMSException
Returns a property as a String.

Specified by:
getStringProperty in interface Message
Parameters:
name - The property name.
Throws:
JMSException

getObjectProperty

public Object getObjectProperty(String name)
                         throws JMSException
API method. Returns a property as an Object.

Specified by:
getObjectProperty in interface Message
Throws:
JMSException - If the name is invalid.

getObjProp

public Object getObjProp(String name)
Throws:
JMSException - If the name is invalid.

setBooleanProperty

public void setBooleanProperty(String name,
                               boolean value)
                        throws JMSException
Sets a property as a boolean value.

Specified by:
setBooleanProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
JMSException
See Also:
Message.setBooleanProperty(java.lang.String, boolean)

setByteProperty

public void setByteProperty(String name,
                            byte value)
                     throws JMSException
Sets a property as a byte value.

Specified by:
setByteProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
JMSException
See Also:
Message.setByteProperty(java.lang.String, byte)

setShortProperty

public void setShortProperty(String name,
                             short value)
                      throws JMSException
Sets a property as a short value.

Specified by:
setShortProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
JMSException
See Also:
Message.setShortProperty(java.lang.String, short)

setIntProperty

public void setIntProperty(String name,
                           int value)
                    throws JMSException
Sets a property as a int value.

Specified by:
setIntProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
JMSException
See Also:
Message.setIntProperty(java.lang.String, int)

setLongProperty

public void setLongProperty(String name,
                            long value)
                     throws JMSException
Sets a property as a long value.

Specified by:
setLongProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
JMSException
See Also:
Message.setLongProperty(java.lang.String, long)

setFloatProperty

public void setFloatProperty(String name,
                             float value)
                      throws JMSException
Sets a property as a float value.

Specified by:
setFloatProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
JMSException
See Also:
Message.setFloatProperty(java.lang.String, float)

setDoubleProperty

public void setDoubleProperty(String name,
                              double value)
                       throws JMSException
Sets a property as a double value.

Specified by:
setDoubleProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
JMSException
See Also:
Message.setDoubleProperty(java.lang.String, double)

setStringProperty

public void setStringProperty(String name,
                              String value)
                       throws JMSException
Sets a property as a String.

Specified by:
setStringProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
JMSException

setObjectProperty

public void setObjectProperty(String name,
                              Object value)
                       throws JMSException
Sets a property value.

Specified by:
setObjectProperty in interface Message
Parameters:
name - The property name.
value - The property value.
Throws:
MessageNotWriteableException - If the message properties are read-only.
MessageValueException - If the value is not a Java primitive object.
JMSException

getOptionalHeader

public Object getOptionalHeader(String name)
Returns an optional Message Header field value according to its name.

Parameters:
name - The header field name.

acknowledge

public void acknowledge()
                 throws JMSException
Note that the acknowledge method of Message acknowledges all messages received on that message’s session. Message.acknowledge() method: Clarify that the method applies to ALL consumed messages of the session. Rationale for this change: A possible misinterpretation of the existing Java API documentation for Message.acknowledge() assumed that only messages received prior to “this” message should be acknowledged. The updated Java API documentation statement emphasizes that message acknowledgment is really a session-level activity and that this message is only being used to identify the session in order to acknowledge all messages consumed by the session. The acknowledge method was placed in the message object only to enable easy access to acknowledgment capability within a message listener’s onMessage method. This change aligns the specification and Java API documentation to define Message.acknowledge in the same manner. Method acknowledging the received messages.

Specified by:
acknowledge in interface Message
Throws:
JMSException
See Also:
Message.acknowledge()

clearBody

public void clearBody()
               throws JMSException
Clear out the message body. Clearing a message's body does not clear its header values or property entries. If this message body was read-only, calling this method leaves the message body is in the same state as an empty body in a newly created message

Specified by:
clearBody in interface Message
Throws:
JMSException
See Also:
Message.clearBody()

isValid

public boolean isValid()
Returns true if the message is valid and is not expired.


propertyExists

public boolean propertyExists(String name)
Returns true if a given property exists.

Specified by:
propertyExists in interface Message
Parameters:
name - The name of the property to check.

getPropertyNames

public Enumeration getPropertyNames()
Returns an enumeration of the properties names.

Specified by:
getPropertyNames in interface Message

clearProperties

public void clearProperties()
Empties the properties table.

Specified by:
clearProperties in interface Message

setOptionalHeader

public void setOptionalHeader(String name,
                              Object value)
Sets an optional header field value.

Parameters:
name - The header field name.
value - The corresponding value.

convertBodyToBytes

public final void convertBodyToBytes()
                              throws IOException
Convert the message body to data

Throws:
IOException

buildBodyFromBytes

public final void buildBodyFromBytes()
                              throws IOException
Builds the message body from data

Throws:
IOException

setMapBody

public void setMapBody(HashMap<String,Object> map)
                throws MessageNotWriteableException
Sets a map as the body of the message.

Parameters:
map -
Throws:
IOException - In case of an error while setting the map.
MessageNotWriteableException - If the message body is read-only.

setTextBody

public void setTextBody(String text)
                 throws MessageNotWriteableException
Sets a String as the body of the message.

Parameters:
text -
Throws:
MessageNotWriteableException - If the message body is read-only.

setStreamBody

public void setStreamBody(com.j_spaces.jms.utils.ByteArray bytes)
                   throws MessageNotWriteableException
Sets the message body as a stream of bytes.

Parameters:
bytes -
Throws:
MessageNotWriteableException - If the message body is read-only.

setBodyAsBytes

public void setBodyAsBytes(com.j_spaces.jms.utils.ByteArray bytes)
                    throws MessageNotWriteableException
Sets the message body as an array of bytes.

Parameters:
bytes -
Throws:
MessageNotWriteableException - If the message body is read-only.

setBodyAsBytes

public void setBodyAsBytes(byte[] data,
                           int offset,
                           int length)
Parameters:
data - The bodyAsBytes to set.
offset -
length -

getMapBody

public HashMap getMapBody()
Returns the hashmap based body of the message.

Returns:
m_body_map

getTextBody

public String getTextBody()
Gets the String body of the message.

Returns:
m_body_text

getStreamBody

public com.j_spaces.jms.utils.ByteArray getStreamBody()
Returns the stream of bytes body of the message.

Returns:
m_body_bytes

getBodyAsBytes

public com.j_spaces.jms.utils.ByteArray getBodyAsBytes()
                                                throws IOException
Returns the array of bytes body of the message.

Returns:
Returns the bodyAsBytes.
Throws:
IOException

getProperties

public HashMap getProperties()
Returns:
m_properties

toString

public String toString()
Overrides:
toString in class Object

isBodyRO

public boolean isBodyRO()
Returns:
m_bodyRO

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

getToDestination

public Destination getToDestination()
Returns:
Returns the m_to destination.

setToDestination

public void setToDestination(Destination toDest)
Parameters:
toDest - The destination to set.

writeBody

public void writeBody(DataOutput dataOut)
               throws IOException
Used serialize the message body to an output stream

Parameters:
dataOut -
Throws:
IOException

readBody

public void readBody(DataInput dataIn)
              throws IOException
Used to help build the body from an input stream

Parameters:
dataIn -
Throws:
IOException