org.apache.turbine.services.avaloncomponent
Class ACSYaafiComponentService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.turbine.services.avaloncomponent.ACSYaafiComponentService
All Implemented Interfaces:
AvalonComponentService, org.apache.avalon.framework.activity.Disposable, Initable, org.apache.avalon.framework.activity.Initializable, Service

public class ACSYaafiComponentService
extends TurbineBaseService
implements AvalonComponentService, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.Disposable

An implementation of Turbine service initializing the YAAFI container

Version:
$Id$
Author:
Siegfried Goeschl, Thomas Vandahl

Field Summary
static java.lang.String COMPONENT_PARAMETERS_KEY
          property to lookup the properties file
static java.lang.String COMPONENT_PARAMETERS_VALUE
          the default value for the parameter file
static java.lang.String CONTAINER_CONFIGURATION_KEY
          property to lookup the container configuration file
static java.lang.String CONTAINER_CONFIGURATION_VALUE
          the default value for the container configuration file
static java.lang.String SERVICE_NAME
          The publically visible name of the service
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.turbine.services.avaloncomponent.AvalonComponentService
AVALON_LOG_CATEGORY, COMPONENT_APP_ROOT, COMPONENT_CONFIG_KEY, COMPONENT_CONFIG_VALUE, COMPONENT_LOOKUP_KEY, COMPONENT_ROLE_KEY, COMPONENT_ROLE_VALUE
 
Constructor Summary
ACSYaafiComponentService()
           
 
Method Summary
protected  org.apache.avalon.framework.logger.Logger createAvalonLogger(java.lang.String name)
          Create the Avalon logger to be passed to YAAFI
protected  org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration createServiceContainerConfiguration(org.apache.commons.configuration.Configuration conf, java.lang.String appRoot)
          Create a ServiceContainerConfiguration based on the Turbine configuration
 void dispose()
          Disposes of the container and releases resources
 void init()
          Load all configured components and initialize them.
 void initialize()
          Initializes the container
 org.apache.avalon.framework.component.Component lookup(java.lang.String path)
          Returns an instance of the named component
 void release(org.apache.avalon.framework.component.Component component)
          Releases the component
 void shutdown()
          Shuts the Component Service down, calls dispose on the components that implement this interface
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, setInitableBroker
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
The publically visible name of the service

See Also:
Constant Field Values

CONTAINER_CONFIGURATION_KEY

public static final java.lang.String CONTAINER_CONFIGURATION_KEY
property to lookup the container configuration file

See Also:
Constant Field Values

CONTAINER_CONFIGURATION_VALUE

public static final java.lang.String CONTAINER_CONFIGURATION_VALUE
the default value for the container configuration file

See Also:
Constant Field Values

COMPONENT_PARAMETERS_KEY

public static final java.lang.String COMPONENT_PARAMETERS_KEY
property to lookup the properties file

See Also:
Constant Field Values

COMPONENT_PARAMETERS_VALUE

public static final java.lang.String COMPONENT_PARAMETERS_VALUE
the default value for the parameter file

See Also:
Constant Field Values
Constructor Detail

ACSYaafiComponentService

public ACSYaafiComponentService()
Method Detail

init

public void init()
          throws InitializationException
Load all configured components and initialize them. This is a zero parameter variant which queries the Turbine Servlet for its config.

Specified by:
init in interface Initable
Overrides:
init in class TurbineBaseService
Throws:
InitializationException - Something went wrong in the init stage

shutdown

public void shutdown()
Shuts the Component Service down, calls dispose on the components that implement this interface

Specified by:
shutdown in interface Initable
Overrides:
shutdown in class TurbineBaseService

initialize

public void initialize()
                throws java.lang.Exception
Initializes the container

Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Throws:
java.lang.Exception - generic exception

dispose

public void dispose()
Disposes of the container and releases resources

Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

lookup

public org.apache.avalon.framework.component.Component lookup(java.lang.String path)
                                                       throws org.apache.avalon.framework.component.ComponentException
Returns an instance of the named component

Specified by:
lookup in interface AvalonComponentService
Parameters:
path - Name of the role the component fills.
Returns:
an instance of the named component
Throws:
java.lang.Exception - generic exception
org.apache.avalon.framework.component.ComponentException - generic exception

release

public void release(org.apache.avalon.framework.component.Component component)
Releases the component

Specified by:
release in interface AvalonComponentService
Parameters:
component - the component to release

createServiceContainerConfiguration

protected org.apache.fulcrum.yaafi.framework.factory.ServiceContainerConfiguration createServiceContainerConfiguration(org.apache.commons.configuration.Configuration conf,
                                                                                                                       java.lang.String appRoot)
                                                                                                                throws java.io.IOException
Create a ServiceContainerConfiguration based on the Turbine configuration

Parameters:
conf - the Turbine configuration
appRoot - the absolute path to the application root directory
Returns:
the YAAFI configuration
Throws:
java.io.IOException - creating the YAAFI configuration failed

createAvalonLogger

protected org.apache.avalon.framework.logger.Logger createAvalonLogger(java.lang.String name)
Create the Avalon logger to be passed to YAAFI

Parameters:
name - the name of the logger
Returns:
an Avalon Logger


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