org.jboss.messaging.jms.client
Class JBossMessage

java.lang.Object
  extended by org.jboss.messaging.jms.client.JBossMessage
All Implemented Interfaces:
javax.jms.Message
Direct Known Subclasses:
JBossBytesMessage, JBossMapMessage, JBossObjectMessage, JBossStreamMessage, JBossTextMessage

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

Implementation of a JMS Message JMS Messages only live on the client side - the server only deals with MessageImpl instances

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, Andy Taylor, Clebert Suconic $Id: JBossMessage.java 3466 2007-12-10 18:44:52Z timfox $

Field Summary
static SimpleString CORRELATIONID_HEADER_NAME
           
static SimpleString JBM_MESSAGE_ID
           
static java.lang.String JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST
           
static java.lang.String JMS_JBM_INPUT_STREAM
           
static java.lang.String JMS_JBM_OUTPUT_STREAM
           
static java.lang.String JMS_JBM_SAVE_STREAM
           
static java.lang.String JMSXDELIVERYCOUNT
           
static java.lang.String JMSXGROUPID
           
protected  ClientMessage message
           
protected  boolean propertiesReadOnly
           
protected  boolean readOnly
           
static SimpleString REPLYTO_HEADER_NAME
           
static byte TYPE
           
static SimpleString TYPE_HEADER_NAME
           
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
  JBossMessage()
          constructors for test purposes only
  JBossMessage(byte type)
           
protected JBossMessage(byte type, ClientSession session)
           
  JBossMessage(ClientMessage message, ClientSession session)
          Constructor for when receiving a message from the server
  JBossMessage(ClientSession session)
           
protected JBossMessage(javax.jms.Message foreign, byte type, ClientSession session)
           
  JBossMessage(javax.jms.Message foreign, ClientSession session)
           
 
Method Summary
 void acknowledge()
           
protected  void checkRead()
           
protected  void checkWrite()
           
 void clearBody()
           
 void clearProperties()
           
static java.util.Map<java.lang.String,java.lang.Object> coreMaptoJMSMap(java.util.Map<java.lang.String,java.lang.Object> coreMessage)
           
static JBossMessage createMessage(ClientMessage message, ClientSession session)
           
 void doBeforeReceive()
           
 void doBeforeSend()
           
protected  MessagingBuffer getBody()
           
 boolean getBooleanProperty(java.lang.String name)
           
 byte getByteProperty(java.lang.String name)
           
 ClientMessage getCoreMessage()
           
 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()
           
 javax.jms.Destination getJMSDestination()
           
 long getJMSExpiration()
           
 java.lang.String getJMSMessageID()
           
 int getJMSPriority()
           
 boolean getJMSRedelivered()
           
 javax.jms.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 propertyExists(java.lang.String name)
           
 void saveToOutputStream(java.io.OutputStream output)
           
 void setBooleanProperty(java.lang.String name, boolean value)
           
 void setByteProperty(java.lang.String name, byte value)
           
 void setDoubleProperty(java.lang.String name, double value)
           
 void setFloatProperty(java.lang.String name, float value)
           
 void setInputStream(java.io.InputStream input)
           
 void setIntProperty(java.lang.String name, int value)
           
 void setJMSCorrelationID(java.lang.String correlationID)
           
 void setJMSCorrelationIDAsBytes(byte[] correlationID)
           
 void setJMSDeliveryMode(int deliveryMode)
           
 void setJMSDestination(javax.jms.Destination destination)
           
 void setJMSExpiration(long expiration)
           
 void setJMSMessageID(java.lang.String jmsMessageID)
           
 void setJMSPriority(int priority)
           
 void setJMSRedelivered(boolean redelivered)
           
 void setJMSReplyTo(javax.jms.Destination dest)
           
 void setJMSTimestamp(long timestamp)
           
 void setJMSType(java.lang.String type)
           
 void setLongProperty(java.lang.String name, long value)
           
 void setObjectProperty(java.lang.String name, java.lang.Object value)
           
 void setOutputStream(java.io.OutputStream output)
           
 void setShortProperty(java.lang.String name, short value)
           
 void setStringProperty(java.lang.String name, java.lang.String value)
           
 java.lang.String toString()
           
 boolean waitCompletionOnStream(long timeWait)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REPLYTO_HEADER_NAME

public static final SimpleString REPLYTO_HEADER_NAME

CORRELATIONID_HEADER_NAME

public static final SimpleString CORRELATIONID_HEADER_NAME

JBM_MESSAGE_ID

public static final SimpleString JBM_MESSAGE_ID

TYPE_HEADER_NAME

public static final SimpleString TYPE_HEADER_NAME

JMSXDELIVERYCOUNT

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

