cz.cuni.amis.pogamut.base.utils.logging
Class AbstractLogCategories

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.utils.logging.AbstractLogCategories
All Implemented Interfaces:
ILogCategories
Direct Known Subclasses:
LogCategories, LogCategoriesJMXProxy

public abstract class AbstractLogCategories
extends java.lang.Object
implements ILogCategories

Class that wraps the map with log categories. It allows you to simply create new categories or query it's mapping.

The only constructor LogCategories(Logger) is protected and is instantiated during the construction of AgentLogger.


Constructor Summary
AbstractLogCategories()
           
 
Method Summary
 void addLogCategory(java.lang.String name, LogCategory category)
          Used by AbstractAgentLogger to slip itself into the map.
 java.util.Map<java.lang.String,LogCategory> getCategories()
          Returns IMMUTABLE mapping of cathegories names to instances of those log categories.
protected abstract  java.util.Map<java.lang.String,LogCategory> getCategoriesInternal()
           
 java.lang.String[] getCategoryNames()
          Returns names of all existing log categories.
 java.lang.String[] getCategoryNamesSorted()
          Returns names of all existing log categories sorted alphabetically.
 boolean hasCategory(java.lang.String name)
          Whether some category with specified name exists.
 void setLevel(java.util.logging.Level newLevel)
          Set level for all handlers of all categories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.base.utils.logging.ILogCategories
getCategory
 

Constructor Detail

AbstractLogCategories

public AbstractLogCategories()
Method Detail

getCategoriesInternal

protected abstract java.util.Map<java.lang.String,LogCategory> getCategoriesInternal()
Returns:
Muttable map with categories.

hasCategory

public boolean hasCategory(java.lang.String name)
Whether some category with specified name exists.

Specified by:
hasCategory in interface ILogCategories
Parameters:
name -
Returns:

getCategories

public java.util.Map<java.lang.String,LogCategory> getCategories()
Returns IMMUTABLE mapping of cathegories names to instances of those log categories.

You have to synchronize on it before iterating through it!

Specified by:
getCategories in interface ILogCategories
Returns:

addLogCategory

public void addLogCategory(java.lang.String name,
                           LogCategory category)
Used by AbstractAgentLogger to slip itself into the map.

Specified by:
addLogCategory in interface ILogCategories
Parameters:
name -
category -

getCategoryNames

public java.lang.String[] getCategoryNames()
Returns names of all existing log categories.

Specified by:
getCategoryNames in interface ILogCategories
Returns:

getCategoryNamesSorted

public java.lang.String[] getCategoryNamesSorted()
Returns names of all existing log categories sorted alphabetically.

Specified by:
getCategoryNamesSorted in interface ILogCategories
Returns:

setLevel

public void setLevel(java.util.logging.Level newLevel)
Set level for all handlers of all categories.

Specified by:
setLevel in interface ILogCategories
Parameters:
newLevel -