Class GenericLifecycleManager
- java.lang.Object
-
- com.anaptecs.jeaf.core.servicechannel.base.AbstractLifecycleManager
-
- com.anaptecs.jeaf.core.servicechannel.base.GenericLifecycleManager
-
- All Implemented Interfaces:
com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager
- Direct Known Subclasses:
LocalLifecycleManagerImpl
public abstract class GenericLifecycleManager extends AbstractLifecycleManager
This class implements a JEAF life cycle manager. This implementation does not contain any environment specific operations and therefore can be a base class for all life cycle manager implementations. During initialization all components and services will be created / loaded.- Version:
- 1.0
- Author:
- JEAF Development Team
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COMPONENT_FACTORIES_FILE
Constant for the name of the property file that contains the names of the component factories.static java.lang.String
COMPONENT_FACTORY_CLASS_NAMES
Constant for the property that contains the names of all component factories that should be created.
-
Constructor Summary
Constructors Constructor Description GenericLifecycleManager()
Initialize object.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description com.anaptecs.jeaf.xfun.api.health.HealthCheckResult
checkService(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pService, com.anaptecs.jeaf.xfun.api.health.CheckLevel pCheckLevel)
Method checks the current state of the service implementation that provides the passed service interface.com.anaptecs.jeaf.xfun.api.health.HealthCheckResult
checkServiceProvider(java.lang.Class<? extends com.anaptecs.jeaf.core.api.ServiceProvider> pServiceProviderClass, com.anaptecs.jeaf.xfun.api.health.CheckLevel pCheckLevel)
Method checks the current state of the service provider implementation that provides the passed service provider interface.protected abstract com.anaptecs.jeaf.core.servicechannel.api.ServiceChannel
createServiceChannel()
Method creates a new instance of the service channel that should be used in the specific runtime environment for which a concrete life cycle manager implementation is designed for.void
fireTriggers()
Method notifies all registered triggers that a trigger interval completed.com.anaptecs.jeaf.core.servicechannel.api.ActivityRegistry
getActivityRegistry()
Method has to return a fully initialized activity registry for this environment.com.anaptecs.jeaf.core.spi.ComponentImplementation
getComponent(com.anaptecs.jeaf.core.spi.ServiceImplementation pService)
Method returns the component to which the passed service implementation belongs to.java.util.Collection<com.anaptecs.jeaf.core.api.Component>
getComponents()
Method returns all components that were loaded by this life cycle manager.com.anaptecs.jeaf.core.servicechannel.api.ServiceChannel
getServiceChannel()
Method returns the service channel implementation that is used in the context of this lifecycle manager implementation.com.anaptecs.jeaf.core.servicechannel.api.ServiceProviderRegistry
getServiceProviderRegistry()
Method has to return a fully initialized service provider registry for this environment.java.util.Collection<java.lang.Class<? extends com.anaptecs.jeaf.core.api.ServiceProvider>>
getServiceProviders()
Method returns the class objects of all service providers that were loaded by this life cycle manager.com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry
getServiceRegistry()
Method returns the service registry that was created during the initialization of JEAF.java.util.Collection<java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service>>
getServices()
Method returns the class objects of all services that were loaded by this life cycle manager.int
getTriggerInterval()
Method returns the currently defined trigger interval.protected abstract javax.transaction.UserTransaction
getUserTransaction()
Method returns a UserTransaction object that can be used by the life cycle manager for internal use.void
performShutdown()
Method implements the shutdown of the JEAF core.void
performStartup()
Method implements the startup of the JEAF core.boolean
supportsScheduling()
Method checks if this lifecycle manager implementation supports scheduling.-
Methods inherited from class com.anaptecs.jeaf.core.servicechannel.base.AbstractLifecycleManager
addLifecycleListener, getContext, getContextManager, initialize, injectDependencies, isInitalized, shutdown
-
-
-
-
Field Detail
-
COMPONENT_FACTORIES_FILE
public static final java.lang.String COMPONENT_FACTORIES_FILE
Constant for the name of the property file that contains the names of the component factories.- See Also:
- Constant Field Values
-
COMPONENT_FACTORY_CLASS_NAMES
public static final java.lang.String COMPONENT_FACTORY_CLASS_NAMES
Constant for the property that contains the names of all component factories that should be created.- See Also:
- Constant Field Values
-
-
Method Detail
-
createServiceChannel
protected abstract com.anaptecs.jeaf.core.servicechannel.api.ServiceChannel createServiceChannel()
Method creates a new instance of the service channel that should be used in the specific runtime environment for which a concrete life cycle manager implementation is designed for.- Returns:
- ServiceChannel Service channel implementation that should be used in this specific environment. The method must not return null.
-
getUserTransaction
protected abstract javax.transaction.UserTransaction getUserTransaction() throws javax.naming.NamingException
Method returns a UserTransaction object that can be used by the life cycle manager for internal use.- Returns:
UserTransaction
UserTransaction that can be used by the life cycle manager. The method must not return null.- Throws:
javax.naming.NamingException
- If the JNDI lookup for the UserTransaction object fails.
-
supportsScheduling
public final boolean supportsScheduling()
Method checks if this lifecycle manager implementation supports scheduling. As all implementations based on this lifecycle manager base class support scheduling the method always returns true.- Returns:
- boolean Method returns always returns true.
-
getTriggerInterval
public final int getTriggerInterval()
Method returns the currently defined trigger interval.- Returns:
- int Currently defined trigger interval in seconds.
-
fireTriggers
public final void fireTriggers()
Method notifies all registered triggers that a trigger interval completed.
-
getComponent
public com.anaptecs.jeaf.core.spi.ComponentImplementation getComponent(com.anaptecs.jeaf.core.spi.ServiceImplementation pService)
Method returns the component to which the passed service implementation belongs to.- Parameters:
pService
- Service implementation to which the providing component should be returned. The parameter must not be null.- Returns:
ComponentImplementation
Component that provides the passed service implementation. The method never returns null.
-
getComponents
public final java.util.Collection<com.anaptecs.jeaf.core.api.Component> getComponents()
Method returns all components that were loaded by this life cycle manager.- Returns:
- Collection All loaded components. The method never returns null and the collection can not be edited.
-
getServiceRegistry
public final com.anaptecs.jeaf.core.servicechannel.api.ServiceRegistry getServiceRegistry()
Method returns the service registry that was created during the initialization of JEAF.- Returns:
- ServiceRegistry Service registry object that was created during the initialization method
initialize()
. The method never returns null. - See Also:
LifecycleManager.initialize()
,LifecycleManager.getServiceRegistry()
-
getServiceProviderRegistry
public final com.anaptecs.jeaf.core.servicechannel.api.ServiceProviderRegistry getServiceProviderRegistry()
Method has to return a fully initialized service provider registry for this environment. The method will be called only after initialization (AbstractLifecycleManager.initialize()
. There is no matter if the service registry is created within this method or before.- Returns:
ServiceProviderRegistry
Service provider registry that will be used in this environment. The method must not return null.
-
getActivityRegistry
public final com.anaptecs.jeaf.core.servicechannel.api.ActivityRegistry getActivityRegistry()
Method has to return a fully initialized activity registry for this environment. The method will be called only after initialization (AbstractLifecycleManager.initialize()
. There is no matter if the service registry is created within this method or before.- Returns:
ActivityRegistry
Activity registry that will be used in this environment. The method must not return null.
-
getServiceChannel
public final com.anaptecs.jeaf.core.servicechannel.api.ServiceChannel getServiceChannel()
Method returns the service channel implementation that is used in the context of this lifecycle manager implementation.- Returns:
- ServiceChannel Service channel instance for this environment. The method never return null.
- See Also:
LifecycleManager.getServiceChannel()
-
getServices
public final java.util.Collection<java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service>> getServices()
Method returns the class objects of all services that were loaded by this life cycle manager.- Returns:
Collection
Class objects of all loaded services. The method never returns null and the collection can not be edited.
-
getServiceProviders
public final java.util.Collection<java.lang.Class<? extends com.anaptecs.jeaf.core.api.ServiceProvider>> getServiceProviders()
Method returns the class objects of all service providers that were loaded by this life cycle manager.- Returns:
Collection
Class objects of all loaded service providers. The method never returns null and the collection can not be edited.
-
checkService
public final com.anaptecs.jeaf.xfun.api.health.HealthCheckResult checkService(java.lang.Class<? extends com.anaptecs.jeaf.core.api.Service> pService, com.anaptecs.jeaf.xfun.api.health.CheckLevel pCheckLevel)
Method checks the current state of the service implementation that provides the passed service interface.- Parameters:
pService
- Service whose state should be checked. The parameter must not be null.pCheckLevel
- Level of check that should be performed. The parameter must not be null.- Returns:
CheckResult
Object describing the result of the check. The method may return null. This means that the service does not implement any checks.
-
checkServiceProvider
public final com.anaptecs.jeaf.xfun.api.health.HealthCheckResult checkServiceProvider(java.lang.Class<? extends com.anaptecs.jeaf.core.api.ServiceProvider> pServiceProviderClass, com.anaptecs.jeaf.xfun.api.health.CheckLevel pCheckLevel)
Method checks the current state of the service provider implementation that provides the passed service provider interface.- Parameters:
pServiceProviderClass
- Service Provider whose state should be checked. The parameter must not be null.pCheckLevel
- Level of check that should be performed. The parameter must not be null.- Returns:
HealthCheckResult
Object describing the result of the check. The method may return null. This means that the service provider does not implement any checks.
-
performStartup
public void performStartup()
Method implements the startup of the JEAF core. Within the method the following steps are performed in the following order:- Create component factories
- Create components
- Create all service instances and proxies using the components service factories
- Create all activity instances
- Inject dependencies on all service and activity instances
- Specified by:
performStartup
in classAbstractLifecycleManager
- See Also:
com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager#performStartup()
-
performShutdown
public void performShutdown()
Method implements the shutdown of the JEAF core.- Specified by:
performShutdown
in classAbstractLifecycleManager
- See Also:
com.anaptecs.jeaf.core.servicechannel.api.LifecycleManager#performShutdown()
-
-