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 2016/09/15 10:08:44 UTC

[03/17] james-project git commit: MAILET-124 Changing composite matcher interface

MAILET-124 Changing composite matcher interface


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/185f5b09
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/185f5b09
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/185f5b09

Branch: refs/heads/master
Commit: 185f5b098094e54c96a437038b5f22434686e3db
Parents: b3fb0ef
Author: Benoit Tellier <bt...@linagora.com>
Authored: Thu Sep 1 15:19:17 2016 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Sep 15 11:50:49 2016 +0200

----------------------------------------------------------------------
 .../impl/jmx/JMXStateMailetProcessorListener.java       |  2 +-
 .../mailetcontainer/impl/matchers/CompositeMatcher.java |  7 ++++---
 .../impl/matchers/GenericCompositeMatcher.java          | 12 +++++++-----
 3 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/185f5b09/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java
index acb977a..1a826cf 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/jmx/JMXStateMailetProcessorListener.java
@@ -150,7 +150,7 @@ public class JMXStateMailetProcessorListener implements MailetProcessorListener,
             if (matcher instanceof CompositeMatcher) {
                 // we increment the nesting as we have one more child level and
                 // register the child matchers
-                registerMatchers(matcherMBeanName, ((CompositeMatcher) matcher).iterator(), nestingLevel + 1);
+                registerMatchers(matcherMBeanName, ((CompositeMatcher) matcher).getMatchers().iterator(), nestingLevel + 1);
             }
 
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/185f5b09/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/CompositeMatcher.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/CompositeMatcher.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/CompositeMatcher.java
index 7bdf47f..6a759d4 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/CompositeMatcher.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/CompositeMatcher.java
@@ -19,7 +19,8 @@
 
 package org.apache.james.mailetcontainer.impl.matchers;
 
-import java.util.Iterator;
+import java.util.List;
+
 import org.apache.mailet.Matcher;
 
 /**
@@ -54,9 +55,9 @@ import org.apache.mailet.Matcher;
 public interface CompositeMatcher extends Matcher {
 
     /**
-     * @return Iterator if child Matchers
+     * @return Immutable list for the child matchers
      */
-    Iterator<Matcher> iterator();
+    List<Matcher> getMatchers();
 
     /**
      * Add a child matcher to this composite matcher. This is called by

http://git-wip-us.apache.org/repos/asf/james-project/blob/185f5b09/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/GenericCompositeMatcher.java
----------------------------------------------------------------------
diff --git a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/GenericCompositeMatcher.java b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/GenericCompositeMatcher.java
index 936fcc1..7158ef2 100644
--- a/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/GenericCompositeMatcher.java
+++ b/server/mailet/mailetcontainer-camel/src/main/java/org/apache/james/mailetcontainer/impl/matchers/GenericCompositeMatcher.java
@@ -19,13 +19,15 @@
 
 package org.apache.james.mailetcontainer.impl.matchers;
 
-import java.util.Collection;
-import java.util.Iterator;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
 
 import org.apache.mailet.Matcher;
 import org.apache.mailet.base.GenericMatcher;
 
+import com.google.common.collect.ImmutableList;
+
 /**
  * Abstract base class for CompositeMatchers. This class handles the child
  * collection of Matchers associated with the CompositeMatcher.
@@ -43,10 +45,10 @@ public abstract class GenericCompositeMatcher extends GenericMatcher implements
     }
 
     /**
-     * @return Iterator for the child matchers
+     * @return Immutable collection for the child matchers
      */
-    public Iterator<Matcher> iterator() {
-        return matchers.iterator();
+    public List<Matcher> getMatchers() {
+        return ImmutableList.copyOf(matchers);
     }
 
     // the collection used to store the child-matchers


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org