📄 discoveryserviceimpl.html
字号:
<DD>Service objects are not manipulated directly to protect usage of the service. A Service interface is returned to access the service methods.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/service/Service.html#getInterface()">getInterface</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/service/Service.html" title="interface in net.jxta.service">Service</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>Service public interface of the service</DL></DD></DL><HR><A NAME="getImplAdvertisement()"><!-- --></A><H3>getImplAdvertisement</H3><PRE>public <A HREF="../../../../net/jxta/document/Advertisement.html" title="class in net.jxta.document">Advertisement</A> <B>getImplAdvertisement</B>()</PRE><DL><DD>Returns the advertisment for this service.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/service/Service.html#getImplAdvertisement()">getImplAdvertisement</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/service/Service.html" title="interface in net.jxta.service">Service</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>Advertisement the advertisement.</DL></DD></DL><HR><A NAME="getRemoteAdvertisements(java.lang.String, int, java.lang.String, java.lang.String, int)"><!-- --></A><H3>getRemoteAdvertisements</H3><PRE>public int <B>getRemoteAdvertisements</B>(java.lang.String peer, int type, java.lang.String attribute, java.lang.String value, int threshold)</PRE><DL><DD>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.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/discovery/DiscoveryService.html#getRemoteAdvertisements(java.lang.String, int, java.lang.String, java.lang.String, int)">getRemoteAdvertisements</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/discovery/DiscoveryService.html" title="interface in net.jxta.discovery">DiscoveryService</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>peer</CODE> - id of a peer, specifying null results in a propagate within the group<DD><CODE>type</CODE> - Discovery type PEER, GROUP, ADV<DD><CODE>attribute</CODE> - 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")<DD><CODE>value</CODE> - 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<DD><CODE>threshold</CODE> - the upper limit of responses from one peer threshold of 0, and type od PEER has a special behaviour peers respond with own adv only.<DT><B>Returns:</B><DD>query ID for this discovery query</DL></DD></DL><HR><A NAME="getRemoteAdvertisements(java.lang.String, int, java.lang.String, java.lang.String, int, net.jxta.discovery.DiscoveryListener)"><!-- --></A><H3>getRemoteAdvertisements</H3><PRE>public int <B>getRemoteAdvertisements</B>(java.lang.String peer, int type, java.lang.String attribute, java.lang.String value, int threshold, <A HREF="../../../../net/jxta/discovery/DiscoveryListener.html" title="interface in net.jxta.discovery">DiscoveryListener</A> listener)</PRE><DL><DD>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.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/discovery/DiscoveryService.html#getRemoteAdvertisements(java.lang.String, int, java.lang.String, java.lang.String, int, net.jxta.discovery.DiscoveryListener)">getRemoteAdvertisements</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/discovery/DiscoveryService.html" title="interface in net.jxta.discovery">DiscoveryService</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>attribute</CODE> - 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")<DD><CODE>value</CODE> - 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<DD><CODE>threshold</CODE> - the upper limit of responses from one peer threshold of 0, and type od PEER has a special behaviour<DD><CODE>peer</CODE> - id of a peer, specifying null results in a propagate within the group<DD><CODE>type</CODE> - Discovery type PEER, GROUP, ADV<DD><CODE>listener</CODE> - the listener which will be called back with found advertisements.<DT><B>Returns:</B><DD>query ID for this discovery query</DL></DD></DL><HR><A NAME="getLocalAdvertisements(int, java.lang.String, java.lang.String)"><!-- --></A><H3>getLocalAdvertisements</H3><PRE>public java.util.Enumeration <B>getLocalAdvertisements</B>(int type, java.lang.String attribute, java.lang.String value) throws java.io.IOException</PRE><DL><DD>Retrieve Stored Peer, Group, and General Advertisements<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/discovery/DiscoveryService.html#getLocalAdvertisements(int, java.lang.String, java.lang.String)">getLocalAdvertisements</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/discovery/DiscoveryService.html" title="interface in net.jxta.discovery">DiscoveryService</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>type</CODE> - Discovery type PEER, GROUP, ADV<DD><CODE>attribute</CODE> - 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")<DD><CODE>value</CODE> - 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<DT><B>Returns:</B><DD>Enumeration of stored advertisements/structured documents<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - - If an I/O error occurs</DL></DD></DL><HR><A NAME="getGroup()"><!-- --></A><H3>getGroup</H3><PRE>public <A HREF="../../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A> <B>getGroup</B>()</PRE><DL><DD>Returns the group to which this service is attached.<P><DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>PeerGroup the group</DL></DD></DL><HR><A NAME="startApp(java.lang.String[])"><!-- --></A><H3>startApp</H3><PRE>public int <B>startApp</B>(java.lang.String[] arg)</PRE><DL><DD>Some Modules will wait for this method being invoked, before completing their initializatino to the point that they are fully functional. That is also the opportunity to supply arbitrary arguments (mostly to applications). <p/>If this module is a <A HREF="../../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup"><CODE>PeerGroup</CODE></A> service, it may be invoked several times depending on its return value. <p/>Note: the name of this method is historical and no-longer adequate.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/platform/Module.html#startApp(java.lang.String[])">startApp</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/platform/Module.html" title="interface in net.jxta.platform">Module</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>arg</CODE> - An array of Strings forming the parameters for this Module.<DT><B>Returns:</B><DD>int A status indication which may be one of <A HREF="../../../../net/jxta/platform/Module.html#START_OK"><CODE>Module.START_OK</CODE></A>, <A HREF="../../../../net/jxta/platform/Module.html#START_AGAIN_PROGRESS"><CODE>Module.START_AGAIN_PROGRESS</CODE></A>, <A HREF="../../../../net/jxta/platform/Module.html#START_AGAIN_STALLED"><CODE>Module.START_AGAIN_STALLED</CODE></A>, which indicates partial or complete success, or any other value (negative values are recommended for future compatibility), which indicates failure.</DL></DD></DL><HR><A NAME="stopApp()"><!-- --></A><H3>stopApp</H3><PRE>public void <B>stopApp</B>()</PRE><DL><DD>One can ask a Module to stop. The Module cannot be forced to comply, but in the future we might be able to deny it access to anything after some timeout. <p/>Note: the name of this method is no-longer adequate. dettach from the resolver<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/platform/Module.html#stopApp()">stopApp</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/platform/Module.html" title="interface in net.jxta.platform">Module</A></CODE></DL></DD><DD><DL></DL></DD></DL><HR><A NAME="init(net.jxta.peergroup.PeerGroup, net.jxta.id.ID, net.jxta.document.Advertisement)"><!-- --></A><H3>init</H3><PRE>public void <B>init</B>(<A HREF="../../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A> pg, <A HREF="../../../../net/jxta/id/ID.html" title="class in net.jxta.id">ID</A> assignedID, <A HREF="../../../../net/jxta/document/Advertisement.html" title="class in net.jxta.document">Advertisement</A> impl) throws <A HREF="../../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></PRE><DL><DD>Initialize the module, passing it its peer group and advertisement. <p/>Note: when subclassing one of the existing PeerGroup implementations (which implement Module), it may not be recommended to overload the init method. See the documentation of the PeerGroup class being subclassed.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../../net/jxta/platform/Module.html#init(net.jxta.peergroup.PeerGroup, net.jxta.id.ID, net.jxta.document.Advertisement)">init</A></CODE> in interface <CODE><A HREF="../../../../net/jxta/platform/Module.html" title="interface in net.jxta.platform">Module</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pg</CODE> - The PeerGroup from which this Module can obtain services. If this module is a service, this is also the PeerGroup of which this module is a service.<DD><CODE>assignedID</CODE> - Identity of Module within group. modules can use it as a the root of their namespace to create names that are unique within the group but predictible by the same module on another peer. This is normaly the ModuleClassID which is also the name under which the module is known by other modules. For a group it is the PeerGroupID itself. The parameters of a service, in the Peer configuration, are indexed
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -