org.objectweb.joram.shared.messages
Class Message

java.lang.Object
  extended byorg.objectweb.joram.shared.messages.Message
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Message
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

The Message class actually provides the transport facility for the data exchanged during MOM operations.

A message may either carry a String, or a serializable object, or an hashtable, or bytes, even nothing. It is charaterized by properties and "header" fields.

See Also:
Serialized Form

Field Summary
 int acksCounter
          The number of acknowledgements a message still expects from its subscribers before having been fully consumed by them (field used by JMS proxies).
 boolean deletedDest
          true if the message target destination is deleted.
 int deliveryCount
          The number of delivery attempts for this message.
 boolean denied
          true if the message has been denied at least once by a consumer.
 int durableAcksCounter
          The number of acknowledgements a message still expects from its durable subscribers before having been fully consumed by them (field used by JMS proxies).
 boolean expired
          true if the message expired.
 boolean notWriteable
          true if the message could not be written on the dest.
 long order
          Arrival position of this message on its queue or proxy.
 boolean undeliverable
          true if the message is considered as undeliverable.
 
Constructor Summary
Message()
          Constructs a Message instance.
 
Method Summary
 void clearBody()
          Method clearing the message body.
 void clearProperties()
          Empties the properties table.
 java.lang.Object clone()
          Clones the message.
 boolean getBooleanProperty(java.lang.String name)
          Returns a property as a boolean value.
 byte getByteProperty(java.lang.String name)
           
 byte[] getBytes()
          Returns the array of bytes body of the message.
 java.lang.String getCorrelationId()
          Returns the message correlation identifier.
 java.lang.String getDestinationId()
          Returns the message destination identifier.
 double getDoubleProperty(java.lang.String name)
          Returns a property as a double value.
 long getExpiration()
          Returns the message expiration time.
 float getFloatProperty(java.lang.String name)
          Returns a property as a float value.
 java.lang.String getIdentifier()
          Returns the message identifier.
 int getIntProperty(java.lang.String name)
          Returns a property as a int value.
 long getLongProperty(java.lang.String name)
          Returns a property as a long value.
 java.util.Map getMap()
          Returns the map body of the message.
 java.lang.Object getObject()
          Returns the object body of the message.
 java.lang.Object getObjectProperty(java.lang.String name)
          Returns a property as an object.
 java.lang.Object getOptionalHeader(java.lang.String name)
          Returns an optional header field value.
 boolean getPersistent()
          Returns true if the message is persistent.
 int getPriority()
          Returns the message priority.
 java.util.Enumeration getPropertyNames()
          Returns an enumeration of the properties names.
 java.lang.String getReplyToId()
          Returns the destination id the reply should be sent to.
 short getShortProperty(java.lang.String name)
          Returns a property as a short value.
 byte[] getStream()
          Returns the stream of bytes body of the message.
 java.lang.String getStringProperty(java.lang.String name)
          Returns a property as a String.
 java.lang.String getText()
          Gets the String body of the message.
 long getTimestamp()
          Returns the message time stamp.
 int getType()
          Returns the message type.
 boolean isValid()
          Returns true if the message is valid.
 boolean propertyExists(java.lang.String name)
          Returns true if a given property exists.
 boolean replyToQueue()
          Returns true if the reply to destination is a queue.
 void setBooleanProperty(java.lang.String name, boolean value)
          Sets a property as a boolean value.
 void setByteProperty(java.lang.String name, byte value)
          Sets a property as a byte value.
 void setBytes(byte[] bytes)
          Sets the message body as an array of bytes.
 void setCorrelationId(java.lang.String correlationId)
          Sets the message correlation identifier.
 void setDestination(java.lang.String id, boolean queue)
          Sets the message destination.
 void setDoubleProperty(java.lang.String name, double value)
          Sets a property as a double value.
 void setExpiration(long expiration)
          Sets the message expiration.
 void setFloatProperty(java.lang.String name, float value)
          Sets a property as a float value.
 void setIdentifier(java.lang.String id)
          Sets the message identifier.
 void setIntProperty(java.lang.String name, int value)
          Sets a property as an int value.
 void setLongProperty(java.lang.String name, long value)
          Sets a property as a long value.
 void setMap(java.util.HashMap map)
          Sets a map as the body of the message.
 void setObject(java.lang.Object object)
          Sets an object as the body of the message.
 void setObjectProperty(java.lang.String name, java.lang.Object value)
          Sets a property value.
 void setOptionalHeader(java.lang.String name, java.lang.Object value)
          Sets an optional header field value.
 void setPersistent(boolean persistent)
          Sets the message persistence mode.
 void setPriority(int priority)
          Sets the message priority.
 void setReplyTo(java.lang.String id, boolean queue)
          Sets the destination to which a reply should be sent.
 void setShortProperty(java.lang.String name, short value)
          Sets a property as a short value.
 void setStream(byte[] bytes)
          Sets the message body as a stream of bytes.
 void setStringProperty(java.lang.String name, java.lang.String value)
          Sets a property as a String.
 void setText(java.lang.String text)
          Sets a String as the body of the message.
 void setTimestamp(long timestamp)
          Sets the message time stamp.
 java.util.Hashtable soapCode()
          Transforms this message into a table of primitive values that can be vehiculated through the SOAP protocol.
