james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [07/15] james-project git commit: MAILBOX-317 Rework HBaseMailboxManager constructor
Date Fri, 03 Nov 2017 02:33:24 GMT
MAILBOX-317 Rework HBaseMailboxManager 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/3653aa9c
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/3653aa9c
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/3653aa9c

Branch: refs/heads/master
Commit: 3653aa9ca8910ac4eccdaebcfe2f81492e6b80ff
Parents: f879859
Author: benwa <btellier@linagora.com>
Authored: Thu Nov 2 09:19:47 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Fri Nov 3 09:32:32 2017 +0700

----------------------------------------------------------------------
 .../james/mailbox/hbase/HBaseMailboxManager.java   | 17 ++++++-----------
 .../hbase/HBaseMailboxManagerStressTest.java       | 11 +++++++++--
 .../mailbox/hbase/HBaseMailboxManagerTest.java     | 11 +++++++++--
 .../imapmailbox/hbase/host/HBaseHostSystem.java    | 10 ++++++++--
 4 files changed, 32 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/3653aa9c/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxManager.java
----------------------------------------------------------------------
diff --git a/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxManager.java
b/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxManager.java
index be5d4d9..25e74b2 100644
--- a/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxManager.java
+++ b/mailbox/hbase/src/main/java/org/apache/james/mailbox/hbase/HBaseMailboxManager.java
@@ -29,10 +29,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;
 import org.apache.james.mailbox.store.transaction.Mapper;
@@ -49,17 +50,11 @@ public class HBaseMailboxManager extends StoreMailboxManager {
                                MailboxPathLocker locker,
                                MessageParser messageParser,
                                MessageId.Factory messageIdFactory,
+                               MailboxEventDispatcher dispatcher,
+                               DelegatingMailboxListener delegatingMailboxListener,
                                StoreRightManager storeRightManager) {
-        super(mapperFactory, authenticator, authorizator, locker, messageParser, messageIdFactory,
storeRightManager);
-    }
-
-    public HBaseMailboxManager(HBaseMailboxSessionMapperFactory mapperFactory,
-                               Authenticator authenticator,
-                               Authorizator authorizator,
-                               MessageParser messageParser,
-                               MessageId.Factory messageIdFactory,
-                               StoreRightManager storeRightManager) {
-        super(mapperFactory, authenticator, authorizator, new JVMMailboxPathLocker(), messageParser,
messageIdFactory, storeRightManager);
+        super(mapperFactory, authenticator, authorizator, locker, messageParser, messageIdFactory,
+            dispatcher, delegatingMailboxListener, storeRightManager);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/3653aa9c/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerStressTest.java
----------------------------------------------------------------------
diff --git a/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerStressTest.java
b/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerStressTest.java
index 4fb2025..7a44866 100644
--- a/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerStressTest.java
+++ b/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerStressTest.java
@@ -40,7 +40,10 @@ import org.apache.james.mailbox.hbase.mail.HBaseUidProvider;
 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.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.After;
@@ -66,13 +69,17 @@ public class HBaseMailboxManagerStressTest extends MailboxManagerStressTest
{
 
         Authenticator noAuthenticator = null;
         Authorizator noAuthorizator = null;
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         HBaseMailboxManager manager = new HBaseMailboxManager(mapperFactory,
             noAuthenticator,
             noAuthorizator,
+            new JVMMailboxPathLocker(),
             new MessageParser(),
             messageIdFactory,
-            storeRightManager
-        );
+            mailboxEventDispatcher,
+            delegatingListener,
+            storeRightManager);
 
         try {
             manager.init();

http://git-wip-us.apache.org/repos/asf/james-project/blob/3653aa9c/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerTest.java
----------------------------------------------------------------------
diff --git a/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerTest.java
b/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerTest.java
index f6f8ad2..5d0cba7 100644
--- a/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerTest.java
+++ b/mailbox/hbase/src/test/java/org/apache/james/mailbox/hbase/HBaseMailboxManagerTest.java
@@ -40,7 +40,10 @@ import org.apache.james.mailbox.hbase.mail.HBaseUidProvider;
 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.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.After;
@@ -66,13 +69,17 @@ public class HBaseMailboxManagerTest extends MailboxManagerTest {
 
         Authenticator noAuthenticator = null;
         Authorizator noAuthorizator = null;
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         HBaseMailboxManager manager = new HBaseMailboxManager(mapperFactory,
             noAuthenticator,
             noAuthorizator,
+            new JVMMailboxPathLocker(),
             new MessageParser(),
             messageIdFactory,
-            storeRightManager
-        );
+            mailboxEventDispatcher,
+            delegatingListener,
+            storeRightManager);
 
         try {
             manager.init();

http://git-wip-us.apache.org/repos/asf/james-project/blob/3653aa9c/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
----------------------------------------------------------------------
diff --git a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
index 54b8ccc..1b0cacd 100644
--- a/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
+++ b/mpt/impl/imap-mailbox/hbase/src/test/java/org/apache/james/mpt/imapmailbox/hbase/host/HBaseHostSystem.java
@@ -41,8 +41,11 @@ import org.apache.james.mailbox.hbase.HBaseMailboxManager;
 import org.apache.james.mailbox.hbase.HBaseMailboxSessionMapperFactory;
 import org.apache.james.mailbox.hbase.mail.HBaseModSeqProvider;
 import org.apache.james.mailbox.hbase.mail.HBaseUidProvider;
+import org.apache.james.mailbox.store.JVMMailboxPathLocker;
 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;
@@ -103,9 +106,12 @@ public class HBaseHostSystem extends JamesImapHostSystem {
         GroupMembershipResolver groupMembershipResolver = new SimpleGroupMembershipResolver();
         MessageParser messageParser = new MessageParser();
 
+        DefaultDelegatingMailboxListener delegatingListener = new DefaultDelegatingMailboxListener();
+        MailboxEventDispatcher mailboxEventDispatcher = new MailboxEventDispatcher(delegatingListener);
         StoreRightManager storeRightManager = new StoreRightManager(mapperFactory, aclResolver,
groupMembershipResolver);
-        mailboxManager = new HBaseMailboxManager(mapperFactory, authenticator, authorizator,
messageParser,
-                                                 messageIdFactory, storeRightManager);
+        mailboxManager = new HBaseMailboxManager(mapperFactory, authenticator, authorizator,
+            new JVMMailboxPathLocker(), messageParser,
+            messageIdFactory, mailboxEventDispatcher, delegatingListener, storeRightManager);
         mailboxManager.init();
 
         SubscriptionManager subscriptionManager = new StoreSubscriptionManager(mapperFactory);


---------------------------------------------------------------------
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