public class MessageImpl extends java.lang.Object implements Message, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected static L10N |
L |
protected static java.util.logging.Logger |
log |
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
Constructor and Description |
---|
MessageImpl() |
MessageImpl(Message msg)
Create a message, copying the properties
|
MessageImpl(MessageImpl msg) |
Modifier and Type | Method and Description |
---|---|
void |
acknowledge()
Acknowledge receipt of this message.
|
java.io.InputStream |
bodyToInputStream()
Serialize the body to an input stream.
|
protected void |
checkBodyReadable() |
protected void |
checkBodyWriteable() |
protected void |
checkHeaderWriteable() |
protected void |
checkPropertyWriteable() |
void |
clearBody()
Clears the body, setting write mode.
|
void |
clearProperties()
Clears the message properties, making them writeable.
|
MessageImpl |
copy() |
protected void |
copy(MessageImpl newMsg) |
boolean |
getBooleanProperty(java.lang.String name)
Returns a boolean property with the given name.
|
byte |
getByteProperty(java.lang.String name)
Returns a property as a byte
|
double |
getDoubleProperty(java.lang.String name)
Returns a property as a double
|
float |
getFloatProperty(java.lang.String name)
Returns a property as a float
|
int |
getIntProperty(java.lang.String name)
Returns a property as an integer
|
java.lang.String |
getJMSCorrelationID()
Returns the correlation id.
|
byte[] |
getJMSCorrelationIDAsBytes()
Returns the correlation id.
|
int |
getJMSDeliveryMode()
Gets the delivery model
|
Destination |
getJMSDestination()
Gets the destination
|
long |
getJMSExpiration()
Returns the message expiration time.
|
java.lang.String |
getJMSMessageID()
Returns the message id.
|
int |
getJMSPriority()
Returns the message priority.
|
boolean |
getJMSRedelivered()
Returns if the message is being redelivered.
|
Destination |
getJMSReplyTo()
Gets the reply-to destination
|
long |
getJMSTimestamp()
Returns the time the message was sent.
|
java.lang.String |
getJMSType()
Returns the message type
|
long |
getLongProperty(java.lang.String name)
Returns a property as a long
|
java.lang.Object |
getObjectProperty(java.lang.String name)
Returns a string property.
|
java.util.HashMap<java.lang.String,java.lang.Object> |
getProperties()
Returns the properties.
|
java.util.Enumeration |
getPropertyNames()
Returns an enumeration of the message's properties.
|
long |
getSequence() |
short |
getShortProperty(java.lang.String name)
Returns a property as a short
|
java.lang.String |
getStringProperty(java.lang.String name)
Returns a string property.
|
MessageType |
getType()
Returns the type enumeration.
|
static boolean |
isReserved(java.lang.String name) |
java.io.InputStream |
propertiesToInputStream()
Serialize the properties to an input stream.
|
boolean |
propertyExists(java.lang.String name)
Returns true if the property exists.
|
void |
readBody(java.io.InputStream is)
Read the body from an input stream.
|
void |
readProperties(java.io.InputStream is)
Read the properties from an input stream.
|
protected void |
setBodyReadOnly()
Sets the body for reading.
|
void |
setBooleanProperty(java.lang.String name,
boolean value)
Sets a boolean property.
|
void |
setByteProperty(java.lang.String name,
byte value)
Sets a byte property.
|
void |
setDoubleProperty(java.lang.String name,
double value)
Sets a double property.
|
void |
setFloatProperty(java.lang.String name,
float value)
Sets a float property.
|
void |
setIntProperty(java.lang.String name,
int value)
Sets an integer property.
|
void |
setJMSCorrelationID(java.lang.String id)
Sets the correlation id.
|
void |
setJMSCorrelationIDAsBytes(byte[] id)
Sets the correlation id.
|
void |
setJMSDeliveryMode(int deliveryMode)
Sets the delivery mode
|
void |
setJMSDestination(Destination destination)
Sets the reply-to destination
|
void |
setJMSExpiration(long time)
Sets the message expiration type.
|
void |
setJMSMessageID(java.lang.String id)
Sets the message id.
|
void |
setJMSPriority(int priority)
Sets the message priority.
|
void |
setJMSRedelivered(boolean isRedelivered)
Sets if the message is being redelivered.
|
void |
setJMSReplyTo(Destination replyTo)
Sets the reply-to destination
|
void |
setJMSTimestamp(long time)
Sets the time the message was sent.
|
void |
setJMSType(java.lang.String type)
Sets the message type.
|
void |
setLongProperty(java.lang.String name,
long value)
Sets a long property.
|
void |
setObjectProperty(java.lang.String name,
java.lang.Object value)
Sets an object property.
|
void |
setReceive()
Sets the body for reading.
|
void |
setSequence(long seq) |
void |
setSession(JmsSession session)
Sets the session.
|
void |
setShortProperty(java.lang.String name,
short value)
Sets a short property.
|
void |
setStringProperty(java.lang.String name,
java.lang.String value)
Sets a string property.
|
java.lang.String |
toString() |
void |
writeBody(java.io.OutputStream os)
Serialize the body to an output stream.
|
void |
writeProperties(java.io.OutputStream os)
Serialize the properties to an input stream.
|
protected static final java.util.logging.Logger log
protected static final L10N L
public MessageImpl()
public MessageImpl(Message msg) throws JMSException
JMSException
public MessageImpl(MessageImpl msg)
public void setSession(JmsSession session)
public MessageType getType()
public java.lang.String getJMSMessageID()
getJMSMessageID
in interface Message
public void setJMSMessageID(java.lang.String id)
setJMSMessageID
in interface Message
id
- the new message idpublic long getJMSTimestamp() throws JMSException
getJMSTimestamp
in interface Message
JMSException
public void setJMSTimestamp(long time) throws JMSException
setJMSTimestamp
in interface Message
time
- the message timestampJMSException
public byte[] getJMSCorrelationIDAsBytes() throws JMSException
getJMSCorrelationIDAsBytes
in interface Message
JMSException
public void setJMSCorrelationIDAsBytes(byte[] id) throws JMSException
setJMSCorrelationIDAsBytes
in interface Message
id
- the correlation idJMSException
public java.lang.String getJMSCorrelationID() throws JMSException
getJMSCorrelationID
in interface Message
JMSException
public void setJMSCorrelationID(java.lang.String id) throws JMSException
setJMSCorrelationID
in interface Message
id
- the correlation idJMSException
public Destination getJMSReplyTo() throws JMSException
getJMSReplyTo
in interface Message
JMSException
public void setJMSReplyTo(Destination replyTo) throws JMSException
setJMSReplyTo
in interface Message
replyTo
- the destinationJMSException
public Destination getJMSDestination() throws JMSException
getJMSDestination
in interface Message
JMSException
public void setJMSDestination(Destination destination) throws JMSException
setJMSDestination
in interface Message
destination
- the destinationJMSException
public int getJMSDeliveryMode() throws JMSException
getJMSDeliveryMode
in interface Message
JMSException
public void setJMSDeliveryMode(int deliveryMode) throws JMSException
setJMSDeliveryMode
in interface Message
deliveryMode
- the delivery modeJMSException
public boolean getJMSRedelivered()
getJMSRedelivered
in interface Message
public void setJMSRedelivered(boolean isRedelivered)
setJMSRedelivered
in interface Message
deliveryMode
- the delivery modepublic java.lang.String getJMSType() throws JMSException
getJMSType
in interface Message
JMSException
public void setJMSType(java.lang.String type) throws JMSException
setJMSType
in interface Message
type
- the delivery modeJMSException
public long getJMSExpiration() throws JMSException
getJMSExpiration
in interface Message
JMSException
public void setJMSExpiration(long time) throws JMSException
setJMSExpiration
in interface Message
time
- the expiration timeJMSException
public int getJMSPriority()
getJMSPriority
in interface Message
public void setJMSPriority(int priority)
setJMSPriority
in interface Message
priority
- the prioritypublic void clearProperties() throws JMSException
clearProperties
in interface Message
JMSException
public boolean propertyExists(java.lang.String name) throws JMSException
propertyExists
in interface Message
JMSException
public boolean getBooleanProperty(java.lang.String name) throws JMSException
getBooleanProperty
in interface Message
JMSException
public byte getByteProperty(java.lang.String name) throws JMSException
getByteProperty
in interface Message
JMSException
public short getShortProperty(java.lang.String name) throws JMSException
getShortProperty
in interface Message
JMSException
public int getIntProperty(java.lang.String name) throws JMSException
getIntProperty
in interface Message
JMSException
public long getLongProperty(java.lang.String name) throws JMSException
getLongProperty
in interface Message
JMSException
public float getFloatProperty(java.lang.String name) throws JMSException
getFloatProperty
in interface Message
JMSException
public double getDoubleProperty(java.lang.String name) throws JMSException
getDoubleProperty
in interface Message
JMSException
public java.lang.String getStringProperty(java.lang.String name) throws JMSException
getStringProperty
in interface Message
JMSException
public java.lang.Object getObjectProperty(java.lang.String name) throws JMSException
getObjectProperty
in interface Message
JMSException
public java.util.Enumeration getPropertyNames() throws JMSException
getPropertyNames
in interface Message
JMSException
public void setBooleanProperty(java.lang.String name, boolean value) throws JMSException
setBooleanProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void setByteProperty(java.lang.String name, byte value) throws JMSException
setByteProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void setShortProperty(java.lang.String name, short value) throws JMSException
setShortProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void setIntProperty(java.lang.String name, int value) throws JMSException
setIntProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void setLongProperty(java.lang.String name, long value) throws JMSException
setLongProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void setFloatProperty(java.lang.String name, float value) throws JMSException
setFloatProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void setDoubleProperty(java.lang.String name, double value) throws JMSException
setDoubleProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void setStringProperty(java.lang.String name, java.lang.String value) throws JMSException
setStringProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void setObjectProperty(java.lang.String name, java.lang.Object value) throws JMSException
setObjectProperty
in interface Message
name
- the property namevalue
- the property's valueJMSException
public void acknowledge() throws JMSException
acknowledge
in interface Message
JMSException
public void clearBody() throws JMSException
clearBody
in interface Message
JMSException
public void setReceive() throws JMSException
JMSException
protected void setBodyReadOnly()
public java.util.HashMap<java.lang.String,java.lang.Object> getProperties()
public long getSequence()
public void setSequence(long seq)
public MessageImpl copy()
public java.io.InputStream propertiesToInputStream() throws java.io.IOException
java.io.IOException
public void writeProperties(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public void readProperties(java.io.InputStream is) throws java.io.IOException, JMSException
java.io.IOException
JMSException
public java.io.InputStream bodyToInputStream() throws java.io.IOException
java.io.IOException
public void writeBody(java.io.OutputStream os) throws java.io.IOException
java.io.IOException
public void readBody(java.io.InputStream is) throws java.io.IOException, JMSException
java.io.IOException
JMSException
protected void checkHeaderWriteable() throws JMSException
JMSException
protected void checkPropertyWriteable() throws JMSException
JMSException
protected void checkBodyWriteable() throws JMSException
JMSException
protected void checkBodyReadable() throws JMSException
JMSException
protected void copy(MessageImpl newMsg)
public java.lang.String toString()
toString
in class java.lang.Object
public static boolean isReserved(java.lang.String name)