james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [09/15] james-project git commit: MAILBOX-317 Limit the number of constructor of StoreMailboxManager
Date Fri, 03 Nov 2017 02:33:26 GMT
MAILBOX-317 Limit the number of constructor of StoreMailboxManager


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

Branch: refs/heads/master
Commit: fb0c391be061f6273d50962a3b298d46c5dfabcb
Parents: f5a2bbf
Author: benwa <btellier@linagora.com>
Authored: Thu Nov 2 09:36:33 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Nov 3 09:32:32 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/jpa/JPAMailboxManager.java    | 11 ++++-
 .../jpa/openjpa/OpenJPAMailboxManager.java      | 18 +++++--
 .../maildir/MaildirMailboxManagerProvider.java  |  7 ++-
 .../inmemory/InMemoryMailboxManager.java        |  6 ++-
 .../inmemory/MemoryMailboxManagerProvider.java  |  7 ++-
 .../mailbox/store/StoreMailboxManager.java      | 50 ++------------------
 .../StoreMailboxManagerAnnotationTest.java      | 11 +++--
 .../mailbox/store/StoreMailboxManagerTest.java  |  7 ++-
 .../james/mailbox/copier/MailboxCopierTest.java | 12 +++--
 .../host/ElasticSearchHostSystem.java           | 11 +++--
 .../maildir/host/MaildirHostSystem.java         |  7 ++-
 .../adapter/mailbox/MailboxManagementTest.java  |  7 +++
 .../apache/james/pop3server/POP3ServerTest.java | 12 +++--
 13 files changed, 96 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java
b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java
index 2c61935..77dcc68 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/JPAMailboxManager.java
@@ -31,6 +31,8 @@ import org.apache.james.mailbox.store.Authenticator;
 import org.apache.james.mailbox.store.Authorizator;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.event.DelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 import org.apache.james.mailbox.store.transaction.Mapper;
@@ -46,9 +48,11 @@ public abstract class JPAMailboxManager extends StoreMailboxManager {
                              MailboxPathLocker locker,
                              MessageParser messageParser,
                              MessageId.Factory messageIdFactory,
+                             DelegatingMailboxListener delegatingMailboxListener,
+                             MailboxEventDispatcher mailboxEventDispatcher,
                              StoreRightManager storeRightManager) {
         super(mailboxSessionMapperFactory, authenticator, authorizator, locker,
-            messageParser, messageIdFactory, storeRightManager);
+            messageParser, messageIdFactory, mailboxEventDispatcher, delegatingMailboxListener,
storeRightManager);
     }
 
     public JPAMailboxManager(JPAMailboxSessionMapperFactory mailboxSessionMapperFactory,
@@ -57,11 +61,14 @@ public abstract class JPAMailboxManager extends StoreMailboxManager {
                              MailboxPathLocker locker,
                              MessageParser messageParser,
                              MessageId.Factory messageIdFactory,
+                             DelegatingMailboxListener delegatingMailboxListener,
+                             MailboxEventDispatcher mailboxEventDispatcher,
                              int limitAnnotation,
                              int limitAnnotationSize,
                              StoreRightManager storeRightManager) {
         super(mailboxSessionMapperFactory, authenticator, authorizator, locker,
-            messageParser, messageIdFactory, limitAnnotation, limitAnnotationSize, storeRightManager);
+            messageParser, messageIdFactory, limitAnnotation, limitAnnotationSize,
+            mailboxEventDispatcher, delegatingMailboxListener, storeRightManager);
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMailboxManager.java
b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMailboxManager.java
index 52dc140..48339d1 100644
--- a/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMailboxManager.java
+++ b/mailbox/jpa/src/main/java/org/apache/james/mailbox/jpa/openjpa/OpenJPAMailboxManager.java
@@ -36,6 +36,8 @@ import org.apache.james.mailbox.store.Authorizator;
 import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.StoreMessageManager;
 import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.event.DelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 
@@ -56,9 +58,11 @@ public class OpenJPAMailboxManager extends JPAMailboxManager {
                                  MessageId.Factory messageIdFactory,
                                  int annotationLimit,
                                  int annotationLimitSize,
+                                 DelegatingMailboxListener delegatingMailboxListener,
+                                 MailboxEventDispatcher mailboxEventDispatcher,
                                  StoreRightManager storeRightManager) {
         super(mapperFactory, authenticator, authorizator, locker, messageParser,
-            messageIdFactory, annotationLimit, annotationLimitSize, storeRightManager);
+            messageIdFactory, delegatingMailboxListener, mailboxEventDispatcher, annotationLimit,
 annotationLimitSize, storeRightManager);
         if (useStreaming) {
             feature = AdvancedFeature.Streaming;
         } else {
@@ -73,9 +77,11 @@ public class OpenJPAMailboxManager extends JPAMailboxManager {
                                  String encryptPass,
                                  MessageParser messageParser,
                                  MessageId.Factory messageIdFactory,
+                                 DelegatingMailboxListener delegatingMailboxListener,
+                                 MailboxEventDispatcher mailboxEventDispatcher,
                                  StoreRightManager storeRightManager) {
         super(mapperFactory, authenticator, authorizator, locker, messageParser,
-            messageIdFactory, storeRightManager);
+            messageIdFactory, delegatingMailboxListener, mailboxEventDispatcher, storeRightManager);
         if (encryptPass != null) {
             EncryptDecryptHelper.init(encryptPass);
             feature = AdvancedFeature.Encryption;
@@ -90,10 +96,12 @@ public class OpenJPAMailboxManager extends JPAMailboxManager {
                                  Authorizator authorizator,
                                  MessageParser messageParser,
                                  MessageId.Factory messageIdFactory,
+                                 DelegatingMailboxListener delegatingMailboxListener,
+                                 MailboxEventDispatcher mailboxEventDispatcher,
                                  StoreRightManager storeRightManager) {
         this(mapperFactory, authenticator, authorizator, new JVMMailboxPathLocker(), false,
             messageParser, messageIdFactory, MailboxConstants.DEFAULT_LIMIT_ANNOTATIONS_ON_MAILBOX,
-            MailboxConstants.DEFAULT_LIMIT_ANNOTATION_SIZE, storeRightManager);
+            MailboxConstants.DEFAULT_LIMIT_ANNOTATION_SIZE, delegatingMailboxListener, mailboxEventDispatcher,
storeRightManager);
     }
 
     public OpenJPAMailboxManager(JPAMailboxSessionMapperFactory mapperFactory,
@@ -103,9 +111,11 @@ public class OpenJPAMailboxManager extends JPAMailboxManager {
                                  MessageId.Factory messageIdFactory,
                                  int annotationLimit,
                                  int annotationLimitSize,
+                                 DelegatingMailboxListener delegatingMailboxListener,
+                                 MailboxEventDispatcher mailboxEventDispatcher,
                                  StoreRightManager storeRightManager) {
         this(mapperFactory, authenticator, authorizator, new JVMMailboxPathLocker(), false,
-            messageParser, messageIdFactory, annotationLimit, annotationLimitSize, storeRightManager);
+            messageParser, messageIdFactory, annotationLimit, annotationLimitSize, delegatingMailboxListener,
mailboxEventDispatcher, storeRightManager);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
index e36e020..88bcf7c 100644
--- a/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
+++ b/mailbox/maildir/src/test/java/org/apache/james/mailbox/maildir/MaildirMailboxManagerProvider.java
@@ -31,6 +31,8 @@ import org.apache.james.mailbox.store.Authorizator;
 import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.model.DefaultMessageId;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 import org.junit.rules.TemporaryFolder;
@@ -47,8 +49,11 @@ public class MaildirMailboxManagerProvider {
 
         Authenticator noAuthenticator = null;
         Authorizator noAuthorizator = null;
+
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         StoreMailboxManager manager = new StoreMailboxManager(mf, noAuthenticator, noAuthorizator,
new JVMMailboxPathLocker(),
-            messageParser, new DefaultMessageId.Factory(), storeRightManager);
+            messageParser, new DefaultMessageId.Factory(), mailboxEventDispatcher, delegatingListener,
storeRightManager);
         manager.init();
 
         return manager;

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
index 07f8f8a..884bc9b 100644
--- a/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
+++ b/mailbox/memory/src/main/java/org/apache/james/mailbox/inmemory/InMemoryMailboxManager.java
@@ -30,6 +30,7 @@ import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.store.Authenticator;
 import org.apache.james.mailbox.store.Authorizator;
+import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreMessageManager;
@@ -54,8 +55,11 @@ public class InMemoryMailboxManager extends StoreMailboxManager {
     public InMemoryMailboxManager(MailboxSessionMapperFactory mailboxSessionMapperFactory,
Authenticator authenticator,  Authorizator authorizator,
                                   MessageParser messageParser, MessageId.Factory messageIdFactory,
                                   int limitOfAnnotations, int limitAnnotationSize,
+                                  MailboxEventDispatcher dispatcher,
+                                  DelegatingMailboxListener delegatingMailboxListener,
                                   StoreRightManager storeRightManager) {
-        super(mailboxSessionMapperFactory, authenticator, authorizator, messageParser, messageIdFactory,
limitOfAnnotations, limitAnnotationSize, storeRightManager);
+        super(mailboxSessionMapperFactory, authenticator, authorizator, new JVMMailboxPathLocker(),
messageParser, messageIdFactory,
+            limitOfAnnotations, limitAnnotationSize, dispatcher, delegatingMailboxListener,
storeRightManager);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java
b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java
index 7438442..be1c2b9 100644
--- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java
+++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/MemoryMailboxManagerProvider.java
@@ -29,6 +29,8 @@ import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.store.FakeAuthenticator;
 import org.apache.james.mailbox.store.FakeAuthorizator;
 import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 
 import com.google.common.base.Throwables;
@@ -45,8 +47,11 @@ public class MemoryMailboxManagerProvider {
         InMemoryMailboxSessionMapperFactory mailboxSessionMapperFactory = new InMemoryMailboxSessionMapperFactory();
         StoreRightManager storeRightManager = new StoreRightManager(mailboxSessionMapperFactory,
aclResolver, groupMembershipResolver);
         MessageId.Factory messageIdFactory = new InMemoryMessageId.Factory();
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         InMemoryMailboxManager mailboxManager = new InMemoryMailboxManager(mailboxSessionMapperFactory,
new FakeAuthenticator(), FakeAuthorizator.defaultReject(),
-            messageParser, messageIdFactory, LIMIT_ANNOTATIONS, LIMIT_ANNOTATION_SIZE, storeRightManager);
+            messageParser, messageIdFactory, LIMIT_ANNOTATIONS, LIMIT_ANNOTATION_SIZE,
+            mailboxEventDispatcher, delegatingListener, storeRightManager);
 
         try {
             mailboxManager.init();

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
index de7424b..dadc77c 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java
@@ -65,7 +65,6 @@ import org.apache.james.mailbox.model.search.MailboxNameExpression;
 import org.apache.james.mailbox.model.search.MailboxQuery;
 import org.apache.james.mailbox.quota.QuotaManager;
 import org.apache.james.mailbox.quota.QuotaRootResolver;
-import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
 import org.apache.james.mailbox.store.event.DelegatingMailboxListener;
 import org.apache.james.mailbox.store.event.MailboxAnnotationListener;
 import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
@@ -88,6 +87,7 @@ import org.slf4j.LoggerFactory;
 import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 
@@ -103,9 +103,8 @@ public class StoreMailboxManager implements MailboxManager {
     private static final Logger LOGGER = LoggerFactory.getLogger(StoreMailboxManager.class);
     public static final char SQL_WILDCARD_CHAR = '%';
 
-
-    private MailboxEventDispatcher dispatcher;
-    private DelegatingMailboxListener delegatingListener;
+    private final MailboxEventDispatcher dispatcher;
+    private final DelegatingMailboxListener delegatingListener;
     private final MailboxSessionMapperFactory mailboxSessionMapperFactory;
 
     private final Authenticator authenticator;
@@ -136,11 +135,8 @@ public class StoreMailboxManager implements MailboxManager {
 
     private final MessageParser messageParser;
     private final Factory messageIdFactory;
-
     private final int limitOfAnnotations;
-
     private final int limitAnnotationSize;
-
     private final ImmutableMailboxMessage.Factory immutableMailboxMessageFactory;
 
     @Inject
@@ -153,28 +149,11 @@ public class StoreMailboxManager implements MailboxManager {
     }
 
     public StoreMailboxManager(MailboxSessionMapperFactory mailboxSessionMapperFactory, Authenticator
authenticator, Authorizator authorizator,
-                               MailboxPathLocker locker, MessageParser messageParser, MessageId.Factory
messageIdFactory, StoreRightManager storeRightManager) {
-        this(mailboxSessionMapperFactory, authenticator, authorizator, locker, messageParser,
messageIdFactory,
-            MailboxConstants.DEFAULT_LIMIT_ANNOTATIONS_ON_MAILBOX, MailboxConstants.DEFAULT_LIMIT_ANNOTATION_SIZE,
storeRightManager);
-    }
-
-    public StoreMailboxManager(MailboxSessionMapperFactory mailboxSessionMapperFactory, Authenticator
authenticator, Authorizator authorizator,
-            MessageParser messageParser, MessageId.Factory messageIdFactory, int limitOfAnnotations,
int limitAnnotationSize, StoreRightManager storeRightManager) {
-        this(mailboxSessionMapperFactory, authenticator, authorizator, new JVMMailboxPathLocker(),
messageParser, messageIdFactory,
-                limitOfAnnotations, limitAnnotationSize, storeRightManager);
-    }
-
-    public StoreMailboxManager(MailboxSessionMapperFactory mailboxSessionMapperFactory, Authenticator
authenticator, Authorizator authorizator,
-            MailboxPathLocker locker, MessageParser messageParser,
-            MessageId.Factory messageIdFactory, int limitOfAnnotations, int limitAnnotationSize,
StoreRightManager storeRightManager) {
-        this(mailboxSessionMapperFactory, authenticator, authorizator, locker, messageParser,
messageIdFactory,
-            limitOfAnnotations, limitAnnotationSize, null, null, storeRightManager);
-    }
-
-    public StoreMailboxManager(MailboxSessionMapperFactory mailboxSessionMapperFactory, Authenticator
authenticator, Authorizator authorizator,
                                MailboxPathLocker locker, MessageParser messageParser,
                                MessageId.Factory messageIdFactory, int limitOfAnnotations,
int limitAnnotationSize, MailboxEventDispatcher mailboxEventDispatcher,
                                DelegatingMailboxListener delegatingListener, StoreRightManager
storeRightManager) {
+        Preconditions.checkNotNull(delegatingListener);
+        Preconditions.checkNotNull(mailboxEventDispatcher);
         this.authenticator = authenticator;
         this.authorizator = authorizator;
         this.locker = locker;
@@ -236,11 +215,6 @@ public class StoreMailboxManager implements MailboxManager {
      */
     @PostConstruct
     public void init() throws MailboxException {
-
-        if (dispatcher == null) {
-            dispatcher = new MailboxEventDispatcher(getDelegationListener());
-        }
-
         if (index == null) {
             index = new SimpleMessageSearchIndex(mailboxSessionMapperFactory, mailboxSessionMapperFactory,
new DefaultTextExtractor());
         }
@@ -294,9 +268,6 @@ public class StoreMailboxManager implements MailboxManager {
      * @return delegatingListener
      */
     public DelegatingMailboxListener getDelegationListener() {
-        if (delegatingListener == null) {
-            delegatingListener = new DefaultDelegatingMailboxListener();
-        }
         return delegatingListener;
     }
 
@@ -349,17 +320,6 @@ public class StoreMailboxManager implements MailboxManager {
     }
 
     /**
-     * Set the {@link DelegatingMailboxListener} to use with this {@link MailboxManager}
instance. If none is set here a {@link DefaultDelegatingMailboxListener} instance will
-     * be created lazy
-     *
-     * @param delegatingListener
-     */
-    public void setDelegatingMailboxListener(DelegatingMailboxListener delegatingListener)
{
-        this.delegatingListener = delegatingListener;
-        dispatcher = new MailboxEventDispatcher(getDelegationListener());
-    }
-
-    /**
      * Set the {@link MessageSearchIndex} which should be used by this {@link MailboxManager}.
If none is given this implementation will use a {@link SimpleMessageSearchIndex}
      * by default
      *

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerAnnotationTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerAnnotationTest.java
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerAnnotationTest.java
index ffc4b94..ccf2304 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerAnnotationTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerAnnotationTest.java
@@ -38,10 +38,11 @@ import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.mock.MockMailboxSession;
 import org.apache.james.mailbox.model.MailboxAnnotation;
 import org.apache.james.mailbox.model.MailboxAnnotationKey;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.AnnotationMapper;
 import org.apache.james.mailbox.store.mail.MailboxMapper;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
@@ -103,10 +104,12 @@ public class StoreMailboxManagerAnnotationTest {
         StoreRightManager storeRightManager = new StoreRightManager(mailboxSessionMapperFactory,
aclResolver,
                                                                     groupMembershipResolver);
 
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         storeMailboxManager = spy(new StoreMailboxManager(mailboxSessionMapperFactory, authenticator,
authorizator,
-                                                          messageParser, messageIdFactory,
-                                                          MailboxConstants.DEFAULT_LIMIT_ANNOTATIONS_ON_MAILBOX,
-                                                          MailboxConstants.DEFAULT_LIMIT_ANNOTATION_SIZE,
+                                                          new JVMMailboxPathLocker(), messageParser,
messageIdFactory,
+                                                          mailboxEventDispatcher,
+                                                          delegatingListener,
                                                           storeRightManager));
         storeMailboxManager.init();
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java
index 8c9a76d..846cfb0 100644
--- a/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java
+++ b/mailbox/store/src/test/java/org/apache/james/mailbox/store/StoreMailboxManagerTest.java
@@ -42,6 +42,8 @@ import org.apache.james.mailbox.model.MessageId.Factory;
 import org.apache.james.mailbox.model.TestId;
 import org.apache.james.mailbox.model.search.MailboxQuery;
 import org.apache.james.mailbox.model.search.PrefixedRegex;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.MailboxMapper;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
@@ -74,8 +76,11 @@ public class StoreMailboxManagerTest {
         authenticator.addUser(CURRENT_USER, CURRENT_USER_PASSWORD);
         authenticator.addUser(ADMIN, ADMIN_PASSWORD);
         StoreRightManager storeRightManager = new StoreRightManager(mockedMapperFactory,
new UnionMailboxACLResolver(), new SimpleGroupMembershipResolver());
+
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         storeMailboxManager = new StoreMailboxManager(mockedMapperFactory, authenticator,
FakeAuthorizator.forUserAndAdmin(ADMIN, CURRENT_USER),
-                new JVMMailboxPathLocker(), new MessageParser(), messageIdFactory, storeRightManager);
+                new JVMMailboxPathLocker(), new MessageParser(), messageIdFactory, mailboxEventDispatcher,
delegatingListener, storeRightManager);
         storeMailboxManager.init();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java
----------------------------------------------------------------------
diff --git a/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java
b/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java
index 89d9462..27f5187 100644
--- a/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java
+++ b/mailbox/tool/src/test/java/org/apache/james/mailbox/copier/MailboxCopierTest.java
@@ -35,11 +35,13 @@ import org.apache.james.mailbox.exception.BadCredentialsException;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory;
 import org.apache.james.mailbox.mock.MockMailboxManager;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.store.Authorizator;
+import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.model.DefaultMessageId;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 import org.junit.Before;
@@ -159,14 +161,18 @@ public class MailboxCopierTest {
         MessageParser messageParser = new MessageParser();
         InMemoryMailboxSessionMapperFactory mapperFactory = new InMemoryMailboxSessionMapperFactory();
         StoreRightManager storeRightManager = new StoreRightManager(mapperFactory, aclResolver,
groupMembershipResolver);
+
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         return new StoreMailboxManager(
             mapperFactory,
             (userid, passwd) -> AUTHENTIC,
             (userId, otherUserId) -> Authorizator.AuthorizationState.NOT_ADMIN,
+            new JVMMailboxPathLocker(),
             messageParser,
             new DefaultMessageId.Factory(),
-            MailboxConstants.DEFAULT_LIMIT_ANNOTATIONS_ON_MAILBOX,
-            MailboxConstants.DEFAULT_LIMIT_ANNOTATION_SIZE,
+            mailboxEventDispatcher,
+            delegatingListener,
             storeRightManager);
     
     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
index 4d6d184..369492f 100644
--- a/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
+++ b/mpt/impl/imap-mailbox/elasticsearch/src/test/java/org/apache/james/mpt/imapmailbox/elasticsearch/host/ElasticSearchHostSystem.java
@@ -53,10 +53,12 @@ import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.inmemory.InMemoryId;
 import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory;
 import org.apache.james.mailbox.inmemory.InMemoryMessageId;
-import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreRightManager;
 import org.apache.james.mailbox.store.StoreSubscriptionManager;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
@@ -124,9 +126,10 @@ public class ElasticSearchHostSystem extends JamesImapHostSystem {
 
         StoreRightManager storeRightManager = new StoreRightManager(factory, aclResolver,
groupMembershipResolver);
 
-        mailboxManager = new StoreMailboxManager(factory, authenticator, authorizator, messageParser,
-                                                 messageIdFactory, MailboxConstants.DEFAULT_LIMIT_ANNOTATIONS_ON_MAILBOX,
-                                                 MailboxConstants.DEFAULT_LIMIT_ANNOTATION_SIZE,
storeRightManager);
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
+        mailboxManager = new StoreMailboxManager(factory, authenticator, authorizator, new
JVMMailboxPathLocker(),
+            messageParser, messageIdFactory, mailboxEventDispatcher, delegatingListener,
storeRightManager);
         mailboxManager.setMessageSearchIndex(searchIndex);
 
         try {

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
index f39ab06..6f7799e 100644
--- a/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
+++ b/mpt/impl/imap-mailbox/maildir/src/test/java/org/apache/james/mpt/imapmailbox/maildir/host/MaildirHostSystem.java
@@ -37,6 +37,8 @@ import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreRightManager;
 import org.apache.james.mailbox.store.StoreSubscriptionManager;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.model.DefaultMessageId;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
@@ -70,9 +72,12 @@ public class MaildirHostSystem extends JamesImapHostSystem {
         GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
         MessageParser messageParser = new MessageParser();
 
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         StoreRightManager storeRightManager = new StoreRightManager(mailboxSessionMapperFactory,
aclResolver, groupMembershipResolver);
         mailboxManager = new StoreMailboxManager(mailboxSessionMapperFactory, authenticator,
authorizator, locker,
-                messageParser, new DefaultMessageId.Factory(), storeRightManager);
+                messageParser, new DefaultMessageId.Factory(), mailboxEventDispatcher,
+                delegatingListener, storeRightManager);
         mailboxManager.init();
 
         final ImapProcessor defaultImapProcessorFactory = 

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
----------------------------------------------------------------------
diff --git a/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
b/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
index bf80ffb..380a09f 100644
--- a/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
+++ b/server/container/mailbox-adapter/src/test/java/org/apache/james/adapter/mailbox/MailboxManagementTest.java
@@ -40,6 +40,8 @@ import org.apache.james.mailbox.store.FakeAuthorizator;
 import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.MessageMapper;
 import org.apache.james.mailbox.store.mail.model.DefaultMessageId;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
@@ -68,6 +70,9 @@ public class MailboxManagementTest {
                                                                     new UnionMailboxACLResolver(),
                                                                     new SimpleGroupMembershipResolver());
 
+
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         StoreMailboxManager mailboxManager = new StoreMailboxManager(
             inMemoryMapperFactory,
             new FakeAuthenticator(),
@@ -75,6 +80,8 @@ public class MailboxManagementTest {
             new JVMMailboxPathLocker(),
             new MessageParser(),
             new DefaultMessageId.Factory(),
+            mailboxEventDispatcher,
+            delegatingListener,
             storeRightManager);
 
         mailboxManager.init();

http://git-wip-us.apache.org/repos/asf/james-project/blob/fb0c391b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
index 1fc9a50..a0ff351 100644
--- a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
+++ b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
@@ -48,11 +48,13 @@ import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
 import org.apache.james.mailbox.acl.UnionMailboxACLResolver;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.inmemory.InMemoryMailboxSessionMapperFactory;
-import org.apache.james.mailbox.model.MailboxConstants;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.store.Authorizator;
+import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 import org.apache.james.mailbox.store.StoreMailboxManager;
 import org.apache.james.mailbox.store.StoreRightManager;
+import org.apache.james.mailbox.store.event.DefaultDelegatingMailboxListener;
+import org.apache.james.mailbox.store.event.MailboxEventDispatcher;
 import org.apache.james.mailbox.store.mail.model.DefaultMessageId;
 import org.apache.james.mailbox.store.mail.model.impl.MessageParser;
 import org.apache.james.pop3server.netty.POP3Server;
@@ -722,6 +724,9 @@ public class POP3ServerTest {
         GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
         MessageParser messageParser = new MessageParser();
         StoreRightManager storeRightManager = new StoreRightManager(factory, aclResolver,
groupMembershipResolver);
+
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         mailboxManager = new StoreMailboxManager(factory, (userid, passwd) -> {
             try {
                 return usersRepository.test(userid, passwd.toString());
@@ -730,10 +735,11 @@ public class POP3ServerTest {
                 return false;
             }
         }, (userId, otherUserId) -> Authorizator.AuthorizationState.NOT_ADMIN,
+            new JVMMailboxPathLocker(),
             messageParser,
             new DefaultMessageId.Factory(),
-            MailboxConstants.DEFAULT_LIMIT_ANNOTATIONS_ON_MAILBOX,
-            MailboxConstants.DEFAULT_LIMIT_ANNOTATION_SIZE,
+            mailboxEventDispatcher,
+            delegatingListener,
             storeRightManager);
         mailboxManager.init();
 


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


Mime
View raw message