Project JXTA

net.jxta.impl.discovery
Class DiscoveryInterface

java.lang.Object
  |
  +--net.jxta.impl.discovery.DiscoveryInterface

public class DiscoveryInterface
extends java.lang.Object
implements net.jxta.discovery.Discovery

DiscoveryInterface provides a pure interface object that permits interaction with the actual DiscoveryService implementation without giving access to the real object.


Fields inherited from interface net.jxta.discovery.Discovery
ADV, GROUP, PEER
 
Constructor Summary
DiscoveryInterface(DiscoveryService theRealThing)
          Only authorized constructor
 
Method Summary
 void flushAdvertisements(java.lang.String id, int type)
          flush cached peer Advertisements.
 net.jxta.document.Advertisement getAdvertisement()
          Returns the advertisment for that service.
 net.jxta.service.Service getInterface()
          returns an interface object that permits to use this service without having access to the real object.
 java.util.Enumeration getLocalAdvertisements(int type, java.lang.String attribute, java.lang.String value)
          Retrieve Stored Advertisements
 void getRemoteAdvertisements(java.lang.String peer, int type, java.lang.String attribute, java.lang.String value, int threshold)
          Discover peers within a region set by the endpoint
 void init(net.jxta.peergroup.PeerGroup pg, net.jxta.document.Advertisement a)
          Initialize the application FIXME: This is meaningless for the interface object; it is there only to satisfy the requirements of the interface that we implement.
 void publish(net.jxta.document.Advertisement adv, int type)
          Publish an advertisement same as above, provided as a convenience
 void remotePublish(net.jxta.document.Advertisement adv, int type)
           
 int startApp(java.lang.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

DiscoveryInterface

public DiscoveryInterface(DiscoveryService theRealThing)
Only authorized constructor
Method Detail

getInterface

public net.jxta.service.Service getInterface()
returns an interface object that permits to use this service without having access to the real object. Since THIS is already such an object, it returns itself. FIXME: it is kind of absurd to have this method part of the interface but we do not want to define two levels of Service interface just for that.
Returns:
Resolver An interface object that implements this service and nothing more.

getAdvertisement

public net.jxta.document.Advertisement getAdvertisement()
Returns the advertisment for that service.
Returns:
Advertisement the advertisement.
Since:
JXTA 1.0

init

public void init(net.jxta.peergroup.PeerGroup pg,
                 net.jxta.document.Advertisement a)
Initialize the application 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().
Parameters:
group - PeerGroup this application is started from
Since:
JXTA 1.0

startApp

public int startApp(java.lang.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
Parameters:
arg - A table of strings arguments.
Returns:
int status indication.

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.

getRemoteAdvertisements

public void getRemoteAdvertisements(java.lang.String peer,
                                    int type,
                                    java.lang.String attribute,
                                    java.lang.String value,
                                    int threshold)
Discover peers within a region set by the endpoint
Specified by:
getRemoteAdvertisements in interface net.jxta.discovery.Discovery
Parameters:
address - Address of a peer, or portal to connect to, if address is null then getPeerAdv "discover" in the region of the group
See Also:
net.jxta.endpoint.Address

getLocalAdvertisements

public java.util.Enumeration getLocalAdvertisements(int type,
                                                    java.lang.String attribute,
                                                    java.lang.String value)
                                             throws java.io.IOException
Retrieve Stored Advertisements
Specified by:
getLocalAdvertisements in interface net.jxta.discovery.Discovery
Returns:
Enumeration of stored advertisements/structured documents
Since:
JXTA 1.0

flushAdvertisements

public void flushAdvertisements(java.lang.String id,
                                int type)
                         throws java.io.IOException
flush cached peer Advertisements.
Specified by:
flushAdvertisements in interface net.jxta.discovery.Discovery

publish

public void publish(net.jxta.document.Advertisement adv,
                    int type)
             throws java.io.IOException
Publish an advertisement same as above, provided as a convenience
Specified by:
publish in interface net.jxta.discovery.Discovery
Parameters:
doc - StructuredDocument to publish

remotePublish

public void remotePublish(net.jxta.document.Advertisement adv,
                          int type)
Specified by:
remotePublish in interface net.jxta.discovery.Discovery

Project JXTA