static Message soapDecode(java.util.Hashtable h)
          Transforms a table of primitive values into a Message instance.
 boolean toQueue()
          Returns true if the destination is a queue.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

order

public long order
Arrival position of this message on its queue or proxy.


deliveryCount

public int deliveryCount
The number of delivery attempts for this message.


denied

public boolean denied
true if the message has been denied at least once by a consumer.


deletedDest

public boolean deletedDest
true if the message target destination is deleted.


expired

public boolean expired
true if the message expired.


notWriteable

public boolean notWriteable
true if the message could not be written on the dest.


undeliverable

public boolean undeliverable
true if the message is considered as undeliverable.


acksCounter

public transient int acksCounter
The number of acknowledgements a message still expects from its subscribers before having been fully consumed by them (field used by JMS proxies).


durableAcksCounter

public transient int durableAcksCounter
The number of acknowledgements a message still expects from its durable subscribers before having been fully consumed by them (field used by JMS proxies).

Constructor Detail

Message

public Message()
Constructs a Message instance.

Method Detail

setIdentifier

public void setIdentifier(java.lang.String id)
Sets the message identifier.


setPersistent

public void setPersistent(boolean persistent)
Sets the message persistence mode.


setPriority

public void setPriority(int priority)
Sets the message priority.

Parameters:
priority - Priority value: 0 the lowest, 9 the highest, 4 normal.

setExpiration

public void setExpiration(long expiration)
Sets the message expiration.


setTimestamp

public void setTimestamp(long timestamp)
Sets the message time stamp.


setDestination

public void setDestination(java.lang.String id,
                           boolean queue)
Sets the message destination.

Parameters:
id - The destination identifier.
queue - true if the destination is a queue.

setCorrelationId

public void setCorrelationId(java.lang.String correlationId)
Sets the message correlation identifier.


setReplyTo

public void setReplyTo(java.lang.String id,
                       boolean queue)
Sets the destination to which a reply should be sent.

Parameters:
id - The destination identifier.
queue - true if the destination is a queue.

setOptionalHeader

public void setOptionalHeader(java.lang.String name,
                              java.lang.Object value)
Sets an optional header field value.

Parameters:
name - The header field name.
value - The corresponding value.

getType

public int getType()
Returns the message type.


getIdentifier

public java.lang.String getIdentifier()
Returns the message identifier.


getPersistent

public boolean getPersistent()
Returns true if the message is persistent.


getPriority

public int getPriority()
Returns the message priority.


getExpiration

public long getExpiration()
Returns the message expiration time.


getTimestamp

public long getTimestamp()
Returns the message time stamp.


getDestinationId

public java.lang.String getDestinationId()
Returns the message destination identifier.


toQueue

public boolean toQueue()
Returns true if the destination is a queue.


getCorrelationId

public java.lang.String getCorrelationId()
Returns the message correlation identifier.


getReplyToId

public java.lang.String getReplyToId()
Returns the destination id the reply should be sent to.


replyToQueue

public boolean replyToQueue()
Returns true if the reply to destination is a queue.


getOptionalHeader

public java.lang.Object getOptionalHeader(java.lang.String name)
Returns an optional header field value.

Parameters:
name - The header field name.

setBooleanProperty

public void setBooleanProperty(java.lang.String name,
                               boolean value)
                        throws MessageROException
Sets a property as a boolean value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.

setByteProperty

public void setByteProperty(java.lang.String name,
                            byte value)
                     throws MessageROException
Sets a property as a byte value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.

setDoubleProperty

public void setDoubleProperty(java.lang.String name,
                              double value)
                       throws MessageROException
Sets a property as a double value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.

setFloatProperty

public void setFloatProperty(java.lang.String name,
                             float value)
                      throws MessageROException
Sets a property as a float value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.

setIntProperty

public void setIntProperty(java.lang.String name,
                           int value)
                    throws MessageROException
Sets a property as an int value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.

setLongProperty

