org.codehaus.dna.impl
Class ContainerUtil

java.lang.Object
  extended byorg.codehaus.dna.impl.ContainerUtil

public class ContainerUtil
extends java.lang.Object

Utility class to make it easier to process a object through its lifecycle stages.

Version:
$Revision: 1.2 $ $Date: 2004/05/01 09:51:48 $

Constructor Summary
ContainerUtil()
           
 
Method Summary
static void compose(java.lang.Object object, ResourceLocator locator)
          Supply specified object with ResourceLocator if it implements the Composable interface.
static void configure(java.lang.Object object, Configuration configuration)
          Supply specified object with Configuration if it implements the Configurable interface.
static void dispose(java.lang.Object object)
          Dispose specified object if it implements the Active interface.
static void enableLogging(java.lang.Object object, Logger logger)
          Supply specified object with Logger if it implements the LogEnabled interface.
static void initialize(java.lang.Object object)
          Initialize specified object if it implements the Active interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContainerUtil

public ContainerUtil()
Method Detail

enableLogging

public static void enableLogging(java.lang.Object object,
                                 Logger logger)
Supply specified object with Logger if it implements the LogEnabled interface.

Parameters:
object - the object to process
logger - the logger. If null then the specified object must not implement LogEnabled.
Throws:
java.lang.IllegalArgumentException - if the object is LogEnabled and Logger is null

compose

public static void compose(java.lang.Object object,
                           ResourceLocator locator)
                    throws MissingResourceException
Supply specified object with ResourceLocator if it implements the Composable interface.

Parameters:
object - the object to process
locator - the ResourceLocator. If null then the specified object must not implement Composable.
Throws:
java.lang.IllegalArgumentException - if the object is Composable and locator is null
MissingResourceException - if processing lifecycle stage on object throws exception

configure

public static void configure(java.lang.Object object,
                             Configuration configuration)
                      throws ConfigurationException
Supply specified object with Configuration if it implements the Configurable interface.

Parameters:
object - the object to process
configuration - the Configuration. If null then the specified object must not implement Configurable.
Throws:
java.lang.IllegalArgumentException - if the object is Configurable and configuration is null
ConfigurationException - if processing lifecycle stage on object throws exception

initialize

public static void initialize(java.lang.Object object)
                       throws java.lang.Exception
Initialize specified object if it implements the Active interface.

Parameters:
object - the object to process
Throws:
java.lang.Exception - if processing lifecycle stage on object throws exception

dispose

public static void dispose(java.lang.Object object)
                    throws java.lang.Exception
Dispose specified object if it implements the Active interface.

Parameters:
object - the object to process
Throws:
java.lang.Exception - if processing lifecycle stage on object throws exception


Copyright © 2003-2004 Codehaus. All Rights Reserved.