org.objectweb.joram.shared.messages

Class Message

Implemented Interfaces:
Cloneable, Serializable

public class Message
extends java.lang.Object
implements Cloneable, 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.

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.
Object
clone()
Clones the message.
boolean
getBooleanProperty(String name)
Returns a property as a boolean value.
byte
getByteProperty(String name)
byte[]
getBytes()
Returns the array of bytes body of the message.
String
getCorrelationId()
Returns the message correlation identifier.
String
getDestinationId()
Returns the message destination identifier.
double
getDoubleProperty(String name)
Returns a property as a double value.
long
getExpiration()
Returns the message expiration time.
float
getFloatProperty(String name)
Returns a property as a float value.
String
getIdentifier()
Returns the message identifier.
int
getIntProperty(String name)
Returns a property as a int value.
long
getLongProperty(String name)
Returns a property as a long value.
Map
getMap()
Returns the map body of the message.
Object
getObject()
Returns the object body of the message.
Object
getObjectProperty(String name)
Returns a property as an object.
Object
getOptionalHeader(String name)
Returns an optional header field value.
boolean
getPersistent()
Returns true if the message is persistent.
int
getPriority()
Returns the message priority.
Enumeration
getPropertyNames()
Returns an enumeration of the properties names.
String
getReplyToId()
Returns the destination id the reply should be sent to.
short
getShortProperty(String name)
Returns a property as a short value.
byte[]
getStream()
Returns the stream of bytes body of the message.
String
getStringProperty(String name)
Returns a property as a String.
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(String name)
Returns true if a given property exists.
boolean
replyToQueue()
Returns true if the reply to destination is a queue.
void
setBooleanProperty(String name, boolean value)
Sets a property as a boolean value.
void
setByteProperty(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(String correlationId)
Sets the message correlation identifier.
void
setDestination(String id, boolean queue)
Sets the message destination.
void
setDoubleProperty(String name, double value)
Sets a property as a double value.
void
setExpiration(long expiration)
Sets the message expiration.
void
setFloatProperty(String name, float value)
Sets a property as a float value.
void
setIdentifier(String id)
Sets the message identifier.
void
setIntProperty(String name, int value)
Sets a property as an int value.
void
setLongProperty(String name, long value)
Sets a property as a long value.
void
setMap(HashMap map)
Sets a map as the body of the message.
void
setObject(Object object)
Sets an object as the body of the message.
void
setObjectProperty(String name, Object value)
Sets a property value.
void
setOptionalHeader(String name, 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(String id, boolean queue)
Sets the destination to which a reply should be sent.
void
setShortProperty(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(String name, String value)
Sets a property as a String.
void
setText(String text)
Sets a String as the body of the message.
void
setTimestamp(long timestamp)
Sets the message time stamp.
Hashtable
soapCode()
Transforms this message into a table of primitive values that can be vehiculated through the SOAP protocol.
static Message
soapDecode(Hashtable h)
Transforms a table of primitive values into a Message instance.
boolean
toQueue()
Returns true if the destination is a queue.
String
toString()

Field Details

acksCounter

public 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).


deletedDest

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


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.


durableAcksCounter

public 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).


expired

public boolean expired
true if the message expired.


notWriteable

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


order

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


undeliverable

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

Constructor Details

Message

public Message()
Constructs a Message instance.

Method Details

clearBody

public void clearBody()
Method clearing the message body.


clearProperties

public void clearProperties()
Empties the properties table.


clone

public Object clone()
Clones the message.


getBooleanProperty

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

Throws:
MessageValueException - If the property type is invalid.


getByteProperty

public byte getByteProperty(String name)
            throws MessageValueException

Throws:
MessageValueException - If the property type is invalid.


getBytes

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


getCorrelationId

public String getCorrelationId()
Returns the message correlation identifier.


getDestinationId

public String getDestinationId()
Returns the message destination identifier.


getDoubleProperty

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

Parameters:
name - The property name.

Throws:
MessageValueException - If the property type is invalid.


getExpiration

public long getExpiration()
Returns the message expiration time.


getFloatProperty

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

Parameters:
name - The property name.

Throws:
MessageValueException - If the property type is invalid.


getIdentifier

public String getIdentifier()
Returns the message identifier.


getIntProperty

public int getIntProperty(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(String name)
            throws MessageValueException
Returns a property as a long value.

Parameters:
name - The property name.

Throws:
MessageValueException - If the property type is invalid.


getMap

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


getObject

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


getObjectProperty

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

Parameters:
name - The property name.


getOptionalHeader

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

Parameters:
name - The header field name.


getPersistent

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


getPriority

public int getPriority()
Returns the message priority.


getPropertyNames

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


getReplyToId

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


getShortProperty

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

Parameters:
name - The property name.

Throws:
MessageValueException - If the property type is invalid.


getStream

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


getStringProperty

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

Parameters:
name - The property name.


getText

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


getTimestamp

public long getTimestamp()
Returns the message time stamp.


getType

public int getType()
Returns the message type.


isValid

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


propertyExists

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

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


replyToQueue

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


setBooleanProperty

public void setBooleanProperty(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(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.


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.


setCorrelationId

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


setDestination

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

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


setDoubleProperty

public void setDoubleProperty(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.


setExpiration

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


setFloatProperty

public void setFloatProperty(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.


setIdentifier

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


setIntProperty

public void setIntProperty(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(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.


setMap

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


setObject

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

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


setObjectProperty

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

Parameters:
name - The property name.
value - The property value.


setOptionalHeader

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

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


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.


setReplyTo

public void setReplyTo(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.


setShortProperty

public void setShortProperty(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.


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.


setStringProperty

public void setStringProperty(String name,
                              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.


setText

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

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


setTimestamp

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


soapCode

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


soapDecode

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


toQueue

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


toString

public String toString()


Copyright B) 2004 Scalagent - All rights reserved