JMS_JBM_INPUT_STREAM

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

JMS_JBM_OUTPUT_STREAM

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

JMS_JBM_SAVE_STREAM

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

JMSXGROUPID

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

JBOSS_MESSAGING_BRIDGE_MESSAGE_ID_LIST

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

TYPE

public static final byte TYPE
See Also:
Constant Field Values

message

protected ClientMessage message

readOnly

protected boolean readOnly

propertiesReadOnly

protected boolean propertiesReadOnly
Constructor Detail

JBossMessage

public JBossMessage()
constructors for test purposes only


JBossMessage

public JBossMessage(byte type)

JBossMessage

protected JBossMessage(byte type,
                       ClientSession session)

JBossMessage

public JBossMessage(ClientSession session)

JBossMessage

public JBossMessage(ClientMessage message,
                    ClientSession session)
Constructor for when receiving a message from the server


JBossMessage

public JBossMessage(javax.jms.Message foreign,
                    ClientSession session)
             throws javax.jms.JMSException
Throws:
javax.jms.JMSException

JBossMessage

protected JBossMessage(javax.jms.Message foreign,
                       byte type,
                       ClientSession session)
                throws javax.jms.JMSException
Throws:
javax.jms.JMSException
Method Detail

coreMaptoJMSMap

public static java.util.Map<java.lang.String,java.lang.Object> coreMaptoJMSMap(java.util.Map<java.lang.String,java.lang.Object> coreMessage)

createMessage

public static JBossMessage createMessage(ClientMessage message,
                                         ClientSession session)

getJMSMessageID

public java.lang.String getJMSMessageID()
Specified by:
getJMSMessageID in interface javax.jms.Message

setJMSMessageID

public void setJMSMessageID(java.lang.String jmsMessageID)
                     throws javax.jms.JMSException
Specified by:
setJMSMessageID in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSTimestamp

public long getJMSTimestamp()
                     throws javax.jms.JMSException
Specified by:
getJMSTimestamp in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSTimestamp

public void setJMSTimestamp(long timestamp)
                     throws javax.jms.JMSException
Specified by:
setJMSTimestamp in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSCorrelationIDAsBytes

public byte[] getJMSCorrelationIDAsBytes()
                                  throws javax.jms.JMSException
Specified by:
getJMSCorrelationIDAsBytes in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSCorrelationIDAsBytes

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

setJMSCorrelationID

public void setJMSCorrelationID(java.lang.String correlationID)
                         throws javax.jms.JMSException
Specified by:
setJMSCorrelationID in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSCorrelationID

public java.lang.String getJMSCorrelationID()
                                     throws javax.jms.JMSException
Specified by:
getJMSCorrelationID in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSReplyTo

public javax.jms.Destination getJMSReplyTo()
                                    throws javax.jms.JMSException
Specified by:
getJMSReplyTo in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSReplyTo

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

getJMSDestination

public javax.jms.Destination getJMSDestination()
                                        throws javax.jms.JMSException
Specified by:
getJMSDestination in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSDestination

public void setJMSDestination(javax.jms.Destination destination)
                       throws javax.jms.JMSException
Specified by:
setJMSDestination in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSDeliveryMode

public int getJMSDeliveryMode()
                       throws javax.jms.JMSException
Specified by:
getJMSDeliveryMode in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSDeliveryMode

public void setJMSDeliveryMode(int deliveryMode)
                        throws javax.jms.JMSException
Specified by:
setJMSDeliveryMode in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSRedelivered

public boolean getJMSRedelivered()
                          throws javax.jms.JMSException
Specified by:
getJMSRedelivered in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSRedelivered

public void setJMSRedelivered(boolean redelivered)
                       throws javax.jms.JMSException
Specified by:
setJMSRedelivered in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSType

public void setJMSType(java.lang.String type)
                throws javax.jms.JMSException
Specified by:
setJMSType in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSType

public java.lang.String getJMSType()
                            throws javax.jms.JMSException
Specified by:
getJMSType in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSExpiration

public long getJMSExpiration()
                      throws javax.jms.JMSException
Specified by:
getJMSExpiration in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSExpiration

public void setJMSExpiration(long expiration)
                      throws javax.jms.JMSException
Specified by:
setJMSExpiration in interface javax.jms.Message
Throws:
javax.jms.JMSException

getJMSPriority

public int getJMSPriority()
                   throws javax.jms.JMSException
Specified by:
getJMSPriority in interface javax.jms.Message
Throws:
javax.jms.JMSException

setJMSPriority

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

clearProperties

public void clearProperties()
                     throws javax.jms.JMSException
Specified by:
clearProperties in interface javax.jms.Message
Throws:
javax.jms.JMSException

