Project JXTA

net.jxta.impl.peergroup
Class Platform

java.lang.Object
  extended by net.jxta.impl.peergroup.GenericPeerGroup
      extended by net.jxta.impl.peergroup.StdPeerGroup
          extended by 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:


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.jxta.peergroup.PeerGroup
PeerGroup.GlobalRegistry
 
Field Summary
 
Fields inherited from class net.jxta.impl.peergroup.StdPeerGroup
compatKey1, compatKey2, compatVal1, compatVal2, disabledModules, stdCompatStatement, stdProvider, stdUri
 
Fields inherited from class net.jxta.impl.peergroup.GenericPeerGroup
configAdvertisement, configurator, parentGroup
 
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
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK
 
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.StdPeerGroup
compatible, getCacheManager, isCompatible, loadAllModules, mkImplAdvBuiltin, startApp
 
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
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Platform

public Platform()
Default constructor

Method Detail

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:

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

JXTA J2SE