peersim.pastry
Class Message

java.lang.Object
  extended by peersim.pastry.Message

public class Message
extends java.lang.Object

Message class provide all functionalities to magage the various messages, principally LOOKUP messages (messages from application level sender destinated to another application level).
Types Of messages:
(application messages)
- MSG_LOOKUP: indicates that the body Object containes information to application level of the recipient

(service internal protocol messages)
- MSG_JOINREQUEST: message containing a join request of a node, the message is passed between many pastry nodes accorting to the protocol
- MSG_JOINREPLY: according to protocol, the body transport information related to a join reply message
- MSG_LSPROBEREQUEST:according to protocol, the body transport information related to a probe request message
- MSG_LSPROBEREPLY: not used in the current implementation
- MSG_SERVICEPOLL: internal message used to provide cyclic cleaning service of dead nodes
The body for message types MSG_JOINREQUEST and MSG_JOINREPLY if defined by the class Message.BodyJoinRequestReply

Title: MSPASTRY

Description: MsPastry implementation for PeerSim

Copyright: Copyright (c) 2007

Company: The Pastry Group


Nested Class Summary
static class Message.BodyJoinRequestReply
           
 
Field Summary
 java.lang.Object body
          This Object contains the body of the message, no matter what it contains
 java.math.BigInteger dest
          Recipient address of the message
 long id
          ID of the message.
static int MAX_TRACK
          Tha trace vector has this limit size
 int messageType
          Identify the type of this message
static int MSG_JOINREPLY
          Message Type
static int MSG_JOINREQUEST
          Message Type
static int MSG_LOOKUP
          Message Type
static int MSG_LSPROBEREPLY
          Message Type
static int MSG_LSPROBEREQUEST
          Message Type
static int MSG_SERVICEPOLL
          Internal Message: polling cleaner
protected  int nrHops
          Available to conunt the number of hops the message did.
 java.math.BigInteger src
          Source address of the message: has to be filled ad application level
protected  long timestamp
          Available to contains the timestamp of the (creation date of the) message
protected  java.math.BigInteger[] tracks
          Available to contains the path of the message
protected  int trackSize
          current size of the tracks vector
 
Constructor Summary
Message()
          Creates an empty message by using default values (message type = MSG_LOOKUP and new String("") value for the body of the message)
Message(int messageType, java.lang.Object body)
          Creates an empty message by using default values (message messageType = MSG_LOOKUP and null value for the body of the message)
Message(java.lang.Object body)
          Creates a lookup message with the specified body
 
Method Summary
 Message copy()
           
static Message makeJoinRequest(java.lang.Object body)
          Encapsulates the creation of a join request
static Message makeLookUp(java.lang.Object body)
          Encapsulates the creation of a join request
 java.lang.String messageTypetoString()
           
 java.lang.String toString()
           
 java.lang.String traceToString()
          returns a ";" separated list of the tracks vector
 java.lang.String traceToString(boolean header)
          returns a ";" separated list of the tracks vector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_TRACK

public static final int MAX_TRACK
Tha trace vector has this limit size

See Also:
Constant Field Values

MSG_LOOKUP

public static final int MSG_LOOKUP
Message Type

See Also:
Constant Field Values

MSG_JOINREQUEST

public static final int MSG_JOINREQUEST
Message Type

See Also:
Constant Field Values

MSG_JOINREPLY

public static final int MSG_JOINREPLY
Message Type

See Also:
Constant Field Values

MSG_LSPROBEREQUEST

public static final int MSG_LSPROBEREQUEST
Message Type

See Also:
Constant Field Values

MSG_LSPROBEREPLY

public static final int MSG_LSPROBEREPLY
Message Type

See Also:
Constant Field Values

MSG_SERVICEPOLL

public static final int MSG_SERVICEPOLL
Internal Message: polling cleaner

See Also:
Constant Field Values

messageType

public int messageType
Identify the type of this message


body

public java.lang.Object body
This Object contains the body of the message, no matter what it contains


id

public long id
ID of the message. this is automatically generated univocally, and should not change


dest

public java.math.BigInteger dest
Recipient address of the message


src

public java.math.BigInteger src
Source address of the message: has to be filled ad application level


nrHops

protected int nrHops
Available to conunt the number of hops the message did.


trackSize

protected int trackSize
current size of the tracks vector


tracks

protected java.math.BigInteger[] tracks
Available to contains the path of the message


timestamp

protected long timestamp
Available to contains the timestamp of the (creation date of the) message

Constructor Detail

Message

public Message(java.lang.Object body)
Creates a lookup message with the specified body

Parameters:
body - Object body to assign (shallow copy)

Message

public Message()
Creates an empty message by using default values (message type = MSG_LOOKUP and new String("") value for the body of the message)


Message

public Message(int messageType,
               java.lang.Object body)
Creates an empty message by using default values (message messageType = MSG_LOOKUP and null value for the body of the message)

Parameters:
messageType - int type of the message
body - Object body to assign (shallow copy)
Method Detail

makeJoinRequest

public static final Message makeJoinRequest(java.lang.Object body)
Encapsulates the creation of a join request

Parameters:
body - Object
Returns:
Message

makeLookUp

public static final Message makeLookUp(java.lang.Object body)
Encapsulates the creation of a join request

Parameters:
body - Object
Returns:
Message

traceToString

public java.lang.String traceToString(boolean header)
returns a ";" separated list of the tracks vector

Parameters:
header - boolean if true, even an initial information header is printed
Returns:
String

traceToString

public java.lang.String traceToString()
returns a ";" separated list of the tracks vector

Returns:
String

toString

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

copy

public Message copy()

messageTypetoString

public java.lang.String messageTypetoString()