james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [01/29] james-project git commit: JAMES-2169 MailboxProbe.createMailbox should return a MailboxId
Date Wed, 04 Oct 2017 09:28:24 GMT
Repository: james-project
Updated Branches:
  refs/heads/master 651a03db6 -> 10da4351c


JAMES-2169 MailboxProbe.createMailbox should return a MailboxId


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

Branch: refs/heads/master
Commit: f5f12d24d6c6ad781a6074a2f94d99cce51fcc57
Parents: 55b8709
Author: Matthieu Baechler <matthieu@apache.org>
Authored: Wed Sep 27 12:03:18 2017 +0200
Committer: benwa <btellier@linagora.com>
Committed: Tue Oct 3 09:23:47 2017 +0700

----------------------------------------------------------------------
 .../org/apache/james/mailbox/store/probe/MailboxProbe.java    | 3 ++-
 .../java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java | 5 +++--
 .../main/java/org/apache/james/modules/MailboxProbeImpl.java  | 6 ++++--
 .../james/adapter/mailbox/MailboxManagerManagement.java       | 7 +++++--
 .../james/adapter/mailbox/MailboxManagerManagementMBean.java  | 5 +++--
 5 files changed, 17 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/f5f12d24/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java
index b96671e..7b29962 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/probe/MailboxProbe.java
@@ -27,12 +27,13 @@ import javax.mail.Flags;
 
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.ComposedMessageId;
+import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 
 public interface MailboxProbe {
 
-    void createMailbox(String namespace, String user, String name);
+    MailboxId createMailbox(String namespace, String user, String name);
 
     Mailbox getMailbox(String namespace, String user, String name);
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/f5f12d24/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java
----------------------------------------------------------------------
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java
b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java
index ebc1f0e..5a92492 100644
--- a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java
+++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxMailboxProbe.java
@@ -33,6 +33,7 @@ import org.apache.james.adapter.mailbox.MailboxManagerManagementMBean;
 import org.apache.james.adapter.mailbox.ReIndexerManagementMBean;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.ComposedMessageId;
+import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 import org.apache.james.mailbox.store.probe.MailboxProbe;
@@ -70,8 +71,8 @@ public class JmxMailboxProbe implements MailboxProbe, JmxProbe {
     }
 
     @Override
-    public void createMailbox(String namespace, String user, String name) {
-        mailboxManagerManagement.createMailbox(namespace, user, name);
+    public MailboxId createMailbox(String namespace, String user, String name) {
+        return mailboxManagerManagement.createMailbox(namespace, user, name);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/f5f12d24/server/container/guice/mailbox/src/main/java/org/apache/james/modules/MailboxProbeImpl.java
----------------------------------------------------------------------
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 b2462ee..1bf0252 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
@@ -37,6 +37,7 @@ import org.apache.james.mailbox.SubscriptionManager;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.ComposedMessageId;
 import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxMetaData;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MailboxQuery;
@@ -63,12 +64,13 @@ public class MailboxProbeImpl implements GuiceProbe, MailboxProbe {
     }
 
     @Override
-    public void createMailbox(String namespace, String user, String name) {
+    public MailboxId createMailbox(String namespace, String user, String name) {
         MailboxSession mailboxSession = null;
         try {
             mailboxSession = mailboxManager.createSystemSession(user);
             mailboxManager.startProcessingRequest(mailboxSession);
-            mailboxManager.createMailbox(new MailboxPath(namespace, user, name), mailboxSession);
+            return mailboxManager.createMailbox(new MailboxPath(namespace, user, name), mailboxSession)
+                    .orElseThrow(() -> new MailboxException("mailbox name is probably
empty"));
         } catch (MailboxException e) {
             throw Throwables.propagate(e);
         } finally {

http://git-wip-us.apache.org/repos/asf/james-project/blob/f5f12d24/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
----------------------------------------------------------------------
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
index 11caf4b..8242c08 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
@@ -37,6 +37,7 @@ import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.MailboxConstants;
+import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxMetaData;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MailboxQuery;
@@ -130,7 +131,7 @@ public class MailboxManagerManagement extends StandardMBean implements
MailboxMa
     }
 
     @Override
-    public void createMailbox(String namespace, String user, String name) {
+    public MailboxId createMailbox(String namespace, String user, String name) {
         checkMailboxArguments(namespace, user, name);
         MailboxSession session = null;
         MailboxPath mailboxPath = new MailboxPath(namespace, user, name);
@@ -142,9 +143,11 @@ public class MailboxManagerManagement extends StandardMBean implements
MailboxMa
                      .build()) {
             session = mailboxManager.createSystemSession(user);
             mailboxManager.startProcessingRequest(session);
-            mailboxManager.createMailbox(mailboxPath, session);
+            return mailboxManager.createMailbox(mailboxPath, session)
+                .orElseThrow(() -> new MailboxException("mailbox name is probably empty"));
         } catch (Exception e) {
             LOGGER.error("Unable to create mailbox", e);
+            throw Throwables.propagate(e);
         } finally {
             closeSession(session);
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/f5f12d24/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java
----------------------------------------------------------------------
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java
b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java
index 9485075..ca96dca 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagementMBean.java
@@ -20,6 +20,8 @@ package org.apache.james.adapter.mailbox;
 
 import java.util.List;
 
+import org.apache.james.mailbox.model.MailboxId;
+
 /**
  * JMX MBean for Mailbox management
  */
@@ -43,12 +45,11 @@ public interface MailboxManagerManagementMBean {
 
     /**
      * Create a mailbox
-     *
      * @param namespace Namespace of the created mailbox
      * @param user User of the created mailbox
      * @param name Name of the created mailbox
      */
-    void createMailbox(String namespace,String user, String name);
+    MailboxId createMailbox(String namespace, String user, String name);
 
     /**
      * Delete the given mailbox


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