Class AbstractLifecycleManager

  • All Implemented Interfaces:
    com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
    Direct Known Subclasses:
    GenericLifecycleManager

    public abstract class AbstractLifecycleManager
    extends java.lang.Object
    implements com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
    The life cycle managers task is to perform all life cycle operations of JEAF. Since these actions depend very much on the environment (like EJB Containers, EJB Client Container or pure J2SE environments) implementations for each environment have to be implemented. Which concrete implementation will be used can be configured in the JEAF properties.
    Version:
    1.0
    Author:
    JEAF Development Team
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractLifecycleManager()
      Initialize object.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void addLifecycleListener​(com.anaptecs.jeaf.core.servicechannel.api.LifecycleListener pLifecycleListener)
      Method adds the passed object to the list of life cycle listeners.
      com.anaptecs.jeaf.core.api.Context getContext()
      Method returns a representation of the context.
      com.anaptecs.jeaf.core.servicechannel.api.ContextManager getContextManager()
      Method returns the context manager that is configured.
      void initialize()
      Method triggers the initialization of all parts of JEAF and the components and services based on the JEAF Framework.
      void injectDependencies​(java.lang.Object pObject)
      Method injects all dependencies to JEAF services and service providers to the passed object.
      boolean isInitalized()
      Method checks whether this instance of a life cycle manager has already been initialized.
      protected abstract void performShutdown()
      Method is called on JEAF's shutdown in order to provide a shutdown hook for specific life cycle manager implementations.
      protected abstract void performStartup()
      Method is called on JEAF's initialization in order to load required components and service.
      void shutdown()
      Method triggers the shutdown of all parts of JEAF and the components and services based on the JEAF Framework.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager

        checkService, checkServiceProvider, getActivityRegistry, getComponent, getComponents, getServiceChannel, getServiceProviderRegistry, getServiceProviders, getServiceRegistry, getServices, supportsScheduling
    • Constructor Detail

      • AbstractLifecycleManager

        protected AbstractLifecycleManager()
        Initialize object. Thereby the object will be set its initial state NOT_STARTED.
    • Method Detail

      • addLifecycleListener

        public final void addLifecycleListener​(com.anaptecs.jeaf.core.servicechannel.api.LifecycleListener pLifecycleListener)
        Method adds the passed object to the list of life cycle listeners. The objects will be informed about JEAF's life cycle events. This will only happen if the passed object implements the interface LifecycleListener. This method is intended for internal usage only. For this reason any object can be passed to this method. Whenever the passed object implements the interface LifecycleManager it will be registered as listener.
        Specified by:
        addLifecycleListener in interface com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
        Parameters:
        pLifecycleListener - Object that should be added as life cycle listener. The parameter must not be null.
      • initialize

        public final void initialize()
        Method triggers the initialization of all parts of JEAF and the components and services based on the JEAF Framework. The method must not be called if this object is not in state NOT_INITIALIZED.
        Specified by:
        initialize in interface com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
      • isInitalized

        public final boolean isInitalized()
        Method checks whether this instance of a life cycle manager has already been initialized.
        Specified by:
        isInitalized in interface com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
        Returns:
        boolean The method returns true if the life cycle manager already has been initialized or false in all other cases.
      • shutdown

        public final void shutdown()
        Method triggers the shutdown of all parts of JEAF and the components and services based on the JEAF Framework. The method must not be called of this object is not in state INITIALIZED.
        Specified by:
        shutdown in interface com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
      • getContext

        public com.anaptecs.jeaf.core.api.Context getContext()
        Method returns a representation of the context. The context object can be used to access the different types of contexts.
        Specified by:
        getContext in interface com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
        Returns:
        Context representation of the context. The method never returns null.
      • getContextManager

        public com.anaptecs.jeaf.core.servicechannel.api.ContextManager getContextManager()
        Method returns the context manager that is configured.
        Specified by:
        getContextManager in interface com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
        Returns:
        ContextManager Current context manager. The method never returns null.
      • injectDependencies

        public void injectDependencies​(java.lang.Object pObject)
        Method injects all dependencies to JEAF services and service providers to the passed object. Therefore the method checks all fields of the class and all of its parents classes for annotated fields that declare a dependency to a JEAF Service or Service Provider. The method must not be called from inside of service or service provider implementations as this may lead to problems during bootstrapping. For these classes the dependency injection will be done automatically.
        Specified by:
        injectDependencies in interface com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
        Parameters:
        pObject - Object on which the dependencies should be injected. The parameter must not be null and the passed object will be modified.
      • performStartup

        protected abstract void performStartup()
        Method is called on JEAF's initialization in order to load required components and service. Which actions have to be performed depends on the concrete environment.
      • performShutdown

        protected abstract void performShutdown()
        Method is called on JEAF's shutdown in order to provide a shutdown hook for specific life cycle manager implementations. Which actions are performed by this method depends on the concrete environment for which the life cycle manager implementation is designed.