org.picocontainer.gems.monitors
Class CommonsLoggingComponentMonitor

java.lang.Object
  extended by org.picocontainer.monitors.AbstractComponentMonitor
      extended by org.picocontainer.gems.monitors.CommonsLoggingComponentMonitor
All Implemented Interfaces:
Serializable, ComponentMonitor

public class CommonsLoggingComponentMonitor
extends AbstractComponentMonitor
implements Serializable

A ComponentMonitor which writes to a Commons Logging Log instance. The Log instance can either be injected or, if not set, the LogFactory will be used to retrieve it at every invocation of the monitor.

Version:
$Revision: $
Author:
Paul Hammant, Mauro Talevi
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.picocontainer.monitors.AbstractComponentMonitor
INSTANTIATED, INSTANTIATED2, INSTANTIATING, INSTANTIATION_FAILED, INVOCATION_FAILED, INVOKED, INVOKING, LIFECYCLE_INVOCATION_FAILED
 
Constructor Summary
CommonsLoggingComponentMonitor()
          Creates a CommonsLoggingComponentMonitor with no Log instance set.
CommonsLoggingComponentMonitor(Class logClass)
          Creates a CommonsLoggingComponentMonitor with a given Log instance class.
CommonsLoggingComponentMonitor(Class logClass, ComponentMonitor delegate)
          Creates a CommonsLoggingComponentMonitor with a given Log instance class.
CommonsLoggingComponentMonitor(Log log)
          Creates a CommonsLoggingComponentMonitor with a given Log instance
CommonsLoggingComponentMonitor(Log log, ComponentMonitor delegate)
          Creates a CommonsLoggingComponentMonitor with a given Log instance
CommonsLoggingComponentMonitor(String logName)
          Creates a CommonsLoggingComponentMonitor with a given Log instance name.
CommonsLoggingComponentMonitor(String logName, ComponentMonitor delegate)
          Creates a CommonsLoggingComponentMonitor with a given Log instance name.
 
Method Summary
protected  Log getLog(Member member)
           
 void instantiated(Constructor constructor, long duration)
           
 void instantiated(Constructor constructor, Object instantiated, Object[] parameters, long duration)
           
 void instantiating(Constructor constructor)
           
 void instantiationFailed(Constructor constructor, Exception cause)
           
 void invocationFailed(Method method, Object instance, Exception cause)
           
 void invoked(Method method, Object instance, long duration)
           
 void invoking(Method method, Object instance)
           
 void lifecycleInvocationFailed(Method method, Object instance, RuntimeException cause)
           
 
Methods inherited from class org.picocontainer.monitors.AbstractComponentMonitor
format, toString, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonsLoggingComponentMonitor

public CommonsLoggingComponentMonitor()
Creates a CommonsLoggingComponentMonitor with no Log instance set. The LogFactory will be used to retrieve the Log instance at every invocation of the monitor.


CommonsLoggingComponentMonitor

public CommonsLoggingComponentMonitor(Class logClass)
Creates a CommonsLoggingComponentMonitor with a given Log instance class. The class name is used to retrieve the Log instance.

Parameters:
logClass - the class of the Log

CommonsLoggingComponentMonitor

public CommonsLoggingComponentMonitor(String logName)
Creates a CommonsLoggingComponentMonitor with a given Log instance name. It uses the LogFactory to create the Log instance.

Parameters:
logName - the name of the Log

CommonsLoggingComponentMonitor

public CommonsLoggingComponentMonitor(Log log)
Creates a CommonsLoggingComponentMonitor with a given Log instance

Parameters:
log - the Log to write to

CommonsLoggingComponentMonitor

public CommonsLoggingComponentMonitor(Class logClass,
                                      ComponentMonitor delegate)
Creates a CommonsLoggingComponentMonitor with a given Log instance class. The class name is used to retrieve the Log instance.

Parameters:
logClass - the class of the Log

CommonsLoggingComponentMonitor

public CommonsLoggingComponentMonitor(String logName,
                                      ComponentMonitor delegate)
Creates a CommonsLoggingComponentMonitor with a given Log instance name. It uses the LogFactory to create the Log instance.

Parameters:
logName - the name of the Log

CommonsLoggingComponentMonitor

public CommonsLoggingComponentMonitor(Log log,
                                      ComponentMonitor delegate)
Creates a CommonsLoggingComponentMonitor with a given Log instance

Parameters:
log - the Log to write to
Method Detail

instantiating

public void instantiating(Constructor constructor)
Specified by:
instantiating in interface ComponentMonitor

instantiated

public void instantiated(Constructor constructor,
                         long duration)
Specified by:
instantiated in interface ComponentMonitor

instantiated

public void instantiated(Constructor constructor,
                         Object instantiated,
                         Object[] parameters,
                         long duration)
Specified by:
instantiated in interface ComponentMonitor

instantiationFailed

public void instantiationFailed(Constructor constructor,
                                Exception cause)
Specified by:
instantiationFailed in interface ComponentMonitor

invoking

public void invoking(Method method,
                     Object instance)
Specified by:
invoking in interface ComponentMonitor

invoked

public void invoked(Method method,
                    Object instance,
                    long duration)
Specified by:
invoked in interface ComponentMonitor

invocationFailed

public void invocationFailed(Method method,
                             Object instance,
                             Exception cause)
Specified by:
invocationFailed in interface ComponentMonitor

lifecycleInvocationFailed

public void lifecycleInvocationFailed(Method method,
                                      Object instance,
                                      RuntimeException cause)
Specified by:
lifecycleInvocationFailed in interface ComponentMonitor

getLog

protected Log getLog(Member member)


Copyright © 2003-2010 Codehaus. All Rights Reserved.