viceroy.net
Class DummyCommunicationManager

java.lang.Object
  |
  +--viceroy.net.DummyCommunicationManager
All Implemented Interfaces:
ViceroyPeerManager

public class DummyCommunicationManager
extends java.lang.Object
implements ViceroyPeerManager

Implementation of Communication manager

Author:
Anat Talmy
, Oren Dobzinski

Field Summary
 ViceroyPeer entrancePoint
          The entrance point of the net
private static org.apache.log4j.Logger logger
          logger for debug
 
Constructor Summary
DummyCommunicationManager()
           
 
Method Summary
 void addListener(Listener listener, AuthorizedViceroyPeer bounded)
          adds a new listener to the system.
 void discover(ViceroyPeer me)
          finds the successor of me in the Viceroy network.
 void leave(AuthorizedViceroyPeer peer)
          removes the given peer from the network.
 Address register(AuthorizedViceroyPeer peer)
          registers a new ViceroyPeer in the system.
 void send(ViceroyPeer destination, Message message)
          send a message
 void setEntrancePoint(ViceroyPeer _entrancePoint)
          Sets the entrance point of the net
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.apache.log4j.Logger logger
logger for debug


entrancePoint

public ViceroyPeer entrancePoint
The entrance point of the net

Constructor Detail

DummyCommunicationManager

public DummyCommunicationManager()
Method Detail

setEntrancePoint

public void setEntrancePoint(ViceroyPeer _entrancePoint)
Sets the entrance point of the net

Parameters:
_entrancePoint - The entrance point

register

public Address register(AuthorizedViceroyPeer peer)
registers a new ViceroyPeer in the system. The return value of this method should be kept at the registerred peer, for messages which need a return address

Specified by:
register in interface ViceroyPeerManager
Parameters:
peer - the peer to register
Returns:
an address that should be kept in case the registerred peer needs am answer for a certain message.

addListener

public void addListener(Listener listener,
                        AuthorizedViceroyPeer bounded)
adds a new listener to the system. Several local peers can listen on the same message with different listeners. The listener is able to distinguish between the messages

Specified by:
addListener in interface ViceroyPeerManager
Parameters:
listener - the listener to add
bounded - the peer that the incoming messages specify as destination

discover

public void discover(ViceroyPeer me)
finds the successor of me in the Viceroy network. This step is called 'discovery'. The successor is the ViceroyPeer who is responsible to my HashValue before my takeover

Specified by:
discover in interface ViceroyPeerManager
Parameters:
me - The peer who wishes to find its successor - to initiate the discovery process.
Since:
version 1.1

send

public void send(ViceroyPeer destination,
                 Message message)
send a message

Specified by:
send in interface ViceroyPeerManager
Parameters:
destination - the destination of the message
message - the message to be sent

leave

public void leave(AuthorizedViceroyPeer peer)
removes the given peer from the network. All its listeners will be removed, and no messages will reach it

Specified by:
leave in interface ViceroyPeerManager
Parameters:
peer - the peer that leaves