peersim.pastry
Class MSPastryProtocol

java.lang.Object
  extended by peersim.pastry.MSPastryProtocol
All Implemented Interfaces:
java.lang.Cloneable, peersim.core.Protocol, peersim.edsim.EDProtocol

public class MSPastryProtocol
extends java.lang.Object
implements java.lang.Cloneable, peersim.edsim.EDProtocol


Nested Class Summary
static interface MSPastryProtocol.Listener
          Event Handler container for managing the receiving of a message
 
Field Summary
 LeafSet leafSet
          leaf set of this pastry node
 java.math.BigInteger nodeId
          nodeId of this pastry node
 RoutingTable routingTable
          routing table of this pastry node
 
Constructor Summary
MSPastryProtocol(java.lang.String prefix)
          Used only by the initializer when creating the prototype Every other instance call CLONE to create the new object.
 
Method Summary
 java.lang.Object clone()
          Replicate this object by returning an identical copy.
 MSPastryProtocol get(int i)
          shortcut for getting the MSPastry level of the node with index "i" in the network
 peersim.transport.Transport getTr(int i)
          shortcut for getting the Transport level of the node with index "i" in the network
 void join()
          Given that this node was correctly initialized (e.g.
 void processEvent(peersim.core.Node myNode, int myPid, java.lang.Object event)
          manage the peersim receiving of the events
 void receiveRoute(Message m)
          see MSPastry protocol "ReceiveRoute" primitive
 void send(java.math.BigInteger recipient, java.lang.Object data)
          This primitive provide the sending of the data to dest, by encapsulating it into a LOOKUP Message
 void setListener(MSPastryProtocol.Listener l)
          allows to change/clear the listener
 void setNodeId(java.math.BigInteger tmp)
          set the current NodeId
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeId

public java.math.BigInteger nodeId
nodeId of this pastry node


routingTable

public RoutingTable routingTable
routing table of this pastry node


leafSet

public LeafSet leafSet
leaf set of this pastry node

Constructor Detail

MSPastryProtocol

public MSPastryProtocol(java.lang.String prefix)
Used only by the initializer when creating the prototype Every other instance call CLONE to create the new object. clone could not use this constructor, preferring a more quick constructor

Parameters:
prefix - String
Method Detail

setListener

public void setListener(MSPastryProtocol.Listener l)
allows to change/clear the listener

Parameters:
l - Listener

clone

public java.lang.Object clone()
Replicate this object by returning an identical copy. it put the eye on the fact that only the peersim initializer call this method and we expects to replicate every time a non-initialized table. Thus the method clone() do not fill any particular field;

Specified by:
clone in interface peersim.core.Protocol
Overrides:
clone in class java.lang.Object
Returns:
Object

receiveRoute

public void receiveRoute(Message m)
see MSPastry protocol "ReceiveRoute" primitive

Parameters:
m - Message

join

public void join()
Given that this node was correctly initialized (e.g. routing table and leafset created, and empty) it perform a join requesta to the mspastry according to the protocol specification


get

public final MSPastryProtocol get(int i)
shortcut for getting the MSPastry level of the node with index "i" in the network

Parameters:
i - int
Returns:
MSPastryProtocol

getTr

public final peersim.transport.Transport getTr(int i)
shortcut for getting the Transport level of the node with index "i" in the network

Parameters:
i - int
Returns:
MSPastryProtocol

send

public void send(java.math.BigInteger recipient,
                 java.lang.Object data)
This primitive provide the sending of the data to dest, by encapsulating it into a LOOKUP Message

Parameters:
recipient - BigInteger
data - Object

processEvent

public void processEvent(peersim.core.Node myNode,
                         int myPid,
                         java.lang.Object event)
manage the peersim receiving of the events

Specified by:
processEvent in interface peersim.edsim.EDProtocol
Parameters:
myNode - Node
myPid - int
event - Object

setNodeId

public void setNodeId(java.math.BigInteger tmp)
set the current NodeId

Parameters:
tmp - BigInteger