org.jboss.jms.message
Class JBossMessage

java.lang.Object
  extended byorg.jboss.messaging.core.message.MessageSupport
      extended byorg.jboss.jms.message.JBossMessage
All Implemented Interfaces:
Message, java.io.Serializable, Streamable
Direct Known Subclasses:
JBossBytesMessage, JBossMapMessage, JBossObjectMessage, JBossStreamMessage, JBossTextMessage

public class JBossMessage
extends MessageSupport
implements java.io.Serializable

Implementation of a JMS Message Note that the only reason this class is Serializable is so that messages can be returned from JMX operations. Java serialization is not used to serialize messages between client and server in normal JMS operations

Author:
Ovidiu Feodorov, Tim Fox, Tyronne Wickramarathne Partially ported from JBossMQ implementation originally written by:, Norbert Lataille (Norbert.Lataille@m4x.org), Hiram Chirino (Cojonudo14@hotmail.com), David Maplesden (David.Maplesden@orion.co.nz), Adrian Brock $Id: JBossMessage.java 2715 2007-05-19 15:31:23Z timfox $
See Also:
Serialized Form

Field Summary
protected  int connectionID
           
static java.lang.String JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME
           
static java.lang.String JBOSS_MESSAGING_ORIG_DESTINATION
           
static java.lang.String JBOSS_MESSAGING_ORIG_MESSAGE_ID
           
static java.lang.String JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME
           
protected  java.lang.String jmsMessageID
           
static byte TYPE
           
 
Fields inherited from class org.jboss.messaging.core.message.MessageSupport
expiration, headers, messageID, priority, reliable, timestamp
 
Fields inherited from interface org.jboss.messaging.core.message.Message
FAILED_NODE_ID
 
Constructor Summary
  JBossMessage()
           
protected JBossMessage(JBossMessage other)
          Create a new JBossMessage by making a shallow copy of another
  JBossMessage(long messageID)
           
  JBossMessage(long messageID, boolean reliable, long expiration, long timestamp, byte priority, java.util.Map headers, byte[] payloadAsByteArray)
           
  JBossMessage(Message foreign, long messageID)
          A copy constructor for non-JBoss Messaging JMS messages.
 
Method Summary
 void acknowledge()
           
 void clearBody()
           
 void clearProperties()
           
 void copyPayload(java.lang.Object payload)
           
static MessageProxy createThinDelegate(long deliveryId, JBossMessage m, int deliveryCount)
           
 void doBeforeSend()
           
 JBossMessage doCopy()
           
static java.lang.String dump(JBossMessage m)
           
 boolean getBooleanProperty(java.lang.String name)
           
 byte getByteProperty(java.lang.String name)
           
 int getConnectionID()
           
 double getDoubleProperty(java.lang.String name)
           
 float getFloatProperty(java.lang.String name)
           
 java.util.Map getHeaders()
           
 int getIntProperty(java.lang.String name)
           
 java.lang.String getJMSCorrelationID()
           
 byte[] getJMSCorrelationIDAsBytes()
           
 int getJMSDeliveryMode()
           
 Destination getJMSDestination()
           
 long getJMSExpiration()
           
 java.lang.String getJMSMessageID()
           
 int getJMSPriority()
           
 java.util.Map getJMSProperties()
           
 boolean getJMSRedelivered()
           
 Destination getJMSReplyTo()
           
 long getJMSTimestamp()
           
 java.lang.String getJMSType()
           
 long getLongProperty(java.lang.String name)
           
 java.lang.Object getObjectProperty(java.lang.String name)
           
 java.util.Enumeration getPropertyNames()
           
 long getScheduledDeliveryTime()
           
 short getShortProperty(java.lang.String name)
           
 java.lang.String getStringProperty(java.lang.String name)
           
 byte getType()
           
 boolean isCorrelationIDBytes()
           
 boolean isReference()
           
 boolean propertyExists(java.lang.String name)
           
 void read(java.io.DataInputStream in)
           
 void setBooleanProperty(java.lang.String name, boolean value)
           
 void setByteProperty(java.lang.String name, byte value)
           
 void setConnectionID(int connectionID)
           
 void setDoubleProperty(java.lang.String name, double value)
           
 void setFloatProperty(java.lang.String name, float value)
           
 void setIntProperty(java.lang.String name, int value)
           
 void setJMSCorrelationID(java.lang.String correlationID)
           
 void setJMSCorrelationIDAsBytes(byte[] correlationID)
           
 void setJMSDeliveryMode(int deliveryMode)
           
 void setJMSDestination(Destination destination)
           
 void setJMSExpiration(long expiration)
           
 void setJMSMessageID(java.lang.String jmsMessageID)
           
 void setJMSPriority(int priority)
           
 void setJMSRedelivered(boolean redelivered)
           
 void setJMSReplyTo(Destination replyTo)
           
 void setJMSTimestamp(long timestamp)
           
 void setJMSType(java.lang.String type)
           
 void setLongProperty(java.lang.String name, long value)
           
 void setMessageId(long messageID)
           
 void setObjectProperty(java.lang.String name, java.lang.Object value)
           
 void setShortProperty(java.lang.String name, short value)
           
 void setStringProperty(java.lang.String name, java.lang.String value)
           
 java.lang.String toString()
           
 void write(java.io.DataOutputStream out)
           
 
