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/11/03 02:33:25 UTC

[08/15] james-project git commit: MAILBOX-317 Rework JcrMailboxManager constructor

MAILBOX-317 Rework JcrMailboxManager constructor

Passing the event system should not be optional. And It should not be class concern to init the right system.

In the operation:
 - Delete one constructor
 - Implement logic in only one constructor (the other should only call it)


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

Branch: refs/heads/master
Commit: f5a2bbfaae134e0644f8753a5aabdc48a427c10c
Parents: 3653aa9
Author: benwa <bt...@linagora.com>
Authored: Thu Nov 2 09:22:14 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Fri Nov 3 09:32:32 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/jcr/JCRMailboxManager.java       | 17 ++++++-----------
 .../mailbox/jcr/JCRMailboxManagerProvider.java     |  7 ++++++-
 .../mpt/imapmailbox/jcr/host/JCRHostSystem.java    |  8 ++++++--
 3 files changed, 18 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/f5a2bbfa/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRMailboxManager.java b/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRMailboxManager.java
index fb13206..eca67e9 100644
--- a/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRMailboxManager.java
+++ b/mailbox/jcr/src/main/java/org/apache/james/mailbox/jcr/JCRMailboxManager.java
@@ -28,10 +28,11 @@ import org.apache.james.mailbox.model.MailboxPath;
 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.StoreMailboxManager;
 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;
 
@@ -44,20 +45,14 @@ public class JCRMailboxManager extends StoreMailboxManager implements JCRImapCon
     public JCRMailboxManager(JCRMailboxSessionMapperFactory mapperFactory,
                              Authenticator authenticator,
                              Authorizator authorizator,
-                             MessageParser messageParser,
-                             MessageId.Factory messageIdFactory,
-                             StoreRightManager storeRightManager) {
-	    this(mapperFactory, authenticator, authorizator, new JVMMailboxPathLocker(), messageParser, messageIdFactory, storeRightManager);
-    }
-
-    public JCRMailboxManager(JCRMailboxSessionMapperFactory mapperFactory,
-                             Authenticator authenticator,
-                             Authorizator authorizator,
                              MailboxPathLocker locker,
                              MessageParser messageParser,
                              MessageId.Factory messageIdFactory,
+                             MailboxEventDispatcher mailboxEventDispatcher,
+                             DelegatingMailboxListener delegatingMailboxListener,
                              StoreRightManager storeRightManager) {
-        super(mapperFactory, authenticator, authorizator, locker, messageParser, messageIdFactory, storeRightManager);
+        super(mapperFactory, authenticator, authorizator, locker, messageParser, messageIdFactory,
+            mailboxEventDispatcher, delegatingMailboxListener, storeRightManager);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/f5a2bbfa/mailbox/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerProvider.java
----------------------------------------------------------------------
diff --git a/mailbox/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerProvider.java b/mailbox/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerProvider.java
index 09ed47a..ee76ed6 100644
--- a/mailbox/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerProvider.java
+++ b/mailbox/jcr/src/test/java/org/apache/james/mailbox/jcr/JCRMailboxManagerProvider.java
@@ -32,6 +32,8 @@ 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.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.xml.sax.InputSource;
@@ -66,8 +68,11 @@ public class JCRMailboxManagerProvider {
         Authenticator noAuthenticator = null;
         Authorizator noAuthorizator = null;
         StoreRightManager storeRightManager = new StoreRightManager(mf, aclResolver, groupMembershipResolver);
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         JCRMailboxManager manager = new JCRMailboxManager(mf, noAuthenticator, noAuthorizator, locker,
-            messageParser, new DefaultMessageId.Factory(), storeRightManager);
+            messageParser, new DefaultMessageId.Factory(), mailboxEventDispatcher, delegatingListener,
+            storeRightManager);
 
         try {
             manager.init();

http://git-wip-us.apache.org/repos/asf/james-project/blob/f5a2bbfa/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java b/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
index eb3f7d0..01a286b 100644
--- a/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
+++ b/mpt/impl/imap-mailbox/jcr/src/test/java/org/apache/james/mpt/imapmailbox/jcr/host/JCRHostSystem.java
@@ -43,6 +43,8 @@ import org.apache.james.mailbox.jcr.mail.JCRModSeqProvider;
 import org.apache.james.mailbox.jcr.mail.JCRUidProvider;
 import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 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.mailbox.store.quota.DefaultQuotaRootResolver;
@@ -93,8 +95,10 @@ public class JCRHostSystem extends JamesImapHostSystem {
             MessageParser messageParser = new MessageParser();
 
             StoreRightManager storeRightManager = new StoreRightManager(mf, aclResolver, groupMembershipResolver);
-            mailboxManager = new JCRMailboxManager(mf, authenticator, authorizator, messageParser,
-                    new DefaultMessageId.Factory(), storeRightManager);
+            DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+            MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
+            mailboxManager = new JCRMailboxManager(mf, authenticator, authorizator, new JVMMailboxPathLocker(), messageParser,
+                    new DefaultMessageId.Factory(), mailboxEventDispatcher, delegatingListener, storeRightManager);
             mailboxManager.init();
 
             final ImapProcessor defaultImapProcessorFactory = 


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