Class SpringCompMgr

    • Field Detail

      • CLOSE_ON_SHUTDOWN

        protected static final String CLOSE_ON_SHUTDOWN
        System property to control if we close on jvm shutdown (if set) or on the loss of our last child (if not set).
        See Also:
        Constant Field Values
      • SHUTDOWN_ON_ERROR

        protected static final String SHUTDOWN_ON_ERROR
        System property to control if we close the jvm on a error occurring at startup. This is useful to set in development so that it's clearer when the component manager failed to startup.
        See Also:
        Constant Field Values
      • CONFIGURATION_COMPONENT_PACKAGE

        protected static final String CONFIGURATION_COMPONENT_PACKAGE
        The Sakai configuration component package, which must be the last defined.
        See Also:
        Constant Field Values
      • CONFIGURATION_COMPONENTS

        protected static final String[] CONFIGURATION_COMPONENTS
        The Sakai configuration components, which must be the first loaded.
      • m_loadedComponents

        protected Set m_loadedComponents
        The already created components given to manage (their interface names).
      • m_childCount

        protected int m_childCount
        A count of the # of child AC's that call us parent.
      • m_hasBeenClosed

        protected boolean m_hasBeenClosed
        Records that close has been called.
      • lateRefresh

        protected boolean lateRefresh
    • Constructor Detail

      • SpringCompMgr

        public SpringCompMgr​(ComponentManager parent)
        Initialize.
        Parameters:
        parent - A ComponentManager in which this one gets nested, or NULL if this is this top one.
    • Method Detail

      • init

        public void init​(boolean lateRefresh)
        Initialize the component manager.
        Parameters:
        lateRefresh - If true then don't refresh the application context but leave it up to the caller, this is useful when running tests as it means you can change the application context before everything gets setup. In production systems it should be false.
      • getApplicationContext

        public org.springframework.context.ConfigurableApplicationContext getApplicationContext()
        Access the ApplicationContext
        Returns:
        the ApplicationContext
      • get

        public <T> T get​(Class<T> iface)
        Find a component that is registered to provide this interface.
        Specified by:
        get in interface ComponentManager
        Parameters:
        iface - The interface Class.
        Returns:
        a component instance, or null if not found.
      • get

        public Object get​(String ifaceName)
        Find a component that is registered to provide this interface.
        Specified by:
        get in interface ComponentManager
        Parameters:
        ifaceName - The fully qualified interface Class name.
        Returns:
        a component instance, or null if not found.
      • contains

        public boolean contains​(Class iface)
        Check if this interface Class has a registered component.
        Specified by:
        contains in interface ComponentManager
        Parameters:
        iface - The interface Class.
        Returns:
        true if this interface Class has a registered component, false if not.
      • contains

        public boolean contains​(String ifaceName)
        Check if this interface Class name has a registered component.
        Specified by:
        contains in interface ComponentManager
        Parameters:
        ifaceName - The fully qualified interface Class name.
        Returns:
        true if this interface has a registered component, false if not.
      • getRegisteredInterfaces

        public Set getRegisteredInterfaces()
        Get all interfaces registered in the component manager.
        Specified by:
        getRegisteredInterfaces in interface ComponentManager
        Returns:
        A Set (String class name) of all interfaces registered in the component manager.
      • close

        public void close()
        Close the component manager, shutting down any created singletons.
        Specified by:
        close in interface ComponentManager
      • loadComponent

        public void loadComponent​(Class iface,
                                  Object component)
        Load a singleton already created component for this interface class as a singleton.
        Specified by:
        loadComponent in interface ComponentManager
        Parameters:
        iface - The interface class.
        component - The alread created component.
      • loadComponent

        public void loadComponent​(String ifaceName,
                                  Object component)
        Load a singleton already created component for this interface class as a singleton.
        Specified by:
        loadComponent in interface ComponentManager
        Parameters:
        ifaceName - The fully qualified interface Class name.
        component - The alread created component.
      • loadComponents

        protected void loadComponents()
        Locate the component loader, and load any available components.
      • addChildAc

        public void addChildAc()
        Increment the count of ACs that call this one parent.
      • removeChildAc

        public void removeChildAc()
        Decrement the count of ACs that call this one parent.
      • getCatalina

        protected String getCatalina()
        Check the environment for catalina's base or home directory.
        Returns:
        Catalina's base or home directory.
      • hasBeenClosed

        public boolean hasBeenClosed()
        Description copied from interface: ComponentManager
        Check if the ComponentManager has already been or is in the processing of being closed.
        Specified by:
        hasBeenClosed in interface ComponentManager
        Returns:
        true if closed, false if not.