net.jxta.impl.peergroup
Class Platform
java.lang.Object
net.jxta.impl.peergroup.GenericPeerGroup
net.jxta.impl.peergroup.StdPeerGroup
net.jxta.impl.peergroup.Platform
- All Implemented Interfaces:
- CompatibilityEquater, PeerGroup, Module, Service
public class Platform
- extends StdPeerGroup
Provides the implementation for the World Peer Group.
Key differences from regular groups are:
- Provides a mechanism for peer group configuration parameter and for
reconfiguration via a plugin configurator.
- Ensures that only a single instance of the World Peer Group exists
within the context of the current classloader.
Fields inherited from interface net.jxta.peergroup.PeerGroup |
accessClassID, allPurposePeerGroupSpecID, applicationClassID, Both, DEFAULT_EXPIRATION, DEFAULT_LIFETIME, discoveryClassID, endpointClassID, FromParent, globalRegistry, Here, httpProtoClassID, membershipClassID, peerGroupClassID, peerinfoClassID, pipeClassID, proxyClassID, refAccessSpecID, refDiscoverySpecID, refEndpointSpecID, refHttpProtoSpecID, refMembershipSpecID, refNetPeerGroupSpecID, refPeerinfoSpecID, refPipeSpecID, refPlatformSpecID, refProxySpecID, refRelayProtoSpecID, refRendezvousSpecID, refResolverSpecID, refRouterProtoSpecID, refShellSpecID, refStartNetPeerGroupSpecID, refTcpProtoSpecID, refTlsProtoSpecID, relayProtoClassID, rendezvousClassID, resolverClassID, routerProtoClassID, tcpProtoClassID, tlsProtoClassID, WK_ID_PREFIX |
Constructor Summary |
Platform()
Default constructor |
Method Summary |
ModuleImplAdvertisement |
getAllPurposePeerGroupImplAdvertisement()
Returns the all purpose peer group implementation advertisement that
is most usefull when called in the context of the platform group: the
description of an infrastructure group. |
protected void |
initFirst(PeerGroup nullParent,
ID assignedID,
Advertisement impl)
Performs all initialization steps that need to be performed
before any subclass initialization is performed.
Classes that override this method should always call
super.initFirst() before doing
any of their own work.
This method loads and initializes all modules
described in the given implementation advertisement. |
protected void |
initLast()
Perform all initialization steps that need to be performed
after any subclass initialization is performed.
Classes that override this method should always call super.initLast
after doing any of their own work. |
protected ModuleImplAdvertisement |
mkPlatformImplAdv()
|
void |
stopApp()
Stops the group and all its services.
PeerGroupInterface's stopApp() does nothing. Only a real reference
to the group object permits to stop it without going through ref
counting. |
Methods inherited from class net.jxta.impl.peergroup.GenericPeerGroup |
addService, checkServices, decRefCount, equals, getAccessService, getConfigAdvertisement, getDiscoveryService, getEndpointService, getHomeThreadGroup, getImplAdvertisement, getInterface, getJxtaLoader, getLoader, getMembershipService, getParentGroup, getPeerAdvertisement, getPeerGroupAdvertisement, getPeerGroupID, getPeerGroupName, getPeerID, getPeerInfoService, getPeerName, getPipeService, getRendezVousService, getResolverService, getRoleMap, getWeakInterface, hashCode, init, isRendezvous, loadModule, loadModule, loadModule, loadModule, lookupService, lookupService, newGroup, newGroup, newGroup, publishGroup, removeService, setConfigAdvertisement, setJxtaLoader, unref |
Platform
public Platform()
- Default constructor
initFirst
protected void initFirst(PeerGroup nullParent,
ID assignedID,
Advertisement impl)
throws PeerGroupException
- Performs all initialization steps that need to be performed
before any subclass initialization is performed.
Classes that override this method should always call
super.initFirst()
before doing
any of their own work.
This method loads and initializes all modules
described in the given implementation advertisement. Then, all modules
are placed in a list and the list is processed iteratively. During each
iteration, the Module.startApp(String[])
method of each module
is invoked once. Iterations continue until no progress is being made or
the list is empty.
The status returned by the Module.startApp(String[])
method
of each module is considered as follows:
Iterations through the list stop when:
- The list is empty: the group initialization proceeds.
- A complete iteration was performed and all modules returned
Module.START_AGAIN_STALLED
: a PeerGroupException
is thrown.
- A number of complete iteration completed without any module
returning
Module.START_OK
: a PeerGroupException
is thrown. The number of complete iterations before that happens is
computed as 1 + the square of the number of modules currently in the
list.
- Overrides:
initFirst
in class StdPeerGroup
- Parameters:
nullParent
- The group that serves as a parent to this group.assignedID
- The unique ID assigned to this module. For
group this is the group ID or null
if a group ID
has not yet been assigned. If null is passed, GenericPeerGroup
choses a new group ID.impl
- The ModuleImplAdvertisement which defines this
group's implementation.
- Throws:
PeerGroupException
initLast
protected void initLast()
throws PeerGroupException
- Perform all initialization steps that need to be performed
after any subclass initialization is performed.
Classes that override this method should always call super.initLast
after doing any of their own work.
- Overrides:
initLast
in class StdPeerGroup
- Throws:
PeerGroupException
mkPlatformImplAdv
protected ModuleImplAdvertisement mkPlatformImplAdv()
throws Exception
- Throws:
Exception
stopApp
public void stopApp()
- Stops the group and all its services.
PeerGroupInterface's stopApp() does nothing. Only a real reference
to the group object permits to stop it without going through ref
counting.
- Specified by:
stopApp
in interface Module
- Overrides:
stopApp
in class StdPeerGroup
getAllPurposePeerGroupImplAdvertisement
public ModuleImplAdvertisement getAllPurposePeerGroupImplAdvertisement()
throws Exception
- Returns the all purpose peer group implementation advertisement that
is most usefull when called in the context of the platform group: the
description of an infrastructure group.
This definition is always the same and has a well known ModuleSpecID.
It includes the basic service, high-level transports and the shell for
main application. It differs from the one returned by StdPeerGroup only
in that it includes the high-level transports (and different specID,
name and description, of course). However, in order to avoid confusing
inheritance schemes (class hierarchy is inverse of object hierarchy)
other possible dependency issues, we just redefine it fully, right here.
The user must remember to change the specID if the set of services
protocols or applications is altered before use.
- Specified by:
getAllPurposePeerGroupImplAdvertisement
in interface PeerGroup
- Overrides:
getAllPurposePeerGroupImplAdvertisement
in class StdPeerGroup
- Returns:
- ModuleImplAdvertisement The new peergroup impl adv.
- Throws:
Exception