org.hypergraphdb.peer
Interface PeerInterface

All Known Implementing Classes:
JXTAPeerInterface

public interface PeerInterface

This interface is implemented by classes that handle incoming and outgoing message traffic for the peer. The interface has some factory methods that allow implementers to decide how to create and allocate objects. TODO: manage threads from this object

Author:
Cipri Costa

Method Summary
 void broadcast(java.lang.Object msg)
           Broadcast a message to all members of this peer's group.
 boolean configure(java.util.Map<java.lang.String,java.lang.Object> configuration)
          Because implementors can be of any type, the configuration is an Object, no constraints to impose here as there is no common set of configuration properties.
 PeerNetwork getPeerNetwork()
           
 HyperGraphPeer getThisPeer()
           Return the HyperGraphPeer to which this PeerInterface is bound.
 PeerFilter newFilterActivity(PeerFilterEvaluator evaluator)
           
 PeerRelatedActivityFactory newSendActivityFactory()
           
 void run(java.util.concurrent.ExecutorService executorService)
           Execute the message handling loop of this interface.
 java.util.concurrent.Future<java.lang.Boolean> send(java.lang.Object networkTarget, java.lang.Object msg)
           
 void setMessageHandler(MessageHandler message)
           There is only one MessageHandler for incoming message through a given PeerInterface and this method sets it for this one.
 void setThisPeer(HyperGraphPeer thisPeer)
           Internally used to initialize the PeerInterface, don't call in application code.
 void stop()
           Stop the PeerInterface - no more messages are going to be received or sent.
 

Method Detail

setMessageHandler

void setMessageHandler(MessageHandler message)

There is only one MessageHandler for incoming message through a given PeerInterface and this method sets it for this one.

Parameters:
message -

configure

boolean configure(java.util.Map<java.lang.String,java.lang.Object> configuration)
Because implementors can be of any type, the configuration is an Object, no constraints to impose here as there is no common set of configuration properties.

Parameters:
configuration -
Returns:

run

void run(java.util.concurrent.ExecutorService executorService)

Execute the message handling loop of this interface. This method is akin to a vanilla run, but with the additional constraint that a specific ExecutorService must be used for the main message handling thread as well as for all activities triggered by this PeerInterface.

Parameters:
executorService -

stop

void stop()

Stop the PeerInterface - no more messages are going to be received or sent.


getThisPeer

HyperGraphPeer getThisPeer()

Return the HyperGraphPeer to which this PeerInterface is bound.


setThisPeer

void setThisPeer(HyperGraphPeer thisPeer)

Internally used to initialize the PeerInterface, don't call in application code.


getPeerNetwork

PeerNetwork getPeerNetwork()

newFilterActivity

PeerFilter newFilterActivity(PeerFilterEvaluator evaluator)

newSendActivityFactory

PeerRelatedActivityFactory newSendActivityFactory()

broadcast

void broadcast(java.lang.Object msg)

Broadcast a message to all members of this peer's group.

Parameters:
msg -

send

java.util.concurrent.Future<java.lang.Boolean> send(java.lang.Object networkTarget,
                                                    java.lang.Object msg)