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 ma...@apache.org on 2020/04/30 07:28:38 UTC

[james-project] 02/11: [REFACTORING] MailboxProbeImpl should not rely on mappers

This is an automated email from the ASF dual-hosted git repository.

matthieu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 152aa7d125c9814ed635e7d984a7acf9a6ae5567
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Apr 29 11:51:19 2020 +0700

    [REFACTORING] MailboxProbeImpl should not rely on mappers
---
 .../java/org/apache/james/modules/MailboxProbeImpl.java    | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
index 1d5936a..0ca9380 100644
--- a/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
+++ b/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
@@ -34,7 +34,6 @@ import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.SubscriptionManager;
 import org.apache.james.mailbox.exception.MailboxException;
-import org.apache.james.mailbox.exception.MailboxNotFoundException;
 import org.apache.james.mailbox.model.ComposedMessageId;
 import org.apache.james.mailbox.model.MailboxCounters;
 import org.apache.james.mailbox.model.MailboxId;
@@ -43,20 +42,16 @@ import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.search.MailboxQuery;
 import org.apache.james.mailbox.model.search.Wildcard;
 import org.apache.james.mailbox.probe.MailboxProbe;
-import org.apache.james.mailbox.store.mail.MailboxMapper;
-import org.apache.james.mailbox.store.mail.MailboxMapperFactory;
 import org.apache.james.utils.GuiceProbe;
 
 public class MailboxProbeImpl implements GuiceProbe, MailboxProbe {
     private final MailboxManager mailboxManager;
-    private final MailboxMapperFactory mailboxMapperFactory;
     private final SubscriptionManager subscriptionManager;
 
     @Inject
-    private MailboxProbeImpl(MailboxManager mailboxManager, MailboxMapperFactory mailboxMapperFactory,
+    private MailboxProbeImpl(MailboxManager mailboxManager,
                              SubscriptionManager subscriptionManager) {
         this.mailboxManager = mailboxManager;
-        this.mailboxMapperFactory = mailboxMapperFactory;
         this.subscriptionManager = subscriptionManager;
     }
 
@@ -85,12 +80,9 @@ public class MailboxProbeImpl implements GuiceProbe, MailboxProbe {
         MailboxSession mailboxSession = null;
         try {
             mailboxSession = mailboxManager.createSystemSession(username);
-            MailboxMapper mailboxMapper = mailboxMapperFactory.getMailboxMapper(mailboxSession);
             MailboxPath path = new MailboxPath(namespace, username, name);
-            return mailboxMapper.findMailboxByPath(path)
-                .blockOptional()
-                .orElseThrow(() -> new MailboxNotFoundException(path.asString()))
-                .getMailboxId();
+            return mailboxManager.getMailbox(path, mailboxSession)
+                .getId();
         } catch (MailboxException e) {
             throw new RuntimeException(e);
         } finally {


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