public void setLongProperty(java.lang.String name,
                            long value)
                     throws MessageROException
Sets a property as a long value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.

setObjectProperty

public void setObjectProperty(java.lang.String name,
                              java.lang.Object value)
                       throws MessageException
Sets a property value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.
MessageValueException - If the value is not a Java primitive object.
MessageException

setShortProperty

public void setShortProperty(java.lang.String name,
                             short value)
                      throws MessageROException
Sets a property as a short value.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.

setStringProperty

public void setStringProperty(java.lang.String name,
                              java.lang.String value)
                       throws MessageROException
Sets a property as a String.

Parameters:
name - The property name.
value - The property value.
Throws:
MessageROException - If the message properties are read-only.

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name)
                           throws MessageValueException
Returns a property as a boolean value.

Throws:
MessageValueException - If the property type is invalid.

getByteProperty

public byte getByteProperty(java.lang.String name)
                     throws MessageValueException
Throws:
MessageValueException - If the property type is invalid.

getDoubleProperty

public double getDoubleProperty(java.lang.String name)
                         throws MessageValueException
Returns a property as a double value.

Parameters:
name - The property name.
Throws:
MessageValueException - If the property type is invalid.

getFloatProperty

public float getFloatProperty(java.lang.String name)
                       throws MessageValueException
Returns a property as a float value.

Parameters:
name - The property name.
Throws:
MessageValueException - If the property type is invalid.

getIntProperty

public int getIntProperty(java.lang.String name)
                   throws MessageValueException
Returns a property as a int value.

Parameters:
name - The property name.
Throws:
MessageValueException - If the property type is invalid.

getLongProperty

public long getLongProperty(java.lang.String name)
                     throws MessageValueException
Returns a property as a long value.

Parameters:
name - The property name.
Throws:
MessageValueException - If the property type is invalid.

getObjectProperty

public java.lang.Object getObjectProperty(java.lang.String name)
Returns a property as an object.

Parameters:
name - The property name.

getShortProperty

public short getShortProperty(java.lang.String name)
                       throws MessageValueException
Returns a property as a short value.

Parameters:
name - The property name.
Throws:
MessageValueException - If the property type is invalid.

getStringProperty

public java.lang.String getStringProperty(java.lang.String name)
Returns a property as a String.

Parameters:
name - The property name.

propertyExists

public boolean propertyExists(java.lang.String name)
Returns true if a given property exists.

Parameters:
name - The name of the property to check.

getPropertyNames

public java.util.Enumeration getPropertyNames()
Returns an enumeration of the properties names.


clearProperties

public void clearProperties()
Empties the properties table.


setObject

public void setObject(java.lang.Object object)
               throws java.io.IOException,
                      MessageROException
Sets an object as the body of the message.

Throws:
java.io.IOException - In case of an error while setting the object.
MessageROException - If the message body is read-only.

setMap

public void setMap(java.util.HashMap map)
            throws java.lang.Exception
Sets a map as the body of the message.

Throws:
java.io.IOException - In case of an error while setting the map.
MessageROException - If the message body is read-only.
java.lang.Exception

setText

public void setText(java.lang.String text)
             throws MessageROException
Sets a String as the body of the message.

Throws:
MessageROException - If the message body is read-only.

setStream

public void setStream(byte[] bytes)
               throws MessageROException
Sets the message body as a stream of bytes.

Throws:
MessageROException - If the message body is read-only.

setBytes

public void setBytes(byte[] bytes)
              throws MessageROException
Sets the message body as an array of bytes.

Throws:
MessageROException - If the message body is read-only.

getObject

public java.lang.Object getObject()
                           throws java.lang.Exception
Returns the object body of the message.

Throws:
java.io.IOException - In case of an error while getting the object.
java.lang.ClassNotFoundException - If the object class is unknown.
java.lang.Exception

getMap

public java.util.Map getMap()
Returns the map body of the message.


getText

public java.lang.String getText()
Gets the String body of the message.


getStream

public byte[] getStream()
Returns the stream of bytes body of the message.


getBytes

public byte[] getBytes()
Returns the array of bytes body of the message.


clearBody

public void clearBody()
Method clearing the message body.


isValid

public boolean isValid()
Returns true if the message is valid.


clone

public java.lang.Object clone()
Clones the message.


soapCode

public java.util.Hashtable soapCode()
Transforms this message into a table of primitive values that can be vehiculated through the SOAP protocol.


soapDecode

public static Message soapDecode(java.util.Hashtable h)
Transforms a table of primitive values into a Message instance.


toString

public java.lang.String toString()


Copyright ? 2004 Scalagent - All rights reserved