org.jboss.jms.message
Class JBossMessage

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

public class JBossMessage
extends MessageSupport

Implementation of a JMS Message

Author:
Ovidiu Feodorov, Tim Fox 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, Ovidiu Feodorov, Tyronne Wickramarathne $Id: JBossMessage.java 2591 2007-04-19 15:25:51Z timfox $
See Also:
Serialized Form

Field Summary
protected  int connectionID
           
protected  java.lang.String correlationID
           
protected  byte[] correlationIDBytes
           
protected  JBossDestination destination
           
protected  java.lang.String jmsMessageID
           
protected  java.lang.String jmsType
           
protected  java.util.Map properties
           
protected  JBossDestination replyToDestination
           
static byte TYPE
           
 
Fields inherited from class org.jboss.messaging.core.message.RoutableSupport
BOOLEAN, BYTE, BYTES, deliveryCount, DOUBLE, expiration, FLOAT, headers, INT, LIST, LONG, MAP, messageID, NULL, OBJECT, priority, reliable, SHORT, STRING, timestamp
 
Fields inherited from interface org.jboss.messaging.core.Routable
COLLECTOR_ID, REMOTE_ROUTABLE, REPLICATOR_ID
 
Constructor Summary
  JBossMessage()
          Only deserialization should use this constructor directory
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 coreHeaders, byte[] payloadAsByteArray, int persistentChannelCount, java.lang.String jmsType, java.lang.String correlationID, byte[] correlationIDBytes, JBossDestination destination, JBossDestination replyTo, java.util.HashMap jmsProperties)
           
  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(JBossMessage m, int deliveryCount)
           
 void doAfterSend()
           
 JBossMessage doShallowCopy()
           
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)
           
 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()
           
 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)
           
protected  JBossDestination readDestination(java.io.ObjectInput in)
           
 void readExternal(java.io.ObjectInput 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 setJMSProperties(java.util.Map props)
           
 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()
           
protected  void writeDestination(java.io.ObjectOutput out, Destination dest)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class org.jboss.messaging.core.message.MessageSupport
clearPayloadAsByteArray, copyPayloadAsByteArrayToPayload, decPersistentChannelCount, equals, getHeaders, getMessage, getPayload, getPayloadAsByteArray, getPersistentChannelCount, hashCode, incPersistentChannelCount, readPayloadExternal, setPayload, writePayloadExternal
 
Methods inherited from class org.jboss.messaging.core.message.RoutableSupport
containsHeader, decrementDeliveryCount, getDeliveryCount, getExpiration, getHeader, getHeaderNames, getMessageID, getPriority, getTimestamp, incrementDeliveryCount, internalReadObject, internalWriteObject, isExpired, isReliable, putHeader, readList, readMap, removeHeader, setDeliveryCount, setPriority, setReliable, writeList, writeMap
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.messaging.core.Routable
containsHeader, decrementDeliveryCount, getDeliveryCount, getExpiration, getHeader, getHeaderNames, getMessageID, getPriority, getTimestamp, incrementDeliveryCount, isExpired, isReliable, putHeader, removeHeader, setDeliveryCount, setPriority, setReliable
 

Field Detail

TYPE

public static final byte TYPE
See Also:
Constant Field Values

destination

protected JBossDestination destination

replyToDestination

protected JBossDestination replyToDestination

jmsType

protected java.lang.String jmsType

properties

protected java.util.Map properties

correlationID

protected java.lang.String correlationID

correlationIDBytes

protected byte[] correlationIDBytes

connectionID

protected transient int connectionID

jmsMessageID

protected transient java.lang.String jmsMessageID
Constructor Detail

JBossMessage

public JBossMessage()
Only deserialization should use this constructor directory


JBossMessage

public JBossMessage(long messageID)

JBossMessage

public JBossMessage(long messageID,
                    boolean reliable,
                    long expiration,
                    long timestamp,
                    byte priority,
                    java.util.Map coreHeaders,
                    byte[] payloadAsByteArray,
                    int persistentChannelCount,
                    java.lang.String jmsType,
                    java.lang.String correlationID,
                    byte[] correlationIDBytes,
                    JBossDestination destination,
                    JBossDestination replyTo,
                    java.util.HashMap jmsProperties)

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(JBossMessage m,
                                              int deliveryCount)

dump

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

isReference

public boolean isReference()
Specified by:
isReference in interface Routable
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

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

doAfterSend

public void doAfterSend()
                 throws JMSException
Throws:
JMSException

getType

public byte getType()

getJMSProperties

public java.util.Map getJMSProperties()
Returns:
a reference of the internal JMS property map.

setJMSProperties

public void setJMSProperties(java.util.Map props)

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

doShallowCopy

public JBossMessage doShallowCopy()
                           throws JMSException
Throws:
JMSException

isCorrelationIDBytes

public boolean isCorrelationIDBytes()

acknowledge

public void acknowledge()

setMessageId

public void setMessageId(long messageID)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Overrides:
writeExternal in class MessageSupport
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Overrides:
readExternal in class MessageSupport
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeDestination

protected void writeDestination(java.io.ObjectOutput out,
                                Destination dest)
                         throws java.io.IOException
Throws:
java.io.IOException

readDestination

protected JBossDestination readDestination(java.io.ObjectInput in)
                                    throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2006 JBoss Inc. All Rights Reserved.