Class ContainerUtil
java.lang.Object
org.apache.avalon.framework.container.ContainerUtil
Utility class that makes it easier to transfer
a component throught it's lifecycle stages.
- Version:
- CVS $Revision: 1.16 $ $Date: 2004/02/11 14:34:26 $
- Author:
- Avalon Development Team
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
compose
(Object object, ComponentManager componentManager) Deprecated.compose() is no longer the preferred method via which components will be supplied with Components.static void
configure
(Object object, Configuration configuration) Configure specified object if it implements theConfigurable
interface.static void
contextualize
(Object object, Context context) Supply specified object with a Context object if it implements theContextualizable
interface.static void
Dispose specified object if it implements theDisposable
interface.static void
enableLogging
(Object object, Logger logger) Supply specified object with Logger if it implements theLogEnabled
interface.static void
Execute the specified object if it implements theExecutable
interface.static void
initialize
(Object object) Initialize specified object if it implements theInitializable
interface.static void
parameterize
(Object object, Parameters parameters) Parameterize specified object if it implements theParameterizable
interface.static void
service
(Object object, ServiceManager serviceManager) Supply specified object with ServiceManager if it implements theServiceable
interface.static void
Run specified object through shutdown lifecycle stages (Stop and Dispose).static void
Start specified object if it implements theStartable
interface.static void
Stop specified object if it implements theStartable
interface.
-
Method Details
-
shutdown
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
-
enableLogging
Supply specified object with Logger if it implements theLogEnabled
interface.- Parameters:
object
- the object to Startlogger
- 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
-
contextualize
Supply specified object with a Context object if it implements theContextualizable
interface.- Parameters:
object
- the object to contextualizecontext
- 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 objectIllegalArgumentException
- if the object is Contextualizable but context is null
-
service
Supply specified object with ServiceManager if it implements theServiceable
interface.- Parameters:
object
- the object to serviceserviceManager
- 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 objectIllegalArgumentException
- if the object is Servicable but ServiceManager is null
-
compose
public static void compose(Object object, 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 theComposable
interface.- Parameters:
object
- the object to composecomponentManager
- 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 objectIllegalArgumentException
- if the object is Composable but ComponentManager is null
-
configure
public static void configure(Object object, Configuration configuration) throws ConfigurationException Configure specified object if it implements theConfigurable
interface.- Parameters:
object
- the object to Startconfiguration
- 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 nullIllegalArgumentException
- if the object is Configurable but Configuration is null
-
parameterize
Parameterize specified object if it implements theParameterizable
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 objectIllegalArgumentException
- if the object is Parameterizable but parameters is null
-
initialize
Initialize specified object if it implements theInitializable
interface.- Parameters:
object
- the object to Initialize- Throws:
Exception
- if there is a problem Initializing object
-
start
Start specified object if it implements theStartable
interface.- Parameters:
object
- the object to Start- Throws:
Exception
- if there is a problem Starting object
-
execute
Execute the specified object if it implements theExecutable
interface.- Parameters:
object
- the object to execute- Throws:
Exception
- if there is a problem executing object
-
stop
Stop specified object if it implements theStartable
interface.- Parameters:
object
- the object to stop- Throws:
Exception
- if there is a problem stoppping object
-
dispose
Dispose specified object if it implements theDisposable
interface.- Parameters:
object
- the object to dispose
-