org.apache.log4j.chainsaw
Class RuleMediator

java.lang.Object
  extended by org.apache.log4j.rule.AbstractRule
      extended by org.apache.log4j.chainsaw.RuleMediator
All Implemented Interfaces:
java.io.Serializable, org.apache.log4j.rule.Rule

public class RuleMediator
extends org.apache.log4j.rule.AbstractRule
implements org.apache.log4j.rule.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(org.apache.log4j.spi.LoggingEvent e)
           
 org.apache.log4j.rule.Rule getExclusionRule()
           
 org.apache.log4j.rule.Rule getInclusionRule()
           
 org.apache.log4j.rule.Rule getLoggerRule()
           
 org.apache.log4j.rule.Rule getRefinementRule()
           
 void setExclusionRule(org.apache.log4j.rule.Rule r)
          Sets the Exclusion rule to be used, and fires a PropertyChangeEvent to listeners.
 void setInclusionRule(org.apache.log4j.rule.Rule r)
          Sets the Inclusion rule to be used, and fires a PropertyChangeEvent to listeners
 void setLoggerRule(org.apache.log4j.rule.Rule r)
           
 void setRefinementRule(org.apache.log4j.rule.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(org.apache.log4j.spi.LoggingEvent e)
Specified by:
evaluate in interface org.apache.log4j.rule.Rule

setInclusionRule

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

Parameters:
r -

setRefinementRule

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

Parameters:
r -

setLoggerRule

public void setLoggerRule(org.apache.log4j.rule.Rule r)

setExclusionRule

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

Parameters:
r -

getExclusionRule

public final org.apache.log4j.rule.Rule getExclusionRule()
Returns:
exclusion rule

getInclusionRule

public final org.apache.log4j.rule.Rule getInclusionRule()
Returns:
inclusion rule

getLoggerRule

public final org.apache.log4j.rule.Rule getLoggerRule()
Returns:
logger rule

getRefinementRule

public final org.apache.log4j.rule.Rule getRefinementRule()
Returns:
refinement rule


Copyright © 2007 Apache Software Foundation. All Rights Reserved.