MAILBOX-277 introduce MessageIdManager
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/bfd0b611 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/bfd0b611 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/bfd0b611 Branch: refs/heads/master Commit: bfd0b61167b5253f6941bf5b517b981e78dd2109 Parents: 9e90756 Author: Matthieu Baechler <matthieu.baech...@linagora.com> Authored: Tue Oct 18 16:27:42 2016 +0200 Committer: Matthieu Baechler <matthieu.baech...@linagora.com> Committed: Tue Oct 25 09:50:48 2016 +0200 ---------------------------------------------------------------------- .../apache/james/mailbox/MessageIdManager.java | 42 ++++++++++++++++++++ .../mailbox/manager/IntegrationResources.java | 3 ++ .../manager/InMemoryIntegrationResources.java | 37 +++++++++++++++++ 3 files changed, 82 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/bfd0b611/mailbox/api/src/main/java/org/apache/james/mailbox/MessageIdManager.java ---------------------------------------------------------------------- diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/MessageIdManager.java b/mailbox/api/src/main/java/org/apache/james/mailbox/MessageIdManager.java new file mode 100644 index 0000000..dafdc59 --- /dev/null +++ b/mailbox/api/src/main/java/org/apache/james/mailbox/MessageIdManager.java @@ -0,0 +1,42 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james.mailbox; + +import java.util.List; + +import javax.mail.Flags; + +import org.apache.james.mailbox.MessageManager.FlagsUpdateMode; +import org.apache.james.mailbox.exception.MailboxException; +import org.apache.james.mailbox.model.MailboxId; +import org.apache.james.mailbox.model.MessageId; +import org.apache.james.mailbox.model.MessageResult; +import org.apache.james.mailbox.model.MessageResult.FetchGroup; + +public interface MessageIdManager { + + void setFlags(Flags newState, FlagsUpdateMode replace, MessageId messageId, MailboxId mailboxId, MailboxSession mailboxSession) throws MailboxException; + + List<MessageResult> getMessages(List<MessageId> messageId, FetchGroup minimal, MailboxSession mailboxSession) throws MailboxException; + + void delete(MessageId messageId, List<MailboxId> mailboxIds, MailboxSession mailboxSession) throws MailboxException; + + void setInMailboxes(MessageId messageId, List<MailboxId> mailboxIds, MailboxSession mailboxSession) throws MailboxException; +} http://git-wip-us.apache.org/repos/asf/james-project/blob/bfd0b611/mailbox/api/src/test/java/org/apache/james/mailbox/manager/IntegrationResources.java ---------------------------------------------------------------------- diff --git a/mailbox/api/src/test/java/org/apache/james/mailbox/manager/IntegrationResources.java b/mailbox/api/src/test/java/org/apache/james/mailbox/manager/IntegrationResources.java index b9252f8..ff70bc7 100644 --- a/mailbox/api/src/test/java/org/apache/james/mailbox/manager/IntegrationResources.java +++ b/mailbox/api/src/test/java/org/apache/james/mailbox/manager/IntegrationResources.java @@ -20,6 +20,7 @@ package org.apache.james.mailbox.manager; import org.apache.james.mailbox.MailboxManager; +import org.apache.james.mailbox.MessageIdManager; import org.apache.james.mailbox.quota.MaxQuotaManager; import org.apache.james.mailbox.quota.QuotaManager; import org.apache.james.mailbox.acl.GroupMembershipResolver; @@ -41,6 +42,8 @@ public interface IntegrationResources { GroupMembershipResolver createGroupMembershipResolver() throws Exception; + MessageIdManager createMessageIdManager(MailboxManager mailboxManager); + /** * Init you will want to perform before tests * http://git-wip-us.apache.org/repos/asf/james-project/blob/bfd0b611/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java ---------------------------------------------------------------------- diff --git a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java index 7539934..a47965f 100644 --- a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java +++ b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/manager/InMemoryIntegrationResources.java @@ -19,7 +19,14 @@ package org.apache.james.mailbox.inmemory.manager; +import java.util.List; + +import javax.mail.Flags; + import org.apache.james.mailbox.MailboxManager; +import org.apache.james.mailbox.MailboxSession; +import org.apache.james.mailbox.MessageIdManager; +import org.apache.james.mailbox.MessageManager.FlagsUpdateMode; import org.apache.james.mailbox.acl.GroupMembershipResolver; import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver; import org.apache.james.mailbox.acl.UnionMailboxACLResolver; @@ -30,6 +37,10 @@ import org.apache.james.mailbox.inmemory.quota.InMemoryCurrentQuotaManager; import org.apache.james.mailbox.inmemory.quota.InMemoryPerUserMaxQuotaManager; import org.apache.james.mailbox.manager.IntegrationResources; import org.apache.james.mailbox.manager.ManagerTestResources; +import org.apache.james.mailbox.model.MailboxId; +import org.apache.james.mailbox.model.MessageId; +import org.apache.james.mailbox.model.MessageResult; +import org.apache.james.mailbox.model.MessageResult.FetchGroup; import org.apache.james.mailbox.quota.MaxQuotaManager; import org.apache.james.mailbox.quota.QuotaManager; import org.apache.james.mailbox.quota.QuotaRootResolver; @@ -64,6 +75,32 @@ public class InMemoryIntegrationResources implements IntegrationResources { } @Override + public MessageIdManager createMessageIdManager(MailboxManager mailboxManager) { + return new MessageIdManager() { + @Override + public void delete(MessageId messageId, List<MailboxId> mailboxIds, MailboxSession mailboxSession) + throws MailboxException { + } + + @Override + public List<MessageResult> getMessages(List<MessageId> messageId, FetchGroup minimal, + MailboxSession mailboxSession) throws MailboxException { + return null; + } + + @Override + public void setFlags(Flags newState, FlagsUpdateMode replace, MessageId messageId, MailboxId mailboxId, + MailboxSession mailboxSession) throws MailboxException { + } + + @Override + public void setInMailboxes(MessageId messageId, List<MailboxId> mailboxIds, MailboxSession mailboxSession) + throws MailboxException { + } + }; + } + + @Override public QuotaManager createQuotaManager(MaxQuotaManager maxQuotaManager, MailboxManager mailboxManager) throws Exception { StoreQuotaManager quotaManager = new StoreQuotaManager(); quotaManager.setCalculateWhenUnlimited(false); --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org