org.x4juli.global.components
Class AbstractFilter

java.lang.Object
  extended byorg.x4juli.global.components.AbstractComponent
      extended byorg.x4juli.global.components.AbstractFilter
All Implemented Interfaces:
Component, ExtendedFilter, java.util.logging.Filter, OptionHandler
Direct Known Subclasses:
AndFilter, DenyAllFilter, LevelMatchFilter, LevelRangeFilter, StringMatchFilter, WrapperFilter

public abstract class AbstractFilter
extends AbstractComponent
implements ExtendedFilter

The abstract class for every org.x4juli.filter class. The class provides the basic implementation for cascading filters. Different to log4j, java.util.logging.Filter works with booleans (and so has two states) - log4j offers three.

Since:
0.5
Author:
Boris Unckel

Field Summary
private  ExtendedFilter next
          Points to the next filter in the filter chain.
 
Fields inherited from class org.x4juli.global.components.AbstractComponent
INTERNAL_LOG_LEVEL, manager, repository
 
Fields inherited from interface org.x4juli.global.spi.ExtendedFilter
ACCEPT, DENY, X4JULI_ACCEPT, X4JULI_DENY, X4JULI_NEUTRAL
 
Constructor Summary
AbstractFilter()
           
 
Method Summary
 void activateOptions()
          Usually filters options become active when set.
abstract  int decide(ExtendedLogRecord record)
           If the decision is DENY, then the event will be dropped.
 ExtendedFilter getNext()
          Return the pointer to the next filter;
 boolean isLoggable(java.util.logging.LogRecord record)
           
 void setNext(ExtendedFilter next)
          Set the next filter pointer.
 
Methods inherited from class org.x4juli.global.components.AbstractComponent
getLogger, getLogger, getLoggerRepository, getMessageProperties, getNonFloodingLogger, getProperty, getProperty, getProperty, getProperty, resetErrorCount, setObjectStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next

private ExtendedFilter next
Points to the next filter in the filter chain.

Constructor Detail

AbstractFilter

public AbstractFilter()
Method Detail

activateOptions

public void activateOptions()
Usually filters options become active when set. We provide a default do-nothing implementation for convenience.

Specified by:
activateOptions in interface OptionHandler
Since:
0.5
See Also:
OptionHandler.activateOptions()

setNext

public void setNext(ExtendedFilter next)
Description copied from interface: ExtendedFilter
Set the next filter pointer.

Specified by:
setNext in interface ExtendedFilter
Since:
0.5
See Also:
ExtendedFilter.setNext(org.x4juli.global.spi.ExtendedFilter)

getNext

public ExtendedFilter getNext()
Description copied from interface: ExtendedFilter
Return the pointer to the next filter;

Specified by:
getNext in interface ExtendedFilter
Since:
0.5
See Also:
ExtendedFilter.getNext()

decide

public abstract int decide(ExtendedLogRecord record)

If the decision is DENY, then the event will be dropped. If the decision is NEUTRAL, then the next filter, if any, will be invoked. If the decision is ACCEPT then the event will be logged without consulting with other filters in the chain.

Specified by:
decide in interface ExtendedFilter
Parameters:
record - The LoggingEvent to decide upon.
Since:
0.5

isLoggable

public final boolean isLoggable(java.util.logging.LogRecord record)
Specified by:
isLoggable in interface java.util.logging.Filter
Since:
0.5
See Also:
Filter.isLoggable(java.util.logging.LogRecord)


${license_html}