|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.peergroup.GenericPeerGroup
net.jxta.impl.peergroup.StdPeerGroup
public class StdPeerGroup
A subclass of GenericPeerGroup that makes a peer group out of independent plugin services listed in its impl advertisement.
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 | |
---|---|
static String |
MODULE_IMPL_STD_PROVIDER
|
static String |
MODULE_IMPL_STD_URI
|
static XMLDocument |
STD_COMPAT
|
protected static String |
STD_COMPAT_BINDING
|
protected static String |
STD_COMPAT_BINDING_VALUE
|
protected static String |
STD_COMPAT_FORMAT
|
protected static String |
STD_COMPAT_FORMAT_VALUE
The Specification title and Specification version we require. |
Fields inherited from class net.jxta.impl.peergroup.GenericPeerGroup |
---|
configAdvertisement, implAdvertisement, initComplete, jxtaHome, parentGroup |
Fields inherited from interface net.jxta.platform.Module |
---|
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK |
Constructor Summary | |
---|---|
StdPeerGroup()
constructor |
Method Summary | |
---|---|
boolean |
compatible(Element compat)
Return true if the provided compatibility statement is compatible with this group. |
ModuleImplAdvertisement |
getAllPurposePeerGroupImplAdvertisement()
Get an all purpose peerGroup ModuleImplAdvertisement that is compatible with this group. |
Map<ModuleClassID,Object> |
getApplications()
Return a map of the applications for this group. |
Cm |
getCacheManager()
Returns the cache manager associated with this group. |
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. |
(package private) static boolean |
isCompatible(Element compat)
Evaluates if the given compatibility statement makes the module that bears it is loadable by this group. |
protected void |
loadAllModules(Map<ModuleClassID,Object> modules,
boolean privileged)
Builds a table of modules indexed by their class ID. |
(package private) static ModuleImplAdvertisement |
mkImplAdvBuiltin(ModuleSpecID specID,
String code,
String descr)
An internal convenience method essentially for bootstrapping. |
int |
startApp(String[] arg)
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 java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final XMLDocument STD_COMPAT
public static final String MODULE_IMPL_STD_URI
public static final String MODULE_IMPL_STD_PROVIDER
protected static final String STD_COMPAT_FORMAT
protected static final String STD_COMPAT_FORMAT_VALUE
protected static final String STD_COMPAT_BINDING
protected static final String STD_COMPAT_BINDING_VALUE
Constructor Detail |
---|
public StdPeerGroup()
Method Detail |
---|
static ModuleImplAdvertisement mkImplAdvBuiltin(ModuleSpecID specID, String code, String descr)
specID
- spec IDcode
- code uridescr
- description
public boolean compatible(Element compat)
compat
- compatibility element
static boolean isCompatible(Element compat)
compat
- The compatibility statement being tested.
true
if we are compatible with the provided statement
otherwise false
.protected void loadAllModules(Map<ModuleClassID,Object> modules, boolean privileged)
modules
- The modules to loadprivileged
- if true then modules will get a real reference to
the group loading them, otherwise its an interface object.public int startApp(String[] arg)
startApp
in interface Module
startApp
in class GenericPeerGroup
arg
- An array of Strings forming the parameters for this
Module.
public void stopApp()
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.
stopApp
in interface Module
stopApp
in class GenericPeerGroup
protected void initFirst(PeerGroup parent, ID assignedID, Advertisement impl) throws PeerGroupException
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:
Module.START_OK
: The module is removed from the list of
modules to be started and its Module.startApp(String[])
method will not be invoked again.
Module.START_AGAIN_PROGRESS
: The module remains in the
list of modules to be started and its Module.startApp(String[])
method will be invoked during the next iteration, if there is one. Module.START_AGAIN_STALLED
: The module remains in the list
of modules to be started and its Module.startApp(String[])
method will be invoked during the next iteration if there is one. Module.startApp(String[])
method will not be invoked again.Module.START_AGAIN_STALLED
: a PeerGroupException
is thrown.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.
initFirst
in class GenericPeerGroup
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.
PeerGroupException
- if a group initialization error occursprotected void initLast() throws PeerGroupException
initLast
in class GenericPeerGroup
PeerGroupException
- if a group initialization error occurspublic ModuleImplAdvertisement getAllPurposePeerGroupImplAdvertisement()
ModuleImplAdvertisement
will contain
embedded ModuleImplAdvertisement
s for the referenced services as
opposed to ModuleSpecID
s. This is because JXSE 2.4.1 and earlier
do not handle load failures of modules loaded by spec id correctly.
After JXSE 2.5 is released this should be changed to use the better
ModuleSpecID
based peer group module specification.
public Cm getCacheManager()
public Map<ModuleClassID,Object> getApplications()
ModuleClassID
Module
or
ModuleImplAdvertisement
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |