📄 discoveryservice.java
字号:
*/
public final static long DEFAULT_EXPIRATION = 1000 * 60 * 60 * 2;
/**
* This method discovers PeerAdvertisements, GroupAdvertisements and other
* jxta Advertisements. jxta Advertisements are documents that describe pipes,
* services, etc. The discovery scope can be narrowed down firstly by Name and
* Value pair where the match is an exact match, secondly by setting a upper
* limit where the responding peer will not exceed. Discovery can be performed
* in two ways 1. by specifying a null peerid, the discovery message is
* propagated on the local sub-net utilizing ip multicast. In addition to the
* multicast it is also propagated to rendezvous points. 2. by passing a
* peerid, the EndpointRouter will attempt to resolve destination peer's
* endpoints or route the message to other routers in attempt to reach the
* peer.
*
*@param attribute attribute name to narrow disocvery to Valid values for
* this parameter are null (don't care), or exact element name in the
* advertisement of interest (e.g. "Name")
*@param value value of attribute to narrow disocvery to valid values for
* this parameter are null (don't care), Exact value, or use of wild
* card(s) (e.g. if a Advertisement defines <Name>FooBar</name> , a value
* of "*bar", "foo*", or "*ooB*", will return the Advertisement
*@param threshold the upper limit of responses from one peer
*@param peerid id of a peer, specifying null results in a propagate
* within the group
*@param type Discovery type PEER, GROUP, ADV
*@return query ID for this discovery query
*@since JXTA 1.0
*@deprecated
*/
public int getRemoteAdvertisements(String peerid,
int type,
String attribute,
String value,
int threshold);
/**
* This method discovers PeerAdvertisements, GroupAdvertisements and jxta
* Advertisements. jxta Advertisements are documents that describe pipes,
* services, etc. The discovery scope can be narrowed down firstly by Name and
* Value pair where the match is an exact match, secondly by setting a upper
* limit where the responding peer will not exceed. DiscoveryServiceImpl can
* be performed in two ways 1. by specifying a null peerid, the discovery
* message is propagated on the local sub-net utilizing ip multicast. In
* addition to the multicast it is also propagated to rendezvous points. 2. by
* passing a peerid, the EndpointRouter will attempt to resolve destination
* peer's endpoints or route the message to other routers in attempt to reach
* the peer.
*
*@param attribute attribute name to narrow disocvery to Valid values for
* this parameter are null (don't care), or exact element name in the
* advertisement of interest (e.g. "Name")
*@param value value of attribute to narrow disocvery to valid values for
* this parameter are null (don't care), Exact value, or use of wild
* card(s) (e.g. if a Advertisement defines <Name>FooBar</name> , a value
* of "*bar", "foo*", or "*ooB*", will return the Advertisement
*@param threshold the upper limit of responses from one peer
*@param peerid id of a peer, specifying null results in a propagate
* within the group
*@param type Discovery type PEER, GROUP, ADV
*@param listener the listener which will be called back with found
* advertisements.
*@since JXTA 1.0
*/
public void getRemoteAdvertisements(String peerid,
int type,
String attribute,
String value,
int threshold,
DiscoveryListener listener);
/**
* Retrieve Stored Peer, Group, and General Advertisements
*
*@param type Discovery type PEER, GROUP, ADV
*@param attribute attribute name to narrow disocvery to Valid values
* for this parameter are null (don't care), or exact element name in the
* advertisement of interest (e.g. "Name")
*@param value value of attribute to narrow disocvery to valid
* values for this parameter are null (don't care), Exact value, or use of
* wild card(s) (e.g. if a Advertisement defines <Name>FooBar</name> , a
* value of "*bar", "foo*", or "*ooB*", will return the Advertisement
*@return Enumeration of stored advertisements/structured
* documents
*@exception IOException - If an I/O error occurs
*@since JXTA 1.0
*/
public Enumeration getLocalAdvertisements(int type, String attribute,
String value) throws IOException;
/**
* Publish an advertisement with a default lifetime of <code>
* DEFAULT_LIFETIME</code> and default expiration time for "others" of <code>DEFAULT_EXPIRATION</code>
*
*@param advertisement publish an adverisement within this group
*@param type Discovery type PEER, GROUP, ADV
*@exception IOException - If an I/O error occurs
*@since JXTA 1.0
*/
public void publish(Advertisement advertisement, int type)
throws IOException;
/**
* Publish an advertisement that will expire after a certain time. A node that
* finds this advertisement will hold it for about <i> lifetimeForOthers</i>
* milliseconds, or <i>lifetime</i> whichever is smaller
*
*@param type Discovery type PEER, GROUP, ADV
*@param lifetime the amount of time this advertisement will live in
* my cache in milliseconds
*@param lifetimeForOthers the amount of time this advertisement will live in
* other people's caches in milliseconds.
*@param adv advertisement to publish
*@exception IOException - If an I/O error occurs
*/
public void publish(Advertisement adv,
int type,
long lifetime,
long lifetimeForOthers)
throws IOException;
/**
* Remote Publish an advertisement will attempt to remote publish adv on all
* configured transports, the Advertisement will carry a lifetime of
* Expiration time, or lifetime whichever is smaller
*
*@param type Discovery type PEER, GROUP, ADV
*@param adv advertisement to publish
*@since JXTA 1.0
*/
public void remotePublish(Advertisement adv, int type);
/**
* Remote Publish an advertisement will attempt to remote publish adv on all
* configured transports, the Advertisement will carry a a expiration of <i>
* lifetime</i>
*
*@param type Discovery type PEER, GROUP, ADV
*@param lifetime the amount of time to advise other nodes to hold this
* advertisement in their caches.
*@param adv advertisement to publish
*@since JXTA 1.0
*/
public void remotePublish(Advertisement adv, int type, long lifetime);
/**
* flush s stored Document
*
*@param id Document ID, Peer ID, or PeerGroup ID
*@param type Discovery type PEER, GROUP, ADV
*@exception IOException - If an I/O error occurs
*@since JXTA 1.0
*/
public void flushAdvertisements(String id, int type)
throws IOException;
/**
* register a discovery listener, to notified on discovery events
*
*@param listener The feature to be added to the DiscoveryListener attribute
*/
public void addDiscoveryListener(DiscoveryListener listener);
/**
* remove a discovery listener
*
*@param listener listener to be called back for discovery events
*@return true if the argument was a component of this vector; false
* otherwise
*/
public boolean removeDiscoveryListener(DiscoveryListener listener);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -