All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.aglet.Message

java.lang.Object
   |
   +----com.ibm.aglet.Message

public class Message
extends Object
implements Serializable
The Message class is a object that holds its kind and arguments passed to the receiver. In handleMessage() method on Aglet class, the reply to the request can be set if any.


Variable Index

 o CLONE
These kinds are used to specify the priority of the system message.
 o DEACTIVATE
 o DISPATCH
 o DISPOSE
 o FUTURE
 o ONEWAY
 o REVERT
 o SYNCHRONOUS
The types of message that indecates how the message was sent.

Constructor Index

 o Message(String)
Constructs a message.
 o Message(String, boolean)
Constructs a message with an argument value.
 o Message(String, char)
Constructs a message with an argument value.
 o Message(String, double)
Constructs a message with an argument value.
 o Message(String, float)
Constructs a message with an argument value.
 o Message(String, int)
Constructs a message with an argument value.
 o Message(String, long)
Constructs a message with an argument value.
 o Message(String, Object)
Constructs a message with an argument value.

Method Index

 o enableDeferedReply(boolean)
Enable a defered reply.
 o equals(Object)
Compares two Message objects.
 o getArg()
Gets the argument.
 o getArg(String)
Gets the value to which specified key is mapped in this message.
 o getKind()
Gets the kind of this message
 o getMessageType()
Returns a type indecating how the message has been sent.
 o getTimeStamp()
Gets the time in milliseconds when the message was sent.
 o sameKind(Message)
Checks if the message has same kind as the given message.
 o sameKind(String)
Checks if the message has same kind as given string.
 o sendException(Exception)
Sets a exception to this message.
 o sendReply()
Send a reply without sepcific value.
 o sendReply(boolean)
Sends a bolean value as a reply.
 o sendReply(char)
Sends a character value as a reply.
 o sendReply(double)
Sends a double value as a reply.
 o sendReply(float)
Sends a float value as a reply.
 o sendReply(int)
Sends a integer value as a reply.
 o sendReply(long)
Sends a long value as a reply.
 o sendReply(Object)
Sets a reply to this message.
 o setArg(String, boolean)
Set a boolean value with an associated name.
 o setArg(String, byte)
Set a bye value with an associated name.
 o setArg(String, char)
Set a character value with an associated name.
 o setArg(String, double)
Set a double value with an associated name.
 o setArg(String, float)
Set a float value with an associated name.
 o setArg(String, int)
Set a int value with an associated name.
 o setArg(String, long)
Sets a long value with an associated name.
 o setArg(String, Object)
Sets a value with an associated name.
 o setArg(String, short)
Set a bye value with an associated name.
 o toString()
Gets the string representation of the message.

Variables

 o SYNCHRONOUS
 public static final int SYNCHRONOUS
The types of message that indecates how the message was sent.

See Also:
getMessageType
 o FUTURE
 public static final int FUTURE
 o ONEWAY
 public static final int ONEWAY
 o CLONE
 public static final String CLONE
These kinds are used to specify the priority of the system message.

See Also:
setPriority
 o DISPATCH
 public static final String DISPATCH
 o DISPOSE
 public static final String DISPOSE
 o DEACTIVATE
 public static final String DEACTIVATE
 o REVERT
 public static final String REVERT

Constructors

 o Message
 public Message(String kind)
Constructs a message. The message object created by this constructor have a hashtable which can be used for argument-value pair.
   Message msg = new Message("stock-price");
   msg.setArg("company", "ibm");
   msg.setArg("currency", "dollar");
   Double d = (Double) proxy.sendMessage(msg);
 

Parameters:
kind - a kind of this message.
 o Message
 public Message(String kind,
                Object arg)
Constructs a message with an argument value.

Parameters:
kind - a kind of this message.
arg - an argument of this message.
 o Message
 public Message(String kind,
                int i)
Constructs a message with an argument value.

Parameters:
kind - a kind of this message.
 o Message
 public Message(String kind,
                double d)
Constructs a message with an argument value.

Parameters:
kind - a kind of this message.
 o Message
 public Message(String kind,
                float f)
Constructs a message with an argument value.

