org.objectweb.util.monolog.component
Class MonologComponent

java.lang.Object
  extended byorg.objectweb.util.monolog.component.MonologComponent
All Implemented Interfaces:
org.objectweb.fractal.api.control.AttributeController, HandlerFactory, LevelFactory, LoggerFactory, MonologAttributes, MonologFactory

public class MonologComponent
extends java.lang.Object
implements MonologFactory, MonologAttributes

Author:
S.Chassande-Barrioz

Field Summary
 
Fields inherited from interface org.objectweb.util.monolog.api.MonologFactory
DEFAULT, LOG_CONFIGURATION_FILE, LOG_CONFIGURATION_FILE_USE_CLASSPATH, LOG_CONFIGURATION_TYPE, PROPERTY, XML
 
Constructor Summary
MonologComponent()
           
 
Method Summary
 void configure(java.util.Properties prop)
          This method permits to order to a monolog wrapper to configure the underlying log system.
 Handler createHandler(java.lang.String hn, byte handlertype)
          It retrieves a new instance of an handler which the type is specified by the parameter.
 Level defineLevel(java.lang.String name, int value)
          It defines a new Level with a name and an integer value.
 Level defineLevel(java.lang.String name, java.lang.String value)
          It defines a new Level with a name and a string value.
 Handler getHandler(java.lang.String handlername)
          It retrieves the handler which the name is specified by the parameter
static HandlerFactory getHandlerFactory()
           
 Handler[] getHandlers()
          It retrieves all handler managed by this factory.
 Level getLevel(int value)
          It retrieves a Level instance which the integer value is equals to the parameter.
 Level getLevel(java.lang.String name)
          It retrieves a Level instance which the name is equals to the parameter.
static LevelFactory getLevelFactory()
           
 Level[] getLevels()
          It retrieves all Level instances defined in this manager.
 Logger getLogger(java.lang.String key)
          This method permits to fetch a Logger.
 Logger getLogger(java.lang.String key, java.lang.String resourceBundleName)
          This method permits to fetch a Logger.
static LoggerFactory getLoggerFactory()
           
 Logger[] getLoggers()
          It retrieves a list of all loggers.
 java.lang.String getPropertiesFileName()
           
 java.lang.String getResourceBundleName()
          Accessors to a resource bundle name associated to a LoggerFactory.
 Handler removeHandler(java.lang.String handlername)
          It removes the handler which the name is specified by the parameter
 void removeLevel(java.lang.String name)
          It removes a Level instance to this manager.
 void setPropertiesFileName(java.lang.String propfn)
           
 void setResourceBundleName(java.lang.String resourceBundleName)
          Accessors to a resource bundle name associated to a LoggerFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MonologComponent

public MonologComponent()
Method Detail

getLoggerFactory

public static LoggerFactory getLoggerFactory()

getLevelFactory

public static LevelFactory getLevelFactory()

getHandlerFactory

public static HandlerFactory getHandlerFactory()

getPropertiesFileName

public java.lang.String getPropertiesFileName()
Specified by:
getPropertiesFileName in interface MonologAttributes

setPropertiesFileName

public void setPropertiesFileName(java.lang.String propfn)
Specified by:
setPropertiesFileName in interface MonologAttributes

getLogger

public Logger getLogger(java.lang.String key)
Description copied from interface: LoggerFactory
This method permits to fetch a Logger. If the Logger described by the parameters does not exist, then the LoggerFactory must return a new instance of Logger. The key parameter is a description of the expected Logger. In simple cases, the key is the initial topic of the Logger.

Specified by:
getLogger in interface LoggerFactory

getLogger

public Logger getLogger(java.lang.String key,
                        java.lang.String resourceBundleName)
Description copied from interface: LoggerFactory
This method permits to fetch a Logger. If the Logger described by the parameters does not exist, then the LoggerFactory must return a new instance of Logger. The key parameter is a description of the expected Logger. In simple cases, the key is the initial topic of the Logger. The resourceBundleName parameter allows specifying the name of a resource bundle in order to internationalise the logging.

Specified by:
getLogger in interface LoggerFactory

getResourceBundleName

public java.lang.String getResourceBundleName()
Description copied from interface: LoggerFactory
Accessors to a resource bundle name associated to a LoggerFactory.

Specified by:
getResourceBundleName in interface LoggerFactory

setResourceBundleName

public void setResourceBundleName(java.lang.String resourceBundleName)
Description copied from interface: LoggerFactory
Accessors to a resource bundle name associated to a LoggerFactory.

Specified by:
setResourceBundleName in interface LoggerFactory

getLoggers

public Logger[] getLoggers()
Description copied from interface: LoggerFactory
It retrieves a list of all loggers.

Specified by:
getLoggers in interface LoggerFactory

defineLevel

public Level defineLevel(java.lang.String name,
                         int value)
Description copied from interface: LevelFactory
It defines a new Level with a name and an integer value.

Specified by:
defineLevel in interface LevelFactory
Parameters:
name - is the name of the new level
value - is the integer value of the new level
Returns:
a Level instance or a null value if It exists a Level with the same name but with another integer value.

defineLevel

public Level defineLevel(java.lang.String name,
                         java.lang.String value)
Description copied from interface: LevelFactory
It defines a new Level with a name and a string value. The string value is analyzed to obtain the integer value.

Specified by:
defineLevel in interface LevelFactory
Parameters:
name - is the name of the new level
value - is the string value of the new level
Returns:
a Level instance or a null value if It exists a Level with the same name but with another integer value.

getLevel

public Level getLevel(java.lang.String name)
Description copied from interface: LevelFactory
It retrieves a Level instance which the name is equals to the parameter.

Specified by:
getLevel in interface LevelFactory
Parameters:
name - is the name of request Level
Returns:
a Leve instance or a null value if the level does not exist.

getLevel

public Level getLevel(int value)
Description copied from interface: LevelFactory
It retrieves a Level instance which the integer value is equals to the parameter.

Specified by:
getLevel in interface LevelFactory
Parameters:
value - is the integer value of request Level
Returns:
a Leve instance or a null value if the level does not exist. As it is possible to define several Levels which have the same integer value this methods returns the Level instance of first name found in the list.

getLevels

public Level[] getLevels()
Description copied from interface: LevelFactory
It retrieves all Level instances defined in this manager.

Specified by:
getLevels in interface LevelFactory

removeLevel

public void removeLevel(java.lang.String name)
Description copied from interface: LevelFactory
It removes a Level instance to this manager.

Specified by:
removeLevel in interface LevelFactory

createHandler

public Handler createHandler(java.lang.String hn,
                             byte handlertype)
Description copied from interface: HandlerFactory
It retrieves a new instance of an handler which the type is specified by the parameter.

Specified by:
createHandler in interface HandlerFactory
Parameters:
handlertype - is the type of the parameter. The possible value are defined in this interface by the XXX_HANDLER_TYPE constants.
Returns:
a new instance of an handler

getHandlers

public Handler[] getHandlers()
Description copied from interface: HandlerFactory
It retrieves all handler managed by this factory.

Specified by:
getHandlers in interface HandlerFactory
Returns:
a set of Handler instance or an empty set.

getHandler

public Handler getHandler(java.lang.String handlername)
Description copied from interface: HandlerFactory
It retrieves the handler which the name is specified by the parameter

Specified by:
getHandler in interface HandlerFactory
Parameters:
handlername - is the name of the handler
Returns:
an handler instance or a null value.

removeHandler

public Handler removeHandler(java.lang.String handlername)
Description copied from interface: HandlerFactory
It removes the handler which the name is specified by the parameter

Specified by:
removeHandler in interface HandlerFactory
Parameters:
handlername - is the name of the handler
Returns:
the removed handler instance or a null value if it does not exist.

configure

public void configure(java.util.Properties prop)
               throws java.lang.Exception
Description copied from interface: MonologFactory
This method permits to order to a monolog wrapper to configure the underlying log system.

Specified by:
configure in interface MonologFactory
Parameters:
prop - contains properties which describes the way to configure. In particular three properties could be used:
  • LOG_CONFIGURATION_TYPE
  • LOG_CONFIGURATION_FILE
  • LOG_CONFIGURATION_FILE_USE_CLASSPATH
    • Throws:
      java.lang.Exception