org.apache.qpid.client.message
Class AbstractJMSMessage

java.lang.Object
  extended by org.apache.qpid.client.message.AbstractJMSMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
AbstractBytesMessage, JMSObjectMessage, JMSTextMessage

public abstract class AbstractJMSMessage
extends Object
implements Message


Field Summary
protected  boolean _changedData
           
protected  org.apache.mina.common.ByteBuffer _data
           
protected  AMQMessageDelegate _delegate
          If the acknowledge mode is CLIENT_ACKNOWLEDGE the session is required
protected  boolean _readableMessage
           
 
Fields inherited from interface org.apache.qpid.jms.Message
JMS_TYPE
 
Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
protected AbstractJMSMessage(AMQMessageDelegate delegate, org.apache.mina.common.ByteBuffer data)
           
protected AbstractJMSMessage(AMQMessageDelegateFactory delegateFactory, org.apache.mina.common.ByteBuffer data)
           
 
Method Summary
 void acknowledge()
           
 void acknowledgeThis()
           
protected  void checkReadable()
           
protected  void checkWritable()
           
 void clearBody()
           
abstract  void clearBodyImpl()
          This forces concrete classes to implement clearBody()
 void clearProperties()
           
 AMQSession getAMQSession()
           
 boolean getBooleanProperty(String s)
           
 byte getByteProperty(String s)
           
 int getContentLength()
           
 String getContentType()
           
 org.apache.mina.common.ByteBuffer getData()
           
 AMQMessageDelegate getDelegate()
           
 long getDeliveryTag()
          Get the AMQ message number assigned to this message
 double getDoubleProperty(String s)
           
 String getEncoding()
           
 float getFloatProperty(String s)
           
 int getIntProperty(String s)
           
 String getJMSCorrelationID()
           
 byte[] getJMSCorrelationIDAsBytes()
           
 int getJMSDeliveryMode()
           
 Destination getJMSDestination()
           
 long getJMSExpiration()
           
 String getJMSMessageID()
           
 int getJMSPriority()
           
 boolean getJMSRedelivered()
           
 Destination getJMSReplyTo()
           
 long getJMSTimestamp()
           
 String getJMSType()
           
 long getLongProperty(String s)
           
protected abstract  String getMimeType()
           
 Object getObjectProperty(String s)
           
 Enumeration getPropertyNames()
           
 String getReplyToString()
           
 short getShortProperty(String s)
           
 String getStringProperty(String s)
           
 void prepareForSending()
          Invoked prior to sending the message.
 boolean propertyExists(String propertyName)
           
 void receivedFromServer()
           
protected  void removeProperty(String propertyName)
           
 void reset()
           
 void setAMQSession(AMQSession s)
          The session is set when CLIENT_ACKNOWLEDGE mode is used so that the CHANNEL ACK can be sent when the user calls acknowledge()
 void setBooleanProperty(String s, boolean b)
           
 void setByteProperty(String s, byte b)
           
 void setContentType(String contentType)
           
 void setDoubleProperty(String s, double v)
           
 void setEncoding(String encoding)
           
 void setFloatProperty(String s, float v)
           
 void setIntProperty(String s, int i)
           
 void setJMSCorrelationID(String correlationId)
           
 void setJMSCorrelationIDAsBytes(byte[] bytes)
           
 void setJMSDeliveryMode(int i)
           
 void setJMSDestination(Destination destination)
           
 void setJMSExpiration(long l)
           
 void setJMSMessageID(String messageId)
           
 void setJMSMessageID(UUID messageId)
           
 void setJMSPriority(int i)
           
 void setJMSRedelivered(boolean b)
           
 void setJMSReplyTo(Destination destination)
           
 void setJMSTimestamp(long timestamp)
           
 void setJMSType(String string)
           
 void setLongProperty(String s, long l)
           
 void setObjectProperty(String s, Object o)
           
 void setShortProperty(String s, short i)
           
 void setStringProperty(String s, String s1)
           
abstract  String toBodyString()
          Get a String representation of the body of the message.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_data

protected org.apache.mina.common.ByteBuffer _data

_readableMessage

protected boolean _readableMessage

