Rice Pastry API

rice.pastry.messaging
Class Message

java.lang.Object
  |
  +--rice.pastry.messaging.Message
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
BroadcastLeafSet, BroadcastRouteRow, DistRMRegrTestMessage, DistRMRegrTestReplicateMessage, DistScribeRegrTestMessage, InitiateJoin, InitiateLeafSetMaintenance, InitiateRouteSetMaintenance, JoinRequest, MultiRingApplMessage, MultiRingPastryRegrTest.MultiRingTestAppMessage, PastryEndpointMessage, PingMessageNew, RequestLeafSet, RequestRouteRow, RMMessage, RouteMessage, ScribeMessage, TestMessage

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.5 2003/07/21 19:45:46 druschel Exp $
Author:
Andrew Ladd, Sitaram Iyer
See Also:
Serialized Form

Constructor Summary
Message(rice.pastry.messaging.Address dest)
          Constructor.
Message(rice.pastry.messaging.Address dest, rice.pastry.security.Credentials cred)
          Constructor.
Message(rice.pastry.messaging.Address dest, rice.pastry.security.Credentials cred, java.util.Date timestamp)
          Constructor.
Message(rice.pastry.messaging.Address dest, java.util.Date timestamp)
          Constructor.
 
Method Summary
 rice.pastry.security.Credentials getCredentials()
          Gets the credentials of the sender.
 java.util.Date getDate()
          Gets the timestamp of the message, if it exists.
 rice.pastry.messaging.Address getDestination()
          Gets the address of message receiver that the message is for.
 rice.pastry.NodeId getSenderId()
          Get sender Id.
 java.io.ObjectInputStream getStream()
          Get stream over which the object was deserialized.
 boolean hasPriority()
          Get priority
protected  void setPriority(boolean prio)
          Set priority.
 void setSenderId(rice.pastry.NodeId id)
          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
 

Constructor Detail

Message

public Message(rice.pastry.messaging.Address dest)
Constructor.

Parameters:
dest - the destination.

Message

public Message(rice.pastry.messaging.Address dest,
               rice.pastry.security.Credentials cred)
Constructor.

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

Message

public Message(rice.pastry.messaging.Address dest,
               rice.pastry.security.Credentials cred,
               java.util.Date timestamp)
Constructor.

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

Message

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

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

getDestination

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

Returns:
the destination id.

getCredentials

public rice.pastry.security.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 rice.pastry.NodeId getSenderId()
Get sender Id.

Returns:
the immediate sender's NodeId.

setSenderId

public void setSenderId(rice.pastry.NodeId id)
Set sender Id. Called by NodeHandle just before dispatch, so that this Id is guaranteed to belong to the immediate sender.


hasPriority

public boolean hasPriority()
Get priority

Returns:
the priority of this message.

setPriority

protected void setPriority(boolean prio)
Set priority.


getStream

public java.io.ObjectInputStream getStream()
Get stream over which the object was deserialized. Used for indexing into the LocalNode.pending hashmap. See README.handle_localnode.

Returns:
the object input stream

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 - Rice Pastry.


Imprint-Dataprotection