Project JXTA

net.jxta.peergroup
Interface PeerGroup

All Superinterfaces:
Module, Service
All Known Implementing Classes:
LightWeightPeerGroup

public interface PeerGroup
extends Service

Peer groups are formed as a collection of peers that have agreed upon a common set of services. Each peer group is assigned a unique peer group ID and a peer group advertisement. The peer group advertisement contains a ModuleSpecID which refers to a module specification for this peer group.

The peer group specification mandates each of the group services (membership, discovery, resolver, etc). Implementations of that specification are described by ModuleImplAdvertisements which are identified by the group's ModuleSpecID. Implementations are responsible for providing the services mandated by the specification. The java reference implementation achieves this by loading additional Modules which ModuleSpecIDs are listed by the group implementation advertisement.

In order to participate in a group, a peer needs to join the group using the peer group membership service.

JXTA comes with two subclasses of peer groups:

See Also:
PeerGroupID, Service, PeerGroupFactory, PeerGroupAdvertisement, ModuleImplAdvertisement, ModuleSpecID, ModuleClassID

Nested Class Summary
static class PeerGroup.GlobalRegistry
           
 
Field Summary
static ModuleClassID accessClassID
          Well known module class identifier: AccessService
static ModuleSpecID allPurposePeerGroupSpecID
          Well known group specification identifier: an all purpose peer group specification.
static ModuleClassID applicationClassID
          Well known module class identifier: application
static int Both
          Look for needed ModuleImplAdvertisement in both this group and its parent.
static long DEFAULT_EXPIRATION
          Default expiration time for discovered group advertisements. (2 weeks)
static long DEFAULT_LIFETIME
          Default life time for group advertisements in the publisher's cache.
static ModuleClassID discoveryClassID
          Well known module class identifier: discovery service
static ModuleClassID endpointClassID
          Well known module class identifier: endpoint service
static int FromParent
          Look for needed ModuleImplAdvertisement in the parent group of this group.
static PeerGroup.GlobalRegistry globalRegistry
           
static int Here
          Look for needed ModuleImplAdvertisement in this group.
static ModuleClassID httpProtoClassID
          Well known module class identifier: http protocol
static ModuleClassID membershipClassID
          Well known module class identifier: membership service
static ModuleClassID peerGroupClassID
          Well known module class identifier: peer group
static ModuleClassID peerinfoClassID
          Well known module class identifier: peerinfo service
static ModuleClassID pipeClassID
          Well known module class identifier: pipe service
static ModuleClassID proxyClassID
          Well known module class identifier: ProxyService
static ModuleSpecID refAccessSpecID
          Well known access specification identifier: the standard access service
static ModuleSpecID refDiscoverySpecID
          Well known service specification identifier: the standard discovery
static ModuleSpecID refEndpointSpecID
          Well known service specification identifier: the standard endpoint
static ModuleSpecID refHttpProtoSpecID
          Well known endpoint protocol specification identifier: the standard http endpoint protocol
static ModuleSpecID refMembershipSpecID
          Well known service specification identifier: the standard membership
static ModuleSpecID refNetPeerGroupSpecID
          Well known group specification identifier: the Network Peer Group
static ModuleSpecID refPeerinfoSpecID
          Well known service specification identifier: the standard peerinfo
static ModuleSpecID refPipeSpecID
          Well known service specification identifier: the standard pipe service
static ModuleSpecID refPlatformSpecID
          Well known group specification identifier: the platform
static ModuleSpecID refProxySpecID
          Well known application: the Proxy
static ModuleSpecID refRelayProtoSpecID
          Well known endpoint protocol specification identifier: the standard relay endpoint protocol
static ModuleSpecID refRendezvousSpecID
          Well known service specification identifier: the standard rendezvous
static ModuleSpecID refResolverSpecID
          Well known service specification identifier: the standard resolver
static ModuleSpecID refRouterProtoSpecID
          Well known endpoint protocol specification identifier: the standard router
static ModuleSpecID refShellSpecID
          Well known application: the shell
static ModuleSpecID refStartNetPeerGroupSpecID
          Well known main application of the platform: startNetPeerGroup.
