Package org.sakaiproject.component.cover
Class ComponentManager
- java.lang.Object
-
- org.sakaiproject.component.cover.ComponentManager
-
public class ComponentManager extends Object
ComponentManager is a static Cover for the
Component Manager; see that interface for usage details.This cover is special. As a cover for the component manager, it cannot use the component manager to find the instance. Instead, this is where a static single-instance singleton ComponentManger of a particular type is created.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanCACHE_COMPONENTSIf true, covers will cache the components they find once - good for production, bad for some unit testing.protected static ComponentManagerm_componentManagerA component manager - use the Spring based one.static StringSAKAI_COMPONENTS_ROOT_SYS_PROPstatic booleantestingModeSetup the CM in testingMode if this is true (this is to be used for unit tests only), has no effect if the CM is already initialized
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidclose()static booleancontains(Class iface)static booleancontains(String ifaceName)static <T> Tget(Class<T> iface)static Objectget(String ifaceName)static PropertiesgetConfig()Deprecated.This method is redundant, not used by any known client, would expose implementation details, and will be removed in a future release.static ComponentManagergetInstance()Access the component manager of the single instance.static SetgetRegisteredInterfaces()static booleanhasBeenClosed()static booleanisTestingMode()static voidloadComponent(Class iface, Object component)static voidloadComponent(String ifaceName, Object component)static voidsetLateRefresh(boolean b)static voidshutdown()TESTING ONLY
closes and then destroys the component manager
WARNING: this is NOT safe to do in a production systemstatic voidwaitTillConfigured()When the component manager this can be called by a background thread to wait until the component manager has been configured.
-
-
-
Field Detail
-
m_componentManager
protected static ComponentManager m_componentManager
A component manager - use the Spring based one.
-
CACHE_COMPONENTS
public static final boolean CACHE_COMPONENTS
If true, covers will cache the components they find once - good for production, bad for some unit testing.- See Also:
- Constant Field Values
-
SAKAI_COMPONENTS_ROOT_SYS_PROP
public static String SAKAI_COMPONENTS_ROOT_SYS_PROP
-
testingMode
public static boolean testingMode
Setup the CM in testingMode if this is true (this is to be used for unit tests only), has no effect if the CM is already initialized
-
-
Method Detail
-
isTestingMode
public static boolean isTestingMode()
- Returns:
- true if this CM is in testing mode
-
shutdown
public static void shutdown()
TESTING ONLY
closes and then destroys the component manager
WARNING: this is NOT safe to do in a production system
-
getInstance
public static ComponentManager getInstance()
Access the component manager of the single instance.- Returns:
- The ComponentManager.
-
get
public static <T> T get(Class<T> iface)
-
contains
public static boolean contains(Class iface)
-
contains
public static boolean contains(String ifaceName)
-
getRegisteredInterfaces
public static Set getRegisteredInterfaces()
-
close
public static void close()
-
getConfig
@Deprecated public static Properties getConfig()
Deprecated.This method is redundant, not used by any known client, would expose implementation details, and will be removed in a future release. Use the ServerConfigurationService instead.
-
waitTillConfigured
public static void waitTillConfigured()
When the component manager this can be called by a background thread to wait until the component manager has been configured. If the component manager hasn't yet started it will return straight away. If the component manager fails to start it will return. This is to prevent a deadlock between shutdown and startup.
-
hasBeenClosed
public static boolean hasBeenClosed()
-
setLateRefresh
public static void setLateRefresh(boolean b)
-
-