Parameters:
kind - a kind of this message.
 o Message
 public Message(String kind,
                boolean b)
Constructs a message with an argument value.

Parameters:
kind - a kind of this message.
 o Message
 public Message(String kind,
                char c)
Constructs a message with an argument value.

Parameters:
kind - a kind of this message.
 o Message
 public Message(String kind,
                long l)
Constructs a message with an argument value.

Parameters:
kind - a kind of this message.

Methods

 o getKind
 public String getKind()
Gets the kind of this message

 o sameKind
 public boolean sameKind(String k)
Checks if the message has same kind as given string.

Parameters:
k - a string to compare
 o sameKind
 public boolean sameKind(Message m)
Checks if the message has same kind as the given message.

Parameters:
m - a message to compare
 o getTimeStamp
 public long getTimeStamp()
Gets the time in milliseconds when the message was sent.

 o getArg
 public Object getArg()
Gets the argument.

 o getMessageType
 public int getMessageType()
Returns a type indecating how the message has been sent. This works only for the message passed to the handleMessage method.

See Also:
handleMessage
 o setArg
 public void setArg(String name,
                    Object a)
Sets a value with an associated name.

Parameters:
name - a name of this argument.
a - a value of this argument.
 o setArg
 public void setArg(String name,
                    boolean value)
Set a boolean value with an associated name.

Parameters:
name - a name of this argument.
value - a boolean value of this argument.
 o setArg
 public void setArg(String name,
                    byte value)
Set a bye value with an associated name.

Parameters:
name - a name of this argument.
value - a byte value of this argument.
 o setArg
 public void setArg(String name,
                    short value)
Set a bye value with an associated name.

Parameters:
name - a name of this argument.
value - a byte value of this argument.
 o setArg
 public void setArg(String name,
                    int value)
Set a int value with an associated name.

Parameters:
name - a name of this argument.
value - an integer value of this argument.
 o setArg
 public void setArg(String name,
                    double value)
Set a double value with an associated name.

Parameters:
name - a name of this argument.
d - a double value of this argument.
 o setArg
 public void setArg(String name,
                    float value)
Set a float value with an associated name.

Parameters:
name - a name of this argument.
value - a float value of this argument.
 o setArg
 public void setArg(String name,
                    char value)
Set a character value with an associated name.

Parameters:
name - a name of this argument.
value - a character value of this argument.
 o setArg
 public void setArg(String name,
                    long value)
Sets a long value with an associated name.

Parameters:
name - a name of this argument.
value - a long value of this argument.
 o getArg
 public Object getArg(String name)
Gets the value to which specified key is mapped in this message.

Parameters:
name - a name of this argument.
Returns:
a value of this argument.
 o sendReply
 public void sendReply(Object arg)
Sets a reply to this message.

Throws: IllegalAccessError
if a reply has already been sent.
See Also:
getReply
 o sendReply
 public void sendReply()
Send a reply without sepcific value.

Throws: IllegalAccessError
if a reply has already been sent.
 o sendException
 public void sendException(Exception exp)
Sets a exception to this message.

Throws: IllegalAccessError
if a reply has already been sent.
 o sendReply
 public void sendReply(int i)
Sends a integer value as a reply.

 o sendReply
 public void sendReply(double d)
Sends a double value as a reply.

 o sendReply
 public void sendReply(float f)
Sends a float value as a reply.

 o sendReply
 public void sendReply(boolean b)
Sends a bolean value as a reply.

 o sendReply
 public void sendReply(char c)
Sends a character value as a reply.

 o sendReply
 public void sendReply(long l)
Sends a long value as a reply.

 o enableDeferedReply
 public void enableDeferedReply(boolean b)
Enable a defered reply. If this feature is enabled, this message is assumed that it will be handled later. Neither a reply nor a exception does not sent to the callee unless you explicitly send a reply regardless of whatever has been returned in handleMessage method.

Parameters:
b - true if the reply of this message should be defered.
 o equals
 public boolean equals(Object obj)
Compares two Message objects. Use sameKind() method to compare a message with its string representation of the kind.

Overrides:
equals in class Object
See Also:
sameKind
 o toString
 public String toString()
Gets the string representation of the message.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index