public class MockComponentManager extends Object implements ComponentManager
Constructor and Description |
---|
MockComponentManager() |
Modifier and Type | Method and Description |
---|---|
<T> void |
addComponent(String name,
T component) |
void |
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.
|
<T> Map<String,T> |
getComponentsOfType(Class<T> requiredType)
Returns the registered container components that match the given object type (including subclasses).
|
<T> Map<String,T> |
getComponentsOfType(Class<T> requiredType,
String... addonModuleNames)
Returns the registered container component that match the given object type (including subclasses) from a child context.
|
String[] |
getConfigurationResources()
Returns configuration resources for components assembly
|
ContainerConfiguration |
getContainerConfiguration()
Returns the container configuration
|
javax.servlet.ServletConfig |
getServletConfig()
Deprecated.
deprecated since since 3.2.0
|
javax.servlet.ServletContext |
getServletContext() |
void |
initialize()
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 assembly
|
void |
setServletConfig(javax.servlet.ServletConfig servletConfig)
Deprecated.
deprecated since since 3.2.0
|
void |
setServletContext(javax.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.
|
public void setConfigurationResources(String[] configurationResources)
ComponentManager
setConfigurationResources
in interface ComponentManager
public String[] getConfigurationResources()
ComponentManager
getConfigurationResources
in interface ComponentManager
@Deprecated public void setServletConfig(javax.servlet.ServletConfig servletConfig)
ComponentManager
setServletConfig
in interface ComponentManager
ComponentManager.setServletConfig(javax.servlet.ServletConfig)
@Deprecated public javax.servlet.ServletConfig getServletConfig()
ComponentManager
getServletConfig
in interface ComponentManager
ComponentManager.getServletConfig()
public void setServletContext(javax.servlet.ServletContext servletContext)
ComponentManager
setServletContext
in interface ComponentManager
public javax.servlet.ServletContext getServletContext()
getServletContext
in interface ComponentManager
public void initialize()
ComponentManager
initialize
in interface ComponentManager
public void start()
ComponentManager
start
in interface ComponentManager
public <T> T getComponent(String name)
ComponentManager
getComponent
in interface ComponentManager
T
- component typename
- the name of the componentpublic <T> T getComponent(Class<T> requiredType) throws ComponentsException
ComponentManager
ComponentsException
.getComponent
in interface ComponentManager
requiredType
- type the bean must match; can be an interface or superclass.ComponentsException
public <T> Map<String,T> getComponentsOfType(Class<T> requiredType)
ComponentManager
getComponentsOfType
in interface ComponentManager
T
- component typerequiredType
- the required type of the componentpublic <T> T getComponent(String name, String... addonModuleNames)
ComponentManager
addonModuleNames
consists of multiple items, then
each addonModuleNames
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.getComponent
in interface ComponentManager
public <T> T getComponent(Class<T> requiredType, String... addonModuleNames)
ComponentManager
ComponentsException
.
If addonModuleNames
consists of multiple items, then
each addonModuleNames
item is regarded as child addon module name
in the descendant hierarchy, as ordered.getComponent
in interface ComponentManager
requiredType
- type the bean must match; can be an interface or superclass.public <T> Map<String,T> getComponentsOfType(Class<T> requiredType, String... addonModuleNames)
ComponentManager
addonModuleNames
consists of multiple items, then
each addonModuleNames
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.getComponentsOfType
in interface ComponentManager
public void publishEvent(EventObject event)
ComponentManager
publishEvent
in interface ComponentManager
event
- the event to publish (may be an application-specific or built-in HST-2 event)public void registerEventSubscriber(Object subscriber)
ComponentManager
registerEventSubscriber
in interface ComponentManager
public void unregisterEventSubscriber(Object subscriber)
ComponentManager
unregisterEventSubscriber
in interface ComponentManager
public void stop()
ComponentManager
stop
in interface ComponentManager
public void close()
ComponentManager
close
in interface ComponentManager
public ContainerConfiguration getContainerConfiguration()
ComponentManager
getContainerConfiguration
in interface ComponentManager
public <T> void addComponent(String name, T component)
Copyright © 2008–2016 Hippo B.V. (http://www.onehippo.com). All rights reserved.