T - The type of handled extensionspublic class ThreadSafeComponentManager<T> extends AbstractLogEnabled implements Contextualizable, Initializable, Disposable, Serviceable
| Modifier and Type | Class and Description |
|---|---|
(package private) class |
ThreadSafeComponentManager.ComponentFactory |
| Modifier and Type | Field and Description |
|---|---|
private Map<String,ThreadSafeComponentManager.ComponentFactory> |
_componentFactories
Used to map roles to ComponentFactories
|
private Map<String,T> |
_components |
(package private) Map<String,T> |
_componentsInitializing |
(package private) Context |
_context
The application context for components
|
private boolean |
_disposed
Is the Manager disposed or not?
|
private boolean |
_initialized
Is the Manager initialized?
|
protected ServiceManager |
_manager
The Cocoon ServiceManager
|
| Constructor and Description |
|---|
ThreadSafeComponentManager() |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
_addComponent(String role,
ThreadSafeComponentManager.ComponentFactory factory) |
void |
addComponent(String pluginName,
String featureName,
String role,
Class<? extends T> component,
Configuration configuration)
Add a new component to the manager.
|
void |
contextualize(Context context)
Set up the Component Context.
|
void |
dispose()
Properly dispose of the Child handlers.
|
(package private) ThreadSafeComponentManager.ComponentFactory |
getComponentFactory(String pluginName,
String featureName,
String role,
Class<? extends T> componentClass,
Configuration configuration) |
boolean |
hasComponent(T component)
Tests for existence of a component.
|
boolean |
hasRole(String role)
Tests for existence of a component for a given role.
|
void |
initialize()
Properly initialize of the Child handlers.
|
T |
lookup(String role)
Return an instance of a component based on a Role.
|
void |
service(ServiceManager manager) |
getLogger, setLoggerprotected ServiceManager _manager
Map<String,T> _componentsInitializing
private Map<String,T> _components
private Map<String,ThreadSafeComponentManager.ComponentFactory> _componentFactories
private boolean _disposed
private boolean _initialized
public ThreadSafeComponentManager()
public void service(ServiceManager manager)
service in interface Serviceablepublic void contextualize(Context context)
contextualize in interface Contextualizablepublic T lookup(String role) throws ComponentException
role - The key name of the Component to retrieve.ComponentException - if an error occurspublic boolean hasRole(String role)
role - a string identifying the key to check.public boolean hasComponent(T component)
component - to component to checkpublic void initialize() throws Exception
initialize in interface InitializableExceptionpublic void dispose()
dispose in interface Disposablepublic void addComponent(String pluginName, String featureName, String role, Class<? extends T> component, Configuration configuration)
pluginName - the plugin containing the componentfeatureName - the feature containing the componentrole - the role name for the new component.component - the class of this component.configuration - the configuration for this component.void _addComponent(String role, ThreadSafeComponentManager.ComponentFactory factory)
ThreadSafeComponentManager.ComponentFactory getComponentFactory(String pluginName, String featureName, String role, Class<? extends T> componentClass, Configuration configuration)