org.apache.avalon.framework.container

Class ContainerUtil

public final class ContainerUtil extends Object

Utility class that makes it easier to transfer a component throught it's lifecycle stages.

Version: CVS $Revision: 1.13 $ $Date: 2003/02/11 15:58:40 $

Author: Avalon Development Team

Method Summary
static voidcompose(Object object, ComponentManager componentManager)
Supply specified object with ComponentManager if it implements the {@link Composable} interface.
static voidconfigure(Object object, Configuration configuration)
Configure specified object if it implements the {@link Configurable} interface.
static voidcontextualize(Object object, Context context)
Supply specified object with a Context object if it implements the {@link Contextualizable} interface.
static voiddispose(Object object)
Dispose specified object if it implements the {@link Disposable} interface.
static voidenableLogging(Object object, Logger logger)
Supply specified object with Logger if it implements the {@link LogEnabled} interface.
static voidinitialize(Object object)
Initialize specified object if it implements the {@link Initializable} interface.
static voidparameterize(Object object, Parameters parameters)
Parameterize specified object if it implements the {@link Parameterizable} interface.
static voidservice(Object object, ServiceManager serviceManager)
Supply specified object with ServiceManager if it implements the {@link Serviceable} interface.
static voidshutdown(Object object)
Run specified object through shutdown lifecycle stages (Stop and Dispose).
static voidstart(Object object)
Start specified object if it implements the {@link Startable} interface.
static voidstop(Object object)
Stop specified object if it implements the {@link Startable} interface.

Method Detail

compose

public static void compose(Object object, ComponentManager componentManager)

Deprecated: compose() is no longer the preferred method via which components will be supplied with Components. Please Use service() from Composable instead.

Supply specified object with ComponentManager if it implements the {@link Composable} interface.

Parameters: object the object to compose componentManager the ComponentManager object to use for object. May be null in which case the specified object must not implement Composable.

Throws: ComponentException if there is a problem composing object IllegalArgumentException if the object is Composable but ComponentManager is null

configure

public static void configure(Object object, Configuration configuration)
Configure specified object if it implements the {@link Configurable} interface.

Parameters: object the object to Start configuration the configuration object to use during configuration. May be null in which case the specified object must not implement Configurable

Throws: ConfigurationException if there is a problem Configuring object, or the object is Configurable but Configuration is null IllegalArgumentException if the object is Configurable but Configuration is null

contextualize

public static void contextualize(Object object, Context context)
Supply specified object with a Context object if it implements the {@link Contextualizable} interface.

Parameters: object the object to contextualize context the context object to use for object. May be null in which case the specified object must not implement Contextualizable.

Throws: ContextException if there is a problem contextualizing object IllegalArgumentException if the object is Contextualizable but context is null

dispose

public static void dispose(Object object)
Dispose specified object if it implements the {@link Disposable} interface.

Parameters: object the object to dispose

enableLogging

public static void enableLogging(Object object, Logger logger)
Supply specified object with Logger if it implements the {@link LogEnabled} interface.

Parameters: object the object to Start logger the logger to enable component with. May be null in which case the specified object must not implement LogEnabled.

Throws: IllegalArgumentException if the object is LogEnabled but Logger is null

initialize

public static void initialize(Object object)
Initialize specified object if it implements the {@link Initializable} interface.

Parameters: object the object to Initialize

Throws: Exception if there is a problem Initializing object

parameterize

public static void parameterize(Object object, Parameters parameters)
Parameterize specified object if it implements the {@link Parameterizable} interface.

Parameters: object the object to Parameterize. parameters the parameters object to use during Parameterization. May be null in which case the specified object must not implement Parameterizable.

Throws: ParameterException if there is a problem Parameterizing object IllegalArgumentException if the object is Parameterizable but parameters is null

service

public static void service(Object object, ServiceManager serviceManager)
Supply specified object with ServiceManager if it implements the {@link Serviceable} interface.

Parameters: object the object to service serviceManager the serviceManager object to use for object. May be null in which case the specified object must not implement Serviceable.

Throws: ServiceException if there is a problem servicing object IllegalArgumentException if the object is Servicable but ServiceManager is null

shutdown

public static void shutdown(Object object)
Run specified object through shutdown lifecycle stages (Stop and Dispose).

Parameters: object the object to shutdown

Throws: Exception if there is a problem stoppping object

start

public static void start(Object object)
Start specified object if it implements the {@link Startable} interface.

Parameters: object the object to Start

Throws: Exception if there is a problem Starting object

stop

public static void stop(Object object)
Stop specified object if it implements the {@link Startable} interface.

Parameters: object the object to stop

Throws: Exception if there is a problem stoppping object