Interface ComponentManager


public interface ComponentManager
ComponentManager interface. This is responsible for initializing, starting, stopping and closing container components.
Version:
$Id$
  • Method Details

    • setConfigurationResources

      void setConfigurationResources(String[] configurationResources)
      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

      <T> T getComponent(String name)
      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

      <T> T getComponent(Class<T> requiredType) throws ComponentsException
      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 a ComponentsException.
      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

      <T> Map<String,T> getComponentsOfType(Class<T> requiredType)
      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

      <T> T getComponent(String name, String... addonModuleNames)
      Returns the registered component from a child context. If 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.
      Type Parameters:
      T -
      Parameters:
      name -
      addonModuleNames -
      Throws:
      ModuleNotFoundException - thrown when module is not found by the addonModuleNames
    • getComponent

      <T> T getComponent(Class<T> requiredType, String... addonModuleNames) throws ComponentsException
      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 a ComponentsException. If addonModuleNames consists of multiple items, then each addonModuleNames 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

      <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. Returns empty map if a component is not found from a child context by the specified required type. If 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.
      Type Parameters:
      T -
      Parameters:
      requiredType -
      addonModuleNames -
      Returns:
      component map
      Throws:
      ModuleNotFoundException - thrown when module is not found by the addonModuleNames
    • publishEvent

      void publishEvent(EventObject event)
      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

      void registerEventSubscriber(Object subscriber)
      Registers event subscriber object to receive events.
      Parameters:
      subscriber -
    • unregisterEventSubscriber

      void unregisterEventSubscriber(Object subscriber)
      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