|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PeerGroup
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 fully participate in a group, a peer may need to authenticate with the group using the peer group membership service.
PeerGroupID
,
Service
,
PeerGroupFactory
,
PeerGroupAdvertisement
,
ModuleImplAdvertisement
,
ModuleSpecID
,
ModuleClassID
Nested Class Summary | |
---|---|
static class |
PeerGroup.GlobalRegistry
Global registry of instantiated peer groups. |
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
The global registry of Peer Group instances. |
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 |
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 declared in this interface. |
Fields inherited from interface net.jxta.platform.Module |
---|
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, 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 advertisement 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. |
URI |
getStoreHome()
Returns the location of the parent of all items that this peer group is using for persistently storing its preferences, cache, persistent store, properties, etc. |
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 ModuleSpecID Advertisement is sought, compatibility is checked on all candidates and load is attempted. |
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 the provided 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 peer group from its elementary pieces and publishes the corresponding PeerGroupAdvertisement. |
void |
publishGroup(String name,
String description)
Publish this group's Peer Group Advertisement. |
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 |
---|
static final int Here
static final int FromParent
static final int Both
static final long DEFAULT_LIFETIME
static final long DEFAULT_EXPIRATION
static final String WK_ID_PREFIX
static final ModuleClassID peerGroupClassID
static final ModuleClassID resolverClassID
static final ModuleClassID discoveryClassID
static final ModuleClassID pipeClassID
static final ModuleClassID membershipClassID
static final ModuleClassID rendezvousClassID
static final ModuleClassID peerinfoClassID
static final ModuleClassID endpointClassID
static final ModuleClassID tcpProtoClassID
static final ModuleClassID httpProtoClassID
static final ModuleClassID routerProtoClassID
static final ModuleClassID applicationClassID
static final ModuleClassID tlsProtoClassID
static final ModuleClassID proxyClassID
static final ModuleClassID relayProtoClassID
static final ModuleClassID accessClassID
static final ModuleSpecID refPlatformSpecID
static final ModuleSpecID refNetPeerGroupSpecID
static final ModuleSpecID refResolverSpecID
static final ModuleSpecID refDiscoverySpecID
static final ModuleSpecID refPipeSpecID
static final ModuleSpecID refMembershipSpecID
static final ModuleSpecID refRendezvousSpecID
static final ModuleSpecID refPeerinfoSpecID
static final ModuleSpecID refEndpointSpecID
static final ModuleSpecID refTcpProtoSpecID
static final ModuleSpecID refHttpProtoSpecID
static final ModuleSpecID refRouterProtoSpecID
static final ModuleSpecID refTlsProtoSpecID
static final ModuleSpecID allPurposePeerGroupSpecID
static final ModuleSpecID refShellSpecID
static final ModuleSpecID refProxySpecID
static final ModuleSpecID refRelayProtoSpecID
static final ModuleSpecID refAccessSpecID
static final PeerGroup.GlobalRegistry globalRegistry
Method Detail |
---|
ThreadGroup getHomeThreadGroup()
JxtaLoader getLoader()
boolean isRendezvous()
PeerGroupAdvertisement getPeerGroupAdvertisement()
PeerAdvertisement getPeerAdvertisement()
Service lookupService(ID name) throws ServiceNotFoundException
name
- the service identifier.
ServiceNotFoundException
- could not find the service requestedService lookupService(ID name, int roleIndex) throws ServiceNotFoundException
name
- the service identifierroleIndex
- the index in the list of assigned IDs that match
that identifier.
ServiceNotFoundException
- Could not find the service requested.Iterator getRoleMap(ID name)
name
- The ModuleClassID for which the map is desired.
boolean compatible(Element compat)
compat
- compatibility element
Module loadModule(ID assignedID, Advertisement impl) throws ProtocolNotSupportedException, PeerGroupException
assignedID
- Id to be assigned to that module (usually its ClassID).impl
- An implementation advertisement for that module.
ProtocolNotSupportedException
- The implementation described by the
advertisement is incompatible with this peer. The module cannot be loaded.
PeerGroupException
- The module could not be loaded or initializedModule loadModule(ID assignedID, ModuleSpecID specID, int where)
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
prospective 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
).
void publishGroup(String name, String description) throws IOException
name
- The name of this group.description
- The description of this group.
IOException
- The publication could not be accomplished
because of a network or storage failure.PeerGroup newGroup(Advertisement pgAdv) throws PeerGroupException
pgAdv
- The advertisement for the group to be instantiated.
PeerGroupException
- For problems instantiating the peer group.PeerGroup newGroup(PeerGroupID gid, Advertisement impl, String name, String description) throws PeerGroupException
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);
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.
PeerGroupException
- Thrown if the group could not be instantiated.PeerGroup newGroup(PeerGroupID gid) throws PeerGroupException
loadModule(ID,Advertisement)
or even:
grp = new GroupSubClass();
grp.init(parentGroup, gid, impladv);
then, REMEMBER TO PUBLISH THE GROUP IF IT IS ALL NEW.
gid
- the groupID.
PeerGroupException
- Thrown if the group could not be instantiated.RendezVousService getRendezVousService()
null
if there is no Rendezvous Service in this Peer Group.EndpointService getEndpointService()
ResolverService getResolverService()
DiscoveryService getDiscoveryService()
null
if there is no PeerInfo Service in this Peer Group.PeerInfoService getPeerInfoService()
null
if there is no PeerInfo Service in this Peer Group.MembershipService getMembershipService()
PipeService getPipeService()
null
if
there is no Pipe Service in this Peer Group.AccessService getAccessService()
PeerGroupID getPeerGroupID()
PeerID getPeerID()
String getPeerGroupName()
null
if no name was
specified.String getPeerName()
null
if no name was
specified.ConfigParams getConfigAdvertisement()
null
if none is available.ModuleImplAdvertisement getAllPurposePeerGroupImplAdvertisement() throws Exception
Exception
- if an error occurs while creating the implementation advertisementvoid unref()
PeerGroup getWeakInterface()
PeerGroup getParentGroup()
null
if a parent group
if not available.URI getStoreHome()
null
if the peergroup has no defined
location for storing persistent data.
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |