org.hypergraphdb.peer.jxta
Class JXTAPeerInterface

java.lang.Object
  extended by org.hypergraphdb.peer.jxta.JXTAPeerInterface
All Implemented Interfaces:
JXTARequestHandler, PeerInterface

public class JXTAPeerInterface
extends java.lang.Object
implements PeerInterface, JXTARequestHandler

Author:
Cipri Costa Implements the PeerInterface interface and manages the communication with the other peers in the JXTA network. Also manages resources like task allocation and threads.

Constructor Summary
JXTAPeerInterface()
           
 
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.
 void handleRequest(java.net.Socket socket)
           
 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 target, java.lang.Object msg)
           
 void setMessageHandler(MessageHandler messageHandler)
           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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JXTAPeerInterface

public JXTAPeerInterface()
Method Detail

configure

public boolean configure(java.util.Map<java.lang.String,java.lang.Object> configuration)
Description copied from interface: PeerInterface
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.

Specified by:
configure in interface PeerInterface
Returns:

stop

public void stop()
Description copied from interface: PeerInterface

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

Specified by:
stop in interface PeerInterface

setMessageHandler

public void setMessageHandler(MessageHandler messageHandler)
Description copied from interface: PeerInterface

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

Specified by:
setMessageHandler in interface PeerInterface

run

public void run(java.util.concurrent.ExecutorService executorService)
Description copied from interface: PeerInterface

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.

Specified by:
run in interface PeerInterface

handleRequest

public void handleRequest(java.net.Socket socket)
Specified by:
handleRequest in interface JXTARequestHandler

getThisPeer

public HyperGraphPeer getThisPeer()
Description copied from interface: PeerInterface

Return the HyperGraphPeer to which this PeerInterface is bound.

Specified by:
getThisPeer in interface PeerInterface

setThisPeer

public void setThisPeer(HyperGraphPeer thisPeer)
Description copied from interface: PeerInterface

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

Specified by:
setThisPeer in interface PeerInterface

newFilterActivity

public PeerFilter newFilterActivity(PeerFilterEvaluator evaluator)
Specified by:
newFilterActivity in interface PeerInterface

newSendActivityFactory

public PeerRelatedActivityFactory newSendActivityFactory()
Specified by:
newSendActivityFactory in interface PeerInterface

send

public java.util.concurrent.Future<java.lang.Boolean> send(java.lang.Object target,
                                                           java.lang.Object msg)
Specified by:
send in interface PeerInterface

broadcast

public void broadcast(java.lang.Object msg)
Description copied from interface: PeerInterface

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

Specified by:
broadcast in interface PeerInterface

getPeerNetwork

public PeerNetwork getPeerNetwork()
Specified by:
getPeerNetwork in interface PeerInterface