static ModuleSpecID refTcpProtoSpecID
          Well known endpoint protocol specification identifier: the standard tcp endpoint protocol
static ModuleSpecID refTlsProtoSpecID
          Well known endpoint protocol specification identifier: the standard tls endpoint protocol
static ModuleClassID relayProtoClassID
          Well known module class identifier: RelayProtocol
static ModuleClassID rendezvousClassID
          Well known module class identifier: rendezvous service
static ModuleClassID resolverClassID
          Well known module class identifier: resolver service
static ModuleClassID routerProtoClassID
          Well known module class identifier: router protocol
static ModuleClassID tcpProtoClassID
          Well known module class identifier: tcp protocol
static ModuleClassID tlsProtoClassID
          Well known module class identifier: tlsProtocol
static String WK_ID_PREFIX
          Prefix string for all of the Well Known IDs declated in this interface.
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK
 
Method Summary
 boolean compatible(Element compat)
          Return true if the provided compatibility statement is compatible with this group.
 AccessService getAccessService()
          Return the Access Service for this Peer Group.
 ModuleImplAdvertisement getAllPurposePeerGroupImplAdvertisement()
          Get an all purpose peerGroup ModuleImplAdvertisement that is compatible with this group.
 ConfigParams getConfigAdvertisement()
          Returns the config advertisment for this peer in this group (if any).
 DiscoveryService getDiscoveryService()
          Return the Discovery Service for this Peer Group.
 EndpointService getEndpointService()
          Return the Endpoint Service for this Peer Group.
 ThreadGroup getHomeThreadGroup()
          Returns the Thread Group in which threads for this peer group will live.
 JxtaLoader getLoader()
          Returns the class loader for this group.
 MembershipService getMembershipService()
          Return the Membership Service for this Peer Group.
 PeerGroup getParentGroup()
          Returns the parent group of this group.
 PeerAdvertisement getPeerAdvertisement()
          Return the PeerAdvertisement of the local Peer within this Peer Group.
 PeerGroupAdvertisement getPeerGroupAdvertisement()
          Return the PeerGroupAdvertisement for this group.
 PeerGroupID getPeerGroupID()
          Return the Peer Group ID of this Peer Group.
 String getPeerGroupName()
          Return the Name of this group.
 PeerID getPeerID()
          Return the Peer ID by which this Peer is known within this Peer Group.
 PeerInfoService getPeerInfoService()
          Return the PeerInfo Service for this Peer Group.
 String getPeerName()
          Return the name of the local peer within this group.
 PipeService getPipeService()
          Return the Pipe Service for this Peer Group.
 RendezVousService getRendezVousService()
          Return the Rendezvous Service for this Peer Group.
 ResolverService getResolverService()
          Return the Resolver Service for this Peer Group.
 Iterator getRoleMap(ID name)
          Returns the map of the assigned IDs currently associated with the given ModuleClassID by this PeerGroup object.
 PeerGroup getWeakInterface()
          Returns a weak interface object that represents this group.
 boolean isRendezvous()
          Returns the whether the group member is a Rendezvous peer for the group.
 Module loadModule(ID assignedID, Advertisement impl)
          Load a module from a ModuleImplAdv.
 Module loadModule(ID assignedID, ModuleSpecID specID, int where)
          Load a module from a spec id.
 Service lookupService(ID name)
          Lookup for a service by name.
 Service lookupService(ID name, int roleIndex)
          Lookup for a service by class ID and index in a map.
 PeerGroup newGroup(Advertisement pgAdv)
          Instantiate a peer group from its given advertisement.
 PeerGroup newGroup(PeerGroupID gid)
          Instantiate a group from its Peer Group ID only.
 PeerGroup newGroup(PeerGroupID gid, Advertisement impl, String name, String description)
          Instantiates a new group from its elementary pieces and publishes the corresponding PeerGroupAdvertisement.
 void publishGroup(String name, String description)
          Publish this group's Peer Group Advertisment if it has not already been published.
 void unref()
          Explicitly notifies a group interface that it will no-longer be used (similar to dispose).
 
Methods inherited from interface net.jxta.service.Service
getImplAdvertisement, getInterface
 
Methods inherited from interface net.jxta.platform.Module
init, startApp, stopApp
 

Field Detail

Here

static final int Here
Look for needed ModuleImplAdvertisement in this group.

See Also:
Constant Field Values

FromParent

static final int FromParent
Look for needed ModuleImplAdvertisement in the parent group of this group.

See Also:
Constant Field Values

Both

static final int Both
Look for needed ModuleImplAdvertisement in both this group and its parent.

See Also:
Constant Field Values

DEFAULT_LIFETIME

static final long DEFAULT_LIFETIME
Default life time for group advertisements in the publisher's cache. (a year)

See Also:
Constant Field Values

DEFAULT_EXPIRATION

static final long DEFAULT_EXPIRATION
Default expiration time for discovered group advertisements. (2 weeks)

See Also:
Constant Field Values

WK_ID_PREFIX

static final String WK_ID_PREFIX
Prefix string for all of the Well Known IDs declated in this interface.

See Also:
Constant Field Values

peerGroupClassID

static final ModuleClassID peerGroupClassID
Well known module class identifier: peer group


resolverClassID

static final ModuleClassID resolverClassID
Well known module class identifier: resolver service


discoveryClassID

static final ModuleClassID discoveryClassID
Well known module class identifier: discovery service


pipeClassID

static final ModuleClassID pipeClassID
Well known module class identifier: pipe service


membershipClassID

static final ModuleClassID membershipClassID
Well known module class identifier: membership service


rendezvousClassID

static final ModuleClassID rendezvousClassID
Well known module class identifier: rendezvous service


peerinfoClassID

static final ModuleClassID peerinfoClassID
Well known module class identifier: peerinfo service


endpointClassID

static final ModuleClassID endpointClassID
Well known module class identifier: endpoint service


tcpProtoClassID

static final ModuleClassID tcpProtoClassID
Well known module class identifier: tcp protocol


httpProtoClassID

static final ModuleClassID httpProtoClassID
Well known module class identifier: http protocol


routerProtoClassID

static final ModuleClassID routerProtoClassID
Well known module class identifier: router protocol


applicationClassID

static final ModuleClassID applicationClassID
Well known module class identifier: application


tlsProtoClassID

static final ModuleClassID tlsProtoClassID
Well known module class identifier: tlsProtocol


proxyClassID

static final ModuleClassID proxyClassID
Well known module class identifier: ProxyService


relayProtoClassID

static final ModuleClassID relayProtoClassID
Well known module class identifier: RelayProtocol


accessClassID

static final ModuleClassID accessClassID
Well known module class identifier: AccessService


refPlatformSpecID

static final ModuleSpecID refPlatformSpecID
Well known group specification identifier: the platform


refNetPeerGroupSpecID

static final ModuleSpecID refNetPeerGroupSpecID
Well known group specification identifier: the Network Peer Group


refResolverSpecID

static final ModuleSpecID refResolverSpecID
Well known service specification identifier: the standard resolver


refDiscoverySpecID

static final ModuleSpecID refDiscoverySpecID
Well known service specification identifier: the standard discovery


refPipeSpecID

static final ModuleSpecID refPipeSpecID
Well known service specification identifier: the standard pipe service


refMembershipSpecID

static final ModuleSpecID refMembershipSpecID
Well known service specification identifier: the standard membership


refRendezvousSpecID

static final ModuleSpecID refRendezvousSpecID
Well known service specification identifier: the standard rendezvous


refPeerinfoSpecID

static final ModuleSpecID refPeerinfoSpecID
Well known service specification identifier: the standard peerinfo


refEndpointSpecID

static final ModuleSpecID refEndpointSpecID
Well known service specification identifier: the standard endpoint


refTcpProtoSpecID

static final ModuleSpecID refTcpProtoSpecID
Well known endpoint protocol specification identifier: the standard tcp endpoint protocol


refHttpProtoSpecID

static final ModuleSpecID refHttpProtoSpecID
Well known endpoint protocol specification identifier: the standard http endpoint protocol


refRouterProtoSpecID

static final ModuleSpecID refRouterProtoSpecID
Well known endpoint protocol specification identifier: the standard router


refTlsProtoSpecID

static final ModuleSpecID refTlsProtoSpecID
Well known endpoint protocol specification identifier: the standard tls endpoint protocol


allPurposePeerGroupSpecID

static final ModuleSpecID allPurposePeerGroupSpecID
Well known group specification identifier: an all purpose peer group specification. The java reference implementation implements it with the StdPeerGroup class and all the standard platform services and no endpoint protocols.


refStartNetPeerGroupSpecID

static final ModuleSpecID refStartNetPeerGroupSpecID
Well known main application of the platform: startNetPeerGroup.


refShellSpecID

static final ModuleSpecID refShellSpecID
Well known application: the shell


refProxySpecID

static final ModuleSpecID refProxySpecID
Well known application: the Proxy


refRelayProtoSpecID

static final ModuleSpecID refRelayProtoSpecID
Well known endpoint protocol specification identifier: the standard relay endpoint protocol


refAccessSpecID

static final ModuleSpecID refAccessSpecID
Well known access specification identifier: the standard access service


globalRegistry

static final PeerGroup.GlobalRegistry globalRegistry
Method Detail

getHomeThreadGroup

ThreadGroup getHomeThreadGroup()
Returns the Thread Group in which threads for this peer group will live. This is currently used only for debugging purposes so that the source of a thread can be determined.

Returns:
ThreadGroup

getLoader

JxtaLoader getLoader()
Returns the class loader for this group.

Returns:
JxtaLoader The JXTA Class loader used by this group.

isRendezvous

boolean isRendezvous()
Returns the whether the group member is a Rendezvous peer for the group.

Returns:
boolean true if the peer is a rendezvous for the group.

getPeerGroupAdvertisement

PeerGroupAdvertisement getPeerGroupAdvertisement()
Return the PeerGroupAdvertisement for this group.

Returns:
PeerGroupAdvertisement this Group's advertisement.

getPeerAdvertisement

PeerAdvertisement getPeerAdvertisement()
Return the PeerAdvertisement of the local Peer within this Peer Group.

Returns:
the PeerAdvertisement of the local Peer within this Peer Group.

lookupService

Service lookupService(ID name)
                      throws ServiceNotFoundException
Lookup for a service by name.

Parameters:
name - the service identifier.
Returns:
Service, the Service registered by that name
Throws:
ServiceNotFoundException - could not find the service requested

lookupService

Service lookupService(ID name,
                      int roleIndex)
                      throws ServiceNotFoundException
Lookup for a service by class ID and index in a map. More than one service in a group may be of a given ModuleClass. However each of them has a unique assigned ID which serves as the index in the map of services. In most cases, there is only one service of each given Module Class, and the ID of that Module Class is the assigned ID. Otherwise, the group may have a list of existing assigned ID per base class. This routine may be used to retrieve services of the given Module Class and index in that list. In the absence of a mapping, index 0 is still valid and corresponds to the service which assigned ID is exactly the given ID. Group objects with a map are normaly wrappers taylored specially by the loader of a module (often the group itself) in order to provide a map appropriate for that module. Modules that do not use more than one service of a given base class normally never need to call this method; lookupService(ID) is equivalent to lookupService(ID, 0) and will transparently remap index 0 to whatever the group's structure defines as the default for the invoking service. Note: traditionaly, the given ID is expected to be a base Module Class ID, and the assigned ID of a Module is a Class ID of the same base class with a role suffix to make it unique. If the given ID already contains a role suffix, there may exist an entry for it in the map anyway, if not (which is the expected use pattern), then only index 0 exists and the given ID is used whole and untranslated.

Parameters:
name - the service identifier
roleIndex - the index in the list of assigned IDs that match that identifier.
Returns:
Service, the corresponding Service
Throws:
ServiceNotFoundException - Could not find the service requested.
Since:
JXTA 2.3.1

getRoleMap

Iterator getRoleMap(ID name)
Returns the map of the assigned IDs currently associated with the given ModuleClassID by this PeerGroup object. The IDs are returned in the order of their index in the map. So the first ID returned will be identical to what would be returned by the lookup method for the given ID and index 0. If there is no explicit such map, this method will return a singleton containing the given ID as this is the default mapping. There is no guarantee that any of the returned IDs correspond to an actually registered service. This method only maps IDs.

Parameters:
name - The ModuleClassID for which the map is desired.
Returns:
Iterator An iterator on a collection of the IDs to which the given ID maps.
Since:
JXTA 2.3.1

compatible

boolean compatible(Element compat)
Return true if the provided compatibility statement is compatible with this group.

Returns:
boolean True if the statement is compatible.

loadModule

Module loadModule(ID assignedID,
                  Advertisement impl)
                  throws ProtocolNotSupportedException,
                         PeerGroupException
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.

Parameters:
assignedID - Id to be assigned to that module (usually its ClassID).
impl - An implementation advertisement for that module.
Returns:
Module the module loaded and initialized.
Throws:
ProtocolNotSupportedException - The module is a protocol and is disabled per the peer's configuration.
PeerGroupException - The module could not be loaded or initialized

loadModule

Module loadModule(ID assignedID,
                  ModuleSpecID specID,
                  int where)
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.

Parameters:
assignedID - Id to be assigned to that module (usually its ClassID).
specID - The specID of this module.
where - 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).
Returns:
Module the new module, or null if no usuable implementation was found.

publishGroup

void publishGroup(String name,
                  String description)
                  throws IOException
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 newGroup() was called.

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.

If this group has already been previously published, this method does nothing.

Parameters:
name - The name of this group.
description - The description of this group.
Throws:
IOException - The publication could not be accomplished because of a network or storage failure.

newGroup

PeerGroup newGroup(Advertisement pgAdv)
                   throws PeerGroupException
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.

The pgAdv itself may be all new and unpublished. Therefore, the two typical uses of this routine are:

To create a group from a known implAdv, use newGroup(PeerGroupID,Advertisement,String,String)

Parameters:
pgAdv - The advertisement for the group to be instantiated.
Returns:
PeerGroup the initialized (but not started) peergroup.
Throws:
PeerGroupException - The group could not be instantated.

newGroup

PeerGroup newGroup(PeerGroupID gid,
                   Advertisement impl,
                   String name,
                   String description)
                   throws PeerGroupException
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.

The typical use of this routine is creating a whole new group based on a newly created and possibly unpublished implementation adv.

This is a convenience method equivalent to either:

 newGrp = thisGroup.loadModule(gid, impl);
 newGrp.publishGroup(name, description);
 

or, but only if the implementation advertisement has been published:

 newPGAdv = AdvertisementFactory.newAdvertisement(
                 PeerGroupAdvertisement.getAdvertisementType());
 newPGAdv.setPeerGroupID(gid);
 newPGAdv.setModuleSpecID(impl.getModuleSpecID());
 newPGAdv.setName(name);
 newPGAdv.setDescription(description);
 newGrp = thisGroup.newGroup(newPGAdv);
 

Parameters:
gid - The ID of that group. If null then a new group ID will be chosen.
impl - The advertisement of the implementation to be used.
name - The name of the group.
description - A description of this group.
Returns:
PeerGroup the initialized (but not started) peergroup.
Throws:
PeerGroupException - The group could ne be instantiated.

newGroup

PeerGroup newGroup(PeerGroupID gid)
                   throws PeerGroupException
Instantiate a group from its Peer Group ID only. Use this when using a group that has already been published and discovered.

The typical uses of this routine are therefore:

To create a group from a known implAdv, just use loadModule(ID,Advertisement) or even:

grp = new GroupSubClass(); grp.init(parentGroup, gid, impladv);

then, REMEMBER TO PUBLISH THE GROUP IF IT IS ALL NEW.

Parameters:
gid - the groupID.
Returns:
PeerGroup the initialized (but not started) peergroup.
Throws:
PeerGroupException - The group could ne be instantated.

getRendezVousService

RendezVousService getRendezVousService()
Return the Rendezvous Service for this Peer Group. This service is optional and may not be present in all groups.

Returns:
The Rendezvous Service for this Peer Group or null if there is no Rendezvous Service in this Peer Group.

getEndpointService

EndpointService getEndpointService()
Return the Endpoint Service for this Peer Group. This service is present in every Peer Group.

Returns:
EndpointService The Endpoint Service for this Peer Group.

getResolverService

ResolverService getResolverService()
Return the Resolver Service for this Peer Group. This service is present in every Peer Group.

Returns:
ResolverService The Resolver Service for this Peer Group.

getDiscoveryService

DiscoveryService getDiscoveryService()
Return the Discovery Service for this Peer Group.

Returns:
The Discovery Service for this Peer Group or null if there is no PeerInfo Service in this Peer Group.

getPeerInfoService

PeerInfoService getPeerInfoService()
Return the PeerInfo Service for this Peer Group.

Returns:
The PeerInfo Service for this Peer Group or null if there is no PeerInfo Service in this Peer Group.

getMembershipService

MembershipService getMembershipService()
Return the Membership Service for this Peer Group. This service is present in every Peer Group.

Returns:
MembershipService The Membership Service for this Peer Group.

getPipeService

PipeService getPipeService()
Return the Pipe Service for this Peer Group.

Returns:
The Pipe Service for this Peer Group or null if there is no Pipe Service in this Peer Group.

getAccessService

AccessService getAccessService()
Return the Access Service for this Peer Group. This service is present in every Peer Group.

Returns:
AccessService The Access Service for this Peer Group.
Since:
JXTA 2.1

getPeerGroupID

PeerGroupID getPeerGroupID()
Return the Peer Group ID of this Peer Group.

Returns:
PeerGroupId The Peer Group ID of this Peer Group.

getPeerID

PeerID getPeerID()
Return the Peer ID by which this Peer is known within this Peer Group.

Returns:
the Peer ID by which this Peer is known within this Peer Group.

getPeerGroupName

String getPeerGroupName()
Return the Name of this group. This name is not canonical, meaning that there may be other groups with the same name.

Returns:
String This groups's name or null if no name was specified.

getPeerName

String getPeerName()
Return the name of the local peer within this group. This name is not canonical, meaning that there may be other peers with the same name.

Returns:
String This peer's name or null if no name was specified.

getConfigAdvertisement

ConfigParams getConfigAdvertisement()
Returns the config advertisment for this peer in this group (if any).

Returns:
The advertisement or null if none is available.

getAllPurposePeerGroupImplAdvertisement

ModuleImplAdvertisement getAllPurposePeerGroupImplAdvertisement()
                                                                throws Exception
Get an all purpose peerGroup ModuleImplAdvertisement that is compatible with this group. This impl adv can be used to create any group that relies only on the standard services. Or to derive other impl advs, using this impl advertisement as a basis.

Returns:
ModuleImplAdvertisement the adv.
Throws:
Exception

unref

void unref()
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.


getWeakInterface

PeerGroup getWeakInterface()
Returns a weak interface object that represents this group.

A weak interface object has no life-cycle privileges over the group that it represents and therefore its users have no accountability. A weak interface object is safe to give away but holds no promise of sustained validity.

Whatever code gave away a weak interface object retains the power of terminating the group object from which it was obtained, thereby making the weak interface object invalid.

A weak interface object is immutable; its unref and stopApp methods do nothing. Its validity is exactly that of the group or interface object from which it was obtained.

A weak interface object can be obtained from an interface object, or from a real group object, or from a weak interface object. In the later case, the object returned may be the original weak interface object since such objects are immutable.

Whatever code obtains a weak interface object from a group object or regular interface object, remains entirely liable for invoking unref on the initial object before discarding it. Giving away a weak interface object is not equivalent to transfering ownerhsip of the original.

Returns:
PeerGroup A weak interface object that represents this PeerGroup object.
Since:
JXTA 2.2

getParentGroup

PeerGroup getParentGroup()
Returns the parent group of this group. Not all groups have parents and some implementations may not reveal their parents.

Returns:
PeerGroup the parent group or null if a parent group if not available.
Since:
JXTA 2.3

JXTA J2SE