01: /*
02: * TextFilter.java
03: *
04: * Created on 28. August 2003, 22:09
05: */
06:
07: package org.jzonic.jlo.filter;
08:
09: import java.util.Map;
10:
11: /**
12: * This is a simple text filter. The filter will check
13: * if the given expression appears in the message. The
14: * filter is not case sensitive
15: *
16: * @author Andreas Mecky andreasmecky@yahoo.de
17: */
18: public class TextFilter implements LogFilter {
19:
20: private String expression;
21:
22: public TextFilter() {
23: }
24:
25: public boolean match(String message) {
26: if (message != null) {
27: String tmp = message.toUpperCase();
28: if (tmp.indexOf(expression) != -1) {
29: return true;
30: }
31: }
32: return false;
33: }
34:
35: public void setParameters(Map parameter) {
36: if (parameter.containsKey("expression")) {
37: expression = (String) parameter.get("expression");
38: expression = expression.toUpperCase();
39: }
40: }
41:
42: }
|