Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.picocontainer.gems.monitors
Class Slf4jComponentMonitor

    java.lang.Object
      org.picocontainer.gems.monitors.Slf4jComponentMonitor

All Implemented Interfaces:
  Serializable, org.picocontainer.ComponentMonitor

    public class Slf4jComponentMonitor

extends Object
implements org.picocontainer.ComponentMonitor, Serializable

A `ComponentMonitor` which writes to a Slf4j `Logger` instance. The Logger instance can either be injected or, if not set, the `LoggerFactory` will be used to retrieve it at every invocation of the monitor.

Author:
  Paul Hammant, Mauro Talevi, Michael Rimov
See Also:
  Serialized Form

Constructor Summary
`Slf4jComponentMonitor()` Creates a Slf4jComponentMonitor with no Logger instance set.
`Slf4jComponentMonitor(Class<?> loggerClass)` Creates a Slf4jComponentMonitor with a given Logger instance class.
`Slf4jComponentMonitor(Class<?> loggerClass, org.picocontainer.ComponentMonitor delegate)` Creates a Slf4jComponentMonitor with a given Logger instance class.
`Slf4jComponentMonitor(org.picocontainer.ComponentMonitor delegate)` Similar to default constructor behavior, but this version wraps a delegate ComponentMonitor.
`Slf4jComponentMonitor(org.slf4j.Logger logger)` Creates a Slf4jComponentMonitor with a given Logger instance
`Slf4jComponentMonitor(org.slf4j.Logger logger, org.picocontainer.ComponentMonitor delegate)` Creates a Slf4jComponentMonitor with a given Slf4j Logger instance
`Slf4jComponentMonitor(String loggerName)` Creates a Slf4jComponentMonitor with a given Logger instance name.
`Slf4jComponentMonitor(String loggerName, org.picocontainer.ComponentMonitor delegate)` Creates a Slf4jComponentMonitor with a given Logger instance name.

Method Summary
`protected org.slf4j.Logger` | `getLogger(Member member)` Retrieves the logger factory based class being instantiated.
`
`<T> void`
` | `instantiated(org.picocontainer.PicoContainer container, org.picocontainer.ComponentAdapter<T> componentAdapter, Constructor<T> constructor, Object instantiated, Object[] parameters, long duration)` *
`
`<T> Constructor<T>`
` | `instantiating(org.picocontainer.PicoContainer container, org.picocontainer.ComponentAdapter<T> componentAdapter, Constructor<T> constructor)` *
`
`<T> void`
` | `instantiationFailed(org.picocontainer.PicoContainer container, org.picocontainer.ComponentAdapter<T> componentAdapter, Constructor<T> constructor, Exception cause)` *
`void` | `invocationFailed(Member member, Object instance, Exception cause)` *
`void` | `invoked(org.picocontainer.PicoContainer container, org.picocontainer.ComponentAdapter<?> componentAdapter, Method method, Object instance, long duration)` *
`void` | `invoking(org.picocontainer.PicoContainer container, org.picocontainer.ComponentAdapter<?> componentAdapter, Member member, Object instance)` *
`void` | `lifecycleInvocationFailed(org.picocontainer.MutablePicoContainer container, org.picocontainer.ComponentAdapter<?> componentAdapter, Method method, Object instance, RuntimeException cause)` *
`org.picocontainer.Behavior` | `newBehavior(org.picocontainer.Behavior behavior)`
`org.picocontainer.Injector` | `newInjector(org.picocontainer.Injector injector)`
`Object` | `noComponentFound(org.picocontainer.MutablePicoContainer container, Object componentKey)` *

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Slf4jComponentMonitor

    public Slf4jComponentMonitor()

  Creates a Slf4jComponentMonitor with no Logger instance set. The `LoggerFactory` will be used to retrieve the Logger instance at every invocation of the monitor.

### Slf4jComponentMonitor

    public Slf4jComponentMonitor(Class<?> loggerClass)

  Creates a Slf4jComponentMonitor with a given Logger instance class. The class name is used to retrieve the Logger instance.

  Parameters:
    `loggerClass` - the class of the Logger

### Slf4jComponentMonitor

    public Slf4jComponentMonitor(String loggerName)

  Creates a Slf4jComponentMonitor with a given Logger instance name. It uses the `LoggerFactory` to create the Logger instance.

  Parameters:
    `loggerName` - the name of the Log

### Slf4jComponentMonitor

    public Slf4jComponentMonitor(org.slf4j.Logger logger)

  Creates a Slf4jComponentMonitor with a given Logger instance

  Parameters:
    `logger` - the Logger to write to

