Rice Pastry API

rice.pastry.messaging
Class Message

java.lang.Object
  extended byrice.pastry.messaging.Message
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BroadcastLeafSet, BroadcastRouteRow, ConsistentJoinMsg, HelloMsg, InitiateJoin, InitiateLeafSetMaintenance, InitiatePingNeighbor, InitiateRouteSetMaintenance, JoinRequest, PastryEndpointMessage, PingMessageNew, RequestLeafSet, RequestRouteRow, RouteMessage, SocketMessage

public abstract class Message
extends java.lang.Object
implements java.io.Serializable

This is an abstract implementation of a message object.

Version:
$Id: Message.java,v 1.11 2005/06/07 22:02:14 jeffh Exp $
Author:
Andrew Ladd, Sitaram Iyer
See Also:
Serialized Form

Field Summary
static int DEFAULT_PRIORITY_LEVEL
          DESCRIBE THE FIELD
 
Constructor Summary
Message(Address dest)
          Constructor.
Message(Address dest, Credentials cred)
          Constructor.
Message(Address dest, Credentials cred, java.util.Date timestamp)
          Constructor.
Message(Address dest, java.util.Date timestamp)
          Constructor.
 
Method Summary
 Credentials getCredentials()
          Gets the credentials of the sender.
 java.util.Date getDate()
          Gets the timestamp of the message, if it exists.
 Address getDestination()
          Gets the address of message receiver that the message is for.
 int getPriority()
          Get priority
 NodeHandle getSender()
          Get sender.
 NodeId getSenderId()
          Get sender Id.
protected  void setPriority(int prio)
          Set priority.
 void setSender(NodeHandle nh)
          Set sender Id.
 boolean stamp(java.util.Date time)
          If the message has no timestamp, this will stamp the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PRIORITY_LEVEL

public static final int DEFAULT_PRIORITY_LEVEL
DESCRIBE THE FIELD

See Also:
Constant Field Values
Constructor Detail

Message

public Message(Address dest)
Constructor.

Parameters:
dest - the destination.

Message

public Message(Address dest,
               Credentials cred)
Constructor.

Parameters:
dest - the destination.
cred - the credentials.

Message

public Message(Address dest,
               Credentials cred,
               java.util.Date timestamp)
Constructor.

Parameters:
dest - the destination.
cred - the credentials.
timestamp - the timestamp

Message

public Message(Address dest,
               java.util.Date timestamp)
Constructor.

Parameters:
dest - the destination.
timestamp - the timestamp
Method Detail

getDestination

public Address getDestination()
Gets the address of message receiver that the message is for.

Returns:
the destination id.

getCredentials

public Credentials getCredentials()
Gets the credentials of the sender.

Returns:
credentials or null if the sender has no credentials.

getDate

public java.util.Date getDate()
Gets the timestamp of the message, if it exists.

Returns:
a timestamp or null if the sender did not specify one.

getSenderId

public NodeId getSenderId()
Get sender Id.

Returns:
the immediate sender's NodeId.

getSender

public NodeHandle getSender()
Get sender.

Returns:
the immediate sender's NodeId.

getPriority

public int getPriority()
Get priority

Returns:
the priority of this message.

setSender

public void setSender(NodeHandle nh)
Set sender Id. Called by NodeHandle just before dispatch, so that this Id is guaranteed to belong to the immediate sender.

Parameters:
nh - The new Sender value

setPriority

protected void setPriority(int prio)
Set priority.

Parameters:
prio - The new Priority value

stamp

public boolean stamp(java.util.Date time)
If the message has no timestamp, this will stamp the message.

Parameters:
time - the timestamp.
Returns:
true if the message was stamped, false if the message already had a timestamp.

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection