JXTA

net.jxta.impl.peergroup
Class ShadowPeerGroup

java.lang.Object
  extended by net.jxta.impl.peergroup.GenericPeerGroup
      extended by net.jxta.impl.peergroup.StdPeerGroup
          extended by net.jxta.impl.peergroup.ShadowPeerGroup
All Implemented Interfaces:
PeerGroup, Module, Service

public class ShadowPeerGroup
extends StdPeerGroup

ShadowPeerGroup is almost a regular StdPeerGroup, except that it borrows its parent's configuration. The only real use is for the Net Peer Group.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.jxta.impl.peergroup.GenericPeerGroup
GenericPeerGroup.PeerGroupThreadFactory
 
Nested classes/interfaces inherited from interface net.jxta.peergroup.PeerGroup
PeerGroup.GlobalRegistry
 
Field Summary
 
Fields inherited from class net.jxta.impl.peergroup.StdPeerGroup
MODULE_IMPL_STD_PROVIDER, MODULE_IMPL_STD_URI, STD_COMPAT, STD_COMPAT_BINDING, STD_COMPAT_BINDING_VALUE, STD_COMPAT_FORMAT, STD_COMPAT_FORMAT_VALUE
 
Fields inherited from class net.jxta.impl.peergroup.GenericPeerGroup
configAdvertisement, implAdvertisement, initComplete, jxtaHome, 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, 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_DISABLED, START_OK
 
Constructor Summary
ShadowPeerGroup()
           
 
Method Summary
static ModuleImplAdvertisement getDefaultModuleImplAdvertisement()
          Create and populate the default module impl Advertisement for this class.
protected  void initFirst(PeerGroup parent, ID assignedID, Advertisement impl)
          Performs all initialization steps that need to be performed before any subclass initialization is performed.
protected  void initLast()
          Perform all initialization steps that need to be performed after any subclass initialization is performed.
 int startApp(String[] args)
          The group does not care for start args, and does not come-up with args to pass to its main app.
 void stopApp()
          Stop a module.
 
Methods inherited from class net.jxta.impl.peergroup.StdPeerGroup
compatible, getAllPurposePeerGroupImplAdvertisement, getApplications, getCacheManager, isCompatible, loadAllModules, mkImplAdvBuiltin
 
Methods inherited from class net.jxta.impl.peergroup.GenericPeerGroup
addService, checkServices, decRefCount, equals, getAccessService, getConfigAdvertisement, getDiscoveryService, getEndpointService, getExecutor, getHomeThreadGroup, getImplAdvertisement, getInterface, getJxtaLoader, getLoader, getMembershipService, getParentGroup, getPeerAdvertisement, getPeerGroupAdvertisement, getPeerGroupID, getPeerGroupName, getPeerID, getPeerInfoService, getPeerName, getPipeService, getRendezVousService, getResolverService, getRoleMap, getScheduledExecutor, getStoreHome, getWeakInterface, hashCode, init, isRendezvous, loadModule, loadModule, loadModule, loadModule, lookupService, lookupService, newGroup, newGroup, newGroup, publishGroup, removeService, setConfigAdvertisement, setGroupConfigAdvertisement, setStoreHome, toString, unref
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ShadowPeerGroup

public ShadowPeerGroup()
Method Detail

getDefaultModuleImplAdvertisement

public static ModuleImplAdvertisement getDefaultModuleImplAdvertisement()
Create and populate the default module impl Advertisement for this class.

Returns:
The default module impl advertisement for this class.

initFirst

protected void initFirst(PeerGroup parent,
                         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 of the peer group modules described in the provided 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:

This implementation initializes the configuration advertisement with that of the parent group and otherwise behave exactly like its superclass.

Overrides:
initFirst in class StdPeerGroup
Parameters:
parent - 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 will generate a new group ID.
impl - The ModuleImplAdvertisement which defines this group's implementation.
Throws:
PeerGroupException - if a group initialization error occurs

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.

Nothing special for now, but we might want to move some steps from initFirst() in the future.

Overrides:
initLast in class StdPeerGroup
Throws:
PeerGroupException - if a group initialization error occurs

startApp

public int startApp(String[] args)
The group does not care for start args, and does not come-up with args to pass to its main app. So, until we decide on something more useful, the args of the group's startApp are passed-on to the group's main app. NB: both the apps init and startApp methods are invoked.

If it is available, start the shell.

Specified by:
startApp in interface Module
Overrides:
startApp in class StdPeerGroup
Parameters:
args - An array of Strings forming the parameters for this Module.
Returns:
int Status.

stopApp

public void stopApp()
Stop a module. This may be called any time after init() completes and should not assume that startApp() has been called or completed.

The Module cannot be forced to comply, but in the future we might be able to deny it access to anything after some timeout.

PeerGroupInterface's stopApp() does nothing. Only a real reference to the group object permits to stop it without going through ref counting.

If we started the shell we now must stop it.

Specified by:
stopApp in interface Module
Overrides:
stopApp in class StdPeerGroup

JXSE