1 17 18 package org.apache.mailet; 19 20 import javax.mail.MessagingException ; 21 import java.util.Collection ; 22 23 34 public abstract class GenericMatcher implements Matcher, MatcherConfig { 35 MatcherConfig config = null; 36 37 41 public void destroy() { 42 } 44 45 54 public String getCondition() { 55 return config.getCondition(); 56 } 57 58 63 public MatcherConfig getMatcherConfig() { 64 return config; 65 } 66 67 73 public MailetContext getMailetContext() { 74 return getMatcherConfig().getMailetContext(); 75 } 76 77 84 public String getMatcherInfo() { 85 return ""; 86 } 87 88 93 public String getMatcherName() { 94 return config.getMatcherName(); 95 } 96 97 98 111 public void init(MatcherConfig newConfig) throws MessagingException { 112 config = newConfig; 113 init(); 114 } 115 116 127 public void init() throws MessagingException { 128 } 130 131 137 public void log(String message) { 138 StringBuffer logBuffer = 139 new StringBuffer (256) 140 .append(getMatcherName()) 141 .append(": ") 142 .append(message); 143 getMailetContext().log(logBuffer.toString()); 144 } 145 146 153 public void log(String message, Throwable t) { 154 StringBuffer logBuffer = 155 new StringBuffer (256) 156 .append(getMatcherName()) 157 .append(": ") 158 .append(message); 159 getMailetContext().log(logBuffer.toString(), t); 160 } 161 162 175 public abstract Collection match(Mail mail) throws MessagingException ; 176 } 177 | Popular Tags |