_changedData

protected boolean _changedData

_delegate

protected AMQMessageDelegate _delegate
If the acknowledge mode is CLIENT_ACKNOWLEDGE the session is required

Constructor Detail

AbstractJMSMessage

protected AbstractJMSMessage(AMQMessageDelegateFactory delegateFactory,
                             org.apache.mina.common.ByteBuffer data)

AbstractJMSMessage

protected AbstractJMSMessage(AMQMessageDelegate delegate,
                             org.apache.mina.common.ByteBuffer data)
                      throws org.apache.qpid.AMQException
Throws:
org.apache.qpid.AMQException
Method Detail

getJMSMessageID

public String getJMSMessageID()
                       throws JMSException
Specified by:
getJMSMessageID in interface Message
Throws:
JMSException

setJMSMessageID

public void setJMSMessageID(String messageId)
                     throws JMSException
Specified by:
setJMSMessageID in interface Message
Throws:
JMSException

setJMSMessageID

public void setJMSMessageID(UUID messageId)
                     throws JMSException
Throws:
JMSException

getJMSTimestamp

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

setJMSTimestamp

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

getJMSCorrelationIDAsBytes

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

setJMSCorrelationIDAsBytes

public void setJMSCorrelationIDAsBytes(byte[] bytes)
                                throws JMSException
Specified by:
setJMSCorrelationIDAsBytes in interface Message
Throws:
JMSException

setJMSCorrelationID

public void setJMSCorrelationID(String correlationId)
                         throws JMSException
Specified by:
setJMSCorrelationID in interface Message
Throws:
JMSException

getJMSCorrelationID

public String getJMSCorrelationID()
                           throws JMSException
Specified by:
getJMSCorrelationID in interface Message
Throws:
JMSException

getJMSReplyTo

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

setJMSReplyTo

public void setJMSReplyTo(Destination destination)
                   throws JMSException
Specified by:
setJMSReplyTo in interface Message
Throws:
JMSException

getJMSDestination

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

setJMSDestination

public void setJMSDestination(Destination destination)
Specified by:
setJMSDestination in interface Message

getJMSDeliveryMode

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

setJMSDeliveryMode

public void setJMSDeliveryMode(int i)
                        throws JMSException
Specified by:
setJMSDeliveryMode in interface Message
Throws:
JMSException

getJMSRedelivered

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

setJMSRedelivered

public void setJMSRedelivered(boolean b)
                       throws JMSException
Specified by:
setJMSRedelivered in interface Message
Throws:
JMSException

getJMSType

public String getJMSType()
                  throws JMSException
Specified by:
getJMSType in interface Message
Throws:
JMSException

setJMSType

public void setJMSType(String string)
                throws JMSException
Specified by:
setJMSType in interface Message
Throws:
JMSException

getJMSExpiration

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

setJMSExpiration

public void setJMSExpiration(long l)
                      throws JMSException
Specified by:
setJMSExpiration in interface Message
Throws:
JMSException

getJMSPriority

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

setJMSPriority

public void setJMSPriority(int i)
                    throws JMSException
Specified by:
setJMSPriority in interface Message
Throws:
JMSException

propertyExists

public boolean propertyExists(String propertyName)
                       throws JMSException
Specified by:
propertyExists in interface Message
Throws:
JMSException

getBooleanProperty

public boolean getBooleanProperty(String s)
                           throws JMSException
Specified by:
getBooleanProperty in interface Message
Throws:
JMSException

getByteProperty

public byte getByteProperty(String s)
                     throws JMSException
Specified by:
getByteProperty in interface Message
Throws:
JMSException

getShortProperty

public short getShortProperty(String s)
                       throws JMSException
Specified by:
getShortProperty in interface Message
Throws:
JMSException

getIntProperty

public int getIntProperty(String s)
                   throws JMSException
Specified by:
getIntProperty in interface Message
Throws:
JMSException

getLongProperty

public long getLongProperty(String s)
                     throws JMSException
Specified by:
getLongProperty in interface Message
Throws:
JMSException

getFloatProperty

public float getFloatProperty(String s)
                       throws JMSException
Specified by:
getFloatProperty in interface Message
Throws:
JMSException

getDoubleProperty

public double getDoubleProperty(String s)
                         throws JMSException
Specified by:
getDoubleProperty in interface Message
Throws:
JMSException

getStringProperty

public String getStringProperty(String s)
                         throws JMSException
Specified by:
getStringProperty in interface Message
Throws:
JMSException

getObjectProperty

public Object getObjectProperty(String s)
                         throws JMSException
Specified by:
getObjectProperty in interface Message
Throws:
JMSException

getPropertyNames

public Enumeration getPropertyNames()
                             throws JMSException
Specified by:
getPropertyNames in interface Message
Throws:
JMSException

setBooleanProperty

public void setBooleanProperty(String s,
                               boolean b)
                        throws JMSException
Specified by:
setBooleanProperty in interface Message
Throws:
JMSException

setByteProperty

public void setByteProperty(String s,
                            byte b)
                     throws JMSException
Specified by:
setByteProperty in interface Message
Throws:
JMSException

setShortProperty

public void setShortProperty(String s,
                             short i)
                      throws JMSException
Specified by:
setShortProperty in interface Message
Throws:
JMSException

setIntProperty

public void setIntProperty(String s,
                           int i)
                    throws JMSException
Specified by:
setIntProperty in interface Message
Throws:
JMSException

setLongProperty

public void setLongProperty(String s,
                            long l)
                     throws JMSException
Specified by:
setLongProperty in interface Message
Throws:
JMSException

setFloatProperty

public void setFloatProperty(String s,
                             float v)
                      throws JMSException
Specified by:
setFloatProperty in interface Message
Throws:
JMSException

setDoubleProperty

public void setDoubleProperty(String s,
                              double v)
                       throws JMSException
Specified by:
setDoubleProperty in interface Message
Throws:
JMSException

setStringProperty

public void setStringProperty(String s,
                              String s1)
                       throws JMSException
Specified by:
setStringProperty in interface Message
Throws:
JMSException

setObjectProperty

public void setObjectProperty(String s,
                              Object o)
                       throws JMSException
Specified by:
setObjectProperty in interface Message
Throws:
JMSException

clearProperties

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

clearBody

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

acknowledgeThis

public void acknowledgeThis()
                     throws JMSException
Throws:
JMSException

acknowledge

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

clearBodyImpl

public abstract void clearBodyImpl()
                            throws JMSException
This forces concrete classes to implement clearBody()

Throws:
JMSException

toBodyString

public abstract String toBodyString()
                             throws JMSException
Get a String representation of the body of the message. Used in the toString() method which outputs this before message properties.

Throws:
JMSException

getMimeType

protected abstract String getMimeType()

toString

public String toString()
Overrides:
toString in class Object

getDelegate

public AMQMessageDelegate getDelegate()

getData

public org.apache.mina.common.ByteBuffer getData()

checkReadable

protected void checkReadable()
                      throws MessageNotReadableException
Throws:
MessageNotReadableException

checkWritable

protected void checkWritable()
                      throws MessageNotWriteableException
Throws:
MessageNotWriteableException

reset

public void reset()

getContentLength

public int getContentLength()

receivedFromServer

public void receivedFromServer()

setAMQSession

public void setAMQSession(AMQSession s)
The session is set when CLIENT_ACKNOWLEDGE mode is used so that the CHANNEL ACK can be sent when the user calls acknowledge()

Parameters:
s - the AMQ session that delivered this message

getAMQSession

public AMQSession getAMQSession()

getDeliveryTag

public long getDeliveryTag()
Get the AMQ message number assigned to this message

Returns:
the message number

prepareForSending

public void prepareForSending()
                       throws JMSException
Invoked prior to sending the message. Allows the message to be modified if necessary before sending.

Throws:
JMSException

setContentType

public void setContentType(String contentType)

getContentType

public String getContentType()

setEncoding

public void setEncoding(String encoding)

getEncoding

public String getEncoding()

getReplyToString

public String getReplyToString()

removeProperty

protected void removeProperty(String propertyName)
                       throws JMSException
Throws:
JMSException


Licensed to the Apache Software Foundation