org.oddjob.logging
Class AbstractArchiverCache

java.lang.Object
  extended byorg.oddjob.logging.AbstractArchiverCache
Direct Known Subclasses:
ConsoleArchiverCache, LogArchiverCache

public abstract class AbstractArchiverCache
extends java.lang.Object

An base implementation of a Cache for LogEvents.

Author:
Rob Gordon

Field Summary
protected static LogEvent NO_LOG_AVAILABLE
           
 
Constructor Summary
AbstractArchiverCache()
          Default constructor.
AbstractArchiverCache(int maxHistory)
          Construct a LogArchiver with the given amount of history.
 
Method Summary
protected  void addArchive(LogArchive logArchive)
          Add an achive this Log Archiver.
 void addEvent(java.lang.String archive, LogLevel level, java.lang.String message)
          Add an event to the cache.
 void addLogListener(LogListener l, java.lang.String archive, LogLevel level, long last, int history)
          Add a listener.
abstract  void destroy()
           
 long getLastMessageNumber(java.lang.String archive)
           
 int getMaxHistory()
           
 boolean hasArchive(java.lang.String archive)
          Does this Acchiver contain the given archive.
protected  void removeArchive(java.lang.String archive)
          Remove an archive from this LogArchive.
 boolean removeLogListener(LogListener l, java.lang.String archive)
          Remove a listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_LOG_AVAILABLE

protected static final LogEvent NO_LOG_AVAILABLE
Constructor Detail

AbstractArchiverCache

public AbstractArchiverCache()
Default constructor.


AbstractArchiverCache

public AbstractArchiverCache(int maxHistory)
Construct a LogArchiver with the given amount of history.

Parameters:
maxHistory - The number of lines to store for each logger
Method Detail

getMaxHistory

public int getMaxHistory()

getLastMessageNumber

public long getLastMessageNumber(java.lang.String archive)

addLogListener

public void addLogListener(LogListener l,
                           java.lang.String archive,
                           LogLevel level,
                           long last,
                           int history)
Add a listener.

Parameters:
l - The listener
archive - The archive
level - The level
last - The last message number.
history - The max messages required.

removeLogListener

public boolean removeLogListener(LogListener l,
                                 java.lang.String archive)
Remove a listener.

Parameters:
l - The listener.
archive - The archive.

hasArchive

public boolean hasArchive(java.lang.String archive)
Does this Acchiver contain the given archive.

Parameters:
archive - The archive.
Returns:
true if it does, false if it doesn't.

addArchive

protected void addArchive(LogArchive logArchive)
Add an achive this Log Archiver.


removeArchive

protected void removeArchive(java.lang.String archive)
Remove an archive from this LogArchive.

Parameters:
archive -

addEvent

public void addEvent(java.lang.String archive,
                     LogLevel level,
                     java.lang.String message)
Add an event to the cache.

Parameters:
archive - The archive.
level - The level.
message - The message.

destroy

public abstract void destroy()