org.exolab.jmscts.jms.message
Class BasicMessage

java.lang.Object
  |
  +--org.exolab.jmscts.jms.message.BasicMessage
All Implemented Interfaces:
javax.jms.Message
Direct Known Subclasses:
BasicBytesMessage, BasicMapMessage, BasicObjectMessage, BasicStreamMessage, BasicTextMessage

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

This class provides a basic implementation of the javax.jms.Message interface.

Version:
$Revision: 1.2 $ $Date: 2004/02/02 03:49:55 $
Author:
Tim Anderson
See Also:
Message

Fields inherited from interface javax.jms.Message
DEFAULT_DELIVERY_MODE, DEFAULT_PRIORITY, DEFAULT_TIME_TO_LIVE
 
Constructor Summary
BasicMessage()
          Construct a new BasicMessage
 
Method Summary
 void acknowledge()
          No-op.
protected  void checkPropertyWrite()
          Determines if properties may be set
protected  void checkRead()
          Determines if the message body may be read
protected  void checkWrite()
          Determines if the message body may be written
 void clearBody()
          Clear the message body
 void clearProperties()
          Clear the message properties
protected  boolean getBodyReadOnly()
          Determines if the message body is read only
 boolean getBooleanProperty(java.lang.String name)
          Returns the boolean property value with the give name
 byte getByteProperty(java.lang.String name)
          Returns the byte property value with the give name
 double getDoubleProperty(java.lang.String name)
          Returns the double property value with the give name
 float getFloatProperty(java.lang.String name)
          Returns the float property value with the give name
 int getIntProperty(java.lang.String name)
          Returns the int property value with the give name
 java.lang.String getJMSCorrelationID()
          Get the correlation ID for the message
 byte[] getJMSCorrelationIDAsBytes()
          Get the correlation ID as an array of bytes
 int getJMSDeliveryMode()
          Get the message delivery mode
 javax.jms.Destination getJMSDestination()
          Get the message destination
 long getJMSExpiration()
          Get the message's expiration value
 java.lang.String getJMSMessageID()
          Get the message ID
 int getJMSPriority()
          Get the message priority
 boolean getJMSRedelivered()
          Determine if the message is being delivered
 javax.jms.Destination getJMSReplyTo()
          Get the reply-to destination
 long getJMSTimestamp()
          Get the message timestamp
 java.lang.String getJMSType()
          Get the message type
 long getLongProperty(java.lang.String name)
          Returns the long property value with the give name
 java.lang.Object getObjectProperty(java.lang.String name)
          Returns the Object property value with the give name
protected  boolean getPropertiesReadOnly()
          Determines if the message properties are read only
 java.util.Enumeration getPropertyNames()
          Return an enumeration of all the property names
 short getShortProperty(java.lang.String name)
          Returns the short property value with the give name
 java.lang.String getStringProperty(java.lang.String name)
          Returns the String property value with the give name
 boolean propertyExists(java.lang.String name)
          Determines if a property exists
protected  void setBodyReadOnly(boolean readOnly)
          Sets the read-only state of the message body
 void setBooleanProperty(java.lang.String name, boolean value)
          Set a boolean property value with the given name
 void setByteProperty(java.lang.String name, byte value)
          Set a byte property value with the given name
 void setDoubleProperty(java.lang.String name, double value)
          Set a double property value with the given name
 void setFloatProperty(java.lang.String name, float value)
          Set a float property value with the given name
 void setIntProperty(java.lang.String name, int value)
          Set an int property value with the given name
 void setJMSCorrelationID(java.lang.String correlationID)
          Set the correlation ID
 void setJMSCorrelationIDAsBytes(byte[] correlationID)
          Set the correlation ID as an array of bytes
 void setJMSDeliveryMode(int deliveryMode)
          Set the message delivery mode
 void setJMSDestination(javax.jms.Destination destination)
          Set the message destination
 void setJMSExpiration(long expiration)
          Set the message's expiration value
 void setJMSMessageID(java.lang.String messageID)
          Set the message ID
 void setJMSPriority(int priority)
          Set the message priority
 void setJMSRedelivered(boolean redelivered)
          Set to indicate if the message is being redelivered
 void setJMSReplyTo(javax.jms.Destination replyTo)
          Set the reply-to destination
 void setJMSTimestamp(long timestamp)
          Set the message timetamp
 void setJMSType(java.lang.String type)
          Set the message type
 void setLongProperty(java.lang.String name, long value)
          Set a long property value with the given name
 void setObjectProperty(java.lang.String name, java.lang.Object value)
          Set an Object property value with the given name
