jxtaimpl
Interface PeerFinder

All Known Implementing Classes:
AnthillPeerWS

public interface PeerFinder

This interface defines a set of methods which should be implemented for periodically collecting information about other peers (Nests). The main method is discoverNest(). It should use JXTA's PDP in the jxta implementation of Anthill to get new advertisements; once one has been found the method mkNestId() generates a NestId for the nest just discovered. The next step is adding it to the list of known nests via the addKnownNest() method.

Author:
Francesco Russo (frusso@cs.unibo.it)

Method Summary
 void addKnownNest(NestId id)
          When a new nest has been found, a call to this method will just record the new NestId associated to the nest.
 void discoverNest()
          This method is used to collect peer advertisements.
 NestId getDestNestId()
          This method should be invoked by a Nest instance in order to know to which Nest an ant wil be sent.
 NestId mkNestId(Advertisement adv)
          When a new PeerAdvertisement is found, it is handled to this method to extract a valid NestId from it, since that's the smallest information we need to get connected to other nests.
 void run()
          The run method will just periodically call the discoverNest() method and then go to sleep for a specified amount of time.
 

Method Detail

getDestNestId

public NestId getDestNestId()
This method should be invoked by a Nest instance in order to know to which Nest an ant wil be sent.


run

public void run()
The run method will just periodically call the discoverNest() method and then go to sleep for a specified amount of time. The "sleeping time" is set via the constructor of the class implementing this interface.


addKnownNest

public void addKnownNest(NestId id)
When a new nest has been found, a call to this method will just record the new NestId associated to the nest.


discoverNest

public void discoverNest()
This method is used to collect peer advertisements.


mkNestId

public NestId mkNestId(Advertisement adv)
When a new PeerAdvertisement is found, it is handled to this method to extract a valid NestId from it, since that's the smallest information we need to get connected to other nests.