Package org.hippoecm.hst.core.container
Interface ComponentManager
public interface ComponentManager
ComponentManager interface.
This is responsible for initializing, starting, stopping and closing container components.
- Version:
- $Id$
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the component manager and all the components.<T> T
getComponent
(Class<T> requiredType) Returns the registered container component by the specified type if any.<T> T
getComponent
(Class<T> requiredType, String... addonModuleNames) Returns the registered component from a child context by the specified type.<T> T
getComponent
(String name) Returns the registered container component by name.<T> T
getComponent
(String name, String... addonModuleNames) Returns the registered component from a child context.getComponentsOfType
(Class<T> requiredType) Returns the registered container components that match the given object type (including subclasses).getComponentsOfType
(Class<T> requiredType, String... addonModuleNames) Returns the registered container component that match the given object type (including subclasses) from a child context.String[]
Returns configuration resources for components assemblyReturns the container configurationjakarta.servlet.ServletContext
void
Initializes the component manager and container components.void
publishEvent
(EventObject event) Publish the given event to all components which wants to listen to.void
registerEventSubscriber
(Object subscriber) Registers event subscriber object to receive events.void
setConfigurationResources
(String[] configurationResources) Sets configuration resources for components assemblyvoid
setServletContext
(jakarta.servlet.ServletContext servletContext) Set the ServletContext that this object runs in.void
start()
Starts the component manager to serve container components.void
stop()
Stop the component manager.void
unregisterEventSubscriber
(Object subscriber) Unregisters event subscriber object.
-
Method Details
-
setConfigurationResources
Sets configuration resources for components assembly- Parameters:
configurationResources
-
-
getConfigurationResources
String[] getConfigurationResources()Returns configuration resources for components assembly -
setServletContext
void setServletContext(jakarta.servlet.ServletContext servletContext) Set the ServletContext that this object runs in.- Parameters:
servletContext
-
-
getServletContext
jakarta.servlet.ServletContext getServletContext()- Returns:
- the ServletContext that this object runs in
-
initialize
void initialize()Initializes the component manager and container components. -
start
void start()Starts the component manager to serve container components. -
getComponent
Returns the registered container component by name. Returns null if a component is not found by the specified name.- Type Parameters:
T
- component type- Parameters:
name
- the name of the component- Returns:
- component
-
getComponent
Returns the registered container component by the specified type if any. Implementation may also look up a component by translating the specified type into a conventional FQCN string of the type if a component is not found by the specified type. Returns null if no component is found. If there is not exactly single matching component found by the specified type, then it throws aComponentsException
.- Parameters:
requiredType
- type the bean must match; can be an interface or superclass.- Returns:
- component matching the required type or null if not found by the specified type
- Throws:
ComponentsException
-
getComponentsOfType
Returns the registered container components that match the given object type (including subclasses). Returns empty map if a component is not found by the specified required type.- Type Parameters:
T
- component type- Parameters:
requiredType
- the required type of the component- Returns:
- component map
-
getComponent
Returns the registered component from a child context. IfaddonModuleNames
consists of multiple items, then eachaddonModuleNames
item is regarded as child addon module name in the descendant hierarchy, as ordered. Returns null if a component is not found by the specified name.- Type Parameters:
T
-- Parameters:
name
-addonModuleNames
-- Throws:
ModuleNotFoundException
- thrown when module is not found by the addonModuleNames
-
getComponent
Returns the registered component from a child context by the specified type. Implementation may also look up a component by translating the specified type into a conventional FQCN string of the type if a component is not found by the specified type. Returns null if no component is found. If there is not exactly single matching component found by the specified type, then it throws aComponentsException
. IfaddonModuleNames
consists of multiple items, then eachaddonModuleNames
item is regarded as child addon module name in the descendant hierarchy, as ordered.- Parameters:
requiredType
- type the bean must match; can be an interface or superclass.addonModuleNames
-- Returns:
- component matching the required type or null if not found by the specified type
- Throws:
ComponentsException
-
getComponentsOfType
Returns the registered container component that match the given object type (including subclasses) from a child context. Returns empty map if a component is not found from a child context by the specified required type. IfaddonModuleNames
consists of multiple items, then eachaddonModuleNames
item is regarded as child addon module name in the descendant hierarchy, as ordered. Returns empty map if a component is not found by the specified type.- Type Parameters:
T
-- Parameters:
requiredType
-addonModuleNames
-- Returns:
- component map
- Throws:
ModuleNotFoundException
- thrown when module is not found by the addonModuleNames
-
publishEvent
Publish the given event to all components which wants to listen to.- Parameters:
event
- the event to publish (may be an application-specific or built-in HST-2 event)
-
registerEventSubscriber
Registers event subscriber object to receive events.- Parameters:
subscriber
-
-
unregisterEventSubscriber
Unregisters event subscriber object.- Parameters:
subscriber
-
-
stop
void stop()Stop the component manager. -
close
void close()Closes the component manager and all the components. -
getContainerConfiguration
ContainerConfiguration getContainerConfiguration()Returns the container configuration- Returns:
- the container configuration
-