org.objectweb.util.monolog.wrapper.common
Class AbstractFactory

java.lang.Object
  extended by org.objectweb.util.monolog.wrapper.common.AbstractFactory
All Implemented Interfaces:
HandlerFactory, LevelFactory, LoggerFactory, MonologFactory, Configurable

public abstract class AbstractFactory
extends Object
implements MonologFactory, Configurable

Author:
S.Chassande-Barrioz

Field Summary
static String CLASSLOADER_ISOLATION
           
static boolean classLoaderIsoltion
           
static boolean debug
          Inidicates if the monolog wrapper must be logged itself.
protected  Map handlers
          This field references the handler instance by their names.
key = a String object which is an handler name.
static String[][] handlerType2className
           
static String[] handlerTypes
           
protected  Map intToNames
          This field reference the level names by their integer value.
key = a java.lang.Integer which the value is the level
value = a String or an ArrayList of String.
protected  Collection monologFactoryListeners
          This field references the MonolgFactoryListener instance by their names.
key = a String object which is an handler name.
protected  Map nameToLevel
          This field references the level instances by their names.
key = a level name
value = the unique Level instance linked to the name.
protected  String resourceBundleName
          The default resource bundle of this factory
protected static String rootLoggerName
          Name of the root logger.
protected static String rootLoggerPrefix
          Root logger prefix, i.e.
 
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
AbstractFactory()
          It initializes the default monolog level: INHERIT, DEBUG, INFO, WARN, ERROR, FATAL
 
Method Summary
 void addMonologFactoryListener(MonologFactoryListener mfl)
           
abstract  void configure(Properties prop)
           
 Handler createHandler(String hn, String handlertype)
           
static void debug(String m)
          This method must be only used to debug the Monolog wrappers.
 Level defineLevel(String name, int value)
           
 Level defineLevel(String name, String value)
           
protected abstract  String[][] getDefaultHandlerType2className()
           
 Handler getHandler(String hn)
           
 Handler[] getHandlers()
           
 Level getLevel(int value)
           
 Level getLevel(String name)
           
 Level[] getLevels()
           
abstract  Logger getLogger(String key)
           
abstract  Logger[] getLoggers()
           
 String getResourceBundleName()
           
static String getRootLoggerPrefix()
          Gets the prefix of the root logger.
 String getTopicPrefix()
           
static String getTopicWithoutPrefix(String topic)
           
abstract  String getWrapperName()
           
protected  void initHandlerType2className()
           
protected static String monoLoggerName(String name)
          isolates the logger hierarchy for a given class loader by prepending the root logger name.
 Handler removeHandler(String hn)
           
 void removeLevel(String name)
           
 void removeMonologFactoryListener(MonologFactoryListener mfl)
           
 void setResourceBundleName(String rbn)
           
static void warn(String m)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.util.monolog.api.MonologFactory
addLogInfo, getLogInfo, removeLogInfo
 
Methods inherited from interface org.objectweb.util.monolog.api.LoggerFactory
getLogger
 

Field Detail

CLASSLOADER_ISOLATION

public static final String CLASSLOADER_ISOLATION
See Also:
Constant Field Values

handlerTypes

public static String[] handlerTypes

handlerType2className

public static String[][] handlerType2className

classLoaderIsoltion

public static boolean classLoaderIsoltion

debug

public static boolean debug
Inidicates if the monolog wrapper must be logged itself.


rootLoggerPrefix

protected static String rootLoggerPrefix
Root logger prefix, i.e. rootLoggerName followed by '.'.


rootLoggerName

protected static String rootLoggerName
Name of the root logger. This name intends to isolates the loggers associated to a class loader.


resourceBundleName

protected String resourceBundleName
The default resource bundle of this factory


nameToLevel

protected Map nameToLevel
This field references the level instances by their names.
key = a level name
value = the unique Level instance linked to the name.


intToNames

protected Map intToNames
This field reference the level names by their integer value.
key = a java.lang.Integer which the value is the level
value = a String or an ArrayList of String. The strings represent the name which match to the integer value. Indeed both name can be associated to the same integer value.


handlers

protected Map handlers
This field references the handler instance by their names.
key = a String object which is an handler name. value = the unique handler instance which has the key for name.


monologFactoryListeners

protected Collection monologFactoryListeners
This field references the MonolgFactoryListener instance by their names.
key = a String object which is an handler name. value = the unique handler instance which has the key for name.

Constructor Detail

AbstractFactory

public AbstractFactory()
It initializes the default monolog level: INHERIT, DEBUG, INFO, WARN, ERROR, FATAL

Method Detail

getRootLoggerPrefix

public static String getRootLoggerPrefix()
Gets the prefix of the root logger.


getTopicWithoutPrefix

public static String getTopicWithoutPrefix(String topic)

monoLoggerName

protected static String monoLoggerName(String name)
isolates the logger hierarchy for a given class loader by prepending the root logger name.

Parameters:
name - user defined name
Returns:
internal name

debug

public static void debug(String m)
This method must be only used to debug the Monolog wrappers. To active the log of monolog assign the "true" value to the system property "monolog.debug".

Parameters:
m - the message to log.

warn

public static void warn(String m)

getWrapperName

public abstract String getWrapperName()

initHandlerType2className

protected void initHandlerType2className()

getDefaultHandlerType2className

protected abstract String[][] getDefaultHandlerType2className()

configure

public abstract void configure(Properties prop)
                        throws Exception
Specified by:
configure in interface MonologFactory
Throws:
Exception

getLogger

public abstract Logger getLogger(String key)
Specified by:
getLogger in interface LoggerFactory

getLoggers

public abstract Logger[] getLoggers()
Specified by:
getLoggers in interface LoggerFactory

getTopicPrefix

public String getTopicPrefix()
Specified by:
getTopicPrefix in interface LoggerFactory

getResourceBundleName

public String getResourceBundleName()
Specified by:
getResourceBundleName in interface LoggerFactory

setResourceBundleName

public void setResourceBundleName(String rbn)
Specified by:
setResourceBundleName in interface LoggerFactory

createHandler

public Handler createHandler(String hn,
                             String handlertype)
Specified by:
createHandler in interface HandlerFactory

getHandlers

public Handler[] getHandlers()
Specified by:
getHandlers in interface HandlerFactory

getHandler

public Handler getHandler(String hn)
Specified by:
getHandler in interface HandlerFactory

removeHandler

public Handler removeHandler(String hn)
Specified by:
removeHandler in interface HandlerFactory

defineLevel

public Level defineLevel(String name,
                         int value)
Specified by:
defineLevel in interface LevelFactory

defineLevel

public Level defineLevel(String name,
                         String value)
Specified by:
defineLevel in interface LevelFactory

getLevel

public Level getLevel(String name)
Specified by:
getLevel in interface LevelFactory

getLevel

public Level getLevel(int value)
Specified by:
getLevel in interface LevelFactory

getLevels

public Level[] getLevels()
Specified by:
getLevels in interface LevelFactory

removeLevel

public void removeLevel(String name)
Specified by:
removeLevel in interface LevelFactory

addMonologFactoryListener

public void addMonologFactoryListener(MonologFactoryListener mfl)
Specified by:
addMonologFactoryListener in interface MonologFactory

removeMonologFactoryListener

public void removeMonologFactoryListener(MonologFactoryListener mfl)
Specified by:
removeMonologFactoryListener in interface MonologFactory


Copyright © 2012 OW2 Consortium. All Rights Reserved.