net.sf.mmm.util.component.base
Class AbstractLoggableComponent

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
Direct Known Subclasses:
AbstractCliParserBuilder, AbstractDataResourceFactory, AbstractDataResourceProvider, AbstractDetectorStreamProvider, AbstractEventSource, AbstractGenericContextFactory, AbstractGenericValueConverter, AbstractHyphenator, AbstractHyphenatorBuilder, AbstractLineWrapper, AbstractNlsFormatter, AbstractNlsFormatterManager, AbstractNlsMessageFactory, AbstractNlsTemplateResolver, AbstractPojoDescriptorBuilder, AbstractPojoDescriptorBuilderFactory, AbstractPojoPathFunction, AbstractPojoPathNavigator, AbstractSimpleValueConverter, AbstractValueConverter, AbstractValueValidator, CollectionFactoryManagerImpl, CollectionReflectionUtilImpl, DefaultNlsResourceLocator, DefaultPojoDescriptorEnhancer, DomUtilImpl, EncodingUtilImpl, FileUtilImpl, JustificationBuilderImpl, MathUtilImpl, NlsFormatterMap, PeriodicRefresherImpl, ProcessUtilImpl, ReflectionUtilImpl, SimplePojoFactory, StaxUtilImpl, StreamUtilImpl, SystemUtilImpl, XmlBeanMapper

public abstract class AbstractLoggableComponent
extends AbstractComponent

This is the abstract base class for a component that needs a logger.

Since:
2.0.0 (renamed, 1.0.1)
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  org.slf4j.Logger logger
           
 
Constructor Summary
AbstractLoggableComponent()
          The constructor.
 
Method Summary
protected  void doInitialize()
          This method performs the actual initialization.
protected  org.slf4j.Logger getLogger()
          This method gets the logger for this component.
 void setLogger(org.slf4j.Logger logger)
          This method allows to inject the logger instance for this component.
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private org.slf4j.Logger logger
See Also:
getLogger()
Constructor Detail

AbstractLoggableComponent

public AbstractLoggableComponent()
The constructor.

Method Detail

getLogger

protected org.slf4j.Logger getLogger()
                              throws NotInitializedException
This method gets the logger for this component. It should only be invoked after the component has been initialized.
This method is NOT public because the logger should only be used by the component itself and NOT externally.

Returns:
the logger to be used by this component.
Throws:
NotInitializedException - if this component has NOT yet been initialized.

setLogger

public void setLogger(org.slf4j.Logger logger)
               throws AlreadyInitializedException
This method allows to inject the logger instance for this component. This is an optional operation that has to be invoked before the component has been initialized.

Parameters:
logger - is the logger to set.
Throws:
AlreadyInitializedException - if this component has already been initialized.

doInitialize

protected void doInitialize()
This method performs the actual initialization. It is called when AbstractComponent.initialize() is invoked for the first time.
ATTENTION:
When you override this method from a sub-class you need to do a super.AbstractComponent.doInitialize().

Overrides:
doInitialize in class AbstractComponent


Copyright © 2001-2010 mmm-Team. All Rights Reserved.