Top Description Constructors Methods
org.apache.avalon.framework.container

public final Class ContainerUtil

extends Object
Class Inheritance
Imports
org.apache.avalon.framework.activity.Disposable, .Initializable, .Startable, .Executable, org.apache.avalon.framework.component.ComponentException, .ComponentManager, .Composable, org.apache.avalon.framework.configuration.Configurable, .Configuration, .ConfigurationException, org.apache.avalon.framework.context.Context, .ContextException, .Contextualizable, org.apache.avalon.framework.logger.LogEnabled, .Logger, org.apache.avalon.framework.parameters.ParameterException, .Parameterizable, .Parameters, org.apache.avalon.framework.service.ServiceException, .ServiceManager, .Serviceable

Utility class that makes it easier to transfer a component throught it's lifecycle stages.
Author
Avalon Development Team
Version
$Id: ContainerUtil.java 506231 2007-02-12 02:36:54Z crossley $

Constructor Summary

AccessConstructor and Description
private
ContainerUtil()

Private constructor to block instantiation.

Method Summary

Modifier and TypeMethod and Description
public static void
compose(final Object
the object to compose
object
,
final ComponentManager
the ComponentManager object to use for object. May be null in which case the specified object must not implement Composable.
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 Composable interface.
public static void
configure(final Object
the object to Start
object
,
final Configuration
the configuration object to use during configuration. May be null in which case the specified object must not implement Configurable
configuration
)

Configure specified object if it implements the Configurable interface.

public static void
contextualize(final Object
the object to contextualize
object
,
final Context
the context object to use for object. May be null in which case the specified object must not implement Contextualizable.
context
)

Supply specified object with a Context object if it implements the Contextualizable interface.

public static void
dispose(final Object
the object to dispose
object
)

Dispose specified object if it implements the Disposable interface.

public static void
enableLogging(final Object
the object to Start
object
,
final Logger
the logger to enable component with. May be null in which case the specified object must not implement LogEnabled.
logger
)

Supply specified object with Logger if it implements the LogEnabled interface.

public static void
execute(final Object
the object to execute
object
)

Execute the specified object if it implements the Executable interface.

public static void
initialize(final Object
the object to Initialize
object
)

Initialize specified object if it implements the Initializable interface.

public static void
parameterize(final Object
the object to Parameterize.
object
,
final Parameters
the parameters object to use during Parameterization. May be null in which case the specified object must not implement Parameterizable.
parameters
)

Parameterize specified object if it implements the Parameterizable interface.

public static void
service(final Object
the object to service
object
,
final ServiceManager
the serviceManager object to use for object. May be null in which case the specified object must not implement Serviceable.
serviceManager
)

Supply specified object with ServiceManager if it implements the Serviceable interface.

public static void
shutdown(final Object
the object to shutdown
object
)

Run specified object through shutdown lifecycle stages (Stop and Dispose).

public static void
start(final Object
the object to Start
object
)

Start specified object if it implements the Startable interface.

public static void
stop(final Object
the object to stop
object
)

Stop specified object if it implements the Startable interface.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ContainerUtilback to summary
private ContainerUtil()

Private constructor to block instantiation.

Method Detail

composeback to summary
public static void compose(final Object object, final ComponentManager componentManager) throws ComponentException

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 Composable interface.

Parameters
object:Object

the object to compose

componentManager:ComponentManager

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

Exceptions
ComponentException:
if there is a problem composing object
IllegalArgumentException:
if the object is Composable but ComponentManager is null
configureback to summary
public static void configure(final Object object, final Configuration configuration) throws ConfigurationException

Configure specified object if it implements the Configurable interface.

Parameters
object:Object

the object to Start

configuration:Configuration

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

Exceptions
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
contextualizeback to summary
public static void contextualize(final Object object, final Context context) throws ContextException

Supply specified object with a Context object if it implements the Contextualizable interface.

Parameters
object:Object

the object to contextualize

context:Context

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

Exceptions
ContextException:
if there is a problem contextualizing object
IllegalArgumentException:
if the object is Contextualizable but context is null
disposeback to summary
public static void dispose(final Object object)

Dispose specified object if it implements the Disposable interface.

Parameters
object:Object

the object to dispose

enableLoggingback to summary
public static void enableLogging(final Object object, final Logger logger)

Supply specified object with Logger if it implements the LogEnabled interface.

Parameters
object:Object

the object to Start

logger:Logger

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

Exceptions
IllegalArgumentException:
if the object is LogEnabled but Logger is null
executeback to summary
public static void execute(final Object object) throws Exception

Execute the specified object if it implements the Executable interface.

Parameters
object:Object

the object to execute

Exceptions
Exception:
if there is a problem executing object
initializeback to summary
public static void initialize(final Object object) throws Exception

Initialize specified object if it implements the Initializable interface.

Parameters
object:Object

the object to Initialize

Exceptions
Exception:
if there is a problem Initializing object
parameterizeback to summary
public static void parameterize(final Object object, final Parameters parameters) throws ParameterException

Parameterize specified object if it implements the Parameterizable interface.

Parameters
object:Object

the object to Parameterize.

parameters:Parameters

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

Exceptions
ParameterException:
if there is a problem Parameterizing object
IllegalArgumentException:
if the object is Parameterizable but parameters is null
serviceback to summary
public static void service(final Object object, final ServiceManager serviceManager) throws ServiceException

Supply specified object with ServiceManager if it implements the Serviceable interface.

Parameters
object:Object

the object to service

serviceManager:ServiceManager

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

Exceptions
ServiceException:
if there is a problem servicing object
IllegalArgumentException:
if the object is Servicable but ServiceManager is null
shutdownback to summary
public static void shutdown(final Object object) throws Exception

Run specified object through shutdown lifecycle stages (Stop and Dispose).

Parameters
object:Object

the object to shutdown

Exceptions
Exception:
if there is a problem stoppping object
startback to summary
public static void start(final Object object) throws Exception

Start specified object if it implements the Startable interface.

Parameters
object:Object

the object to Start

Exceptions
Exception:
if there is a problem Starting object
stopback to summary
public static void stop(final Object object) throws Exception

Stop specified object if it implements the Startable interface.

Parameters
object:Object

the object to stop

Exceptions
Exception:
if there is a problem stoppping object