|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectp2ps.imp.discovery.DiscoveryServiceImp
An implementation of the discovery service interface.
| Field Summary |
| Fields inherited from interface p2ps.discovery.DiscoveryService |
DEFAULT_LIFETIME, DISCOVERY_SERVICE |
| Constructor Summary | |
DiscoveryServiceImp(Peer peer)
Constructs a new discovery service for the specified peer. |
|
| Method Summary | |
void |
addDiscoveryListener(DiscoveryListener listener)
Adds a listener to be notified when an advert is discovered/published |
void |
connectionReceived(ConnectionReceivedEvent event)
Called when a connection is received by an input pipe. |
Advertisement[] |
getLocalAdvertisements()
|
java.net.URI[] |
getReplyURIs()
|
void |
init()
Initialises the discovery service |
void |
messageReceived(MessageReceivedEvent event)
Handles a broadcast advert or a query reply |
void |
notifyListeners(Advertisement advert)
Notify all the discovery listeners that an advert has been discovered |
void |
publish(Advertisement advert)
Publishes an advert using the discovery pipe. |
void |
publish(Advertisement advert,
long lifetime)
Publishes an advertisement/query using the discovery pipe, with the specified lifetime. |
void |
removeDiscoveryListener(DiscoveryListener listener)
Removes a listener from being notified when an advert is discovered/published |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DiscoveryServiceImp(Peer peer)
| Method Detail |
public void init()
throws InitializationException,
java.io.IOException
init in interface DiscoveryServiceInitializationException
java.io.IOExceptionpublic void addDiscoveryListener(DiscoveryListener listener)
addDiscoveryListener in interface DiscoveryServicepublic void removeDiscoveryListener(DiscoveryListener listener)
removeDiscoveryListener in interface DiscoveryServicepublic java.net.URI[] getReplyURIs()
getReplyURIs in interface DiscoveryServiceInterfacepublic Advertisement[] getLocalAdvertisements()
getLocalAdvertisements in interface DiscoveryServiceInterface
public void publish(Advertisement advert)
throws java.io.IOException
publish in interface DiscoveryServiceadvert - the advert/query being published
java.io.IOException
public void publish(Advertisement advert,
long lifetime)
throws java.io.IOException
publish in interface DiscoveryServiceadvert - the advert/query being publishedlifetime - the lifetime for the advert in milliseconds
java.io.IOExceptionpublic void connectionReceived(ConnectionReceivedEvent event)
public void messageReceived(MessageReceivedEvent event)
messageReceived in interface MessageListenerpublic void notifyListeners(Advertisement advert)
notifyListeners in interface DiscoveryServiceInterface
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||