Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.aglet
Class Message

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

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  CGIMessage

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

Version:
  1.70 $Date: 2001/07/28 06:34:00 $
Author:
  Mitsuru Oshima
See Also:
  Serialized Form

Field Summary
`protected java.lang.Object` | `arg`
`static java.lang.String` | `CLONE` These kinds are used to specify the priority of the system message.
`static java.lang.String` | `DEACTIVATE`
`static java.lang.String` | `DISPATCH`
`static java.lang.String` | `DISPOSE`
`static int` | `FUTURE`
`protected java.lang.String` | `kind`
`static int` | `ONEWAY`
`static java.lang.String` | `REVERT`
`static int` | `SYNCHRONOUS` The types of message that indecates how the message was sent.
`protected long` | `timestamp`

Constructor Summary
`Message(java.lang.String kind)` Constructs a message.
`Message(java.lang.String kind, boolean b)` Constructs a message with an argument value.
`Message(java.lang.String kind, char c)` Constructs a message with an argument value.
`Message(java.lang.String kind, double d)` Constructs a message with an argument value.
`Message(java.lang.String kind, float f)` Constructs a message with an argument value.
`Message(java.lang.String kind, int i)` Constructs a message with an argument value.
`Message(java.lang.String kind, long l)` Constructs a message with an argument value.
`Message(java.lang.String kind, java.lang.Object arg)` Constructs a message with an argument value.

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

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### SYNCHRONOUS

    public static final int SYNCHRONOUS

  The types of message that indecates how the message was sent.
  See Also:

### FUTURE

    public static final int FUTURE

### ONEWAY

    public static final int ONEWAY

### CLONE

    public static final java.lang.String CLONE

  These kinds are used to specify the priority of the system message.
  See Also:
    `MessageManager.setPriority(java.lang.String, int)`

### DISPATCH

    public static final java.lang.String DISPATCH

### DISPOSE

    public static final java.lang.String DISPOSE

### DEACTIVATE

    public static final java.lang.String DEACTIVATE

### REVERT

    public static final java.lang.String REVERT

### arg

    protected java.lang.Object arg

### kind

    protected java.lang.String kind

### timestamp

    protected long timestamp

Constructor Detail

### Message

    public Message(java.lang.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.

### Message

    public Message(java.lang.String kind,
                   char c)

  Constructs a message with an argument value.
  Parameters:
    `kind` - a kind of this message.

### Message

    public Message(java.lang.String kind,
                   double d)

  Constructs a message with an argument value.
  Parameters:
    `kind` - a kind of this message.

### Message

    public Message(java.lang.String kind,
                   float f)

  Constructs a message with an argument value.
  Parameters:
    `kind` - a kind of this message.

### Message

    public Message(java.lang.String kind,
                   int i)

  Constructs a message with an argument value.
  Parameters:
    `kind` - a kind of this message.

### Message

    public Message(java.lang.String kind,
                   long l)

  Constructs a message with an argument value.
  Parameters:
    `kind` - a kind of this message.

### Message

    public Message(java.lang.String kind,
                   java.lang.Object arg)

  Constructs a message with an argument value.
  Parameters:
    `kind` - a kind of this message.
    `arg` - an argument of this message.

### Message

    public Message(java.lang.String kind,
                   boolean b)

  Constructs a message with an argument value.
  Parameters:
    `kind` - a kind of this message.

Method Detail

### 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.

### equals

    public boolean equals(java.lang.Object obj)

  Compares two Message objects. Use sameKind() method to compare a message with its string representation of the kind.
  Overrides:
    `equals` in class `java.lang.Object`
  See Also:
    `sameKind(com.ibm.aglet.Message)`

### getArg

    public java.lang.Object getArg()

  Gets the argument.

### getArg

    public java.lang.Object getArg(java.lang.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.

### getKind

    public java.lang.String getKind()

  Gets the kind of this message

### 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:
    `Aglet.handleMessage(com.ibm.aglet.Message)`

### getTimeStamp

    public long getTimeStamp()

  Gets the time in milliseconds when the message was sent.

### sameKind

    public boolean sameKind(Message m)

  Checks if the message has same kind as the given message.
  Parameters:
    `m` - a message to compare

### sameKind

    public boolean sameKind(java.lang.String k)

  Checks if the message has same kind as given string.
  Parameters:
    `k` - a string to compare

### sendException

    public void sendException(java.lang.Exception exp)

  Sets a exception to this message.
  Throws:
    `IllegalAccessError` - if a reply has already been sent.

### sendReply

    public void sendReply()

  Send a reply without sepcific value.
  Throws:
    `IllegalAccessError` - if a reply has already been sent.

### sendReply

    public void sendReply(char c)

  Sends a character value as a reply.

### sendReply

    public void sendReply(double d)

  Sends a double value as a reply.

### sendReply

    public void sendReply(float f)

  Sends a float value as a reply.

### sendReply

    public void sendReply(int i)

  Sends a integer value as a reply.

### sendReply

    public void sendReply(long l)

  Sends a long value as a reply.

### sendReply

    public void sendReply(java.lang.Object arg)

  Sets a reply to this message.
  Throws:
    `IllegalAccessError` - if a reply has already been sent.
  See Also:
    `FutureReply.getReply()`

### sendReply

    public void sendReply(boolean b)

  Sends a bolean value as a reply.

### setArg

    public void setArg(java.lang.String name,
                       byte value)

  Set a byte value with an associated name.
  Parameters:
    `name` - a name of this argument.
    `value` - a byte value of this argument.

### setArg

    public void setArg(java.lang.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.

### setArg

    public void setArg(java.lang.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.

### setArg

    public void setArg(java.lang.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.

### setArg

    public void setArg(java.lang.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.

### setArg

    public void setArg(java.lang.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.

### setArg

    public void setArg(java.lang.String name,
                       java.lang.Object a)

  Sets a value with an associated name.
  Parameters:
    `name` - a name of this argument.
    `a` - a value of this argument.

### setArg

    public void setArg(java.lang.String name,
                       short value)

  Set a byte value with an associated name.
  Parameters:
    `name` - a name of this argument.
    `value` - a byte value of this argument.

### setArg

    public void setArg(java.lang.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.

### toString

    public java.lang.String toString()

  Gets the string representation of the message.
  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD