org.apache.fulcrum.yaafi.framework.container
Class ServiceContainerImpl

java.lang.Object
  extended by 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

public class ServiceContainerImpl
extends java.lang.Object
implements ServiceContainer, ServiceConstants

Yet another avalon framework implementation (YAAFI).

Author:
Siegfried Goeschl

Field Summary
 
Fields 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, DYNAMICPROXY_ENABLED_KEY, INTERCEPTOR_KEY, INTERCEPTOR_LIST_KEY, RECONFIGURATION_DELAY_KEY, ROLE_NAME
 
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_TEMP, URN_YAAFI_KERNELLOCK
 
Constructor Summary
ServiceContainerImpl()
          Constructor using sensible defaults.
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void contextualize(org.apache.avalon.framework.context.Context context)
           
 void decommision(java.lang.String name)
          Decommision the given service by calling Startable.stop() and Disposable.dispose().
 void dispose()
          Disposes the service container implementation.
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
           
 org.apache.avalon.framework.parameters.Parameters getParameters()
          Return the Avalon parameters loaded by the Avalon service container
 RoleEntry[] getRoleEntries()
          Get a list of all RoleEntries.
 RoleEntry getRoleEntry(java.lang.String name)
          Get a RoleEntryImpl for a given service
 boolean hasService(java.lang.String name)
           
 void initialize()
           
 java.lang.Object lookup(java.lang.String name)
           
 void parameterize(org.apache.avalon.framework.parameters.Parameters parameters)
           
 void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration)
          Reconfiguring the services.
 void reconfigure(java.lang.String[] names)
          Reconfigures a set of services by calling Suspendable.suspend(), Reconfigurable.reconfigure() and Suspendable.resume().
 void release(java.lang.Object object)
           
 void service(org.apache.avalon.framework.service.ServiceManager serviceManager)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceContainerImpl

public ServiceContainerImpl()
Constructor using sensible defaults.

Method Detail

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled
See Also:
LogEnabled.enableLogging(org.apache.avalon.framework.logger.Logger)

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Throws:
org.apache.avalon.framework.context.ContextException
See Also:
Contextualizable.contextualize(org.apache.avalon.framework.context.Context)

service

public void service(org.apache.avalon.framework.service.ServiceManager serviceManager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

parameterize

public void parameterize(org.apache.avalon.framework.parameters.Parameters parameters)
                  throws org.apache.avalon.framework.parameters.ParameterException
Specified by:
parameterize in interface org.apache.avalon.framework.parameters.Parameterizable
Throws:
org.apache.avalon.framework.parameters.ParameterException
See Also:
Parameterizable.parameterize(org.apache.avalon.framework.parameters.Parameters)

initialize

public void initialize()
                throws java.lang.Exception
Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception
See Also:
Initializable.initialize()

dispose

public void dispose()
Disposes the service container implementation.

Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
See Also:
Disposable.dispose()

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:
reconfigure in interface org.apache.avalon.framework.configuration.Reconfigurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Reconfigurable.reconfigure(org.apache.avalon.framework.configuration.Configuration)

getRoleEntry

public RoleEntry getRoleEntry(java.lang.String name)
                       throws org.apache.avalon.framework.service.ServiceException
Description copied from interface: ServiceLifecycleManager
Get a RoleEntryImpl for a given service

Specified by:
getRoleEntry in interface ServiceLifecycleManager
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:
ServiceLifecycleManager.getRoleEntry(java.lang.String)

getRoleEntries

public RoleEntry[] getRoleEntries()
Description copied from interface: ServiceLifecycleManager
Get a list of all RoleEntries.

Specified by:
getRoleEntries in interface ServiceLifecycleManager
Returns:
a list of RoleEntries
See Also:
ServiceLifecycleManager.getRoleEntries()

reconfigure

public void reconfigure(java.lang.String[] names)
                 throws org.apache.avalon.framework.service.ServiceException,
                        org.apache.avalon.framework.configuration.ConfigurationException
Description copied from interface: ServiceLifecycleManager
Reconfigures a set of services by calling Suspendable.suspend(), Reconfigurable.reconfigure() and Suspendable.resume().

Specified by:
reconfigure in interface ServiceLifecycleManager
Parameters:
names - the set of services to be reconfigured
Throws:
org.apache.avalon.framework.service.ServiceException - one of the service was not found
org.apache.avalon.framework.configuration.ConfigurationException - the reconfiguration failed
See Also:
ServiceLifecycleManager.reconfigure(java.lang.String[])

hasService

public boolean hasService(java.lang.String name)
Specified by:
hasService in interface org.apache.avalon.framework.service.ServiceManager
See Also:
ServiceManager.hasService(java.lang.String)

lookup

public java.lang.Object lookup(java.lang.String name)
                        throws org.apache.avalon.framework.service.ServiceException
Specified by:
lookup in interface org.apache.avalon.framework.service.ServiceManager
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
ServiceManager.lookup(java.lang.String)

release

public void release(java.lang.Object object)
Specified by:
release in interface org.apache.avalon.framework.service.ServiceManager
See Also:
ServiceManager.release(java.lang.Object)

decommision

public void decommision(java.lang.String name)
                 throws org.apache.avalon.framework.service.ServiceException
Description copied from interface: ServiceLifecycleManager
Decommision 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:
decommision in interface ServiceLifecycleManager
Parameters:
name - the name of the service
Throws:
org.apache.avalon.framework.service.ServiceException - the service was not found
See Also:
ServiceLifecycleManager.decommision(java.lang.String)

getParameters

public org.apache.avalon.framework.parameters.Parameters getParameters()
Description copied from interface: ServiceContainer
Return the Avalon parameters loaded by the Avalon service container

Specified by:
getParameters in interface ServiceContainer
Returns:
the Avalon paramters
See Also:
ServiceContainer.getParameters()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.