|
Project JXTA | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The jxta DiscoveryService Service provides asynchronous mechanism in jxta for discovering Peer Advertisements, Group Advertisements, and general jxta Advertisements (pipe, service, etc.). The scope of discovery can controlled by specifying name and attribute pair, and a threshold. The threshold is an upper limit the requesting peer specifies for responding peers not to exceed. Each jxta Peer Group has an instance of a DiscoveryService Service the scope of the discovery is limited to the group. for example
A peer in the soccer group invokes the soccer group's DiscoveryService Service to discover pipe advertisements in the group, and is interested in a maximum of 10 Advertisements from each peer:
discovery.getRemoteAdvertisements(null, discovery.ADV, null, null,10);
discovery.publish(adv,discovery.ADV);
parent=soccerGroup.getParent(); discovery= parent.getDiscovery() discovery.publish(adv,discovery.ADV);
<?xml version="1.0" standalone='yes'?> <DiscoveryQuery> <type>int</type> <threshold>int</threshold> <peeradv>peeradv</peeradv> <attribute>attribute</attribute> <value>attribute</value> </DiscoveryQuery>
Service
,
Resolver
,
DiscoveryQueryMsg
,
DiscoveryResponseMsg
,
ResolverQueryMsg
,
ResolverResponseMsg
Field Summary | |
static int |
ADV
DOC type |
static int |
GROUP
Group type |
static int |
PEER
Peer type |
Method Summary | |
void |
flushAdvertisements(java.lang.String id,
int type)
flush stored Documents. |
java.util.Enumeration |
getLocalAdvertisements(int type,
java.lang.String attribute,
java.lang.String value)
Retrieve Stored Peer, Group, and General Advertisements |
void |
getRemoteAdvertisements(java.lang.String peerid,
int type,
java.lang.String attribute,
java.lang.String value,
int threshold)
This method discovers PeerAdvertisements, GroupAdvertisements and jxta Advertisements. |
void |
publish(Advertisement advertisement,
int type)
Publish an advertisement |
void |
remotePublish(Advertisement adv,
int type)
Remote Publish an advertisement |
Methods inherited from interface net.jxta.service.Service |
getAdvertisement, getInterface |
Methods inherited from interface net.jxta.platform.Application |
init, startApp, stopApp |
Field Detail |
public static final int PEER
public static final int GROUP
public static final int ADV
Method Detail |
public void getRemoteAdvertisements(java.lang.String peerid, int type, java.lang.String attribute, java.lang.String value, int threshold)
attribute
- attribute name to narrow disocvery tovalue
- value of attribute to narrow disocvery tothreshold
- the upper limit of responses from one peerpeerid
- id of a peer, or "rendezvous" to connect to, if
address is nulltype
- PEER, GROUP, ADVpublic java.util.Enumeration getLocalAdvertisements(int type, java.lang.String attribute, java.lang.String value) throws java.io.IOException
type
- PEER, GROUP, or ADVattribute
- attribute name to narrow the response tovalue
- value of the named attribute to narrow the response tojava.io.IOException
- - If an I/O error occurspublic void publish(Advertisement advertisement, int type) throws java.io.IOException
advertisement
- publish an adverisement within this grouptype
- PEER, GROUP, ADVjava.io.IOException
- - If an I/O error occurspublic void remotePublish(Advertisement adv, int type)
advertisement
- publish an adverisement within this grouptype
- PEER, GROUP, ADVpublic void flushAdvertisements(java.lang.String id, int type) throws java.io.IOException
id
- Document ID, Peer ID, or PeerGroup IDtype
- PEER, GROUP, ADVjava.io.IOException
- - If an I/O error occurs
|
Project JXTA | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |