Class ServiceContainerImpl
java.lang.Object
org.apache.fulcrum.yaafi.framework.container.ServiceContainerImpl
- All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable,org.apache.avalon.framework.activity.Initializable,org.apache.avalon.framework.configuration.Configurable,org.apache.avalon.framework.configuration.Reconfigurable,org.apache.avalon.framework.context.Contextualizable,org.apache.avalon.framework.logger.LogEnabled,org.apache.avalon.framework.parameters.Parameterizable,org.apache.avalon.framework.service.Serviceable,org.apache.avalon.framework.service.ServiceManager,AvalonYaafiConstants,ServiceConstants,ServiceContainer,ServiceLifecycleManager
Yet another avalon framework implementation (YAAFI).
- Author:
- Siegfried Goeschl
-
Field Summary
Fields inherited from interface org.apache.fulcrum.yaafi.framework.constant.AvalonYaafiConstants
AVALON_CONTAINER_YAAFI, COMPONENT_APP_ROOT, URN_AVALON_CLASSLOADER, URN_AVALON_HOME, URN_AVALON_NAME, URN_AVALON_PARTITION, URN_AVALON_TEMPFields inherited from interface org.apache.fulcrum.yaafi.framework.container.ServiceConstants
CLAZZ_NAME, COMPONENT_CONFIG_KEY, COMPONENT_CONFIG_PROPERTIES_KEY, COMPONENT_CONFIG_VALUE, COMPONENT_CONTAINERFLAVOUR_VALUE, COMPONENT_ISENCRYPTED_KEY, COMPONENT_LOCATION_KEY, COMPONENT_PARAMETERS_KEY, COMPONENT_PARAMETERS_VALUE, COMPONENT_ROLE_KEYS, COMPONENT_ROLE_VALUE, COMPONENT_ROLECONFIGFLAVOUR_VALUE, CONTAINERCLAZZNAME_CONFIG_KEY, CONTAINERFLAVOUR_CONFIG_KEY, DISPOSAL_DELAY_KEY, DYNAMICPROXY_ENABLED_KEY, INTERCEPTOR_KEY, INTERCEPTOR_LIST_KEY, RECONFIGURATION_DELAY_KEY, ROLE_NAME, SERVICEMANAGER_KEY, SERVICEMANAGER_LIST_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(org.apache.avalon.framework.configuration.Configuration configuration) voidcontextualize(org.apache.avalon.framework.context.Context context) voiddecommission(String name) Decommision the given service by calling Startable.stop() and Disposable.dispose().voiddispose()Disposes the service container implementation.voidenableLogging(org.apache.avalon.framework.logger.Logger logger) org.apache.avalon.framework.parameters.ParametersReturn the Avalon parameters loaded by the Avalon service containerGet a list of all RoleEntries.getRoleEntry(String name) Get a RoleEntryImpl for a given servicebooleanhasService(String name) voidLookup a service instance.voidparameterize(org.apache.avalon.framework.parameters.Parameters parameters) voidreconfigure(String[] names) Reconfigures a set of services by calling Suspendable.suspend(), Reconfigurable.reconfigure() and Suspendable.resume().voidreconfigure(org.apache.avalon.framework.configuration.Configuration configuration) Reconfiguring the services.voidvoidservice(org.apache.avalon.framework.service.ServiceManager serviceManager) toString()
-
Constructor Details
-
ServiceContainerImpl
public ServiceContainerImpl()Constructor using sensible defaults.
-
-
Method Details
-
enableLogging
public void enableLogging(org.apache.avalon.framework.logger.Logger logger) - Specified by:
enableLoggingin interfaceorg.apache.avalon.framework.logger.LogEnabled- See Also:
-
contextualize
public void contextualize(org.apache.avalon.framework.context.Context context) throws org.apache.avalon.framework.context.ContextException - Specified by:
contextualizein interfaceorg.apache.avalon.framework.context.Contextualizable- Throws:
org.apache.avalon.framework.context.ContextException- See Also:
-
service
public void service(org.apache.avalon.framework.service.ServiceManager serviceManager) throws org.apache.avalon.framework.service.ServiceException - Specified by:
servicein interfaceorg.apache.avalon.framework.service.Serviceable- Throws:
org.apache.avalon.framework.service.ServiceException- See Also:
-
configure
public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException - Specified by:
configurein interfaceorg.apache.avalon.framework.configuration.Configurable- Throws:
org.apache.avalon.framework.configuration.ConfigurationException- See Also:
-
parameterize
public void parameterize(org.apache.avalon.framework.parameters.Parameters parameters) throws org.apache.avalon.framework.parameters.ParameterException - Specified by:
parameterizein interfaceorg.apache.avalon.framework.parameters.Parameterizable- Throws:
org.apache.avalon.framework.parameters.ParameterException- See Also:
-
initialize
- Specified by:
initializein interfaceorg.apache.avalon.framework.activity.Initializable- Throws:
Exception- See Also:
-
dispose
public void dispose()Disposes the service container implementation.- Specified by:
disposein interfaceorg.apache.avalon.framework.activity.Disposable- See Also:
-
reconfigure
public void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException Reconfiguring the services. I'm not sure how to implement this properly since the Avalon docs is vague on this subject. For now we suspend, reconfigure and resume the services in the correct order.- Specified by:
reconfigurein interfaceorg.apache.avalon.framework.configuration.Reconfigurable- Throws:
org.apache.avalon.framework.configuration.ConfigurationException- See Also:
-
getRoleEntry
public RoleEntry getRoleEntry(String name) throws org.apache.avalon.framework.service.ServiceException Description copied from interface:ServiceLifecycleManagerGet a RoleEntryImpl for a given service- Specified by:
getRoleEntryin interfaceServiceLifecycleManager- Parameters:
name- the name of the service component- Returns:
- the RoleEntryImpl
- Throws:
org.apache.avalon.framework.service.ServiceException- the service was not found- See Also:
-
getRoleEntries
Description copied from interface:ServiceLifecycleManagerGet a list of all RoleEntries.- Specified by:
getRoleEntriesin interfaceServiceLifecycleManager- Returns:
- a list of RoleEntries
- See Also:
-
reconfigure
public void reconfigure(String[] names) throws org.apache.avalon.framework.service.ServiceException, org.apache.avalon.framework.configuration.ConfigurationException Description copied from interface:ServiceLifecycleManagerReconfigures a set of services by calling Suspendable.suspend(), Reconfigurable.reconfigure() and Suspendable.resume().- Specified by:
reconfigurein interfaceServiceLifecycleManager- Parameters:
names- the set of services to be reconfigured- Throws:
org.apache.avalon.framework.service.ServiceException- one of the service was not foundorg.apache.avalon.framework.configuration.ConfigurationException- the reconfiguration failed- See Also:
-
hasService
- Specified by:
hasServicein interfaceorg.apache.avalon.framework.service.ServiceManager- See Also:
-
lookup
Lookup a service instance. The implementation uses the following mechanism- look for a matching local service
- use the fallback service manager as they might know the service
- ask the parent service manager
- Specified by:
lookupin interfaceorg.apache.avalon.framework.service.ServiceManager- Throws:
org.apache.avalon.framework.service.ServiceException- See Also:
-
release
- Specified by:
releasein interfaceorg.apache.avalon.framework.service.ServiceManager
-
decommission
Description copied from interface:ServiceLifecycleManagerDecommision the given service by calling Startable.stop() and Disposable.dispose(). The state of the service component is the same as using lazy initialization. Therefore a new service instance will be created if the service is reused again. If you are keeping an instance of the service you are out of luck.- Specified by:
decommissionin interfaceServiceLifecycleManager- Parameters:
name- the name of the service- Throws:
org.apache.avalon.framework.service.ServiceException- the service was not found- See Also:
-
getParameters
public org.apache.avalon.framework.parameters.Parameters getParameters()Description copied from interface:ServiceContainerReturn the Avalon parameters loaded by the Avalon service container- Specified by:
getParametersin interfaceServiceContainer- Returns:
- the Avalon parameters
- See Also:
-
toString
-