com.tivoli.jflt
Class LogManager

java.lang.Object
  |
  +--com.tivoli.jflt.LogManager
Direct Known Subclasses:
CircularBufferManager, StandardManager

public abstract class LogManager
extends java.lang.Object

LogManager is a JFLT facility from which JFLT-compliant GenericLogger objects are obtained.

The LogManager is a process singleton that can be configured via the static setManager method for using a specialized user's manager implementation. Users must obtain a reference to this singleton manager instance via the getManager method. When a user requests a named message logger from the manager, the manager will create it and then returns a reference to the caller.

Version:
1.2
Author:
Cosimo Vampo, Raimondo Castino

Constructor Summary
protected LogManager()
          Creates a new LogManger.
 
Method Summary
protected abstract  LogAdapter createLogAdapter(LoggerParameters params)
          This method must be provided by manager specializations.
protected  LogCatalog createLogCatalog(java.lang.String catalogName)
          Creates a new LogCatalog instance.
 GenericLogger createLogger(java.lang.String organization, java.lang.String product, java.lang.String component, java.lang.String name, java.lang.String catalogName)
          Creates the specified GenericLogger.
static LogManager getManager()
          Gets the LogManager.
static long getSequenceNumber()
          Gets the sequence number that identifies the current logging manager.
static void setManager(LogManager manager, java.lang.Class catalogClass)
          Configures the LogManager class for using the specified manager specialization and message catalog implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogManager

protected LogManager()
Creates a new LogManger.
Method Detail

getManager

public static final LogManager getManager()
Gets the LogManager. If the LogManager has already been configured for using a manager specialization through a previous call to setManager, the given manager specialization is returned. Otherwise, a default manager used for managing a circular buffer is created and returned.
Returns:
The log manager specialization currently in use.

setManager

public static final void setManager(LogManager manager,
                                    java.lang.Class catalogClass)
Configures the LogManager class for using the specified manager specialization and message catalog implementation.

The sequence number is incremented by one.

Parameters:
manager - The manager specialization. If null, the current manager is used.
catalogClass - The class implementing the LogCatalog interface or null for setting the default catalog implementation (LogCatalogSupport).
Throws:
java.lang.IllegalArgumentException - catalogClass does not implement LogCatalog interface.

getSequenceNumber

public static final long getSequenceNumber()
Gets the sequence number that identifies the current logging manager.
Returns:
The sequence number within the JVM. It's a serial number identifying a particular instance of LogManager in the context of the JVM.

createLogCatalog

protected LogCatalog createLogCatalog(java.lang.String catalogName)
                               throws java.lang.InstantiationException,
                                      java.lang.IllegalAccessException
Creates a new LogCatalog instance.
Parameters:
catalogName - The name used for identifying the catalog containing the logging messages. If null no message catalog is set.
Throws:
java.lang.InstantiationException - If the message catalog class represents an abstract class, or a class without default constructor; or if the instantiation fails for some other reason.
java.lang.IllegalAccessException - If the message catalog class or initializer is not accessible.

createLogger

public GenericLogger createLogger(java.lang.String organization,
                                  java.lang.String product,
                                  java.lang.String component,
                                  java.lang.String name,
                                  java.lang.String catalogName)
Creates the specified GenericLogger. The returned object is fully configured to log messages.
Parameters:
organization - The name of the organization. May not be null or empty String.
product - The name of the product. May not be null or empty String.
component - The name of the component. May not be null or empty String.
name - The name of the logger. May not be null or empty String.
catalogName - The catalog name, usually a Java resource bundle. If null no message catalog is set.
Returns:
A reference to the requested generic logger.

createLogAdapter

protected abstract LogAdapter createLogAdapter(LoggerParameters params)
This method must be provided by manager specializations. It is recommended that this method returns a new instance of a LogAdapter specialization each time is invoked.