org.jscience.util.logging
Class AbstractLogWriter

java.lang.Object
  extended by org.jscience.util.logging.AbstractLogWriter
All Implemented Interfaces:
Filter<LogEntry>, LogWriter
Direct Known Subclasses:
BinaryFileLog, ConsoleLog, JDBCLogWriter, JTextComponentLog, LogFile, SocketWriter, StackTraceFileWriter, StringBufferLog, XMLWriter

public abstract class AbstractLogWriter
extends java.lang.Object
implements LogWriter

provides filtering capabilities for a LogWriter. Extending classes only need to implement writeLogEntry(Object),


Field Summary
protected  Filter<LogEntry> filter
          DOCUMENT ME!
protected  LogEntryFormatter formatter
          DOCUMENT ME!
 
Constructor Summary
protected AbstractLogWriter()
          Creates a new AbstractLogWriter object.
protected AbstractLogWriter(Filter<LogEntry> filter)
          Creates a new AbstractLogWriter object.
protected AbstractLogWriter(Filter<LogEntry> filter, LogEntryFormatter formatter)
          Creates a new AbstractLogWriter object.
protected AbstractLogWriter(LogEntryFormatter formatter)
          Creates a new AbstractLogWriter object.
 
Method Summary
 boolean accept(LogEntry entry)
          returns true if either the filter is null or the filter accepts the given entry
 Filter<LogEntry> getLogFilter()
          DOCUMENT ME!
protected  LogEntryFormatter getLogFormatter()
          DOCUMENT ME!
 void setLogFilter(Filter<LogEntry> filter)
          DOCUMENT ME!
protected  void setLogFormatter(LogEntryFormatter formatter)
          DOCUMENT ME!
 void write(LogEntry entry)
          DOCUMENT ME!
protected abstract  void writeLogEntry(java.lang.Object pattern)
          writes the pattern to the log entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filter

protected Filter<LogEntry> filter
DOCUMENT ME!


formatter

protected LogEntryFormatter formatter
DOCUMENT ME!

Constructor Detail

AbstractLogWriter

protected AbstractLogWriter()
Creates a new AbstractLogWriter object.


AbstractLogWriter

protected AbstractLogWriter(LogEntryFormatter formatter)
Creates a new AbstractLogWriter object.

Parameters:
formatter - DOCUMENT ME!

AbstractLogWriter

protected AbstractLogWriter(Filter<LogEntry> filter)
Creates a new AbstractLogWriter object.

Parameters:
filter - DOCUMENT ME!

AbstractLogWriter

protected AbstractLogWriter(Filter<LogEntry> filter,
                            LogEntryFormatter formatter)
Creates a new AbstractLogWriter object.

Parameters:
filter - DOCUMENT ME!
formatter - DOCUMENT ME!
Method Detail

getLogFilter

public Filter<LogEntry> getLogFilter()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setLogFilter

public void setLogFilter(Filter<LogEntry> filter)
DOCUMENT ME!

Parameters:
filter - DOCUMENT ME!

accept

public boolean accept(LogEntry entry)
returns true if either the filter is null or the filter accepts the given entry

Specified by:
accept in interface Filter<LogEntry>
Parameters:
entry - DOCUMENT ME!
Returns:
DOCUMENT ME!

write

public void write(LogEntry entry)
           throws LogException
DOCUMENT ME!

Specified by:
write in interface LogWriter
Parameters:
entry - DOCUMENT ME!
Throws:
LogException - DOCUMENT ME!

writeLogEntry

protected abstract void writeLogEntry(java.lang.Object pattern)
                               throws LogException
writes the pattern to the log entity. If the LogEntryFormatter is null, the pattern is the LogEntry object itself; otherwise, the pattern is the result of formatting the LogEntry with the given LogEntryFormatter.

Parameters:
pattern - DOCUMENT ME!
Throws:
LogException - DOCUMENT ME!

getLogFormatter

protected LogEntryFormatter getLogFormatter()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setLogFormatter

protected void setLogFormatter(LogEntryFormatter formatter)
DOCUMENT ME!

Parameters:
formatter - DOCUMENT ME!