You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rd...@apache.org on 2008/12/03 11:24:47 UTC
svn commit: r722835 -
/james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java
Author: rdonkin
Date: Wed Dec 3 02:24:46 2008
New Revision: 722835
URL: http://svn.apache.org/viewvc?rev=722835&view=rev
Log:
Introduced control over verbose logging
Modified:
james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java
Modified: james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java?rev=722835&r1=722834&r2=722835&view=diff
==============================================================================
--- james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java (original)
+++ james/jsieve/trunk/mailet/src/main/java/org/apache/jsieve/mailet/SieveMailboxMailet.java Wed Dec 3 02:24:46 2008
@@ -46,6 +46,14 @@
/**
* <p>Executes a <a href='http://www.rfc-editor.org/rfc/rfc3028.txt'>Sieve</a>
* script against incoming mail. The script applied is based on the recipient.</p>
+ * <h4>Init Parameters</h4>
+ * <table>
+ * <thead><tr><th>Name</th><th>Required</th><th>Values</th><th>Role</th></thead>
+ * <tr><td>verbose</td><td>No - defaults to false</td><td>true (ignoring case) to enable, otherwise disable</td>
+ * <td>
+ * Enables verbose logging.
+ * </td></tr>
+ * </table>
*/
public class SieveMailboxMailet extends GenericMailet {
@@ -63,6 +71,9 @@
/** Experimental */
private ResourceLocator locator;
+ /** Indicates whether this mailet should log verbosely */
+ private boolean verbose = false;
+
private SieveFactory factory;
/**
@@ -105,6 +116,29 @@
this.poster = poster;
}
+
+ /**
+ * Is this mailet logging verbosely?
+ * This property is set by init parameters.
+ * @return true if logging should be verbose, false otherwise
+ */
+ public boolean isVerbose() {
+ return verbose;
+ }
+
+
+ /**
+ * Sets whether logging should be verbose for this mailet.
+ * This property is set by init parameters.
+ * @param verbose true when logging should be verbose,
+ * false otherwise
+ */
+ public void setVerbose(boolean verbose) {
+ this.verbose = verbose;
+ }
+
+
+
//@Override
public void init(MailetConfig config) throws MessagingException {
@@ -243,8 +277,11 @@
final InputStream ins = locator.get(relativeUri);
MailAdapter aMailAdapter = new SieveMailAdapter(aMail,
getMailetContext());
- log("Evaluating " + aMailAdapter.toString() + "against \""
+ // This logging operation is potentially costly
+ if (verbose) {
+ log("Evaluating " + aMailAdapter.toString() + "against \""
+ relativeUri + "\"");
+ }
factory.evaluate(aMailAdapter, factory.parse(ins));
}
catch (Exception ex)
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org