org.apache.fulcrum.yaafi.service.servicemanager
Class ServiceManagerServiceImpl

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.fulcrum.yaafi.service.servicemanager.ServiceManagerServiceImpl
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable, 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, ServiceManagerService

public class ServiceManagerServiceImpl
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements ServiceManagerService, org.apache.avalon.framework.context.Contextualizable, 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 contextualize(org.apache.avalon.framework.context.Context context)
           
 void dispose()
           
 org.apache.avalon.framework.logger.Logger getAvalonLogger()
           
 org.apache.avalon.framework.context.Context getContext()
           
static ServiceManagerService getInstance()
           
 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 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 org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
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

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

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)

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

getAvalonLogger

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


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.