Project JXTA

net.jxta.impl.discovery
Class DiscoveryServiceInterface

java.lang.Object
  extended bynet.jxta.impl.discovery.DiscoveryServiceInterface
All Implemented Interfaces:
DiscoveryService, Module, Service

public final class DiscoveryServiceInterface
extends Object
implements DiscoveryService

Provides a pure interface object that permits interaction with the actual Discovery Service implementation without giving access to the real object.


Field Summary
 
Fields inherited from interface net.jxta.discovery.DiscoveryService
ADV, DEFAULT_EXPIRATION, DEFAULT_LIFETIME, GROUP, INFINITE_LIFETIME, NO_EXPIRATION, PEER
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK
 
Constructor Summary
(package private) DiscoveryServiceInterface(DiscoveryServiceImpl theRealThing)
          Only authorized constructor
 
Method Summary
 void addDiscoveryListener(DiscoveryListener listener)
          
 void flushAdvertisement(Advertisement adv)
          
 void flushAdvertisements(String id, int type)
          
 long getAdvExpirationTime(Advertisement adv)
          
 long getAdvExpirationTime(ID id, int type)
          
 long getAdvLifeTime(Advertisement adv)
          
 long getAdvLifeTime(ID id, int type)
          
 Advertisement getImplAdvertisement()
          
 Service getInterface()
          
 Enumeration getLocalAdvertisements(int type, String attribute, String value)
          
 int getRemoteAdvertisements(String peer, int type, String attribute, String value, int threshold)
          
 int getRemoteAdvertisements(String peer, int type, String attribute, String value, int threshold, DiscoveryListener listener)
          
 void init(PeerGroup pg, ID assignedID, Advertisement impl)
          

FIXME: This is meaningless for the interface object; it is there only to satisfy the requirements of the interface that we implement.

 void publish(Advertisement adv)
          
 void publish(Advertisement adv, int type)
          
 void publish(Advertisement adv, int type, long lifetime, long lifetimeForOthers)
          
 void publish(Advertisement adv, long lifetime, long lifetimeForOthers)
          
 void remotePublish(Advertisement adv)
          
 void remotePublish(Advertisement adv, int type)
          
 void remotePublish(Advertisement adv, int type, long lifetime)
          
 void remotePublish(Advertisement adv, long lifetime)
          
 void remotePublish(String peerid, Advertisement adv)
          
 void remotePublish(String peerid, Advertisement adv, int type)
          
 void remotePublish(String peerid, Advertisement adv, int type, long lifetime)
          
 void remotePublish(String peerid, Advertisement adv, long lifetime)
          
 boolean removeDiscoveryListener(DiscoveryListener listener)
          
 int startApp(String[] arg)
          

This is here for temporary class hierarchy reasons.

 void stopApp()
          

This is here for temporary class hierarchy reasons.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscoveryServiceInterface

DiscoveryServiceInterface(DiscoveryServiceImpl theRealThing)
Only authorized constructor

Parameters:
theRealThing - The actual discovery implementation
Method Detail

getInterface

public Service getInterface()

Specified by:
getInterface in interface Service

getImplAdvertisement

public Advertisement getImplAdvertisement()

Specified by:
getImplAdvertisement in interface Service

init

public void init(PeerGroup pg,
                 ID assignedID,
                 Advertisement impl)

FIXME: This is meaningless for the interface object; it is there only to satisfy the requirements of the interface that we implement. Ultimately, the API should define two levels of interfaces: one for the real service implementation and one for the interface object. Right now it feels a bit heavy to so that since the only different between the two would be init() and may-be getName().

Specified by:
init in interface Module

startApp

public int startApp(String[] arg)

This is here for temporary class hierarchy reasons. it is ALWAYS ignored. By definition, the interface object protects the real object's start/stop methods from being called

Specified by:
startApp in interface Module

stopApp

public void stopApp()

This is here for temporary class hierarchy reasons. it is ALWAYS ignored. By definition, the interface object protects the real object's start/stop methods from being called

This request is currently ignored.

Specified by:
stopApp in interface Module

getRemoteAdvertisements

public int getRemoteAdvertisements(String peer,
                                   int type,
                                   String attribute,
                                   String value,
                                   int threshold)

Specified by:
getRemoteAdvertisements in interface DiscoveryService

getRemoteAdvertisements

public int getRemoteAdvertisements(String peer,
                                   int type,
                                   String attribute,
                                   String value,
                                   int threshold,
                                   DiscoveryListener listener)

Specified by:
getRemoteAdvertisements in interface DiscoveryService

getLocalAdvertisements

public Enumeration getLocalAdvertisements(int type,
                                          String attribute,
                                          String value)
                                   throws IOException

Specified by:
getLocalAdvertisements in interface DiscoveryService
Throws:
IOException

flushAdvertisement

public void flushAdvertisement(Advertisement adv)
                        throws IOException

Specified by:
flushAdvertisement in interface DiscoveryService
Throws:
IOException

flushAdvertisements

public void flushAdvertisements(String id,
                                int type)
                         throws IOException

Specified by:
flushAdvertisements in interface DiscoveryService
Throws:
IOException

getAdvExpirationTime

public long getAdvExpirationTime(ID id,
                                 int type)

Specified by:
getAdvExpirationTime in interface DiscoveryService

getAdvLifeTime

public long getAdvLifeTime(ID id,
                           int type)

Specified by:
getAdvLifeTime in interface DiscoveryService

getAdvExpirationTime

public long getAdvExpirationTime(Advertisement adv)

Specified by:
getAdvExpirationTime in interface DiscoveryService

getAdvLifeTime

public long getAdvLifeTime(Advertisement adv)

Specified by:
getAdvLifeTime in interface DiscoveryService

publish

public void publish(Advertisement adv,
                    int type)
             throws IOException

Specified by:
publish in interface DiscoveryService
Throws:
IOException

publish

public void publish(Advertisement adv)
             throws IOException

Specified by:
publish in interface DiscoveryService
Throws:
IOException

publish

public void publish(Advertisement adv,
                    int type,
                    long lifetime,
                    long lifetimeForOthers)
             throws IOException

Specified by:
publish in interface DiscoveryService
Throws:
IOException

publish

public void publish(Advertisement adv,
                    long lifetime,
                    long lifetimeForOthers)
             throws IOException

Specified by:
publish in interface DiscoveryService
Throws:
IOException

remotePublish

public void remotePublish(Advertisement adv,
                          int type)

Specified by:
remotePublish in interface DiscoveryService

remotePublish

public void remotePublish(Advertisement adv)

Specified by:
remotePublish in interface DiscoveryService

remotePublish

public void remotePublish(Advertisement adv,
                          int type,
                          long lifetime)

Specified by:
remotePublish in interface DiscoveryService

remotePublish

public void remotePublish(Advertisement adv,
                          long lifetime)

Specified by:
remotePublish in interface DiscoveryService

remotePublish

public void remotePublish(String peerid,
                          Advertisement adv,
                          int type)

Specified by:
remotePublish in interface DiscoveryService

remotePublish

public void remotePublish(String peerid,
                          Advertisement adv)

Specified by:
remotePublish in interface DiscoveryService

remotePublish

public void remotePublish(String peerid,
                          Advertisement adv,
                          int type,
                          long lifetime)

Specified by:
remotePublish in interface DiscoveryService

remotePublish

public void remotePublish(String peerid,
                          Advertisement adv,
                          long lifetime)

Specified by:
remotePublish in interface DiscoveryService

addDiscoveryListener

public void addDiscoveryListener(DiscoveryListener listener)

Specified by:
addDiscoveryListener in interface DiscoveryService

removeDiscoveryListener

public boolean removeDiscoveryListener(DiscoveryListener listener)

Specified by:
removeDiscoveryListener in interface DiscoveryService

JXTA J2SE