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 2018/12/12 10:52:04 UTC

[11/16] james-project git commit: MAILBOX-357 Get rid of the EventFactory#MailboxAware API

MAILBOX-357 Get rid of the EventFactory#MailboxAware API


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

Branch: refs/heads/master
Commit: 6d75890a86ba3b351ba86e8ed4ac0c9a67a5a2d7
Parents: 13f6aff
Author: Benoit Tellier <bt...@linagora.com>
Authored: Mon Dec 10 14:25:24 2018 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Wed Dec 12 17:50:58 2018 +0700

----------------------------------------------------------------------
 .../james/mailbox/store/event/EventFactory.java | 69 ++------------------
 1 file changed, 6 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/6d75890a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
index 1fd51e5..9a372ac 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/EventFactory.java
@@ -45,18 +45,12 @@ import com.google.common.collect.ImmutableMap;
 
 public class EventFactory {
 
-    public interface MailboxAware {
-        Mailbox getMailbox();
-    }
-
-    public final class AddedImpl extends MailboxListener.Added implements MailboxAware {
+    public final class AddedImpl extends MailboxListener.Added {
         private final Map<MessageUid, MessageMetaData> added;
-        private final Mailbox mailbox;
 
         public AddedImpl(MailboxSession.SessionId sessionId, User user, Mailbox mailbox, SortedMap<MessageUid, MessageMetaData> uids) {
             super(sessionId, user, new StoreMailboxPath(mailbox), mailbox.getMailboxId());
             this.added = ImmutableMap.copyOf(uids);
-            this.mailbox = mailbox;
         }
 
         @Override
@@ -68,21 +62,14 @@ public class EventFactory {
         public MessageMetaData getMetaData(MessageUid uid) {
             return added.get(uid);
         }
-
-        @Override
-        public Mailbox getMailbox() {
-            return mailbox;
-        }
     }
 
-    public final class ExpungedImpl extends MailboxListener.Expunged implements MailboxAware {
+    public final class ExpungedImpl extends MailboxListener.Expunged {
         private final Map<MessageUid, MessageMetaData> uids;
-        private final Mailbox mailbox;
 
         public ExpungedImpl(MailboxSession.SessionId sessionId, User user, Mailbox mailbox,  Map<MessageUid, MessageMetaData> uids) {
             super(sessionId, user,  new StoreMailboxPath(mailbox), mailbox.getMailboxId());
             this.uids = ImmutableMap.copyOf(uids);
-            this.mailbox = mailbox;
         }
 
         @Override
@@ -94,25 +81,16 @@ public class EventFactory {
         public MessageMetaData getMetaData(MessageUid uid) {
             return uids.get(uid);
         }
-
-        @Override
-        public Mailbox getMailbox() {
-            return mailbox;
-        }
     }
 
-    public final class FlagsUpdatedImpl extends MailboxListener.FlagsUpdated implements MailboxAware {
+    public final class FlagsUpdatedImpl extends MailboxListener.FlagsUpdated {
         private final List<MessageUid> uids;
-
-        private final Mailbox mailbox;
-
         private final List<UpdatedFlags> uFlags;
 
         public FlagsUpdatedImpl(MailboxSession.SessionId sessionId, User user, Mailbox mailbox, List<MessageUid> uids, List<UpdatedFlags> uFlags) {
             super(sessionId, user, new StoreMailboxPath(mailbox), mailbox.getMailboxId());
             this.uids = ImmutableList.copyOf(uids);
             this.uFlags = ImmutableList.copyOf(uFlags);
-            this.mailbox = mailbox;
         }
 
         @Override
@@ -124,67 +102,32 @@ public class EventFactory {
         public List<UpdatedFlags> getUpdatedFlags() {
             return uFlags;
         }
-
-        @Override
-        public Mailbox getMailbox() {
-            return mailbox;
-        }
-
     }
 
-    public final class MailboxDeletionImpl extends MailboxListener.MailboxDeletion implements MailboxAware {
-        private final Mailbox mailbox;
-
+    public final class MailboxDeletionImpl extends MailboxListener.MailboxDeletion {
         public MailboxDeletionImpl(MailboxSession.SessionId sessionId, User user, Mailbox mailbox, QuotaRoot quotaRoot, QuotaCount deletedMessageCount, QuotaSize totalDeletedSize) {
             super(sessionId, user, new StoreMailboxPath(mailbox), quotaRoot, deletedMessageCount, totalDeletedSize, mailbox.getMailboxId());
-            this.mailbox = mailbox;
         }
-
-
-        @Override
-        public Mailbox getMailbox() {
-            return mailbox;
-        }
-
     }
 
-    public final class MailboxAddedImpl extends MailboxListener.MailboxAdded implements MailboxAware {
-
-        private final Mailbox mailbox;
-
+    public final class MailboxAddedImpl extends MailboxListener.MailboxAdded {
         public MailboxAddedImpl(MailboxSession.SessionId sessionId, User user, Mailbox mailbox) {
             super(sessionId, user,  new StoreMailboxPath(mailbox), mailbox.getMailboxId());
-            this.mailbox = mailbox;
         }
-
-
-        @Override
-        public Mailbox getMailbox() {
-            return mailbox;
-        }
-
     }
 
-    public final class MailboxRenamedEventImpl extends MailboxListener.MailboxRenamed implements MailboxAware {
-
+    public final class MailboxRenamedEventImpl extends MailboxListener.MailboxRenamed {
         private final MailboxPath newPath;
-        private final Mailbox newMailbox;
 
         public MailboxRenamedEventImpl(MailboxSession.SessionId sessionId, User user, MailboxPath oldPath, Mailbox newMailbox) {
             super(sessionId, user, oldPath, newMailbox.getMailboxId());
             this.newPath = new StoreMailboxPath(newMailbox);
-            this.newMailbox = newMailbox;
         }
 
         @Override
         public MailboxPath getNewPath() {
             return newPath;
         }
-
-        @Override
-        public Mailbox getMailbox() {
-            return newMailbox;
-        }
     }
 
     public MailboxListener.Added added(MailboxSession session, SortedMap<MessageUid, MessageMetaData> uids, Mailbox mailbox) {


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