protected  void setPropertiesReadOnly(boolean readOnly)
          Sets the read-only state of the message properties
 void setReadOnly(boolean readOnly)
          Sets the read-only state of the message
 void setShortProperty(java.lang.String name, short value)
          Set a short property value with the given name
 void setStringProperty(java.lang.String name, java.lang.String value)
          Set a String property value with the given name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMessage

public BasicMessage()
Construct a new BasicMessage
Method Detail

acknowledge

public void acknowledge()
No-op.
Specified by:
acknowledge in interface javax.jms.Message

clearBody

public void clearBody()
               throws javax.jms.JMSException
Clear the message body
Specified by:
clearBody in interface javax.jms.Message
Throws:
javax.jms.JMSException - for any error

clearProperties

public void clearProperties()
Clear the message properties
Specified by:
clearProperties in interface javax.jms.Message

getJMSMessageID

public java.lang.String getJMSMessageID()
Get the message ID
Specified by:
getJMSMessageID in interface javax.jms.Message
Returns:
the message ID

setJMSMessageID

public void setJMSMessageID(java.lang.String messageID)
Set the message ID
Specified by:
setJMSMessageID in interface javax.jms.Message
Parameters:
messageID - the message ID

getJMSType

public java.lang.String getJMSType()
Get the message type
Specified by:
getJMSType in interface javax.jms.Message
Returns:
the message type

setJMSType

public void setJMSType(java.lang.String type)
Set the message type
Specified by:
setJMSType in interface javax.jms.Message
Parameters:
type - the message type

getJMSTimestamp

public long getJMSTimestamp()
Get the message timestamp
Specified by:
getJMSTimestamp in interface javax.jms.Message
Returns:
the message timestamp

setJMSTimestamp

public void setJMSTimestamp(long timestamp)
Set the message timetamp
Specified by:
setJMSTimestamp in interface javax.jms.Message
Parameters:
timestamp - the message timestamp

getJMSCorrelationID

public java.lang.String getJMSCorrelationID()
Get the correlation ID for the message
Specified by:
getJMSCorrelationID in interface javax.jms.Message
Returns:
the correlation ID for the message

setJMSCorrelationID

public void setJMSCorrelationID(java.lang.String correlationID)
Set the correlation ID
Specified by:
setJMSCorrelationID in interface javax.jms.Message
Parameters:
correlationID - the correlation ID

getJMSCorrelationIDAsBytes

public byte[] getJMSCorrelationIDAsBytes()
Get the correlation ID as an array of bytes
Specified by:
getJMSCorrelationIDAsBytes in interface javax.jms.Message
Returns:
the correlation ID as an array of bytes

setJMSCorrelationIDAsBytes

public void setJMSCorrelationIDAsBytes(byte[] correlationID)
Set the correlation ID as an array of bytes
Specified by:
setJMSCorrelationIDAsBytes in interface javax.jms.Message
Parameters:
correlationID - the correlation ID as an array of bytes

getJMSDestination

public javax.jms.Destination getJMSDestination()
Get the message destination
Specified by:
getJMSDestination in interface javax.jms.Message
Returns:
the message destination

setJMSDestination

public void setJMSDestination(javax.jms.Destination destination)
Set the message destination
Specified by:
setJMSDestination in interface javax.jms.Message
Parameters:
destination - the message destination

getJMSReplyTo

public javax.jms.Destination getJMSReplyTo()
Get the reply-to destination
Specified by:
getJMSReplyTo in interface javax.jms.Message
Returns:
the reply-to destination

setJMSReplyTo

public void setJMSReplyTo(javax.jms.Destination replyTo)
Set the reply-to destination
Specified by:
setJMSReplyTo in interface javax.jms.Message
Parameters:
replyTo - the reply-to destination

getJMSDeliveryMode

