org.apache.fulcrum.servicemanager
Class ServiceManagerServiceImpl

java.lang.Object
  extended byorg.apache.fulcrum.servicemanager.ServiceManagerServiceImpl
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.parameters.Parameterizable, org.apache.avalon.framework.configuration.Reconfigurable, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.service.ServiceManager, ServiceManagerService

public class ServiceManagerServiceImpl
extends Object
implements ServiceManagerService, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.configuration.Reconfigurable, org.apache.avalon.framework.parameters.Parameterizable, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.activity.Disposable

This is a sort of "edelhack" to solve the problem of accessing the Avalon infrastructure without having an instance of the container. The implementation stores the very first instance of itself in a static variable which can be accessed using getInstance(). This allows access to the various Avalon artifacts.

Author:
Siegfried Goeschl

Constructor Summary
ServiceManagerServiceImpl()
          Constructor
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void contextualize(org.apache.avalon.framework.context.Context context)
           
 void dispose()
           
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
           
 org.apache.avalon.framework.configuration.Configuration getConfiguration()
           
 org.apache.avalon.framework.context.Context getContext()
           
static ServiceManagerService getInstance()
           
 org.apache.avalon.framework.logger.Logger getLogger()
           
 org.apache.avalon.framework.parameters.Parameters getParameters()
           
 org.apache.avalon.framework.service.ServiceManager getServiceManager()
           
 boolean hasService(String name)
           
 Object lookup(String name)
           
 void parameterize(org.apache.avalon.framework.parameters.Parameters parameters)
           
 void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void release(Object object)
           
 void service(org.apache.avalon.framework.service.ServiceManager serviceManager)
           
protected static void setInstance(ServiceManagerServiceImpl instance)
          Create the one and only instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceManagerServiceImpl

public ServiceManagerServiceImpl()
Constructor

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)

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)

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)

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)

reconfigure

public void reconfigure(org.apache.avalon.framework.configuration.Configuration configuration)
                 throws org.apache.avalon.framework.configuration.ConfigurationException
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)

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)

dispose

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

hasService

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

lookup

public Object lookup(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(Object object)
Specified by:
release in interface org.apache.avalon.framework.service.ServiceManager
See Also:
ServiceManager.release(java.lang.Object)

getServiceManager

public org.apache.avalon.framework.service.ServiceManager getServiceManager()
Specified by:
getServiceManager in interface ServiceManagerService
Returns:
the ServiceManager for the container

getParameters

public org.apache.avalon.framework.parameters.Parameters getParameters()
Specified by:
getParameters in interface ServiceManagerService
Returns:
the Parameters for the container

getContext

public org.apache.avalon.framework.context.Context getContext()
Specified by:
getContext in interface ServiceManagerService
Returns:
the Context for the container

getLogger

public org.apache.avalon.framework.logger.Logger getLogger()
Specified by:
getLogger in interface ServiceManagerService
Returns:
the Logger of this service
See Also:
ServiceManagerService.getLogger()

getConfiguration

public org.apache.avalon.framework.configuration.Configuration getConfiguration()
Specified by:
getConfiguration in interface ServiceManagerService
Returns:
the Configuration for this service
See Also:
ServiceManagerService.getConfiguration()

getInstance

public static ServiceManagerService getInstance()
Returns:
the one and only instance of this class

setInstance

protected static void setInstance(ServiceManagerServiceImpl instance)
Create the one and only instance

Parameters:
instance - the instance


Copyright © 2008 The Apache Software Foundation. All Rights Reserved.