|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectraccoon.core.types.AbsComponent
raccoon.core.types.AbsLoadable
raccoon.core.types.AbsConfigurableLoadable
raccoon.core.manager.ServiceManager
public class ServiceManager
The main component that handles the life cycle of any component that complies to the contract IBaseComponent
.
Field Summary | |
---|---|
static java.lang.String |
MAPPING_PROPERTY_NAME
The property used by the service manager to locate the mapping file that it should use. |
static java.lang.String |
SERVICES_XML_FILE
The property used by the service manager to locate the services xml file that it should use. |
Fields inherited from class raccoon.core.types.AbsConfigurableLoadable |
---|
mConfigurableManager |
Fields inherited from class raccoon.core.types.AbsLoadable |
---|
mIsLoaded |
Fields inherited from class raccoon.core.types.AbsComponent |
---|
mIsInError |
Constructor Summary | |
---|---|
ServiceManager()
|
Method Summary | |
---|---|
void |
bootstrap()
Force the ServiceManager to auto load using the specified ResourceBundle in the appropriate java property. |
void |
clear()
Clears all the current errors attached to this component. |
void |
configureParameters()
Configures the various parameters for this component. |
java.lang.String |
getConfigurationName()
Convenience method to check in debug mode if this service manager is using the right configuration file. |
static void |
invokeBeanProperty(java.lang.Object pBeanInstance,
java.lang.String pPropertyName,
java.lang.String pPropertyType,
java.lang.String pPropertyValue,
java.lang.String pCollectionType)
Invokes the given property setter. |
static boolean |
isConfigurable()
Does this component require a property file to be correctly configured. |
static boolean |
isInitialisable()
Does this component need to be started and stopped?. |
boolean |
isLoaded(java.lang.String pComponentName)
Checks if a given service is already loaded, convenience method for faster access. |
boolean |
isLoaded(java.lang.String pComponentName,
java.lang.String pComponentKey)
Checks if a given service is already loaded, convenience method for faster access. |
boolean |
isLogable()
Does this component require a logging component in order to function correctly?. |
void |
load()
Invoked by the service helper to start this component once it has been configured. |
IBaseComponent |
lookup(java.lang.String pComponentName)
Retrieves a component that has been loaded and initialised based upon it's logical name. |
IBaseComponent |
lookup(java.lang.String pComponentName,
java.lang.String pComponentKey)
Retrieves a component that has been loaded and initialised based upon it's logical key name. |
IBaseComponent |
lookup(java.lang.String pComponentName,
java.lang.String pComponentKey,
java.util.Hashtable pBeanProperties)
Retrieves a component that has been loaded and initialised based upon it's logical key name. |
void |
setConfig(IConfig pConfig)
Defines the configuration service used by this component. |
void |
shutdown(boolean pThrowOnError)
Shuts down all the loaded components. |
void |
unload()
Invoked by the service manager to stop this component. |
Methods inherited from class raccoon.core.types.AbsConfigurableLoadable |
---|
isStable, setConfigurableManager, setLogger |
Methods inherited from class raccoon.core.types.AbsLoadable |
---|
getLog, isInError, isInitialised, isRunning |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface raccoon.api.types.IServiceManager |
---|
isStable |
Field Detail |
---|
public static final java.lang.String MAPPING_PROPERTY_NAME
public static final java.lang.String SERVICES_XML_FILE
Constructor Detail |
---|
public ServiceManager()
Method Detail |
---|
public static boolean isConfigurable()
true
if this component needs property file.public boolean isLogable()
true
if this component needs a logging component.public static boolean isInitialisable()
true
if this component needs to be started and stopped.public void setConfig(IConfig pConfig)
pConfig
- the configuration service.public void clear()
public java.lang.String getConfigurationName()
getConfigurationName
in interface IServiceManager
<service>
public void load() throws LoadableException
load
in interface ILoadable
load
in class AbsConfigurableLoadable
LoadableException
- if this component was unable to load itself or dependant components.public void unload() throws LoadableException
true
and then set to
false
once all the init code has been performed.
unload
in interface ILoadable
unload
in class AbsLoadable
LoadableException
- if this component wasn't unable to unload itself or dependant services.public IBaseComponent lookup(java.lang.String pComponentName) throws RaccoonException
lookup
in interface IServiceManager
pComponentName
- the name of the component that was given in the configuration file.
IBaseComponent
instance loaded and initialised if necessary.
RaccoonException
- if the component couldn't be loaded or found.public boolean isLoaded(java.lang.String pComponentName) throws RaccoonException
lookup(String)
isLoaded
in interface IServiceManager
pComponentName
- the logical name of the component.
true
if the object already exists within this instance of the service manager.
RaccoonException
- if the service manager isn't stable
.public boolean isLoaded(java.lang.String pComponentName, java.lang.String pComponentKey) throws RaccoonException
lookup(String)
isLoaded
in interface IServiceManager
pComponentName
- the logical name of the component.pComponentKey
- a unique key that is used to identify this given component (for example a thread-id).
true
if the object already exists within this instance of the service manager.
RaccoonException
- if the service manager isn't stable
.public IBaseComponent lookup(java.lang.String pComponentName, java.lang.String pComponentKey, java.util.Hashtable pBeanProperties) throws RaccoonException
lookup
in interface IServiceManager
pComponentName
- the name of the component that was given in the configuration file.pComponentKey
- a unique key that is used to identify this given component (for example a thread-id).pBeanProperties
- the bean properties that are to be set before invoking the load method.
IBaseComponent
instance loaded and initialised if necessary.
RaccoonException
- if the component couldn't be loaded or found.public IBaseComponent lookup(java.lang.String pComponentName, java.lang.String pComponentKey) throws RaccoonException
lookup
in interface IServiceManager
pComponentName
- the name of the component that was given in the configuration file.pComponentKey
- the name of the key that was given to this component (for example a thread id).
IBaseComponent
instance loaded and initialised if necessary.
RaccoonException
- if the component couldn't be loaded or found.public static void invokeBeanProperty(java.lang.Object pBeanInstance, java.lang.String pPropertyName, java.lang.String pPropertyType, java.lang.String pPropertyValue, java.lang.String pCollectionType) throws RaccoonException
pBeanInstance
- the java bean instance for which the property is to be set.pPropertyName
- the name of the property that is to be invokedpPropertyType
- the type of the property (string, integer, int, ...)pPropertyValue
- the value of the property.pCollectionType
- if this property is a collection, set this value to "collection" and the property
"add"pPropertyName
will be invoked, else set to null
RaccoonException
- if the process fails.public void bootstrap() throws RaccoonException
RaccoonException
- if something goes wrong.public void shutdown(boolean pThrowOnError) throws RaccoonException
shutdown
in interface IServiceManager
pThrowOnError
- if true
will throw an exception containing all the errors that occured whilst
halting the loaded services.
RaccoonException
- if pThrowOnError
is true
and errors occur.public void configureParameters()
IConfigurableManager
provided during the invocation of AbsConfigurableLoadable.setConfigurableManager(IConfigurableManager)
.
configureParameters
in interface IConfigurable
configureParameters
in class AbsConfigurableLoadable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |