|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.sape.carbon.core.bootstrap.BootStrapper
This class is Carbon's ultimate source for the config service and
ComponentKeeper
. If they have not been loaded already,
this class knows how bootstrap the system to load them.
All public methods are synchronized such that the first thread to acquire the lock on this class will load the Carbon Core, all other concurrent threads will wait for the first to finish. The exception to this is the getState method. This method is synchronized on a different object so that threads merely interested in the system state do not need to wait for the system to load.
This class is final because Carbon is not designed to have this class be overridden so extending it makes no sense.
Copyright 2002 Sapient
Field Summary | |
static String |
BOOT_LOADER_PROPERTY
The bootloader key definition to override the bootloader |
private ComponentKeeper |
componentKeeper
The ComponentKeeper for the Carbon Core |
private ConfigurationService |
configurationService
The ConfigurationService for the Carbon Core |
private static String |
DEFAULT_LOADER_CLASS_NAME
The key to the class name of the default loader |
private DeploymentProperties |
deploymentProperties
The deployement properties cache for this bootstrapper |
private static BootStrapper |
INSTANCE
The single static reference to the boot strapper of this system. |
private org.apache.commons.logging.Log |
log
The handle to Apache-commons logger |
private static String |
STARTUP_COMPONENT_NAME
The default name of the startup component service |
private BootStrapperStateEnum |
state
Attribute to hold the state of the Carbon Core (is it loaded or not). |
private Object |
stateLock
Object used to synchronize upon when state is accessed. |
Constructor Summary | |
private |
BootStrapper()
This is a singleton so we have a private constructor to prevent impropper instantiation. |
Method Summary | |
ComponentKeeper |
fetchComponentKeeper()
Gets a reference to the ComponentKeeper
for the system. |
ConfigurationService |
fetchConfigurationService()
Gets a reference to the root configuration provider for the system. |
private Loader |
fetchLoader()
Factory method for getting a Loader to load the system. |
String |
getDeploymentProperty(String key)
This method provides access to properties that are specific to this deployment of Carbon. |
static BootStrapper |
getInstance()
Static factory method for getting a reference to the BootStrapper . |
BootStrapperStateEnum |
getState()
Gets the state of BootStrapper. |
void |
load()
This method is responsible for making the calls to load of the Carbon Core. |
Object |
setDeploymentProperty(String key,
String value)
This method sets Deployment properties. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private org.apache.commons.logging.Log log
private ConfigurationService configurationService
private ComponentKeeper componentKeeper
private BootStrapperStateEnum state
private final Object stateLock
private final DeploymentProperties deploymentProperties
public static final String BOOT_LOADER_PROPERTY
private static final String DEFAULT_LOADER_CLASS_NAME
private static final String STARTUP_COMPONENT_NAME
private static final BootStrapper INSTANCE
Constructor Detail |
private BootStrapper()
This is a singleton so we have a private constructor to prevent impropper instantiation.
Method Detail |
public ConfigurationService fetchConfigurationService()
Gets a reference to the root configuration provider for the system.
public ComponentKeeper fetchComponentKeeper()
Gets a reference to the ComponentKeeper
for the system.
public void load()
This method is responsible for making the calls to load of the Carbon
Core. It delegates to a Loader
to get references to the
configuration service and the ComponentKeeper
for the
system.
It is synchronized so it can only be run by a single thread. It also contains logic so that it will only run once.
public BootStrapperStateEnum getState()
Gets the state of BootStrapper. This method allows you to determine whether or no the core is up an running yet.
Note that this method is synchronized (within the method, not in the method signature) in order to return a correct result always. If a stale result is acceptable in exchange for better performance, the synchronization can be removed.
public String getDeploymentProperty(String key)
ClassLoader.getResource
method. Deployment Properties
should be properties that either change based on deployment or are
required before the ConfigurationService
is loaded. Cases
of properties varying based on deployment should be minimal. In this
case, the DeploymentService
should be used.
This method has the same semantics as java.util.Properties.getProperty(String)
key
- the name of the property
ClassLoader.getResource(String)
,
Properties.getProperty(String)
,
DeploymentService
public Object setDeploymentProperty(String key, String value)
This method has the same semantics as java.util.Properties.setProperty(String, String)
key
- the key to store the value invalue
- the value of the deployment property
Properties.setProperty(String, String)
private Loader fetchLoader()
Factory method for getting a Loader
to load the system.
This method defaults to using the DefaultLoader
unless
the system property defined by BOOT_LOADER_PROPERTY is set on the
commandline. In that case, the value of the system property must refer
to a class that implements Loader
.
public static BootStrapper getInstance()
Static factory method for getting a reference to the
BootStrapper
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |