public class SpringCompMgr extends Object implements ComponentManager
SpringCompMgr manages API implementation components using the Springframework ApplicationContext.
See the org.sakaiproject.api.kernel.component.ComponentManagerinterface
for details.
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CLOSE_ON_SHUTDOWN
System property to control if we close on jvm shutdown (if set) or on the
loss of our last child (if not set).
|
protected static String |
CONFIGURATION_COMPONENT_PACKAGE
The Sakai configuration component package, which must be the last
defined.
|
protected static String[] |
CONFIGURATION_COMPONENTS
The Sakai configuration components, which must be the first loaded.
|
protected static String |
CONFIGURATION_FILE_NAME |
protected static String |
DEFAULT_CONFIGURATION_FILE |
protected SakaiApplicationContext |
m_ac
The Spring Application Context.
|
protected int |
m_childCount
A count of the # of child AC's that call us parent.
|
protected boolean |
m_hasBeenClosed
Records that close has been called.
|
protected Set |
m_loadedComponents
The already created components given to manage (their interface names).
|
protected static String |
SHUTDOWN_ON_ERROR
System property to control if we close the jvm on a error occurring at startup.
|
SAKAI_COMPONENTS_ROOT_SYS_PROP| Constructor and Description |
|---|
SpringCompMgr(ComponentManager parent)
Initialize.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChildAc()
Increment the count of ACs that call this one parent.
|
void |
close()
Close the component manager, shutting down any created singletons.
|
boolean |
contains(Class iface)
Check if this interface Class has a registered component.
|
boolean |
contains(String ifaceName)
Check if this interface Class name has a registered component.
|
Object |
get(Class iface)
Find a component that is registered to provide this interface.
|
Object |
get(String ifaceName)
Find a component that is registered to provide this interface.
|
org.springframework.context.ConfigurableApplicationContext |
getApplicationContext()
Access the ApplicationContext
|
protected String |
getCatalina()
Check the environment for catalina's base or home directory.
|
Properties |
getConfig()
Access the configuration properties used when configuring components.
|
Set |
getRegisteredInterfaces()
Get all interfaces registered in the component manager.
|
boolean |
hasBeenClosed()
Check if the ComponentManager has already been or is in the processing of being closed.
|
void |
init(boolean lateRefresh)
Initialize the component manager.
|
void |
loadComponent(Class iface,
Object component)
Load a singleton already created component for this interface class as a singleton.
|
void |
loadComponent(String ifaceName,
Object component)
Load a singleton already created component for this interface class as a singleton.
|
protected void |
loadComponents()
Locate the component loader, and load any available components.
|
void |
removeChildAc()
Decrement the count of ACs that call this one parent.
|
void |
waitTillConfigured()
Wait right here till the component manager is fully configured.
|
protected static final String CLOSE_ON_SHUTDOWN
protected static final String SHUTDOWN_ON_ERROR
protected static final String CONFIGURATION_COMPONENT_PACKAGE
protected static final String[] CONFIGURATION_COMPONENTS
protected static final String DEFAULT_CONFIGURATION_FILE
protected static final String CONFIGURATION_FILE_NAME
protected SakaiApplicationContext m_ac
protected Set m_loadedComponents
protected int m_childCount
protected boolean m_hasBeenClosed
public SpringCompMgr(ComponentManager parent)
parent - A ComponentManager in which this one gets nested, or NULL if
this is this top one.public void init(boolean lateRefresh)
lateRefresh - If true then don't refresh the application context
but leave it up to the caller, this is useful when running tests as it means you
can change the application context before everything gets setup. In production
systems it should be false.public org.springframework.context.ConfigurableApplicationContext getApplicationContext()
public Object get(Class iface)
get in interface ComponentManageriface - The interface Class.public Object get(String ifaceName)
get in interface ComponentManagerifaceName - The fully qualified interface Class name.public boolean contains(Class iface)
contains in interface ComponentManageriface - The interface Class.public boolean contains(String ifaceName)
contains in interface ComponentManagerifaceName - The fully qualified interface Class name.public Set getRegisteredInterfaces()
getRegisteredInterfaces in interface ComponentManagerpublic void close()
close in interface ComponentManagerpublic void loadComponent(Class iface, Object component)
loadComponent in interface ComponentManageriface - The interface class.component - The alread created component.public void loadComponent(String ifaceName, Object component)
loadComponent in interface ComponentManagerifaceName - The fully qualified interface Class name.component - The alread created component.protected void loadComponents()
public void addChildAc()
public void removeChildAc()
protected String getCatalina()
public Properties getConfig()
ComponentManagergetConfig in interface ComponentManagerpublic void waitTillConfigured()
ComponentManagerwaitTillConfigured in interface ComponentManagerpublic boolean hasBeenClosed()
ComponentManagerhasBeenClosed in interface ComponentManagerCopyright © 2003-2015 The Sakai Foundation. All Rights Reserved.