Class AbstractMessage
- java.lang.Object
-
- net.timewalker.ffmq4.common.message.AbstractMessage
-
- All Implemented Interfaces:
javax.jms.Message
- Direct Known Subclasses:
BytesMessageImpl,EmptyMessageImpl,MapMessageImpl,ObjectMessageImpl,StreamMessageImpl,TextMessageImpl
public abstract class AbstractMessage extends Object implements javax.jms.Message
Base implementation for a JMS message
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanbodyIsReadOnly
-
Constructor Summary
Constructors Constructor Description AbstractMessage()Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidacknowledge()protected voidassertDeserializationLevel(int targetLevel)voidclearProperties()abstract AbstractMessagecopy()Create an independant copy of this messageprotected voidcopyCommonFields(AbstractMessage clone)Create an independant copy of this messagevoidensureDeserializationLevel(int targetLevel)booleangetBooleanProperty(String name)bytegetByteProperty(String name)doublegetDoubleProperty(String name)floatgetFloatProperty(String name)intgetIntProperty(String name)StringgetJMSCorrelationID()byte[]getJMSCorrelationIDAsBytes()intgetJMSDeliveryMode()javax.jms.DestinationgetJMSDestination()longgetJMSExpiration()StringgetJMSMessageID()intgetJMSPriority()booleangetJMSRedelivered()javax.jms.DestinationgetJMSReplyTo()longgetJMSTimestamp()StringgetJMSType()longgetLongProperty(String name)ObjectgetObjectProperty(String name)Enumeration<String>getPropertyNames()RawDataBuffergetRawMessage()Get the raw message form if availableprotected AbstractSessiongetSession()Get the parent sessionshortgetShortProperty(String name)StringgetStringProperty(String name)protected abstract bytegetType()Get the type value for this messageprotected voidinitializeFromRaw(RawDataBuffer rawMessage)Initialize the message from the given raw databooleanisInternalCopy()Test if this message is an internal copyvoidmarkAsReadOnly()booleanpropertyExists(String name)protected Map<String,Object>readMapFrom(RawDataBuffer in)Write a map to the given output streamprotected abstract voidserializeBodyTo(RawDataBuffer out)protected voidserializeTo(RawDataBuffer out)Write the message content to the given output streamvoidsetBooleanProperty(String name, boolean value)voidsetByteProperty(String name, byte value)voidsetDoubleProperty(String name, double value)voidsetFloatProperty(String name, float value)voidsetInternalCopy(boolean copy)Set if this message is an internal copyvoidsetIntProperty(String name, int value)voidsetJMSCorrelationID(String correlationID)voidsetJMSCorrelationIDAsBytes(byte[] correlationID)voidsetJMSDeliveryMode(int deliveryMode)voidsetJMSDestination(javax.jms.Destination destination)voidsetJMSExpiration(long expiration)voidsetJMSMessageID(String id)voidsetJMSPriority(int priority)voidsetJMSRedelivered(boolean redelivered)voidsetJMSReplyTo(javax.jms.Destination replyTo)voidsetJMSTimestamp(long timestamp)voidsetJMSType(String type)voidsetLongProperty(String name, long value)voidsetObjectProperty(String name, Object value)voidsetSession(AbstractSession session)Set the message sessionvoidsetShortProperty(String name, short value)voidsetStringProperty(String name, String value)StringtoString()protected abstract voidunserializeBodyFrom(RawDataBuffer in)protected voidwriteMapTo(Map<String,Object> map, RawDataBuffer out)Write a map to the given output stream
-
-
-
Method Detail
-
getRawMessage
public final RawDataBuffer getRawMessage()
Get the raw message form if available- Returns:
- the raw message form if available
-
copy
public abstract AbstractMessage copy()
Create an independant copy of this message
-
copyCommonFields
protected final void copyCommonFields(AbstractMessage clone)
Create an independant copy of this message
-
setSession
public final void setSession(AbstractSession session) throws javax.jms.JMSException
Set the message session- Throws:
javax.jms.JMSException
-
getSession
protected final AbstractSession getSession() throws javax.jms.JMSException
Get the parent session- Throws:
javax.jms.JMSException
-
acknowledge
public final void acknowledge() throws javax.jms.JMSException- Specified by:
acknowledgein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
clearProperties
public final void clearProperties()
- Specified by:
clearPropertiesin interfacejavax.jms.Message
-
getBooleanProperty
public final boolean getBooleanProperty(String name) throws javax.jms.JMSException
- Specified by:
getBooleanPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getByteProperty
public final byte getByteProperty(String name) throws javax.jms.JMSException
- Specified by:
getBytePropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getDoubleProperty
public final double getDoubleProperty(String name) throws javax.jms.JMSException
- Specified by:
getDoublePropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getFloatProperty
public final float getFloatProperty(String name) throws javax.jms.JMSException
- Specified by:
getFloatPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getIntProperty
public final int getIntProperty(String name) throws javax.jms.JMSException
- Specified by:
getIntPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getJMSCorrelationID
public final String getJMSCorrelationID()
- Specified by:
getJMSCorrelationIDin interfacejavax.jms.Message
-
getJMSCorrelationIDAsBytes
public final byte[] getJMSCorrelationIDAsBytes()
- Specified by:
getJMSCorrelationIDAsBytesin interfacejavax.jms.Message
-
getJMSDeliveryMode
public final int getJMSDeliveryMode()
- Specified by:
getJMSDeliveryModein interfacejavax.jms.Message
-
getJMSDestination
public final javax.jms.Destination getJMSDestination()
- Specified by:
getJMSDestinationin interfacejavax.jms.Message
-
getJMSExpiration
public final long getJMSExpiration()
- Specified by:
getJMSExpirationin interfacejavax.jms.Message
-
getJMSMessageID
public final String getJMSMessageID()
- Specified by:
getJMSMessageIDin interfacejavax.jms.Message
-
getJMSPriority
public final int getJMSPriority()
- Specified by:
getJMSPriorityin interfacejavax.jms.Message
-
getJMSRedelivered
public final boolean getJMSRedelivered()
- Specified by:
getJMSRedeliveredin interfacejavax.jms.Message
-
getJMSReplyTo
public final javax.jms.Destination getJMSReplyTo()
- Specified by:
getJMSReplyToin interfacejavax.jms.Message
-
getJMSTimestamp
public final long getJMSTimestamp()
- Specified by:
getJMSTimestampin interfacejavax.jms.Message
-
getJMSType
public final String getJMSType()
- Specified by:
getJMSTypein interfacejavax.jms.Message
-
getLongProperty
public final long getLongProperty(String name) throws javax.jms.JMSException
- Specified by:
getLongPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getObjectProperty
public final Object getObjectProperty(String name)
- Specified by:
getObjectPropertyin interfacejavax.jms.Message
-
getShortProperty
public final short getShortProperty(String name) throws javax.jms.JMSException
- Specified by:
getShortPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getStringProperty
public final String getStringProperty(String name) throws javax.jms.JMSException
- Specified by:
getStringPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
propertyExists
public final boolean propertyExists(String name)
- Specified by:
propertyExistsin interfacejavax.jms.Message
-
setBooleanProperty
public final void setBooleanProperty(String name, boolean value) throws javax.jms.JMSException
- Specified by:
setBooleanPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setByteProperty
public final void setByteProperty(String name, byte value) throws javax.jms.JMSException
- Specified by:
setBytePropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setDoubleProperty
public final void setDoubleProperty(String name, double value) throws javax.jms.JMSException
- Specified by:
setDoublePropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setFloatProperty
public final void setFloatProperty(String name, float value) throws javax.jms.JMSException
- Specified by:
setFloatPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setIntProperty
public final void setIntProperty(String name, int value) throws javax.jms.JMSException
- Specified by:
setIntPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSCorrelationID
public final void setJMSCorrelationID(String correlationID)
- Specified by:
setJMSCorrelationIDin interfacejavax.jms.Message
-
setJMSCorrelationIDAsBytes
public final void setJMSCorrelationIDAsBytes(byte[] correlationID)
- Specified by:
setJMSCorrelationIDAsBytesin interfacejavax.jms.Message
-
setJMSDeliveryMode
public final void setJMSDeliveryMode(int deliveryMode) throws javax.jms.JMSException- Specified by:
setJMSDeliveryModein interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSDestination
public final void setJMSDestination(javax.jms.Destination destination) throws javax.jms.JMSException- Specified by:
setJMSDestinationin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSExpiration
public final void setJMSExpiration(long expiration)
- Specified by:
setJMSExpirationin interfacejavax.jms.Message
-
setJMSMessageID
public final void setJMSMessageID(String id) throws javax.jms.JMSException
- Specified by:
setJMSMessageIDin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSPriority
public final void setJMSPriority(int priority) throws javax.jms.JMSException- Specified by:
setJMSPriorityin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setJMSRedelivered
public final void setJMSRedelivered(boolean redelivered)
- Specified by:
setJMSRedeliveredin interfacejavax.jms.Message
-
setJMSReplyTo
public final void setJMSReplyTo(javax.jms.Destination replyTo)
- Specified by:
setJMSReplyToin interfacejavax.jms.Message
-
setJMSTimestamp
public final void setJMSTimestamp(long timestamp)
- Specified by:
setJMSTimestampin interfacejavax.jms.Message
-
setJMSType
public final void setJMSType(String type)
- Specified by:
setJMSTypein interfacejavax.jms.Message
-
setLongProperty
public final void setLongProperty(String name, long value) throws javax.jms.JMSException
- Specified by:
setLongPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setObjectProperty
public final void setObjectProperty(String name, Object value) throws javax.jms.JMSException
- Specified by:
setObjectPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setShortProperty
public final void setShortProperty(String name, short value) throws javax.jms.JMSException
- Specified by:
setShortPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
setStringProperty
public final void setStringProperty(String name, String value) throws javax.jms.JMSException
- Specified by:
setStringPropertyin interfacejavax.jms.Message- Throws:
javax.jms.JMSException
-
getPropertyNames
public final Enumeration<String> getPropertyNames()
- Specified by:
getPropertyNamesin interfacejavax.jms.Message
-
isInternalCopy
public final boolean isInternalCopy()
Test if this message is an internal copy
-
setInternalCopy
public final void setInternalCopy(boolean copy)
Set if this message is an internal copy
-
getType
protected abstract byte getType()
Get the type value for this message
-
serializeTo
protected final void serializeTo(RawDataBuffer out)
Write the message content to the given output stream
-
initializeFromRaw
protected final void initializeFromRaw(RawDataBuffer rawMessage)
Initialize the message from the given raw data
-
ensureDeserializationLevel
public final void ensureDeserializationLevel(int targetLevel)
-
assertDeserializationLevel
protected final void assertDeserializationLevel(int targetLevel)
-
markAsReadOnly
public final void markAsReadOnly()
-
serializeBodyTo
protected abstract void serializeBodyTo(RawDataBuffer out)
-
unserializeBodyFrom
protected abstract void unserializeBodyFrom(RawDataBuffer in)
-
writeMapTo
protected final void writeMapTo(Map<String,Object> map, RawDataBuffer out)
Write a map to the given output stream
-
readMapFrom
protected final Map<String,Object> readMapFrom(RawDataBuffer in)
Write a map to the given output stream
-
-