[logback-dev] svn commit: r1079 - logback/trunk/logback-core/src/main/java/ch/qos/logback/core/filter

noreply.seb at qos.ch noreply.seb at qos.ch
Wed Dec 13 15:00:45 CET 2006


Author: seb
Date: Wed Dec 13 15:00:45 2006
New Revision: 1079

Removed:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/filter/AbstractEvalutatorFilter.java
Modified:
   logback/trunk/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java

Log:
Removed unecessary class and moved its content into EvaluatorFilter

Modified: logback/trunk/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java
==============================================================================
--- logback/trunk/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java	(original)
+++ logback/trunk/logback-core/src/main/java/ch/qos/logback/core/filter/EvaluatorFilter.java	Wed Dec 13 15:00:45 2006
@@ -4,10 +4,48 @@
 import ch.qos.logback.core.boolex.EventEvaluator;
 import ch.qos.logback.core.spi.FilterReply;
 
-public class EvaluatorFilter extends AbstractEvalutatorFilter {
+/**
+ * The value of the {@link #onMatch} and {@link #onMismatch} attributes is set to 
+ * {@link Filter.NEUTRAL}, so that a badly configured evaluator filter doesn't 
+ * disturb the functionning of the chain.
+ * </p>
+ * <p>
+ * It is expected that one of the two attributes will have its value changed to
+ * {@link Filter.ACCEPT} or {@link Filter.DENY}. That way, it is possible to decide if 
+ * a given result must be returned after the evaluation either failed or succeeded.
+ * </p>
+ * 
+ * @author Ceki G&uuml;lc&uuml;
+ * @author S&eacute;bastien Pennec
+ */
+
+public class EvaluatorFilter extends Filter {
 
   EventEvaluator evaluator;
   
+  protected FilterReply onMatch = FilterReply.NEUTRAL;
+  protected FilterReply onMismatch = FilterReply.NEUTRAL;
+
+  final public void setOnMatch(String action) {
+    if ("NEUTRAL".equals(action)) {
+      onMatch = FilterReply.NEUTRAL;
+    } else if ("ACCEPT".equals(action)) {
+      onMatch = FilterReply.ACCEPT;
+    } else if ("DENY".equals(action)) {
+      onMatch = FilterReply.DENY;
+    }
+  }
+
+  final public void setOnMismatch(String action) {
+    if ("NEUTRAL".equals(action)) {
+      onMismatch = FilterReply.NEUTRAL;
+    } else if ("ACCEPT".equals(action)) {
+      onMismatch = FilterReply.ACCEPT;
+    } else if ("DENY".equals(action)) {
+      onMismatch = FilterReply.DENY;
+    }
+  }
+  
   @Override
   public void start() {
     if(evaluator != null) {



More information about the logback-dev mailing list