public int getJMSDeliveryMode()
Get the message delivery mode
Specified by:
getJMSDeliveryMode in interface javax.jms.Message
Returns:
the message delivery mode

setJMSDeliveryMode

public void setJMSDeliveryMode(int deliveryMode)
Set the message delivery mode
Specified by:
setJMSDeliveryMode in interface javax.jms.Message
Parameters:
deliveryMode - the message delivery mode

getJMSExpiration

public long getJMSExpiration()
Get the message's expiration value
Specified by:
getJMSExpiration in interface javax.jms.Message
Returns:
the message's expiration value

setJMSExpiration

public void setJMSExpiration(long expiration)
Set the message's expiration value
Specified by:
setJMSExpiration in interface javax.jms.Message
Parameters:
expiration - the message's expiration value

getJMSPriority

public int getJMSPriority()
Get the message priority
Specified by:
getJMSPriority in interface javax.jms.Message
Returns:
the message priority

setJMSPriority

public void setJMSPriority(int priority)
Set the message priority
Specified by:
setJMSPriority in interface javax.jms.Message
Parameters:
priority - the message priority

getJMSRedelivered

public boolean getJMSRedelivered()
Determine if the message is being delivered
Specified by:
getJMSRedelivered in interface javax.jms.Message
Returns:
true if the message is being delivered

setJMSRedelivered

public void setJMSRedelivered(boolean redelivered)
Set to indicate if the message is being redelivered
Specified by:
setJMSRedelivered in interface javax.jms.Message
Parameters:
redelivered - if true indicates the message is being delivered

propertyExists

public boolean propertyExists(java.lang.String name)
Determines if a property exists
Specified by:
propertyExists in interface javax.jms.Message
Parameters:
name - the property name
Returns:
true if the property exists

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name)
                           throws javax.jms.MessageFormatException
Returns the boolean property value with the give name
Specified by:
getBooleanProperty in interface javax.jms.Message
Parameters:
name - the name of the boolean property
Returns:
the boolean property value with the given name
Throws:
javax.jms.MessageFormatException - if the type conversion is invalid

setBooleanProperty

public void setBooleanProperty(java.lang.String name,
                               boolean value)
Set a boolean property value with the given name
Specified by:
setBooleanProperty in interface javax.jms.Message
Parameters:
name - the name of the boolean property
value - the boolean property value

getByteProperty

public byte getByteProperty(java.lang.String name)
                     throws javax.jms.MessageFormatException
Returns the byte property value with the give name
Specified by:
getByteProperty in interface javax.jms.Message
Parameters:
name - the name of the byte property
Returns:
the byte property value with the given name
Throws:
javax.jms.MessageFormatException - if the type conversion is invalid

setByteProperty

public void setByteProperty(java.lang.String name,
                            byte value)
Set a byte property value with the given name
Specified by:
setByteProperty in interface javax.jms.Message
Parameters:
name - the name of the byte property
value - the byte property value

getShortProperty

public short getShortProperty(java.lang.String name)
                       throws javax.jms.MessageFormatException
Returns the short property value with the give name
Specified by:
getShortProperty in interface javax.jms.Message
Parameters:
name - the name of the short property
Returns:
the short property value with the given name
Throws:
javax.jms.MessageFormatException - if the type conversion is invalid

setShortProperty

public void setShortProperty(java.lang.String name,
                             short value)
Set a short property value with the given name
Specified by:
setShortProperty in interface javax.jms.Message
Parameters:
name - the name of the short property
value - the short property value

getIntProperty

public int getIntProperty(java.lang.String name)
                   throws javax.jms.MessageFormatException
Returns the int property value with the give name
Specified by:
getIntProperty in interface javax.jms.Message
Parameters:
name - the name of the int property
Returns:
the int property value with the given name
Throws:
javax.jms.MessageFormatException - if the type conversion is invalid

setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
Set an int property value with the given name
Specified by:
setIntProperty in interface javax.jms.Message
Parameters:
name - the name of the int property
value - the int property value

getLongProperty

public long getLongProperty(java.lang.String name)
                     throws javax.jms.MessageFormatException
Returns the long property value with the give name
Specified by:
getLongProperty in interface javax.jms.Message
Parameters:
name - the name of the long property
Returns:
the long property value with the given name
Throws:
javax.jms.MessageFormatException - if the type conversion is invalid

