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
JMSExceptionpublic MessageImpl(MessageImpl msg)
public void setSession(JmsSession session)
public MessageType getType()
public java.lang.String getJMSMessageID()
getJMSMessageID in interface Messagepublic void setJMSMessageID(java.lang.String id)
setJMSMessageID in interface Messageid - the new message idpublic long getJMSTimestamp()
throws JMSException
getJMSTimestamp in interface MessageJMSExceptionpublic void setJMSTimestamp(long time)
throws JMSException
setJMSTimestamp in interface Messagetime - the message timestampJMSExceptionpublic byte[] getJMSCorrelationIDAsBytes()
throws JMSException
getJMSCorrelationIDAsBytes in interface MessageJMSExceptionpublic void setJMSCorrelationIDAsBytes(byte[] id)
throws JMSException
setJMSCorrelationIDAsBytes in interface Messageid - the correlation idJMSExceptionpublic java.lang.String getJMSCorrelationID()
throws JMSException
getJMSCorrelationID in interface MessageJMSExceptionpublic void setJMSCorrelationID(java.lang.String id)
throws JMSException
setJMSCorrelationID in interface Messageid - the correlation idJMSExceptionpublic Destination getJMSReplyTo() throws JMSException
getJMSReplyTo in interface MessageJMSExceptionpublic void setJMSReplyTo(Destination replyTo) throws JMSException
setJMSReplyTo in interface MessagereplyTo - the destinationJMSExceptionpublic Destination getJMSDestination() throws JMSException
getJMSDestination in interface MessageJMSExceptionpublic void setJMSDestination(Destination destination) throws JMSException
setJMSDestination in interface Messagedestination - the destinationJMSExceptionpublic int getJMSDeliveryMode()
throws JMSException
getJMSDeliveryMode in interface MessageJMSExceptionpublic void setJMSDeliveryMode(int deliveryMode)
throws JMSException
setJMSDeliveryMode in interface MessagedeliveryMode - the delivery modeJMSExceptionpublic boolean getJMSRedelivered()
getJMSRedelivered in interface Messagepublic void setJMSRedelivered(boolean isRedelivered)
setJMSRedelivered in interface MessagedeliveryMode - the delivery modepublic java.lang.String getJMSType()
throws JMSException
getJMSType in interface MessageJMSExceptionpublic void setJMSType(java.lang.String type)
throws JMSException
setJMSType in interface Messagetype - the delivery modeJMSExceptionpublic long getJMSExpiration()
throws JMSException
getJMSExpiration in interface MessageJMSExceptionpublic void setJMSExpiration(long time)
throws JMSException
setJMSExpiration in interface Messagetime - the expiration timeJMSExceptionpublic int getJMSPriority()
getJMSPriority in interface Messagepublic void setJMSPriority(int priority)
setJMSPriority in interface Messagepriority - the prioritypublic void clearProperties()
throws JMSException
clearProperties in interface MessageJMSExceptionpublic boolean propertyExists(java.lang.String name)
throws JMSException
propertyExists in interface MessageJMSExceptionpublic boolean getBooleanProperty(java.lang.String name)
throws JMSException
getBooleanProperty in interface MessageJMSExceptionpublic byte getByteProperty(java.lang.String name)
throws JMSException
getByteProperty in interface MessageJMSExceptionpublic short getShortProperty(java.lang.String name)
throws JMSException
getShortProperty in interface MessageJMSExceptionpublic int getIntProperty(java.lang.String name)
throws JMSException
getIntProperty in interface MessageJMSExceptionpublic long getLongProperty(java.lang.String name)
throws JMSException
getLongProperty in interface MessageJMSExceptionpublic float getFloatProperty(java.lang.String name)
throws JMSException
getFloatProperty in interface MessageJMSExceptionpublic double getDoubleProperty(java.lang.String name)
throws JMSException
getDoubleProperty in interface MessageJMSExceptionpublic java.lang.String getStringProperty(java.lang.String name)
throws JMSException
getStringProperty in interface MessageJMSExceptionpublic java.lang.Object getObjectProperty(java.lang.String name)
throws JMSException
getObjectProperty in interface MessageJMSExceptionpublic java.util.Enumeration getPropertyNames()
throws JMSException
getPropertyNames in interface MessageJMSExceptionpublic void setBooleanProperty(java.lang.String name,
boolean value)
throws JMSException
setBooleanProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void setByteProperty(java.lang.String name,
byte value)
throws JMSException
setByteProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void setShortProperty(java.lang.String name,
short value)
throws JMSException
setShortProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void setIntProperty(java.lang.String name,
int value)
throws JMSException
setIntProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void setLongProperty(java.lang.String name,
long value)
throws JMSException
setLongProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void setFloatProperty(java.lang.String name,
float value)
throws JMSException
setFloatProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void setDoubleProperty(java.lang.String name,
double value)
throws JMSException
setDoubleProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void setStringProperty(java.lang.String name,
java.lang.String value)
throws JMSException
setStringProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void setObjectProperty(java.lang.String name,
java.lang.Object value)
throws JMSException
setObjectProperty in interface Messagename - the property namevalue - the property's valueJMSExceptionpublic void acknowledge()
throws JMSException
acknowledge in interface MessageJMSExceptionpublic void clearBody()
throws JMSException
clearBody in interface MessageJMSExceptionpublic void setReceive()
throws JMSException
JMSExceptionprotected 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.IOExceptionpublic void writeProperties(java.io.OutputStream os)
throws java.io.IOException
java.io.IOExceptionpublic void readProperties(java.io.InputStream is)
throws java.io.IOException,
JMSException
java.io.IOExceptionJMSExceptionpublic java.io.InputStream bodyToInputStream()
throws java.io.IOException
java.io.IOExceptionpublic void writeBody(java.io.OutputStream os)
throws java.io.IOException
java.io.IOExceptionpublic void readBody(java.io.InputStream is)
throws java.io.IOException,
JMSException
java.io.IOExceptionJMSExceptionprotected void checkHeaderWriteable()
throws JMSException
JMSExceptionprotected void checkPropertyWriteable()
throws JMSException
JMSExceptionprotected void checkBodyWriteable()
throws JMSException
JMSExceptionprotected void checkBodyReadable()
throws JMSException
JMSExceptionprotected void copy(MessageImpl newMsg)
public java.lang.String toString()
toString in class java.lang.Objectpublic static boolean isReserved(java.lang.String name)