Jalopy 1.0b10

de.hunsicker.jalopy.plugin
Class AbstractAppender

java.lang.Object
  |
  +--org.apache.log4j.AppenderSkeleton
        |
        +--de.hunsicker.jalopy.plugin.AbstractAppender
All Implemented Interfaces:
Appender, OptionHandler, SwingAppender

public abstract class AbstractAppender
extends AppenderSkeleton
implements SwingAppender

Skeleton implementation of an appender which outputs messages in a visual component.

Version:
$Revision: 1.4 $
Author:
Marco Hunsicker

Field Summary
static int POS_COLUMN
          Position of the message text in the regex result.
static int POS_FILENAME
          Position of the filename in the regex result.
static int POS_LINE
          Position of the lineno in the regex result.
static int POS_TEXT
          Position of the message text in the regex result.
protected  Pattern regex
          The regex to parse the messages.
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
AbstractAppender()
          Creates a new AbstractAppender object.
 
Method Summary
abstract  void append(LoggingEvent ev)
          Does the actual outputting.
protected  boolean checkEntryConditions()
          {@inheritDoc}
 void close()
          {@inheritDoc}
 void done()
          {@inheritDoc}
 MatchResult parseMessage(LoggingEvent ev)
          Parses the given message.
 boolean requiresLayout()
          {@inheritDoc}
 void setName(String name)
          Sets the name of the appender.
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.hunsicker.jalopy.plugin.SwingAppender
clear
 
Methods inherited from interface org.apache.log4j.Appender
addFilter, clearFilters, doAppend, getErrorHandler, getFilter, getLayout, getName, setErrorHandler, setLayout
 

Field Detail

POS_FILENAME

public static final int POS_FILENAME
Position of the filename in the regex result.

POS_LINE

public static final int POS_LINE
Position of the lineno in the regex result.

POS_TEXT

public static final int POS_TEXT
Position of the message text in the regex result.

POS_COLUMN

public static final int POS_COLUMN
Position of the message text in the regex result.

regex

protected final Pattern regex
The regex to parse the messages. If messages have a format similiar to Emacs messages (filename:lineno:text) the pattern will match.
Constructor Detail

AbstractAppender

public AbstractAppender()
Creates a new AbstractAppender object.
Throws:
ChainingRuntimeException - DOCUMENT ME!
Method Detail

append

public abstract void append(LoggingEvent ev)
Does the actual outputting.
Overrides:
append in class AppenderSkeleton
Parameters:
ev - logging event.

setName

public final void setName(String name)
Sets the name of the appender. Overidden so that the initial name can't be changed.
Specified by:
setName in interface Appender
Overrides:
setName in class AppenderSkeleton
Parameters:
name - appender name (ignored).

close

public void close()
{@inheritDoc}
Specified by:
close in interface Appender
Overrides:
close in class AppenderSkeleton

done

public void done()
{@inheritDoc}
Specified by:
done in interface SwingAppender

parseMessage

public MatchResult parseMessage(LoggingEvent ev)
Parses the given message. To access the parsed information one may typically use:
 MatchResult result = parseMessage(message);
 if (result == null)
 {
     // handle plain message
     ...
 }
 else
 {
     // this is an Emacs style message, you can easily access the
     // information
     String filename = result.group(POS_FILENAME);
     String line = result.group(POS_LINE);
     String column = result.group(POS_COLUMN);
     String text = result.group(POS_TEXT);
     ...
 }
 
Parameters:
ev - logging event.
Returns:
parsing result. Returns null if the message doesn't match the Emacs format filename:line:column:text.

requiresLayout

public boolean requiresLayout()
{@inheritDoc}
Specified by:
requiresLayout in interface Appender
Overrides:
requiresLayout in class AppenderSkeleton
Returns:
always true.

checkEntryConditions

protected boolean checkEntryConditions()
{@inheritDoc}
Returns:
always true.

Jalopy 1.0b10

Submit a bug or feature.

For further information and documentation, visit the official Jalopy website.
This page generated: November 14 2002