setLongProperty

public void setLongProperty(java.lang.String name,
                            long value)
Set a long property value with the given name
Specified by:
setLongProperty in interface javax.jms.Message
Parameters:
name - the name of the long property
value - the long property value

getFloatProperty

public float getFloatProperty(java.lang.String name)
                       throws javax.jms.MessageFormatException
Returns the float property value with the give name
Specified by:
getFloatProperty in interface javax.jms.Message
Parameters:
name - the name of the float property
Returns:
the float property value with the given name
Throws:
javax.jms.MessageFormatException - if the type conversion is invalid

setFloatProperty

public void setFloatProperty(java.lang.String name,
                             float value)
Set a float property value with the given name
Specified by:
setFloatProperty in interface javax.jms.Message
Parameters:
name - the name of the float property
value - the float property value

getDoubleProperty

public double getDoubleProperty(java.lang.String name)
                         throws javax.jms.MessageFormatException
Returns the double property value with the give name
Specified by:
getDoubleProperty in interface javax.jms.Message
Parameters:
name - the name of the double property
Returns:
the double property value with the given name
Throws:
javax.jms.MessageFormatException - if the type conversion is invalid

setDoubleProperty

public void setDoubleProperty(java.lang.String name,
                              double value)
Set a double property value with the given name
Specified by:
setDoubleProperty in interface javax.jms.Message
Parameters:
name - the name of the double property
value - the double property value

getStringProperty

public java.lang.String getStringProperty(java.lang.String name)
                                   throws javax.jms.MessageFormatException
Returns the String property value with the give name
Specified by:
getStringProperty in interface javax.jms.Message
Parameters:
name - the name of the String property
Returns:
the String property value with the given name
Throws:
javax.jms.MessageFormatException - if the type conversion is invalid

setStringProperty

public void setStringProperty(java.lang.String name,
                              java.lang.String value)
Set a String property value with the given name
Specified by:
setStringProperty in interface javax.jms.Message
Parameters:
name - the name of the String property
value - the String property value

getObjectProperty

public java.lang.Object getObjectProperty(java.lang.String name)
Returns the Object property value with the give name
Specified by:
getObjectProperty in interface javax.jms.Message
Parameters:
name - the name of the Object property
Returns:
the Object property value with the given name

setObjectProperty

public void setObjectProperty(java.lang.String name,
                              java.lang.Object value)
Set an Object property value with the given name
Specified by:
setObjectProperty in interface javax.jms.Message
Parameters:
name - the name of the Object property
value - the Object property value

getPropertyNames

public java.util.Enumeration getPropertyNames()
Return an enumeration of all the property names
Specified by:
getPropertyNames in interface javax.jms.Message
Returns:
an enumeration of all the property names

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws javax.jms.JMSException
Sets the read-only state of the message
Parameters:
readOnly - if true, make the message body and properties read-only
Throws:
javax.jms.JMSException - if the read-only state cannot be changed

getPropertiesReadOnly

protected boolean getPropertiesReadOnly()
Determines if the message properties are read only
Returns:
true if the message properties are read only

setPropertiesReadOnly

protected void setPropertiesReadOnly(boolean readOnly)
Sets the read-only state of the message properties
Parameters:
readOnly - if true, make the message properties read-only

getBodyReadOnly

protected boolean getBodyReadOnly()
Determines if the message body is read only
Returns:
true if the message body is read only

setBodyReadOnly

protected void setBodyReadOnly(boolean readOnly)
Sets the read-only state of the message body
Parameters:
readOnly - if true, make the message body

checkPropertyWrite

protected void checkPropertyWrite()
                           throws javax.jms.MessageNotWriteableException
Determines if properties may be set
Throws:
javax.jms.MessageNotWriteableException - if message is read-only

checkWrite

protected void checkWrite()
                   throws javax.jms.MessageNotWriteableException
Determines if the message body may be written
Throws:
javax.jms.MessageNotWriteableException - if the message is read-only

checkRead

protected void checkRead()
                  throws javax.jms.MessageNotReadableException
Determines if the message body may be read
Throws:
javax.jms.MessageNotReadableException - if the message is write-only


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.