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 bt...@apache.org on 2017/06/16 02:45:06 UTC
james-project git commit: JAMES-2057 Provide missing javadocs
Repository: james-project
Updated Branches:
refs/heads/master 6ea664e94 -> d87faa70b
JAMES-2057 Provide missing javadocs
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/d87faa70
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/d87faa70
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/d87faa70
Branch: refs/heads/master
Commit: d87faa70bdc572a2f7db5da61b0e860047031ce4
Parents: 6ea664e
Author: benwa <bt...@linagora.com>
Authored: Thu Jun 15 18:19:17 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Fri Jun 16 09:42:58 2017 +0700
----------------------------------------------------------------------
.../transport/mailets/AddDeliveredToHeader.java | 9 +++++++++
.../apache/james/transport/mailets/AddFooter.java | 2 +-
.../james/transport/matchers/RecipientIs.java | 12 ++++++++++++
.../apache/james/transport/matchers/SenderIs.java | 12 ++++++++++++
.../james/transport/matchers/SentByMailet.java | 11 +++++++++--
.../james/transport/matchers/TooManyLines.java | 10 ++++++++++
.../transport/matchers/TooManyRecipients.java | 9 +++++++++
.../java/com/custom/mailets/AnotherMailet.java | 5 +++++
.../java/com/custom/matchers/AnotherMatcher.java | 6 ++++++
.../james/transport/mailets/CustomMailet.java | 6 ++++++
.../james/transport/matchers/CustomMatcher.java | 6 ++++++
.../james/mailetcontainer/impl/matchers/Not.java | 18 +++++++++---------
.../james/mailetcontainer/impl/matchers/Or.java | 14 +++++++-------
.../james/mailetcontainer/impl/matchers/Xor.java | 16 ++++++++--------
.../matchers/AbstractSQLWhitelistMatcher.java | 3 +++
.../james/transport/matchers/IsOverQuota.java | 14 ++++++++++++++
16 files changed, 126 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddDeliveredToHeader.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddDeliveredToHeader.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddDeliveredToHeader.java
index ac339b1..d4a4082 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddDeliveredToHeader.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddDeliveredToHeader.java
@@ -26,6 +26,15 @@ import org.apache.mailet.MailAddress;
import org.apache.mailet.PerRecipientHeaders;
import org.apache.mailet.base.GenericMailet;
+/**
+ * This mailet adds the de-facto standard QMail Delivered-To header.
+ *
+ * Upon processing by LocalDelivery, a Delivered-To header matching the recipient mail address will be added before storage.
+ *
+ * <pre><code>
+ * <mailet match="All" class="<AddDeliveredToHeader>"/>
+ * </code></pre>
+ */
public class AddDeliveredToHeader extends GenericMailet {
public static final String DELIVERED_TO = "Delivered-To";
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java
index 9cf44f9..7e1b38c 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/mailets/AddFooter.java
@@ -38,7 +38,7 @@ import org.apache.mailet.base.RFC2822Headers;
import com.google.common.base.Optional;
-/*
+/**
* Takes the message and attaches a footer message to it. Right now, it only
* supports simple messages. Needs to have additions to make it support
* messages with alternate content types or with attachments.
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/mailet/standard/src/main/java/org/apache/james/transport/matchers/RecipientIs.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/RecipientIs.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/RecipientIs.java
index 3dce311..6030e91 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/RecipientIs.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/RecipientIs.java
@@ -29,6 +29,18 @@ import org.apache.mailet.base.GenericRecipientMatcher;
import com.google.common.base.Strings;
+
+/**
+ * This matcher matches a specific recipient (in the envelope of the mail), passed as a condition to this matcher.
+ *
+ *
+ * <p>The example below will match only the recipient user@domain</p>
+ *
+ * <pre><code>
+ * <mailet match="RecipientIs=user@domain" class="<any-class>">
+ * </mailet>
+ * </code></pre>
+ */
public class RecipientIs extends GenericRecipientMatcher {
private Collection<MailAddress> recipients;
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
index 0774a2c..b0d7239 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/SenderIs.java
@@ -32,6 +32,18 @@ import org.apache.mailet.base.GenericMatcher;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
+
+/**
+ * This matcher matches a specific sender, passed as a condition to this matcher.
+ *
+ *
+ * <p>The example below will match mail with a sender being user@domain</p>
+ *
+ * <pre><code>
+ * <mailet match="SenderIs=user@domain" class="<any-class>">
+ * </mailet>
+ * </code></pre>
+ */
public class SenderIs extends GenericMatcher {
private Set<MailAddress> senders;
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/mailet/standard/src/main/java/org/apache/james/transport/matchers/SentByMailet.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/SentByMailet.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/SentByMailet.java
index 0df6e96..df173cf 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/SentByMailet.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/SentByMailet.java
@@ -17,8 +17,6 @@
* under the License. *
****************************************************************/
-
-
package org.apache.james.transport.matchers;
import java.util.Collection;
@@ -28,6 +26,15 @@ import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.base.GenericMatcher;
+/**
+ * This matcher matches email sent automatically by mailets.
+ *
+ * <pre><code>
+ * <mailet match="SentByMailetAny" class="<any-class>"/>
+ * </code></pre>
+ *
+ * This matcher allows you, for instance, to enable/disable routing automatically generated emails out of your server.
+ */
public class SentByMailet extends GenericMatcher {
public Collection<MailAddress> match(Mail mail) {
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyLines.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyLines.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyLines.java
index aa37378..958990f 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyLines.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyLines.java
@@ -30,6 +30,16 @@ import org.apache.mailet.base.MailetUtil;
import com.google.common.collect.ImmutableList;
+/**
+ * This matcher matches emails that have too many lines. This allows better rejection of emails when, for instance, MIME4J
+ * is configured with a limited number of lines.
+ *
+ * <p>The example below will match mail with more than 10000 lines</p>
+ *
+ * <pre><code>
+ * <mailet match="TooManyLines=10000" class="<any-class>"/>
+ * </code></pre>
+ */
public class TooManyLines extends GenericMatcher {
private int maximumLineCount;
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java
----------------------------------------------------------------------
diff --git a/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java b/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java
index abaeb96..f7d3e92 100644
--- a/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java
+++ b/mailet/standard/src/main/java/org/apache/james/transport/matchers/TooManyRecipients.java
@@ -30,6 +30,15 @@ import org.apache.mailet.base.MailetUtil;
import com.google.common.collect.ImmutableList;
+/**
+ * This matcher matches emails that have too many recipients.
+ *
+ * <p>The example below will reject any email with more than 5 recipients</p>
+ *
+ * <pre><code>
+ * <mailet match="TooManyRecipients=5" class="<any-class>"/>
+ * </code></pre>
+ */
public class TooManyRecipients extends GenericMatcher {
private int maximumRecipientCount;
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/container/guice/custom-mailets/src/main/java/com/custom/mailets/AnotherMailet.java
----------------------------------------------------------------------
diff --git a/server/container/guice/custom-mailets/src/main/java/com/custom/mailets/AnotherMailet.java b/server/container/guice/custom-mailets/src/main/java/com/custom/mailets/AnotherMailet.java
index e9d0baf..ec9eb26 100644
--- a/server/container/guice/custom-mailets/src/main/java/com/custom/mailets/AnotherMailet.java
+++ b/server/container/guice/custom-mailets/src/main/java/com/custom/mailets/AnotherMailet.java
@@ -24,6 +24,11 @@ import javax.mail.MessagingException;
import org.apache.mailet.Mail;
import org.apache.mailet.base.GenericMailet;
+/**
+ * Mailet introduced for testing purposes.
+ *
+ * Does nothing.
+ */
public class AnotherMailet extends GenericMailet {
@Override
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/container/guice/custom-mailets/src/main/java/com/custom/matchers/AnotherMatcher.java
----------------------------------------------------------------------
diff --git a/server/container/guice/custom-mailets/src/main/java/com/custom/matchers/AnotherMatcher.java b/server/container/guice/custom-mailets/src/main/java/com/custom/matchers/AnotherMatcher.java
index c7acef9..06cd44a 100644
--- a/server/container/guice/custom-mailets/src/main/java/com/custom/matchers/AnotherMatcher.java
+++ b/server/container/guice/custom-mailets/src/main/java/com/custom/matchers/AnotherMatcher.java
@@ -27,6 +27,12 @@ import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.base.GenericMatcher;
+
+/**
+ * Matcher introduced for testing purposes.
+ *
+ * Rejects all recipients.
+ */
public class AnotherMatcher extends GenericMatcher {
@Override
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/mailets/CustomMailet.java
----------------------------------------------------------------------
diff --git a/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/mailets/CustomMailet.java b/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/mailets/CustomMailet.java
index 0b4fe66..f8420fb 100644
--- a/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/mailets/CustomMailet.java
+++ b/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/mailets/CustomMailet.java
@@ -24,6 +24,12 @@ import javax.mail.MessagingException;
import org.apache.mailet.Mail;
import org.apache.mailet.base.GenericMailet;
+
+/**
+ * Mailet introduced for testing purposes.
+ *
+ * Does nothing.
+ */
public class CustomMailet extends GenericMailet {
@Override
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/matchers/CustomMatcher.java
----------------------------------------------------------------------
diff --git a/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/matchers/CustomMatcher.java b/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/matchers/CustomMatcher.java
index 8c2469c..785592a 100644
--- a/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/matchers/CustomMatcher.java
+++ b/server/container/guice/custom-mailets/src/main/java/org/apache/james/transport/matchers/CustomMatcher.java
@@ -27,6 +27,12 @@ import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.base.GenericMatcher;
+
+/**
+ * Matcher introduced for testing purposes.
+ *
+ * Rejects all recipients.
+ */
public class CustomMatcher extends GenericMatcher {
@Override
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java
index b8751f2..e7a8baf 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Not.java
@@ -31,17 +31,17 @@ import org.apache.mailet.Matcher;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
+/**
+ * This is the Not CompositeMatcher - consider what wasn't in the result set
+ * of each child matcher. Of course it is easier to understand if it only
+ * includes one matcher in the composition, the normal recommended use. @See
+ * CompositeMatcher interface.
+ *
+ * @return Collection of Recipients from the Negated composition of the child
+ * Matcher(s).
+ */
public class Not extends GenericCompositeMatcher {
- /**
- * This is the Not CompositeMatcher - consider what wasn't in the result set
- * of each child matcher. Of course it is easier to understand if it only
- * includes one matcher in the composition, the normal recommended use. @See
- * CompositeMatcher interface.
- *
- * @return Collectiom of Recipient from the Negated composition of the child
- * Matcher(s).
- */
public Collection<MailAddress> match(Mail mail) throws MessagingException {
Collection<MailAddress> finalResult = Optional.fromNullable(Lists.newArrayList(mail.getRecipients())).or(new ArrayList<MailAddress>());
for (Matcher matcher : getMatchers()) {
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
index 5f5f00f..6ba1e85 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Or.java
@@ -28,15 +28,15 @@ import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.Matcher;
+/**
+ * This is the Or CompositeMatcher - consider it to be a union of the
+ * results.
+ *
+ * @return Collection of Recipients from the Or composition results of the
+ * child matchers.
+ */
public class Or extends GenericCompositeMatcher {
- /**
- * This is the Or CompositeMatcher - consider it to be a union of the
- * results.
- *
- * @return Collection of Recipient from the Or composition results of the
- * child matchers.
- */
public Collection<MailAddress> match(Mail mail) throws MessagingException {
HashSet<MailAddress> result = new HashSet<MailAddress>();
for (Matcher matcher : getMatchers()) {
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java
index bc9d251..963273f 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/Xor.java
@@ -31,16 +31,16 @@ import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
+/**
+ * This is the Xor CompositeMatcher - consider it to be the inequality
+ * operator for recipients. If any recipients match other matcher results
+ * then the result does not include that recipient.
+ *
+ * @return Collection of Recipients from the Xor composition of the child
+ * matchers.
+ */
public class Xor extends GenericCompositeMatcher {
- /**
- * This is the Xor CompositeMatcher - consider it to be the inequality
- * operator for recipients. If any recipients match other matcher results
- * then the result does not include that recipient.
- *
- * @return Collection of Recipients from the Xor composition of the child
- * matchers.
- */
public Collection<MailAddress> match(Mail mail) throws MessagingException {
Collection<MailAddress> finalResult = null;
boolean first = true;
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java
index cbff433..f23d7d1 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/AbstractSQLWhitelistMatcher.java
@@ -45,6 +45,9 @@ import org.apache.mailet.Mail;
import org.apache.mailet.MailAddress;
import org.apache.mailet.base.GenericMatcher;
+/**
+ * No documentation is available for this deprecated, experimental matcher.
+ */
@SuppressWarnings("deprecation")
@Experimental
public abstract class AbstractSQLWhitelistMatcher extends GenericMatcher {
http://git-wip-us.apache.org/repos/asf/james-project/blob/d87faa70/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsOverQuota.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsOverQuota.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsOverQuota.java
index ba97c78..c8216b4 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsOverQuota.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/IsOverQuota.java
@@ -40,6 +40,20 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+/**
+ * This matcher will check if the incoming email will make recipients exceed their quotas.
+ *
+ * Quota are managed directly by the mailbox. Performance will depend on your implementation (Cassandra and JPA maintains counts, thus it is a fast operation).
+ *
+ * Here is a configuration example:
+ *
+ * <pre><code>
+ * <mailet match="IsOverQuota" class="<any-class>"/>
+ * </code></pre>
+ *
+ * Read the <a href="http://james.apache.org/server/manage-cli.html">CLI documentation on how to configure quota</a>. Note:
+ * managing quotas can also be done through <a href="http://james.apache.org/server/manage-webadmin.html">WebAdmin</a>.
+ */
public class IsOverQuota extends GenericMatcher {
private static final Logger LOGGER = LoggerFactory.getLogger(IsOverQuota.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org