📄 lightweightpeergroup.html
字号:
<PRE>public <A HREF="../../../net/jxta/platform/Module.html" title="interface in net.jxta.platform">Module</A> <B>loadModule</B>(<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/ProtocolNotSupportedException.html" title="class in net.jxta.exception">ProtocolNotSupportedException</A>, <A HREF="../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></PRE><DL><DD>Load a module from a ModuleImplAdv. Compatibility is checked and load is attempted. If compatible and loaded successfuly, the resulting Module is initialized and returned. In most cases the other loadModule() method should be preferred, since unlike this one, it will seek many compatible implementation advertisements and try them all until one works. The home group of the new module (its parent group if the new module is a group) will be this group.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html#loadModule(net.jxta.id.ID, net.jxta.document.Advertisement)">loadModule</A></CODE> in interface <CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>assignedID</CODE> - Id to be assigned to that module (usually its ClassID).<DD><CODE>impl</CODE> - An implementation advertisement for that module.<DT><B>Returns:</B><DD>Module the module loaded and initialized.<DT><B>Throws:</B><DD><CODE><A HREF="../../../net/jxta/exception/ProtocolNotSupportedException.html" title="class in net.jxta.exception">ProtocolNotSupportedException</A></CODE> - The module is a protocol and is disabled per the peer's configuration.<DD><CODE><A HREF="../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></CODE> - The module could not be loaded or initialized</DL></DD></DL><HR><A NAME="loadModule(net.jxta.id.ID, net.jxta.platform.ModuleSpecID, int)"><!-- --></A><H3>loadModule</H3><PRE>public <A HREF="../../../net/jxta/platform/Module.html" title="interface in net.jxta.platform">Module</A> <B>loadModule</B>(<A HREF="../../../net/jxta/id/ID.html" title="class in net.jxta.id">ID</A> assignedID, <A HREF="../../../net/jxta/platform/ModuleSpecID.html" title="class in net.jxta.platform">ModuleSpecID</A> specID, int where)</PRE><DL><DD>Load a module from a spec id. Advertisement is sought, compatibility is checked on all candidates and load is attempted. The first one that is compatible and loads successfuly is initialized and returned.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html#loadModule(net.jxta.id.ID, net.jxta.platform.ModuleSpecID, int)">loadModule</A></CODE> in interface <CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>assignedID</CODE> - Id to be assigned to that module (usually its ClassID).<DD><CODE>specID</CODE> - The specID of this module.<DD><CODE>where</CODE> - May be one of: Here, FromParent, or Both, meaning that the implementation advertisement will be searched in this group, its parent or both. As a general guideline, the implementation advertisements of a group should be searched in its propsective parent (that is Here), the implementation advertisements of a group standard service should be searched in the same group than where this group's advertisement was found (that is, FromParent), while applications may be sought more freely (Both).<DT><B>Returns:</B><DD>Module the new module, or null if no usuable implementation was found.</DL></DD></DL><HR><A NAME="publishGroup(java.lang.String, java.lang.String)"><!-- --></A><H3>publishGroup</H3><PRE>public void <B>publishGroup</B>(java.lang.String name, java.lang.String description) throws java.io.IOException</PRE><DL><DD>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.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html#publishGroup(java.lang.String, java.lang.String)">publishGroup</A></CODE> in interface <CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - The name of this group.<DD><CODE>description</CODE> - The description of this group.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - The publication could not be accomplished because of a network or storage failure.</DL></DD></DL><HR><A NAME="newGroup(net.jxta.document.Advertisement)"><!-- --></A><H3>newGroup</H3><PRE>public <A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A> <B>newGroup</B>(<A HREF="../../../net/jxta/document/Advertisement.html" title="class in net.jxta.document">Advertisement</A> pgAdv) throws <A HREF="../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></PRE><DL><DD>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><P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html#newGroup(net.jxta.document.Advertisement)">newGroup</A></CODE> in interface <CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>pgAdv</CODE> - The advertisement for the group to be instantiated.<DT><B>Returns:</B><DD>PeerGroup the initialized (but not started) peergroup.<DT><B>Throws:</B><DD><CODE><A HREF="../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></CODE> - The group could not be instantated.</DL></DD></DL><HR><A NAME="newGroup(net.jxta.peergroup.PeerGroupID, net.jxta.document.Advertisement, java.lang.String, java.lang.String)"><!-- --></A><H3>newGroup</H3><PRE>public <A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A> <B>newGroup</B>(<A HREF="../../../net/jxta/peergroup/PeerGroupID.html" title="class in net.jxta.peergroup">PeerGroupID</A> gid, <A HREF="../../../net/jxta/document/Advertisement.html" title="class in net.jxta.document">Advertisement</A> impl, java.lang.String name, java.lang.String description) throws <A HREF="../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></PRE><DL><DD>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><P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html#newGroup(net.jxta.peergroup.PeerGroupID, net.jxta.document.Advertisement, java.lang.String, java.lang.String)">newGroup</A></CODE> in interface <CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>gid</CODE> - The ID of that group. If null then a new group ID will be chosen.<DD><CODE>impl</CODE> - The advertisement of the implementation to be used.<DD><CODE>name</CODE> - The name of the group.<DD><CODE>description</CODE> - A description of this group.<DT><B>Returns:</B><DD>PeerGroup the initialized (but not started) peergroup.<DT><B>Throws:</B><DD><CODE><A HREF="../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></CODE> - The group could ne be instantiated.</DL></DD></DL><HR><A NAME="newGroup(net.jxta.peergroup.PeerGroupID)"><!-- --></A><H3>newGroup</H3><PRE>public <A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A> <B>newGroup</B>(<A HREF="../../../net/jxta/peergroup/PeerGroupID.html" title="class in net.jxta.peergroup">PeerGroupID</A> gid) throws <A HREF="../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></PRE><DL><DD>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><P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html#newGroup(net.jxta.peergroup.PeerGroupID)">newGroup</A></CODE> in interface <CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>gid</CODE> - the groupID.<DT><B>Returns:</B><DD>PeerGroup the initialized (but not started) peergroup.<DT><B>Throws:</B><DD><CODE><A HREF="../../../net/jxta/exception/PeerGroupException.html" title="class in net.jxta.exception">PeerGroupException</A></CODE> - The group could ne be instantated.</DL></DD></DL><HR><A NAME="getRendezVousService()"><!-- --></A><H3>getRendezVousService</H3><PRE>public <A HREF="../../../net/jxta/rendezvous/RendezVousService.html" title="interface in net.jxta.rendezvous">RendezVousService</A> <B>getRendezVousService</B>()</PRE><DL><DD>Return the Rendezvous Service for this Peer Group. This service is optional and may not be present in all groups.<P><DD><DL><DT><B>Specified by:</B><DD><CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html#getRendezVousService()">getRendezVousService</A></CODE> in interface <CODE><A HREF="../../../net/jxta/peergroup/PeerGroup.html" title="interface in net.jxta.peergroup">PeerGroup</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>RendezVousService The Rendezvous Service for this
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -