|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.portico.core.BootstrapManager
public class BootstrapManager
This class contains and allows for the management of a collection of Bootstrap
instances for a given RTIExec
. In order ensure that the
MulticastRegistry
starts before any bootstraps (as they may want to use it),
an instance of that class is contained within the manager. It can be obtained by calling the
getMulticastRegistry()
method.
Field Summary | |
---|---|
private com.lbf.commons.messaging.IMessageHandler |
bootstrapHandler
|
private com.lbf.commons.component.ComponentGroup<Bootstrap> |
group
|
protected org.apache.log4j.Logger |
logger
|
protected RTIExec |
rti
|
Constructor Summary | |
---|---|
BootstrapManager(RTIExec execution)
Create a new bootstrap manager for the given execution. |
Method Summary | |
---|---|
private int |
_startBootstraps(boolean strict)
|
boolean |
containsBootstrap(String name)
Returns true if this manager contains a bootstrap by the given name, false otherwise. |
private com.lbf.commons.utils.Bag<String,Object> |
convert(com.lbf.commons.utils.Bag<String,?> bag)
Converts a Bag |
Set<Bootstrap> |
getAllBootstraps()
Get a list of all the bootstraps contained in this manager |
MulticastRegistry |
getMulticastRegistry()
Fetch the contained MulticastRegistry . |
void |
notifyBootstrapsFederationCreated(Federation theFederation)
Notify all the contained and active bootstraps that a new federation has been created, passing the instance that was started. |
void |
notifyBootstrapsFederationDestroyed(String federationName)
Notify all the contained and active bootstraps taht a federation with the provided name has been destroyed. |
void |
registerBootstrap(Bootstrap bootstrap,
com.lbf.commons.utils.Bag<String,?> config)
Register a bootstrap with the manager. |
Bootstrap |
removeBootstrap(String bootstrap)
Remove the bootstrap of the given name from the group and return it. |
int |
size()
Return the number of bootstraps registered in this manager |
private void |
startBootstrap(Bootstrap bootstrap)
Starts the given bootstrap. |
int |
startBootstraps()
This method will attempt to start all the contains bootstraps that
have not yet been started. |
int |
startBootstrapsStrict()
This method is the same as startBootstraps() in that it will
only attempt to start any bootstraps that have not already been started. |
int |
stopBootstraps()
This method will ask all the contained bootstraps to shutdown and cleanup. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private com.lbf.commons.component.ComponentGroup<Bootstrap> group
private com.lbf.commons.messaging.IMessageHandler bootstrapHandler
protected RTIExec rti
protected org.apache.log4j.Logger logger
Constructor Detail |
---|
public BootstrapManager(RTIExec execution) throws JException
JException
Method Detail |
---|
public MulticastRegistry getMulticastRegistry()
MulticastRegistry
.
public void notifyBootstrapsFederationCreated(Federation theFederation)
public void notifyBootstrapsFederationDestroyed(String federationName)
public void registerBootstrap(Bootstrap bootstrap, com.lbf.commons.utils.Bag<String,?> config) throws JException
bootstrap
- The bootstrap to register with the managerconfig
- The set of configuration properties the manager should pass to the bootstrap
on startup. NOTE: This *can* be null.
JException
- If the bootstrap is null or there is a problem registering the bootstrappublic Bootstrap removeBootstrap(String bootstrap)
bootstrap
- The name of the bootstrap to remove from the group
public Set<Bootstrap> getAllBootstraps()
public int size()
public boolean containsBootstrap(String name)
public int startBootstraps()
bootstraps
that
have not yet been started. This method is safe to call at any time as it will only
attempt to start those bootstraps that have not already been started. If any fail to start,
a message will be logged, but no exception will be thrown (if you require this, see
startBootstrapsStrict()
.
The number of bootstraps successfully started will be returned (could be 0 if all were
already started. 0 does NOT indicate an error).
NOTE: If a bootstrap does not start due to a configuration failure, it will be
automatically removed.
public int startBootstrapsStrict() throws JException
startBootstraps()
in that it will
only attempt to start any bootstraps that have not already been started. Like the previous
method, if any fail to start, a message will be logged. UNLIKE startBootstraps(), if
any fail to start, an exception will be thrown.
JException
- If *any* of the "unstarted" bootstraps fail to start happilyprivate int _startBootstraps(boolean strict) throws JException
JException
private void startBootstrap(Bootstrap bootstrap) throws com.lbf.commons.config.ConfigurationException, com.lbf.commons.component.ComponentException
bootstrap
- The bootstrap to start
com.lbf.commons.config.ConfigurationException
- If there is a problem during the configuration process
com.lbf.commons.component.ComponentException
- If there is a problem starting the bootstrappublic int stopBootstraps() throws JException
JException
- If any of the contained bootstraps fail to shutdown or cleanupprivate com.lbf.commons.utils.Bag<String,Object> convert(com.lbf.commons.utils.Bag<String,?> bag)
|
copyright The Portico Project 2008. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |