|
Project JXTA | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.jxta.impl.discovery.DiscoveryService
DiscoveryService Service provides a mechanism to discover peers within a " Network Peer Group" DiscoveryService is limited to the Network Peer Group region set. jxtaDiscovery also provides a way to connect directly to another peer given a Address and request other peer advertisements, this method is particularly useful in the case of a portal where new relationships may be established, or in the case of connecting to a predetermined peer (perhaps described in address book, or through an invitation)
Inner Class Summary | |
protected class |
DiscoveryService.PendingQuery
|
protected class |
DiscoveryService.Requester
|
Field Summary | |
protected Cm |
cm
|
Fields inherited from interface net.jxta.discovery.Discovery |
ADV,
DEFAULT_EXPIRATION,
DEFAULT_LIFETIME,
GROUP,
PEER |
Constructor Summary | |
DiscoveryService()
Default constructor |
Method Summary | |
void |
addDiscoveryListener(net.jxta.discovery.DiscoveryListener listener)
Add a discovery listener |
void |
flushAdvertisements(java.lang.String id,
int type)
flush cached peer Advertisements. |
net.jxta.document.Advertisement |
getAdvertisement()
Returns the advertisement for that service. |
net.jxta.peergroup.PeerGroup |
getGroup()
Returns the group to which this service is attached. |
net.jxta.service.Service |
getInterface()
Service objects are not manipulated directly to protect usage of the service. |
java.util.Enumeration |
getLocalAdvertisements(int type,
java.lang.String attribute,
java.lang.String value)
Retrieve Stored Advertisements based on the type it returns an enum Advertisement for PEER, and GROUP returns an enum of Advertisement for ADV |
int |
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 sadv)
init is called by PeerGroup to init the Service with endpoint etc. |
protected int |
next(int bits)
|
net.jxta.protocol.ResolverResponseMsg |
processQuery(net.jxta.protocol.ResolverQueryMsg query)
Handler API method |
void |
publish(net.jxta.document.Advertisement adv,
int type)
Publish an advertisement This provides a way to advertise Peer/Group Advertisement within the current group. |
void |
publish(net.jxta.document.Advertisement adv,
int type,
long timeoutForMe,
long timeoutForOthers)
Publish an advertisement This provides a way to advertise Peer/Group Advertisement within the current group. |
void |
pushResponse(net.jxta.protocol.ResolverResponseMsg response)
deal with incoming responses for discovery |
void |
remotePublish(net.jxta.document.Advertisement adv,
int type)
|
void |
remotePublish(net.jxta.document.Advertisement adv,
int type,
long timeout)
|
boolean |
removeDiscoveryListener(net.jxta.discovery.DiscoveryListener listener)
remove a discovery listener |
int |
startApp(java.lang.String[] arg)
Supply arguments and starts this service if it hadn't started by itself. |
void |
stopApp()
Ask this service to stop. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected Cm cm
Constructor Detail |
public DiscoveryService()
Method Detail |
public int startApp(java.lang.String[] arg)
arg
- A table of strings arguments.public void stopApp()
public net.jxta.service.Service getInterface()
public net.jxta.document.Advertisement getAdvertisement()
public void init(net.jxta.peergroup.PeerGroup pg, net.jxta.document.Advertisement sadv) throws net.jxta.exception.PeerGroupException
pg
- Peer Grouppublic int getRemoteAdvertisements(java.lang.String peer, int type, java.lang.String attribute, java.lang.String value, int threshold)
address
- Address of a peer, or portal to connect to, if address is null
then getPeerAdv "discover" in the region of the groupnet.jxta.endpoint.Address
public java.util.Enumeration getLocalAdvertisements(int type, java.lang.String attribute, java.lang.String value) throws java.io.IOException
public void flushAdvertisements(java.lang.String id, int type) throws java.io.IOException
public void publish(net.jxta.document.Advertisement adv, int type) throws java.io.IOException
doc
- StructuredDocument to publishpublic void publish(net.jxta.document.Advertisement adv, int type, long timeoutForMe, long timeoutForOthers) throws java.io.IOException
doc
- StructuredDocument to publishtimeout
- Time to livepublic void remotePublish(net.jxta.document.Advertisement adv, int type)
public void remotePublish(net.jxta.document.Advertisement adv, int type, long timeout)
public net.jxta.peergroup.PeerGroup getGroup()
public void pushResponse(net.jxta.protocol.ResolverResponseMsg response)
response
- public net.jxta.protocol.ResolverResponseMsg processQuery(net.jxta.protocol.ResolverQueryMsg query) throws net.jxta.exception.NoResponseException, net.jxta.exception.DiscardQueryException, java.io.IOException, net.jxta.exception.ResendQueryException
query
- GenericResolverMsgprotected int next(int bits)
public void addDiscoveryListener(net.jxta.discovery.DiscoveryListener listener)
DiscoveryListener
- listener to receive discovery eventspublic boolean removeDiscoveryListener(net.jxta.discovery.DiscoveryListener listener)
DiscoveryListener
- listener to remove
|
Project JXTA | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |