p2ps.discovery
Interface DiscoveryService

All Known Implementing Classes:
DiscoveryServiceImp

public interface DiscoveryService

The interface responsible for discovering and publishing advertisements

Version:
$Revision: 295 $
Author:
Ian Wang

Field Summary
static long DEFAULT_LIFETIME
          Default lifetime for an advertisememt (1 hour)
static java.lang.String DISCOVERY_SERVICE
           
 
Method Summary
 void addDiscoveryListener(DiscoveryListener listener)
          Adds a listener to be notified when an advert is discovered
 void init()
          Initialises the discovery service
 void publish(Advertisement advert)
          Publishes an advertisement/query using the discovery pipe, with a DEFAULT_LIFETIME.
 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
 

Field Detail

DISCOVERY_SERVICE

public static final java.lang.String DISCOVERY_SERVICE
See Also:
Constant Field Values

DEFAULT_LIFETIME

public static final long DEFAULT_LIFETIME
Default lifetime for an advertisememt (1 hour)

See Also:
Constant Field Values
Method Detail

init

public void init()
          throws InitializationException,
                 java.io.IOException
Initialises the discovery service

Throws:
InitializationException
java.io.IOException

addDiscoveryListener

public void addDiscoveryListener(DiscoveryListener listener)
Adds a listener to be notified when an advert is discovered


removeDiscoveryListener

public void removeDiscoveryListener(DiscoveryListener listener)
Removes a listener from being notified when an advert is discovered


publish

public void publish(Advertisement advert)
             throws java.io.IOException
Publishes an advertisement/query using the discovery pipe, with a DEFAULT_LIFETIME.

Parameters:
advert - the advert/query being published
Throws:
java.io.IOException

publish

public void publish(Advertisement advert,
                    long lifetime)
             throws java.io.IOException
Publishes an advertisement/query using the discovery pipe, with the specified lifetime.

Parameters:
advert - the advert/query being published
lifetime - the lifetime for the advert in milliseconds
Throws:
java.io.IOException