Methods inherited from class org.jboss.messaging.core.message.MessageSupport
clearPayloadAsByteArray, containsHeader, copyPayloadAsByteArrayToPayload, equals, getExpiration, getHeader, getHeaderNames, getMessageID, getPayload, getPayloadAsByteArray, getPriority, getTimestamp, hashCode, isExpired, isPersisted, isReliable, putHeader, readPayload, removeHeader, setExpiration, setHeaders, setPayload, setPersisted, setPriority, writePayload
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final byte TYPE
See Also:
Constant Field Values

JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME

public static final java.lang.String JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME
See Also:
Constant Field Values

JBOSS_MESSAGING_ORIG_DESTINATION

public static final java.lang.String JBOSS_MESSAGING_ORIG_DESTINATION
See Also:
Constant Field Values

JBOSS_MESSAGING_ORIG_MESSAGE_ID

public static final java.lang.String JBOSS_MESSAGING_ORIG_MESSAGE_ID
See Also:
Constant Field Values

JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME

public static final java.lang.String JBOSS_MESSAGING_ACTUAL_EXPIRY_TIME
See Also:
Constant Field Values

connectionID

protected transient int connectionID

jmsMessageID

protected transient java.lang.String jmsMessageID
Constructor Detail

JBossMessage

public JBossMessage()

JBossMessage

public JBossMessage(long messageID)

JBossMessage

public JBossMessage(long messageID,
                    boolean reliable,
                    long expiration,
                    long timestamp,
                    byte priority,
                    java.util.Map headers,
                    byte[] payloadAsByteArray)

JBossMessage

protected JBossMessage(JBossMessage other)
Create a new JBossMessage by making a shallow copy of another

Parameters:
other - The message to make a shallow copy from

JBossMessage

public JBossMessage(Message foreign,
                    long messageID)
             throws JMSException
A copy constructor for non-JBoss Messaging JMS messages.

Method Detail

createThinDelegate

public static MessageProxy createThinDelegate(long deliveryId,
                                              JBossMessage m,
                                              int deliveryCount)

dump

public static java.lang.String dump(JBossMessage m)

isReference

public boolean isReference()
Overrides:
isReference in class MessageSupport

getJMSMessageID

public java.lang.String getJMSMessageID()

setJMSMessageID

public void setJMSMessageID(java.lang.String jmsMessageID)
                     throws JMSException
Throws:
JMSException

getJMSTimestamp

public long getJMSTimestamp()
                     throws JMSException
Throws:
JMSException

setJMSTimestamp

public void setJMSTimestamp(long timestamp)
                     throws JMSException
Throws:
JMSException

getJMSCorrelationIDAsBytes

public byte[] getJMSCorrelationIDAsBytes()
                                  throws JMSException
Throws:
JMSException

setJMSCorrelationIDAsBytes

public void setJMSCorrelationIDAsBytes(byte[] correlationID)
                                throws JMSException
Throws:
JMSException

setJMSCorrelationID

public void setJMSCorrelationID(java.lang.String correlationID)
                         throws JMSException
Throws:
JMSException

getJMSCorrelationID

public java.lang.String getJMSCorrelationID()
                                     throws JMSException
Throws:
JMSException

getJMSReplyTo

public Destination getJMSReplyTo()
                          throws JMSException
Throws:
JMSException

setJMSReplyTo

public void setJMSReplyTo(Destination replyTo)
                   throws JMSException
Throws:
JMSException

getJMSDestination

public Destination getJMSDestination()
                              throws JMSException
Throws:
JMSException

setJMSDestination

public void setJMSDestination(Destination destination)
                       throws JMSException
Throws:
JMSException

getHeaders

public java.util.Map getHeaders()
Specified by:
getHeaders in interface Message
Overrides:
getHeaders in class MessageSupport

getJMSDeliveryMode

public int getJMSDeliveryMode()
                       throws JMSException
Throws:
JMSException

setJMSDeliveryMode

public void setJMSDeliveryMode(int deliveryMode)
                        throws JMSException
Throws:
JMSException

getJMSRedelivered

