Log4j 1.3alpha-3

org.apache.log4j.chainsaw
Class RuleMediator

java.lang.Object
  |
  +--org.apache.log4j.rule.AbstractRule
        |
        +--org.apache.log4j.chainsaw.RuleMediator
All Implemented Interfaces:
Rule, java.io.Serializable

public class RuleMediator
extends AbstractRule
implements Rule

A mediator class that implements the Rule interface, by combining several optional rules used by Chainsaw's filtering GUI's into a single Rule. This class is based upon the concept of Inclusion, Exclusion and Refinement. By default, this class accepts all events by returning true as part of the Rule interface, unless the Inclusion/Exclusion/Refinement sub-rules have been configured. The sub-rules are queried in this order: Inclusion, Refinement, Exclusion. If any are null, that particular sub-rule is not queried. If any of the sub-rules returns false, this mediator returns false immediately, otherwise they are queried in that order to ensure the overall rule evaluates. Setting the individual sub-rules propagates a PropertyChangeEvent as per standard Java beans principles.

Author:
Paul Smith , Scott Deboy
See Also:
Serialized Form

Constructor Summary
RuleMediator()
           
 
Method Summary
 boolean evaluate(LoggingEvent e)
          Returns true if this implementation of the rule accepts the LoggingEvent, or false if not.
 Rule getExclusionRule()
           
 Rule getInclusionRule()
           
 Rule getLoggerRule()
           
 Rule getRefinementRule()
           
 void setExclusionRule(Rule r)
          Sets the Exclusion rule to be used, and fires a PropertyChangeEvent to listeners.
 void setInclusionRule(Rule r)
          Sets the Inclusion rule to be used, and fires a PropertyChangeEvent to listeners
 void setLoggerRule(Rule r)
           
 void setRefinementRule(Rule r)
          Sets the Refinement rule to be used, and fires a PropertyChangeEvent to listeners
 
Methods inherited from class org.apache.log4j.rule.AbstractRule
addPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.log4j.rule.Rule
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

RuleMediator

public RuleMediator()
Method Detail

evaluate

public boolean evaluate(LoggingEvent e)
Description copied from interface: Rule
Returns true if this implementation of the rule accepts the LoggingEvent, or false if not. What True/False means can be client-specific.

Specified by:
evaluate in interface Rule
Parameters:
e - LoggingEvent this instance will evaluate
Returns:
true if this Rule instance accepts the event, otherwise false.

setInclusionRule

public void setInclusionRule(Rule r)
Sets the Inclusion rule to be used, and fires a PropertyChangeEvent to listeners

Parameters:
r -

setRefinementRule

public void setRefinementRule(Rule r)
Sets the Refinement rule to be used, and fires a PropertyChangeEvent to listeners

Parameters:
r -

setLoggerRule

public void setLoggerRule(Rule r)

setExclusionRule

public void setExclusionRule(Rule r)
Sets the Exclusion rule to be used, and fires a PropertyChangeEvent to listeners.

Parameters:
r -

getExclusionRule

public final Rule getExclusionRule()
Returns:
exclusion rule

getInclusionRule

public final Rule getInclusionRule()
Returns:
inclusion rule

getLoggerRule

public final Rule getLoggerRule()
Returns:
logger rule

getRefinementRule

public final Rule getRefinementRule()
Returns:
refinement rule

Log4j 1.3alpha-3

Copyright 2000-2003 Apache Software Foundation.