### Slf4jComponentMonitor

    public Slf4jComponentMonitor(Class<?> loggerClass,
                                 org.picocontainer.ComponentMonitor delegate)

  Creates a Slf4jComponentMonitor with a given Logger instance class. The class name is used to retrieve the Logger instance.

  Parameters:
    `loggerClass` - the class of the Logger
    `delegate` - the delegate

### Slf4jComponentMonitor

    public Slf4jComponentMonitor(String loggerName,
                                 org.picocontainer.ComponentMonitor delegate)

  Creates a Slf4jComponentMonitor with a given Logger instance name. It uses the `LoggerFactory` to create the Logger instance.

  Parameters:
    `loggerName` - the name of the Log
    `delegate` - the delegate

### Slf4jComponentMonitor

    public Slf4jComponentMonitor(org.slf4j.Logger logger,
                                 org.picocontainer.ComponentMonitor delegate)

  Creates a Slf4jComponentMonitor with a given Slf4j Logger instance

  Parameters:
    `logger` - the Logger to write to
    `delegate` - the delegate

### Slf4jComponentMonitor

    public Slf4jComponentMonitor(org.picocontainer.ComponentMonitor delegate)

  Similar to default constructor behavior, but this version wraps a delegate ComponentMonitor.

  Parameters:
    `delegate` - The next component monitor in the chain.

Method Detail

### instantiating

    public <T> Constructor<T> instantiating(org.picocontainer.PicoContainer container,
                                            org.picocontainer.ComponentAdapter<T> componentAdapter,
                                            Constructor<T> constructor)

  *

  Specified by:
    `instantiating` in interface `org.picocontainer.ComponentMonitor`

### instantiated

    public <T> void instantiated(org.picocontainer.PicoContainer container,
                                 org.picocontainer.ComponentAdapter<T> componentAdapter,
                                 Constructor<T> constructor,
                                 Object instantiated,
                                 Object[] parameters,
                                 long duration)

  *

  Specified by:
    `instantiated` in interface `org.picocontainer.ComponentMonitor`

### instantiationFailed

    public <T> void instantiationFailed(org.picocontainer.PicoContainer container,
                                        org.picocontainer.ComponentAdapter<T> componentAdapter,
                                        Constructor<T> constructor,
                                        Exception cause)

  *

  Specified by:
    `instantiationFailed` in interface `org.picocontainer.ComponentMonitor`

### invoking

    public void invoking(org.picocontainer.PicoContainer container,
                         org.picocontainer.ComponentAdapter<?> componentAdapter,
                         Member member,
                         Object instance)

  *

  Specified by:
    `invoking` in interface `org.picocontainer.ComponentMonitor`

### invoked

    public void invoked(org.picocontainer.PicoContainer container,
                        org.picocontainer.ComponentAdapter<?> componentAdapter,
                        Method method,
                        Object instance,
                        long duration)

  *

  Specified by:
    `invoked` in interface `org.picocontainer.ComponentMonitor`

### invocationFailed

    public void invocationFailed(Member member,
                                 Object instance,
                                 Exception cause)

  *

  Specified by:
    `invocationFailed` in interface `org.picocontainer.ComponentMonitor`

### lifecycleInvocationFailed

    public void lifecycleInvocationFailed(org.picocontainer.MutablePicoContainer container,
                                          org.picocontainer.ComponentAdapter<?> componentAdapter,
                                          Method method,
                                          Object instance,
                                          RuntimeException cause)

  *

  Specified by:
    `lifecycleInvocationFailed` in interface `org.picocontainer.ComponentMonitor`

### noComponentFound

    public Object noComponentFound(org.picocontainer.MutablePicoContainer container,
                                   Object componentKey)

  *

  Specified by:
    `noComponentFound` in interface `org.picocontainer.ComponentMonitor`

### newInjector

    public org.picocontainer.Injector newInjector(org.picocontainer.Injector injector)

  Specified by:
    `newInjector` in interface `org.picocontainer.ComponentMonitor`

### newBehavior

    public org.picocontainer.Behavior newBehavior(org.picocontainer.Behavior behavior)

  Specified by:
    `newBehavior` in interface `org.picocontainer.ComponentMonitor`

### getLogger

    protected org.slf4j.Logger getLogger(Member member)

  Retrieves the logger factory based class being instantiated.

  Parameters:
    `member` - Source method/constructor, etc being instantiated.
  Returns:
    an appropriate logger instance for this callback.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2009 Codehaus. All Rights Reserved.