JAMES-2341 Introduce SpamEventListener, MailboxListener for spam training purpose
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/49c9ea42 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/49c9ea42 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/49c9ea42 Branch: refs/heads/master Commit: 49c9ea42707e499aa435371005d46658915eadb0 Parents: 00e3224 Author: Antoine Duprat <[email protected]> Authored: Thu Feb 22 15:07:47 2018 +0100 Committer: Antoine Duprat <[email protected]> Committed: Wed Feb 28 13:29:31 2018 +0100 ---------------------------------------------------------------------- .../mailbox/store/StoreMailboxManager.java | 9 +++++++ .../mailbox/store/event/SpamEventListener.java | 25 ++++++++++++++++++++ 2 files changed, 34 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/49c9ea42/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java index a48e18f..46d05cc 100644 --- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/StoreMailboxManager.java @@ -67,6 +67,7 @@ import org.apache.james.mailbox.quota.QuotaRootResolver; import org.apache.james.mailbox.store.event.DelegatingMailboxListener; import org.apache.james.mailbox.store.event.MailboxAnnotationListener; import org.apache.james.mailbox.store.event.MailboxEventDispatcher; +import org.apache.james.mailbox.store.event.SpamEventListener; import org.apache.james.mailbox.store.extractor.DefaultTextExtractor; import org.apache.james.mailbox.store.mail.MailboxMapper; import org.apache.james.mailbox.store.mail.model.Mailbox; @@ -135,6 +136,7 @@ public class StoreMailboxManager implements MailboxManager { private final MessageParser messageParser; private final Factory messageIdFactory; private final ImmutableMailboxMessage.Factory immutableMailboxMessageFactory; + private SpamEventListener spamEventListener; @Inject public StoreMailboxManager(MailboxSessionMapperFactory mailboxSessionMapperFactory, Authenticator authenticator, Authorizator authorizator, @@ -199,6 +201,10 @@ public class StoreMailboxManager implements MailboxManager { return immutableMailboxMessageFactory; } + public void setSpamEventListener(SpamEventListener spamEventListener) { + this.spamEventListener = spamEventListener; + } + /** * Init the {@link MailboxManager} * @@ -234,6 +240,9 @@ public class StoreMailboxManager implements MailboxManager { if (hasCapability(MailboxCapabilities.Annotation)) { this.addGlobalListener(new MailboxAnnotationListener(mailboxSessionMapperFactory), session); } + if (spamEventListener != null) { + this.addGlobalListener(spamEventListener, session); + } } @Override http://git-wip-us.apache.org/repos/asf/james-project/blob/49c9ea42/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SpamEventListener.java ---------------------------------------------------------------------- diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SpamEventListener.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SpamEventListener.java new file mode 100644 index 0000000..94321c7 --- /dev/null +++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/SpamEventListener.java @@ -0,0 +1,25 @@ +/**************************************************************** + * 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.store.event; + +import org.apache.james.mailbox.MailboxListener; + +public interface SpamEventListener extends MailboxListener { + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
