⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lightweightpeergroup.html

📁 jxta的api库
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<CODE>&nbsp;<A HREF="../../../net/jxta/service/Service.html" title="interface in net.jxta.service">Service</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/peergroup/LightWeightPeerGroup.html#lookupService(net.jxta.id.ID)">lookupService</A></B>(<A HREF="../../../net/jxta/id/ID.html" title="class in net.jxta.id">ID</A>&nbsp;name)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lookup for a service by name.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/peergroup/LightWeightPeerGroup.html#newGroup(net.jxta.document.Advertisement)">newGroup</A></B>(<A HREF="../../../net/jxta/document/Advertisement.html" title="class in net.jxta.document">Advertisement</A>&nbsp;pgAdv)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Instantiate a peer group from its given advertisement. This instantiator  requires that the ModuleImplAdvertisment for the peer group and the  ModuleImplAdvertisements for the group's services be available for  discovery within the current group.  <p/>The pgAdv itself may be all new and unpublished. Therefore, the two  typical uses of this routine are: <ul> <li>Creating an all new group with a new ID while using an existing and published implementation. (Possibly a new one published for that purpose). The information should first be gathered in a new PeerGroupAdvertisement which is then passed to this method.</li> <li>Instantiating a group which advertisement has already been discovered (therefore there is no need to find it by groupID again).</li> </ul> <p/>To create a group from a known implAdv, use <A HREF="../../../net/jxta/peergroup/PeerGroup.html#newGroup(net.jxta.peergroup.PeerGroupID, net.jxta.document.Advertisement, java.lang.String, java.lang.String)"><CODE>PeerGroup.newGroup(PeerGroupID,Advertisement,String,String)</CODE></A></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/peergroup/LightWeightPeerGroup.html#newGroup(net.jxta.peergroup.PeerGroupID)">newGroup</A></B>(<A HREF="../../../net/jxta/peergroup/PeerGroupID.html" title="class in net.jxta.peergroup">PeerGroupID</A>&nbsp;gid)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Instantiate a group from its Peer Group ID only. Use this when using a group that has already been published and discovered. <p/>The typical uses of this routine are therefore: <ul>   <li>Instantiating a peer group which is assumed to exist and whose Peer   Group ID is already known.</li>   <li>Creating a new peer group instance using an already published   Group advertisement, typically published for that purpose. All other   referenced advertisements must also be available.</li> </ul> <p/>To create a group from a known implAdv, just use <A HREF="../../../net/jxta/peergroup/PeerGroup.html#loadModule(net.jxta.id.ID, net.jxta.document.Advertisement)"><CODE>PeerGroup.loadModule(ID,Advertisement)</CODE></A> or even:<p> <p/><code> grp = new GroupSubClass(); grp.init(parentGroup, gid, impladv); </code> <p/>then, <strong>REMEMBER TO PUBLISH THE GROUP IF IT IS ALL NEW.</strong></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/peergroup/LightWeightPeerGroup.html#newGroup(net.jxta.peergroup.PeerGroupID, net.jxta.document.Advertisement, java.lang.String, java.lang.String)">newGroup</A></B>(<A HREF="../../../net/jxta/peergroup/PeerGroupID.html" title="class in net.jxta.peergroup">PeerGroupID</A>&nbsp;gid,         <A HREF="../../../net/jxta/document/Advertisement.html" title="class in net.jxta.document">Advertisement</A>&nbsp;impl,         java.lang.String&nbsp;name,         java.lang.String&nbsp;description)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Instantiates a new group from its elementary pieces and publishes the corresponding PeerGroupAdvertisement. The pieces are: the groups implementation adv, the group id, the name and description. <p/>The typical use of this routine is creating a whole new group based on a newly created and possibly unpublished implementation adv. <p/>This is a convenience method equivalent to either: <p/><pre> newGrp = thisGroup.loadModule(gid, impl); newGrp.publishGroup(name, description); </pre> <p/>or, but only if the implementation advertisement has been published: <p/><pre> newPGAdv = AdvertisementFactory.newAdvertisement(                 PeerGroupAdvertisement.getAdvertisementType()); newPGAdv.setPeerGroupID(gid); newPGAdv.setModuleSpecID(impl.getModuleSpecID()); newPGAdv.setName(name); newPGAdv.setDescription(description); newGrp = thisGroup.newGroup(newPGAdv); </pre></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/peergroup/LightWeightPeerGroup.html#publishGroup(java.lang.String, java.lang.String)">publishGroup</A></B>(java.lang.String&nbsp;name,             java.lang.String&nbsp;description)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Publish this group's Peer Group Advertisment if it has not already been published. The Peer Group Advertisement is published into the Peer Group in which this group was instantiated, specifically the Peer Group whose <code>newGroup()</code> was called. <p/>Calling this method is only useful if the group is being created from scratch and the PeerGroup advertisement has not been created beforehand. In such a case, the group has never been named or described. Therefore this information has to be supplied here. <p/>If this group has already been previously published, this method does nothing.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/peergroup/LightWeightPeerGroup.html#startApp(java.lang.String[])">startApp</A></B>(java.lang.String[]&nbsp;args)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/peergroup/LightWeightPeerGroup.html#stopApp()">stopApp</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../net/jxta/peergroup/LightWeightPeerGroup.html#unref()">unref</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Explicitly notifies a group interface that it will no-longer be used (similar to dispose). Does nothing to a real group object, only has an effect on a group interface.</TD></TR></TABLE>&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Methods inherited from class java.lang.Object</B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD></TR></TABLE>&nbsp;<P><!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="LightWeightPeerGroup(net.jxta.protocol.PeerGroupAdvertisement)"><!-- --></A><H3>LightWeightPeerGroup</H3><PRE>public <B>LightWeightPeerGroup</B>(<A HREF="../../../net/jxta/protocol/PeerGroupAdvertisement.html" title="class in net.jxta.protocol">PeerGroupAdvertisement</A>&nbsp;adv)</PRE><DL><DD>Constructor All classes that extend this class must invoke this constructor.<P><DT><B>Parameters:</B><DD><CODE>adv</CODE> - PeerGroupAdvertisement of this LightWeightPeerGroup. Note that only the PeerGroupID is used.</DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><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>&nbsp;group,                 <A HREF="../../../net/jxta/id/ID.html" title="class in net.jxta.id">ID</A>&nbsp;assignedID,                 <A HREF="../../../net/jxta/document/Advertisement.html" title="class in net.jxta.document">Advertisement</A>&nbsp;implAdv)</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>group</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  by the assignedID of that service, and a Service must publish its  run-time parameters in the Peer Advertisement under its assigned ID.<DD><CODE>implAdv</CODE> - The implementation advertisement for this  Module. It is permissible to pass null if no implementation  advertisement is available. This may happen if the  implementation was selected by explicit class name rather than  by following an implementation advertisement. Modules are not

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -