|
Project JXTA | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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:
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 |
public static final int Here
public static final int FromParent
public static final int Both
public static final long DEFAULT_LIFETIME
public static final long DEFAULT_EXPIRATION
public static final String WK_ID_PREFIX
public static final ModuleClassID peerGroupClassID
public static final ModuleClassID resolverClassID
public static final ModuleClassID discoveryClassID
public static final ModuleClassID pipeClassID
public static final ModuleClassID membershipClassID
public static final ModuleClassID rendezvousClassID
public static final ModuleClassID peerinfoClassID
public static final ModuleClassID endpointClassID
public static final ModuleClassID tcpProtoClassID
public static final ModuleClassID httpProtoClassID
public static final ModuleClassID routerProtoClassID
public static final ModuleClassID applicationClassID
public static final ModuleClassID tlsProtoClassID
public static final ModuleClassID proxyClassID
public static final ModuleClassID relayProtoClassID
public static final ModuleClassID accessClassID
public static final ModuleSpecID refPlatformSpecID
public static final ModuleSpecID refNetPeerGroupSpecID
public static final ModuleSpecID refResolverSpecID
public static final ModuleSpecID refDiscoverySpecID
public static final ModuleSpecID refPipeSpecID
public static final ModuleSpecID refMembershipSpecID
public static final ModuleSpecID refRendezvousSpecID
public static final ModuleSpecID refPeerinfoSpecID
public static final ModuleSpecID refEndpointSpecID
public static final ModuleSpecID refTcpProtoSpecID
public static final ModuleSpecID refHttpProtoSpecID
public static final ModuleSpecID refRouterProtoSpecID
public static final ModuleSpecID refTlsProtoSpecID
public static final ModuleSpecID allPurposePeerGroupSpecID
public static final ModuleSpecID refStartNetPeerGroupSpecID
public static final ModuleSpecID refShellSpecID
public static final ModuleSpecID refProxySpecID
public static final ModuleSpecID refRelayProtoSpecID
public static final ModuleSpecID refAccessSpecID
public static final PeerGroup.GlobalRegistry globalRegistry
Method Detail |
public ThreadGroup getHomeThreadGroup()
public JxtaLoader getLoader()
public boolean isRendezvous()
public PeerGroupAdvertisement getPeerGroupAdvertisement()
public PeerAdvertisement getPeerAdvertisement()
public Service lookupService(ID name) throws ServiceNotFoundException
name
- the service identifier.
ServiceNotFoundException
- could not find the service requestedpublic Service 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.public Iterator getRoleMap(ID name)
name
- The ModuleClassID for which the map is desired.
public boolean compatible(Element compat)
public 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 module is a protocol and
is disabled per the peer's configuration.
PeerGroupException
- The module could not be loaded or initializedpublic Module 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 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).
public void publishGroup(String name, String description) throws IOException
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.
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.public PeerGroup newGroup(Advertisement pgAdv) throws PeerGroupException
newGroup(PeerGroupID,Advertisement,String,String)
pgAdv
- The advertisement for the group to be instantiated.
PeerGroupException
- The group could not be instantated.public 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
- The group could ne be instantiated.public 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
- The group could ne be instantated.public RendezVousService getRendezVousService()
null
if there is no Rendezvous Service in this Peer Group.public EndpointService getEndpointService()
public ResolverService getResolverService()
public DiscoveryService getDiscoveryService()
null
if there is no PeerInfo Service in this Peer Group.public PeerInfoService getPeerInfoService()
null
if there is no PeerInfo Service in this Peer Group.public MembershipService getMembershipService()
public PipeService getPipeService()
null
if
there is no Pipe Service in this Peer Group.public AccessService getAccessService()
public PeerGroupID getPeerGroupID()
public PeerID getPeerID()
public String getPeerGroupName()
null
if no name was
specified.public String getPeerName()
null
if no name was
specified.public ConfigParams getConfigAdvertisement()
null
if none is available.public ModuleImplAdvertisement getAllPurposePeerGroupImplAdvertisement() throws Exception
Exception
public void unref()
public PeerGroup getWeakInterface()
public PeerGroup getParentGroup()
null
if a parent group
if not available.
|
JXTA J2SE | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |