Joram 5.0.6

org.objectweb.joram.shared.messages
Class Message

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

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

Implements the Message data structure.

See Also:
Serialized Form

Field Summary
static int ADMIN
          A admin message carries a streamable object.
 byte[] body
          true if the body is read-only.
static int BYTES
          A bytes message carries an array of bytes.
 java.lang.String correlationId
          The correlation identifier field.
 boolean deletedDest
          true if the message target destination is deleted.
static int deletedDestFlag
           
 int deliveryCount
          The number of delivery attempts for this message.
 long expiration
          The message expiration time, by default 0 for infinite time-to-live.
 boolean expired
          true if the message expired.
static int expiredFlag
           
 java.lang.String id
          The message identifier.
static int MAP
          A map message carries an hashtable.
 boolean notWriteable
          true if the message could not be written on the dest.
static int notWriteableFlag
           
static int OBJECT
          An object message carries a serializable object.
 Properties optionalHeader
          Table holding header fields that may be required by particular clients (such as JMS clients).
 boolean persistent
          true if the message must be persisted.
static int persistentFlag
           
 int priority
          The message priority from 0 to 9, 9 being the highest.
 Properties properties
          The message properties table.
 boolean redelivered
          true if the message has been denied at least once by a consumer.
static int redeliveredFlag
           
 java.lang.String replyToId
          The reply to destination identifier.
 java.lang.String replyToType
          true if the "reply to" destination is a queue.
static int SIMPLE
          A simple message carries an empty body.
static int STREAM
          A stream message carries a bytes stream.
static int TEXT
          A text message carries a String body.
 long timestamp
          The message time stamp.
 java.lang.String toId
          The message destination identifier.
 java.lang.String toType
          The message destination type.
 int type
          The client message type: SIMPLE, TEXT, OBJECT, MAP, STREAM, BYTES, ADMIN.
 boolean undeliverable
          true if the message is considered as undeliverable.
static int undeliverableFlag
           
 
Constructor Summary
Message()
          Constructs a bright new Message.
 
Method Summary
 java.lang.Object clone()
          Clones the message.
 AbstractAdminMessage getAdminMessage()
          Returns the AbstractAdminMessage body of the message.
 java.lang.String getDestinationId()
          Returns the message destination identifier.
 java.lang.String getDestinationType()
          Returns true if the destination is a queue.
 java.io.Serializable getObject()
          Returns the object body of the message.
 java.lang.Object getOptionalHeader(java.lang.String name)
          Returns an optional header field value.
 java.lang.Object getProperty(java.lang.String name)
          Returns a property as an object.
 java.lang.String getReplyToId()
          Returns the destination id the reply should be sent to.
 java.lang.String getText()
          Returns the text body of the message.
 void readFrom(java.io.InputStream is)
          The object implements the readFrom method to restore its contents from the input stream.
static java.util.Vector readVectorFrom(java.io.InputStream is)
          this method allows to read from the input stream a vector of messages.
 java.lang.String replyToType()
          Returns true if the reply to destination is a queue.
 void setAdminMessage(AbstractAdminMessage adminMsg)
          Sets an AbstractAdminMessage as the body of the message.
 void setDestination(java.lang.String id, java.lang.String type)
          Sets the message destination.
 void setObject(java.io.Serializable object)
          Sets an object as the body of the message.
 void setOptionalHeader(java.lang.String name, java.lang.Object value)
          Sets an optional header field value.
 void setProperty(java.lang.String name, java.lang.Object value)
          Sets a property value.
 void setReplyTo(java.lang.String id, java.lang.String type)
          Sets the destination to which a reply should be sent.
 void setText(java.lang.String text)
          Sets a String as the body of the message.
 java.util.Hashtable soapCode()
           
static Message soapDecode(java.util.Hashtable h)
           
 java.lang.String toString()
           
 void toString(java.lang.StringBuffer strbuf)
           
 void writeTo(java.io.OutputStream os)
          The object implements the writeTo method to write its contents to the output stream.
static void writeVectorTo(java.util.Vector messages, java.io.OutputStream os)
          this method allows to write to the output stream a vector of message.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

optionalHeader

public transient Properties optionalHeader
Table holding header fields that may be required by particular clients (such as JMS clients).


body

public transient byte[] body
true if the body is read-only.


properties

public transient Properties properties
The message properties table.


id

public transient java.lang.String id
The message identifier.


persistent

public transient boolean persistent
true if the message must be persisted.


SIMPLE

public static final int SIMPLE
A simple message carries an empty body.

See Also:
Constant Field Values

TEXT

public static final int TEXT
A text message carries a String body.

See Also:
Constant Field Values

OBJECT

public static final int OBJECT
An object message carries a serializable object.

See Also:
Constant Field Values

MAP

public static final int MAP
A map message carries an hashtable.

See Also:
Constant Field Values

STREAM

public static final int STREAM
A stream message carries a bytes stream.

See Also:
Constant Field Values

BYTES

public static final int BYTES
A bytes message carries an array of bytes.

See Also:
Constant Field Values

ADMIN

public static final int ADMIN
A admin message carries a streamable object.

See Also:
Constant Field Values

type

public transient int type
The client message type: SIMPLE, TEXT, OBJECT, MAP, STREAM, BYTES, ADMIN. By default, the message type is SIMPLE.


priority

public transient int priority
The message priority from 0 to 9, 9 being the highest. By default, the priority is 4?


expiration

public transient long expiration
The message expiration time, by default 0 for infinite time-to-live.


timestamp

public transient long timestamp
The message time stamp.


redelivered

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


toId

public transient java.lang.String toId
The message destination identifier.


toType

public transient java.lang.String toType
The message destination type.


replyToId

public transient java.lang.String replyToId
The reply to destination identifier.


replyToType

public transient java.lang.String replyToType
true if the "reply to" destination is a queue.


correlationId

public transient java.lang.String correlationId
The correlation identifier field.


deletedDest

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


expired

public transient boolean expired
true if the message expired.


notWriteable

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


undeliverable

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


deliveryCount

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


redeliveredFlag

public static int redeliveredFlag

persistentFlag

public static int persistentFlag

deletedDestFlag

public static int deletedDestFlag

expiredFlag

public static int expiredFlag

notWriteableFlag

public static int notWriteableFlag

undeliverableFlag

public static int undeliverableFlag
Constructor Detail

Message

public Message()
Constructs a bright new Message.

Method Detail

getOptionalHeader

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

Parameters:
name - The header field name.

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.

getProperty

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

Parameters:
name - The property name.

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Sets a property value.

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

setDestination

public final void setDestination(java.lang.String id,
                                 java.lang.String type)
Sets the message destination.

Parameters:
id - The destination identifier.
type - The type of the destination.

getDestinationId

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


getDestinationType

public final java.lang.String getDestinationType()
Returns true if the destination is a queue.


getReplyToId

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


replyToType

public final java.lang.String replyToType()
Returns true if the reply to destination is a queue.


setReplyTo

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

Parameters:
id - The destination identifier.
type - The destination type.

setText

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


getText

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


setObject

public void setObject(java.io.Serializable object)
               throws java.io.IOException
Sets an object as the body of the message.

Throws:
java.io.IOException - In case of an error while setting the object.

getObject

public java.io.Serializable getObject()
                               throws java.lang.ClassNotFoundException,
                                      java.io.IOException
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.

setAdminMessage

public void setAdminMessage(AbstractAdminMessage adminMsg)
                     throws java.io.IOException
Sets an AbstractAdminMessage as the body of the message.

Throws:
java.io.IOException - In case of an error while setting the object.

getAdminMessage

public AbstractAdminMessage getAdminMessage()
                                     throws java.lang.ClassNotFoundException,
                                            java.io.IOException
Returns the AbstractAdminMessage 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.

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

toString

public void toString(java.lang.StringBuffer strbuf)

clone

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

Overrides:
clone in class java.lang.Object

soapCode

public java.util.Hashtable soapCode()

soapDecode

public static Message soapDecode(java.util.Hashtable h)

writeTo

public void writeTo(java.io.OutputStream os)
             throws java.io.IOException
The object implements the writeTo method to write its contents to the output stream.

Specified by:
writeTo in interface Streamable
Parameters:
os - the stream to write the object to
Throws:
java.io.IOException

readFrom

public void readFrom(java.io.InputStream is)
              throws java.io.IOException
The object implements the readFrom method to restore its contents from the input stream.

Specified by:
readFrom in interface Streamable
Parameters:
is - the stream to read data from in order to restore the object
Throws:
java.io.IOException

writeVectorTo

public static void writeVectorTo(java.util.Vector messages,
                                 java.io.OutputStream os)
                          throws java.io.IOException
this method allows to write to the output stream a vector of message.

Parameters:
messages - the vector of messages
os - the stream to write the vector to
Throws:
java.io.IOException

readVectorFrom

public static java.util.Vector readVectorFrom(java.io.InputStream is)
                                       throws java.io.IOException
this method allows to read from the input stream a vector of messages.

Parameters:
is - the stream to read data from in order to restore the vector
Returns:
the vector of messages
Throws:
java.io.IOException

Joram 5.0.6

Copyright © 2005 Scalagent - All rights reserved