org.archive.io
Class SinkHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.archive.io.SinkHandler

public class SinkHandler
extends java.util.logging.Handler

A handler that keeps an in-memory vector of all events deemed loggable by configuration. Use it to iterate over logged events long after their occurance. One such use is as a sink for WARNING+SEVERE loggable events. Has support for whether a log record has been already-read. TODO: Add being able to get LogRecords by log level: i.e. return all Level.SEVERE, etc. TODO: Back the vector with a bdbje collection.

Version:
$Date: 2006-09-22 17:23:04 +0000 (Fri, 22 Sep 2006) $ $Revision: 4646 $
Author:
stack

Constructor Summary
SinkHandler()
           
 
Method Summary
 void close()
           
 void flush()
           
 SinkHandlerLogRecord get(long id)
           
 java.util.Vector getAll()
           
 java.util.Vector<SinkHandlerLogRecord> getAllUnread()
           
 int getCount()
           
static SinkHandler getInstance()
           
 int getUnreadCount()
           
 void publish(java.util.logging.LogRecord record)
           
 void read(long id)
           
 SinkHandlerLogRecord remove(long id)
           
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SinkHandler

public SinkHandler()
Method Detail

publish

public void publish(java.util.logging.LogRecord record)
Specified by:
publish in class java.util.logging.Handler

flush

public void flush()
Specified by:
flush in class java.util.logging.Handler

close

public void close()
           throws java.lang.SecurityException
Specified by:
close in class java.util.logging.Handler
Throws:
java.lang.SecurityException

getInstance

public static SinkHandler getInstance()
Returns:
SinkHandler instance if one registered or null.

getAll

public java.util.Vector getAll()
Returns:
all SinkHandlerLogRecords.

getAllUnread

public java.util.Vector<SinkHandlerLogRecord> getAllUnread()
Returns:
Return all unread SinkHandlerLogRecords or null if none unread

getCount

public int getCount()
Returns:
Count of all records.

getUnreadCount

public int getUnreadCount()
Returns:
The count of unread log records.

get

public SinkHandlerLogRecord get(long id)
Parameters:
id - The sequenceNumber ID of the log record to find.
Returns:
A SinkHandlerLogRecord of the given ID or null if not found.

remove

public SinkHandlerLogRecord remove(long id)
Parameters:
id - The sequenceNumber ID of the log record to find.
Returns:
The removed SinkHandlerLogRecord or null if none removed.

read

public void read(long id)
Parameters:
id - The sequenceNumber ID of the log record to find and mark as read.


Copyright © 2003-2011 Internet Archive. All Rights Reserved.