public boolean getJMSRedelivered()
                          throws JMSException
Throws:
JMSException

setJMSRedelivered

public void setJMSRedelivered(boolean redelivered)
                       throws JMSException
Throws:
JMSException

getJMSType

public java.lang.String getJMSType()
                            throws JMSException
Returns:
java.lang.String type
Throws:
JMSException

setJMSType

public void setJMSType(java.lang.String type)
                throws JMSException
Parameters:
type -
Throws:
JMSException

getJMSExpiration

public long getJMSExpiration()
                      throws JMSException
Throws:
JMSException

setJMSExpiration

public void setJMSExpiration(long expiration)
                      throws JMSException
Throws:
JMSException

getJMSPriority

public int getJMSPriority()
                   throws JMSException
Throws:
JMSException

setJMSPriority

public void setJMSPriority(int priority)
                    throws JMSException
Throws:
JMSException

clearProperties

public void clearProperties()
                     throws JMSException
Throws:
JMSException

clearBody

public void clearBody()
               throws JMSException
Throws:
JMSException

propertyExists

public boolean propertyExists(java.lang.String name)
                       throws JMSException
Throws:
JMSException

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name)
                           throws JMSException
Throws:
JMSException

getByteProperty

public byte getByteProperty(java.lang.String name)
                     throws JMSException
Throws:
JMSException

getShortProperty

public short getShortProperty(java.lang.String name)
                       throws JMSException
Throws:
JMSException

getIntProperty

public int getIntProperty(java.lang.String name)
                   throws JMSException
Throws:
JMSException

getLongProperty

public long getLongProperty(java.lang.String name)
                     throws JMSException
Throws:
JMSException

getFloatProperty

public float getFloatProperty(java.lang.String name)
                       throws JMSException
Throws:
JMSException

getDoubleProperty

public double getDoubleProperty(java.lang.String name)
                         throws JMSException
Throws:
JMSException

getStringProperty

public java.lang.String getStringProperty(java.lang.String name)
                                   throws JMSException
Throws:
JMSException

getObjectProperty

public java.lang.Object getObjectProperty(java.lang.String name)
                                   throws JMSException
Throws:
JMSException

getPropertyNames

public java.util.Enumeration getPropertyNames()
                                       throws JMSException
Throws:
JMSException

setBooleanProperty

public void setBooleanProperty(java.lang.String name,
                               boolean value)
                        throws JMSException
Throws:
JMSException

setByteProperty

public void setByteProperty(java.lang.String name,
                            byte value)
                     throws JMSException
Throws:
JMSException

setShortProperty

public void setShortProperty(java.lang.String name,
                             short value)
                      throws JMSException
Throws:
JMSException

setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
                    throws JMSException
Throws:
JMSException

setLongProperty

public void setLongProperty(java.lang.String name,
                            long value)
                     throws JMSException
Throws:
JMSException

setFloatProperty

public void setFloatProperty(java.lang.String name,
                             float value)
                      throws JMSException
Throws:
JMSException

setDoubleProperty

public void setDoubleProperty(java.lang.String name,
                              double value)
                       throws JMSException
Throws:
JMSException

setStringProperty

public void setStringProperty(java.lang.String name,
                              java.lang.String value)
                       throws JMSException
Throws:
JMSException

setObjectProperty

public void setObjectProperty(java.lang.String name,
                              java.lang.Object value)
                       throws JMSException
Throws:
JMSException

doBeforeSend

public void doBeforeSend()
                  throws JMSException
Throws:
JMSException

getType

public byte getType()
Specified by:
getType in interface Message

copyPayload

public void copyPayload(java.lang.Object payload)
                 throws JMSException
Throws:
JMSException

getConnectionID

public int getConnectionID()

setConnectionID

public void setConnectionID(int connectionID)

toString

public java.lang.String toString()
Overrides:
toString in class MessageSupport

doCopy

public JBossMessage doCopy()
                    throws JMSException
Throws:
JMSException

acknowledge

public void acknowledge()

setMessageId

public void setMessageId(long messageID)

getScheduledDeliveryTime

public long getScheduledDeliveryTime()

getJMSProperties

public java.util.Map getJMSProperties()

isCorrelationIDBytes

public boolean isCorrelationIDBytes()

write

public void write(java.io.DataOutputStream out)
           throws java.lang.Exception
Specified by:
write in interface Streamable
Overrides:
write in class MessageSupport
Throws:
java.lang.Exception

read

public void read(java.io.DataInputStream in)
          throws java.lang.Exception
Specified by:
read in interface Streamable
Overrides:
read in class MessageSupport
Throws:
java.lang.Exception


Copyright © 2006 JBoss Inc. All Rights Reserved.