clearBody

public void clearBody()
               throws javax.jms.JMSException
Specified by:
clearBody in interface javax.jms.Message
Throws:
javax.jms.JMSException

propertyExists

public boolean propertyExists(java.lang.String name)
                       throws javax.jms.JMSException
Specified by:
propertyExists in interface javax.jms.Message
Throws:
javax.jms.JMSException

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name)
                           throws javax.jms.JMSException
Specified by:
getBooleanProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getByteProperty

public byte getByteProperty(java.lang.String name)
                     throws javax.jms.JMSException
Specified by:
getByteProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getShortProperty

public short getShortProperty(java.lang.String name)
                       throws javax.jms.JMSException
Specified by:
getShortProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getIntProperty

public int getIntProperty(java.lang.String name)
                   throws javax.jms.JMSException
Specified by:
getIntProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getLongProperty

public long getLongProperty(java.lang.String name)
                     throws javax.jms.JMSException
Specified by:
getLongProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getFloatProperty

public float getFloatProperty(java.lang.String name)
                       throws javax.jms.JMSException
Specified by:
getFloatProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getDoubleProperty

public double getDoubleProperty(java.lang.String name)
                         throws javax.jms.JMSException
Specified by:
getDoubleProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getStringProperty

public java.lang.String getStringProperty(java.lang.String name)
                                   throws javax.jms.JMSException
Specified by:
getStringProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getObjectProperty

public java.lang.Object getObjectProperty(java.lang.String name)
                                   throws javax.jms.JMSException
Specified by:
getObjectProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

getPropertyNames

public java.util.Enumeration getPropertyNames()
                                       throws javax.jms.JMSException
Specified by:
getPropertyNames in interface javax.jms.Message
Throws:
javax.jms.JMSException

setBooleanProperty

public void setBooleanProperty(java.lang.String name,
                               boolean value)
                        throws javax.jms.JMSException
Specified by:
setBooleanProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

setByteProperty

public void setByteProperty(java.lang.String name,
                            byte value)
                     throws javax.jms.JMSException
Specified by:
setByteProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

setShortProperty

public void setShortProperty(java.lang.String name,
                             short value)
                      throws javax.jms.JMSException
Specified by:
setShortProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
                    throws javax.jms.JMSException
Specified by:
setIntProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

setLongProperty

public void setLongProperty(java.lang.String name,
                            long value)
                     throws javax.jms.JMSException
Specified by:
setLongProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

setFloatProperty

public void setFloatProperty(java.lang.String name,
                             float value)
                      throws javax.jms.JMSException
Specified by:
setFloatProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

setDoubleProperty

public void setDoubleProperty(java.lang.String name,
                              double value)
                       throws javax.jms.JMSException
Specified by:
setDoubleProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

setStringProperty

public void setStringProperty(java.lang.String name,
                              java.lang.String value)
                       throws javax.jms.JMSException
Specified by:
setStringProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

setObjectProperty

public void setObjectProperty(java.lang.String name,
                              java.lang.Object value)
                       throws javax.jms.JMSException
Specified by:
setObjectProperty in interface javax.jms.Message
Throws:
javax.jms.JMSException

acknowledge

public void acknowledge()
                 throws javax.jms.JMSException
Specified by:
acknowledge in interface javax.jms.Message
Throws:
javax.jms.JMSException

getCoreMessage

public ClientMessage getCoreMessage()

doBeforeSend

public void doBeforeSend()
                  throws java.lang.Exception
Throws:
java.lang.Exception

doBeforeReceive

public void doBeforeReceive()
                     throws java.lang.Exception
Throws:
java.lang.Exception

getType

public byte getType()

setInputStream

public void setInputStream(java.io.InputStream input)
                    throws javax.jms.JMSException
Throws:
javax.jms.JMSException

setOutputStream

public void setOutputStream(java.io.OutputStream output)
                     throws javax.jms.JMSException
Throws:
javax.jms.JMSException

saveToOutputStream

public void saveToOutputStream(java.io.OutputStream output)
                        throws javax.jms.JMSException
Throws:
javax.jms.JMSException

waitCompletionOnStream

public boolean waitCompletionOnStream(long timeWait)
                               throws javax.jms.JMSException
Throws:
javax.jms.JMSException

toString

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

checkWrite

protected void checkWrite()
                   throws javax.jms.JMSException
Throws:
javax.jms.JMSException

checkRead

protected void checkRead()
                  throws javax.jms.JMSException
Throws:
javax.jms.JMSException

getBody

protected MessagingBuffer getBody()


Copyright © 2006 JBoss Inc. All Rights Reserved.