[james-hupa] 05/05: Refactoring README to improve the content.

2018-02-28 Thread dongxu
This is an automated email from the ASF dual-hosted git repository.

dongxu pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/james-hupa.git

commit 379669b416267c43bfecc2e8f654a69b29bc2ba9
Author: Echo Wang 
AuthorDate: Thu Mar 1 11:23:28 2018 +0800

Refactoring README to improve the content.
---
 README.md | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index dd71fc2..045190a 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Hupa is a Rich IMAP-based Webmail application written in GWT.
 Hupa has been entirely written in java to be coherent with the language used 
in the James project.
 It has been a development reference using GWT good practices (MVP pattern and 
Unit testing)
 
-It is ready for reading, sending,  and managing messages and folders, but it 
still lacks of many features email clients nowadays have.
+It is ready for reading, sending, and managing messages and folders, but it 
still lacks of many features email clients nowadays have.
 
 # Bulding #
 Hupa use maven as building tool. To build hupa download maven 
(http://maven.apache.org), unpack maven and install it.
@@ -28,7 +28,7 @@ $ java -jar target/hupa-${version}.war
 Then point your browser to the url:
 http://localhost:8282
 
-If you prefer to use any other servlet container you can deploy the provided 
.war file in it.
+If you prefer to use any other servlet container you can deploy the provided 
.war file into it.
 
 # Hupa and IMAP/SMTP servers  #
 Hupa is able to discover most of the imap/smtp configuration based on the 
email domain part.
@@ -40,8 +40,8 @@ email provider servers.
 Hupa is compatible with most email providers, gmail, yahoo, hotmail, outlook, 
exchange, james, etc.
 
 # Eclipse GWT Plugin notes #
-- Hupa uses maven to be built, before inporting the project, you should have 
installed m2eclipse
-and google plugins, then go to Import -> New maven project and select the 
modules:
+- Hupa uses maven to be built, before importing the project, you should have 
installed m2eclipse
+and GWT Eclipse Plugin (3.0.0), then go to Import -> Existing Maven Projects 
and select the modules:
 shared, mock, server, widgets, client and hupa.
 
-- To run hupa in hosted mode, select: Run as -> (Google) Web application.
+- To run hupa in hosted mode, select hupa: Run As/Debug As -> GWT Development 
Mode with Jetty.

-- 
To stop receiving notification emails like this one, please contact
don...@apache.org.

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



[james-hupa] 03/05: Use header5 for the title of doc.

2018-02-28 Thread dongxu
This is an automated email from the ASF dual-hosted git repository.

dongxu pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/james-hupa.git

commit 42cf07669bac239186a5286ffd671a2a04c46932
Author: Echo Wang 
AuthorDate: Wed Feb 28 08:24:00 2018 +0800

Use header5 for the title of doc.
---
 README.md | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/README.md b/README.md
index ef15443..912d963 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
-
-## Introduction ##
+# Introduction #
 Hupa is a Rich IMAP-based Webmail application written in GWT.
 
 Hupa has been entirely written in java to be coherent with the language used 
in the James project.
@@ -7,12 +6,12 @@ It has been a development reference using GWT good practices 
(MVP pattern and Un
 
 It is ready for reading, sending,  and managing messages and folders, but it 
still lacks of many features email clients nowadays have.
 
-## Bulding ##
+# Bulding #
 Hupa use maven as building tool. To build hupa download maven 
(http://maven.apache.org), unpack maven and install it.
 After that change to hupa directory and execute the following cmd:
 $ mvn clean package
 
-## Configuring server side  
+# Configuring server side  #
 Hupa uses a properties file to know the IMAP and SMTP servers configuration.
 There is an example configuration file in 
'hupa/src/main/webapp/WEB-INF/conf/config.properties'
 
@@ -31,7 +30,7 @@ http://localhost:8282
 
 If you prefer to use any other servlet container you can deploy the provided 
.war file in it.
 
-## Hupa and IMAP/SMTP servers  #
+# Hupa and IMAP/SMTP servers  #
 Hupa is able to discover most of the imap/smtp configuration based on the 
email domain part.
 When you are prompted to login, type your email address and wait few seconds, 
if you click on the
 gear button you can see the configuration discovered by Hupa, you can modify 
it if it does not match
@@ -40,7 +39,7 @@ email provider servers.
 
 Hupa is compatible with most email providers, gmail, yahoo, hotmail, outlook, 
exchange, james, etc.
 
-## Eclipse GWT Plugin notes 
+# Eclipse GWT Plugin notes #
 - Hupa uses maven to be built, before inporting the project, you shoul install 
m2eclipse
 and google plugins, then go to Import -> New maven project and select the 
modules:
 shared, mock, server, widgets, client and hupa.

-- 
To stop receiving notification emails like this one, please contact
don...@apache.org.

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



[james-hupa] 02/05: Remove maven version since we are using maven 3.

2018-02-28 Thread dongxu
This is an automated email from the ASF dual-hosted git repository.

dongxu pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/james-hupa.git

commit fdf35f14b24a4a9ef57b4637564624392a79fa08
Author: Echo Wang 
AuthorDate: Tue Feb 27 09:25:15 2018 +0800

Remove maven version since we are using maven 3.
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 9eefe36..ef15443 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ It has been a development reference using GWT good practices 
(MVP pattern and Un
 It is ready for reading, sending,  and managing messages and folders, but it 
still lacks of many features email clients nowadays have.
 
 ## Bulding ##
-Hupa use maven2 as building tool. To build hupa download maven2 
(http://maven.apache.org), unpack maven2 and install it.
+Hupa use maven as building tool. To build hupa download maven 
(http://maven.apache.org), unpack maven and install it.
 After that change to hupa directory and execute the following cmd:
 $ mvn clean package
 

-- 
To stop receiving notification emails like this one, please contact
don...@apache.org.

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



[james-hupa] 01/05: Remove commented out content.

2018-02-28 Thread dongxu
This is an automated email from the ASF dual-hosted git repository.

dongxu pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/james-hupa.git

commit 8050e548d63ea3de3304ae46293111f9fc81e8f8
Author: Echo Wang 
AuthorDate: Mon Feb 26 09:10:04 2018 +0800

Remove commented out content.
---
 .../org/apache/hupa/client/place/FolderPlace.java| 20 
 1 file changed, 20 deletions(-)

diff --git a/client/src/main/java/org/apache/hupa/client/place/FolderPlace.java 
b/client/src/main/java/org/apache/hupa/client/place/FolderPlace.java
index 540685e..cd0d9ef 100644
--- a/client/src/main/java/org/apache/hupa/client/place/FolderPlace.java
+++ b/client/src/main/java/org/apache/hupa/client/place/FolderPlace.java
@@ -47,24 +47,4 @@ public class FolderPlace extends HupaPlace {
 return place.getToken();
 }
 }
-//
-//@Override
-//public boolean equals(Object o) {
-//if (o == null)
-//return false;
-//if (o == this)
-//return true;
-//if (o.getClass() != getClass())
-//return false;
-//FolderPlace place = (FolderPlace) o;
-//return (token == place.token || (token != null && 
token.equals(place.token)));
-//}
-//
-//@Override
-//public int hashCode() {
-//final int prime = 31;
-//int result = 1;
-//result = prime * result + ((token == null) ? 0 : token.hashCode());
-//return result;
-//}
 }

-- 
To stop receiving notification emails like this one, please contact
don...@apache.org.

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



[james-hupa] branch trunk updated (697eda5 -> 379669b)

2018-02-28 Thread dongxu
This is an automated email from the ASF dual-hosted git repository.

dongxu pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/james-hupa.git.


from 697eda5  Add TODO tag for issue#HUPA-117.
 new 8050e54  Remove commented out content.
 new fdf35f1  Remove maven version since we are using maven 3.
 new 42cf076  Use header5 for the title of doc.
 new f4b8f1d  Fix typo for README.
 new 379669b  Refactoring README to improve the content.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md  | 23 +++---
 .../org/apache/hupa/client/place/FolderPlace.java  | 20 ---
 2 files changed, 11 insertions(+), 32 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
don...@apache.org.

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



[james-hupa] 04/05: Fix typo for README.

2018-02-28 Thread dongxu
This is an automated email from the ASF dual-hosted git repository.

dongxu pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/james-hupa.git

commit f4b8f1d17e5b4f599dc03d01f0c9f45e9057782a
Author: Echo Wang 
AuthorDate: Thu Mar 1 11:15:32 2018 +0800

Fix typo for README.
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 912d963..dd71fc2 100644
--- a/README.md
+++ b/README.md
@@ -40,7 +40,7 @@ email provider servers.
 Hupa is compatible with most email providers, gmail, yahoo, hotmail, outlook, 
exchange, james, etc.
 
 # Eclipse GWT Plugin notes #
-- Hupa uses maven to be built, before inporting the project, you shoul install 
m2eclipse
+- Hupa uses maven to be built, before inporting the project, you should have 
installed m2eclipse
 and google plugins, then go to Import -> New maven project and select the 
modules:
 shared, mock, server, widgets, client and hupa.
 

-- 
To stop receiving notification emails like this one, please contact
don...@apache.org.

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



[1/8] james-project git commit: JAMES-2341 Move DefaultMailboxes at API level

2018-02-28 Thread rouazana
Repository: james-project
Updated Branches:
  refs/heads/master fc5c1eaaf -> 3dbfd86b8


JAMES-2341 Move DefaultMailboxes at API level


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

Branch: refs/heads/master
Commit: f8c62f29fc4f157feb6cbe6732adb037d3c4b557
Parents: 58c2deb
Author: Antoine Duprat 
Authored: Mon Feb 26 13:49:19 2018 +0100
Committer: Antoine Duprat 
Committed: Wed Feb 28 13:29:31 2018 +0100

--
 .../apache/james/mailbox/DefaultMailboxes.java  | 39 
 .../org/apache/james/jmap/ProvisioningTest.java |  1 +
 .../james/jmap/VacationIntegrationTest.java |  1 +
 .../jmap/VacationRelayIntegrationTest.java  |  1 +
 .../integration/GetMailboxesMethodTest.java |  2 +-
 .../integration/SetMailboxesMethodTest.java |  2 +-
 .../integration/SetMessagesMethodTest.java  |  2 +-
 .../org/apache/james/jmap/DefaultMailboxes.java | 39 
 .../DefaultMailboxesProvisioningFilter.java |  1 +
 .../apache/james/jmap/model/mailbox/Role.java   |  2 +-
 .../DefaultMailboxesProvisioningFilterTest.java |  1 +
 .../jmap/send/PostDequeueDecoratorTest.java |  2 +-
 12 files changed, 49 insertions(+), 44 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/f8c62f29/mailbox/api/src/main/java/org/apache/james/mailbox/DefaultMailboxes.java
--
diff --git 
a/mailbox/api/src/main/java/org/apache/james/mailbox/DefaultMailboxes.java 
b/mailbox/api/src/main/java/org/apache/james/mailbox/DefaultMailboxes.java
new file mode 100644
index 000..0fa4401
--- /dev/null
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/DefaultMailboxes.java
@@ -0,0 +1,39 @@
+/
+ * 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 org.apache.james.mailbox.model.MailboxConstants;
+
+import com.google.common.collect.ImmutableList;
+
+public interface DefaultMailboxes {
+
+String INBOX = MailboxConstants.INBOX;
+String OUTBOX = "Outbox";
+String SENT = "Sent";
+String TRASH = "Trash";
+String DRAFTS = "Drafts";
+String ARCHIVE = "Archive";
+String SPAM = "Spam";
+String TEMPLATES = "Templates";
+
+List DEFAULT_MAILBOXES = ImmutableList.of(INBOX, OUTBOX, SENT, 
TRASH, DRAFTS, SPAM);
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/f8c62f29/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
--
diff --git 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
index 805a0c9..67e40f8 100644
--- 
a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
+++ 
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ProvisioningTest.java
@@ -33,6 +33,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.james.GuiceJamesServer;
+import org.apache.james.mailbox.DefaultMailboxes;
 import 

[2/8] james-project git commit: JAMES-2341 Introduce SpamAssassinConfiguration

2018-02-28 Thread rouazana
JAMES-2341 Introduce SpamAssassinConfiguration


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

Branch: refs/heads/master
Commit: ae8652df1169224fc6258ad93c2156f8884a6457
Parents: 49c9ea4
Author: Antoine Duprat 
Authored: Thu Feb 22 15:41:05 2018 +0100
Committer: Antoine Duprat 
Committed: Wed Feb 28 13:29:31 2018 +0100

--
 mailbox/plugin/spamassassin/pom.xml | 15 +
 .../spamassassin/SpamAssassinConfiguration.java | 66 
 .../SpamAssassinConfigurationTest.java  | 51 +++
 3 files changed, 132 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/ae8652df/mailbox/plugin/spamassassin/pom.xml
--
diff --git a/mailbox/plugin/spamassassin/pom.xml 
b/mailbox/plugin/spamassassin/pom.xml
index 87254bc..e88cc2d 100644
--- a/mailbox/plugin/spamassassin/pom.xml
+++ b/mailbox/plugin/spamassassin/pom.xml
@@ -36,6 +36,21 @@
 ${project.groupId}
 apache-james-mailbox-api
 
+
+junit
+junit
+test
+
+
+nl.jqno.equalsverifier
+equalsverifier
+test
+
+
+org.assertj
+assertj-core
+test
+
 
 
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/ae8652df/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassinConfiguration.java
--
diff --git 
a/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassinConfiguration.java
 
b/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassinConfiguration.java
new file mode 100644
index 000..bfc5f82
--- /dev/null
+++ 
b/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassinConfiguration.java
@@ -0,0 +1,66 @@
+/
+ * 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.spamassassin;
+
+import java.util.Objects;
+import java.util.Optional;
+
+import org.apache.james.util.Host;
+
+import com.google.common.base.MoreObjects;
+
+public class SpamAssassinConfiguration {
+
+private final Optional host;
+
+public SpamAssassinConfiguration(Optional host) {
+this.host = host;
+}
+
+public boolean isEnable() {
+return host.isPresent();
+}
+
+public Optional getHost() {
+return host;
+}
+
+@Override
+public final boolean equals(Object o) {
+if (o instanceof SpamAssassinConfiguration) {
+SpamAssassinConfiguration that = (SpamAssassinConfiguration) o;
+
+return Objects.equals(this.host, that.host);
+}
+return false;
+}
+
+@Override
+public final int hashCode() {
+return Objects.hash(host);
+}
+
+@Override
+public String toString() {
+return MoreObjects.toStringHelper(this)
+.add("host", host)
+.toString();
+}
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/ae8652df/mailbox/plugin/spamassassin/src/test/java/org/apache/james/mailbox/spamassassin/SpamAssassinConfigurationTest.java
--
diff --git 

[6/8] james-project git commit: JAMES-2341 Move Role at API level

2018-02-28 Thread rouazana
JAMES-2341 Move Role at API level


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

Branch: refs/heads/master
Commit: e640b76fece2fa2bfd449d840ad0d7d6cfacba90
Parents: f8c62f2
Author: Antoine Duprat 
Authored: Tue Feb 27 11:20:46 2018 +0100
Committer: Antoine Duprat 
Committed: Wed Feb 28 13:29:32 2018 +0100

--
 .../java/org/apache/james/mailbox/Role.java | 121 ++
 .../java/org/apache/james/mailbox/RoleTest.java | 163 +++
 .../integration/SetMessagesMethodTest.java  |   2 +-
 .../MailboxRoleNotFoundException.java   |   2 +-
 .../james/jmap/json/ObjectMapperFactory.java|   4 +
 .../org/apache/james/jmap/json/RoleMixIn.java   |  27 +++
 .../SetMailboxesDestructionProcessor.java   |   2 +-
 .../methods/SetMailboxesUpdateProcessor.java|   2 +-
 .../methods/SetMessagesCreationProcessor.java   |   2 +-
 .../methods/SetMessagesUpdateProcessor.java |   2 +-
 .../apache/james/jmap/model/MailboxFactory.java |   2 +-
 .../james/jmap/model/mailbox/Mailbox.java   |   1 +
 .../model/mailbox/MailboxCreateRequest.java |   1 +
 .../model/mailbox/MailboxUpdateRequest.java |   1 +
 .../apache/james/jmap/model/mailbox/Role.java   | 125 --
 .../james/jmap/model/mailbox/SortOrder.java |   2 +
 .../james/jmap/send/PostDequeueDecorator.java   |   2 +-
 .../jmap/utils/SystemMailboxesProvider.java |   2 +-
 .../jmap/utils/SystemMailboxesProviderImpl.java |   2 +-
 .../jmap/methods/GetMailboxesMethodTest.java|   2 +-
 .../SetMessagesCreationProcessorTest.java   |   2 +-
 .../model/mailbox/MailboxCreateRequestTest.java |   1 +
 .../james/jmap/model/mailbox/MailboxTest.java   |   1 +
 .../james/jmap/model/mailbox/RoleTest.java  | 162 --
 .../utils/SystemMailboxesProviderImplTest.java  |   2 +-
 25 files changed, 335 insertions(+), 300 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/e640b76f/mailbox/api/src/main/java/org/apache/james/mailbox/Role.java
--
diff --git a/mailbox/api/src/main/java/org/apache/james/mailbox/Role.java 
b/mailbox/api/src/main/java/org/apache/james/mailbox/Role.java
new file mode 100644
index 000..675b91b
--- /dev/null
+++ b/mailbox/api/src/main/java/org/apache/james/mailbox/Role.java
@@ -0,0 +1,121 @@
+/
+ * 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 java.util.Optional;
+import java.util.function.BiFunction;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.MoreObjects;
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableList;
+
+public class Role {
+
+public static final String USER_DEFINED_ROLE_PREFIX = "x-";
+
+private static final BiFunction 
CASE_SENSITIVE_COMPARATOR = (a, b) -> a.equals(b);
+private static final BiFunction 
NON_CASE_SENSITIVE_COMPARATOR = (a, b) -> a.equalsIgnoreCase(b);
+
+public static final Role INBOX = new Role("inbox", DefaultMailboxes.INBOX, 
NON_CASE_SENSITIVE_COMPARATOR);
+public static final Role DRAFTS = new Role("drafts", 
DefaultMailboxes.DRAFTS, CASE_SENSITIVE_COMPARATOR);
+public static final Role OUTBOX = new Role("outbox", 
DefaultMailboxes.OUTBOX, CASE_SENSITIVE_COMPARATOR);
+public static 

[5/8] james-project git commit: JAMES-2341 Introduce SpamAssassin mailbox project

2018-02-28 Thread rouazana
JAMES-2341 Introduce SpamAssassin mailbox project


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

Branch: refs/heads/master
Commit: 00e3224ceab663fabea6953f7f47de326e989f27
Parents: fc5c1ea
Author: Antoine Duprat 
Authored: Wed Feb 21 15:03:44 2018 +0100
Committer: Antoine Duprat 
Committed: Wed Feb 28 13:29:31 2018 +0100

--
 mailbox/plugin/spamassassin/pom.xml | 41 
 mailbox/pom.xml |  2 ++
 pom.xml |  5 
 3 files changed, 48 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/00e3224c/mailbox/plugin/spamassassin/pom.xml
--
diff --git a/mailbox/plugin/spamassassin/pom.xml 
b/mailbox/plugin/spamassassin/pom.xml
new file mode 100644
index 000..87254bc
--- /dev/null
+++ b/mailbox/plugin/spamassassin/pom.xml
@@ -0,0 +1,41 @@
+
+
+http://maven.apache.org/POM/4.0.0; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd;>
+4.0.0
+
+
+org.apache.james
+apache-james-mailbox
+3.1.0-SNAPSHOT
+../../pom.xml
+
+
+apache-james-mailbox-spamassassin
+Apache James :: Mailbox :: Plugin :: SpamAssassin
+Apache James Mailbox SpamAssassin integration
+
+
+
+${project.groupId}
+apache-james-mailbox-api
+
+
+
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/00e3224c/mailbox/pom.xml
--
diff --git a/mailbox/pom.xml b/mailbox/pom.xml
index 942081b..a8204d2 100644
--- a/mailbox/pom.xml
+++ b/mailbox/pom.xml
@@ -52,6 +52,8 @@
 tika
 tool
 zoo-seq-provider
+
+plugin/spamassassin
 
 
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/00e3224c/pom.xml
--
diff --git a/pom.xml b/pom.xml
index 4882d08..e220680 100644
--- a/pom.xml
+++ b/pom.xml
@@ -818,6 +818,11 @@
 
 
 ${project.groupId}
+apache-james-mailbox-spamassassin
+${project.version}
+
+
+${project.groupId}
 apache-james-mailbox-spring
 ${project.version}
 


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



[8/8] james-project git commit: JAMES-2341 Bind SpamAssassin in Cassandra guice implementation

2018-02-28 Thread rouazana
JAMES-2341 Bind SpamAssassin in Cassandra guice implementation


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

Branch: refs/heads/master
Commit: 3dbfd86b8bfb8780d3ed37dc65c1deabe1e52b44
Parents: bd25907
Author: Antoine Duprat 
Authored: Fri Feb 23 09:50:09 2018 +0100
Committer: Antoine Duprat 
Committed: Wed Feb 28 13:29:33 2018 +0100

--
 .../mailbox/store/StoreMailboxManager.java  |  9 ---
 .../apache/james/CassandraJamesServerMain.java  |  4 +-
 .../modules/mailbox/CassandraMailboxModule.java |  6 +-
 .../mailbox/SpamAssassinListenerModule.java | 72 
 4 files changed, 80 insertions(+), 11 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/3dbfd86b/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 46d05cc..a48e18f 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,7 +67,6 @@ 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;
@@ -136,7 +135,6 @@ 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,
@@ -201,10 +199,6 @@ public class StoreMailboxManager implements MailboxManager 
{
 return immutableMailboxMessageFactory;
 }
 
-public void setSpamEventListener(SpamEventListener spamEventListener) {
-this.spamEventListener = spamEventListener;
-}
-
 /**
  * Init the {@link MailboxManager}
  *
@@ -240,9 +234,6 @@ 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/3dbfd86b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
--
diff --git 
a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
 
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
index d117d9b..bfd1c84 100644
--- 
a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
+++ 
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -29,6 +29,7 @@ import 
org.apache.james.modules.data.CassandraUsersRepositoryModule;
 import org.apache.james.modules.mailbox.CassandraMailboxModule;
 import org.apache.james.modules.mailbox.CassandraSessionModule;
 import org.apache.james.modules.mailbox.ElasticSearchMailboxModule;
+import org.apache.james.modules.mailbox.SpamAssassinListenerModule;
 import org.apache.james.modules.mailbox.TikaMailboxModule;
 import org.apache.james.modules.metrics.CassandraMetricsModule;
 import org.apache.james.modules.protocols.IMAPServerModule;
@@ -87,7 +88,8 @@ public class CassandraJamesServerMain {
 new ElasticSearchMailboxModule(),
 new ElasticSearchMetricReporterModule(),
 new MailboxModule(),
-new TikaMailboxModule());
+new TikaMailboxModule(),
+new SpamAssassinListenerModule());
 
 public static 

[4/8] james-project git commit: JAMES-2341 Load SpamAssassin configuration from file

2018-02-28 Thread rouazana
JAMES-2341 Load SpamAssassin configuration from file


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

Branch: refs/heads/master
Commit: 58c2debda944e652ba272c86ad850df4525652a9
Parents: ae8652d
Author: Antoine Duprat 
Authored: Thu Feb 22 15:22:43 2018 +0100
Committer: Antoine Duprat 
Committed: Wed Feb 28 13:29:31 2018 +0100

--
 server/container/guice/cassandra-guice/pom.xml  |  4 ++
 .../SpamAssassinConfigurationLoader.java| 49 
 .../SpamAssassinConfigurationLoaderTest.java| 59 
 3 files changed, 112 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/58c2debd/server/container/guice/cassandra-guice/pom.xml
--
diff --git a/server/container/guice/cassandra-guice/pom.xml 
b/server/container/guice/cassandra-guice/pom.xml
index a0e6b14..affbae2 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -78,6 +78,10 @@
 
 
 ${project.groupId}
+apache-james-mailbox-spamassassin
+
+
+${project.groupId}
 apache-james-mailbox-tika
 test-jar
 test

http://git-wip-us.apache.org/repos/asf/james-project/blob/58c2debd/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/SpamAssassinConfigurationLoader.java
--
diff --git 
a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/SpamAssassinConfigurationLoader.java
 
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/SpamAssassinConfigurationLoader.java
new file mode 100644
index 000..35a2077
--- /dev/null
+++ 
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/SpamAssassinConfigurationLoader.java
@@ -0,0 +1,49 @@
+/
+ * 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.modules.mailbox;
+
+import java.util.Optional;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.james.mailbox.spamassassin.SpamAssassinConfiguration;
+import org.apache.james.util.Host;
+
+public class SpamAssassinConfigurationLoader {
+
+private static final String SPAMASSASSIN_HOST = "spamassassin.host";
+private static final String SPAMASSASSIN_PORT = "spamassassin.port";
+public static final String DEFAULT_HOST = "127.0.0.1";
+public static final int DEFAULT_PORT = 783;
+
+public static SpamAssassinConfiguration disable() {
+return new SpamAssassinConfiguration(Optional.empty());
+}
+
+public static SpamAssassinConfiguration 
fromProperties(PropertiesConfiguration configuration) throws 
ConfigurationException {
+Host host = getHost(configuration);
+return new SpamAssassinConfiguration(Optional.of(host));
+}
+
+private static Host getHost(PropertiesConfiguration propertiesReader) 
throws ConfigurationException {
+return Host.from(propertiesReader.getString(SPAMASSASSIN_HOST, 
DEFAULT_HOST), 
+propertiesReader.getInteger(SPAMASSASSIN_PORT, DEFAULT_PORT));
+}
+}


[7/8] james-project git commit: JAMES-2341 SpamAssassin listener implementation for SpamEventListener

2018-02-28 Thread rouazana
JAMES-2341 SpamAssassin listener implementation for SpamEventListener


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

Branch: refs/heads/master
Commit: bd259078b11fd104d6ccd8ec523e109fe114adde
Parents: e640b76
Author: Antoine Duprat 
Authored: Fri Feb 23 09:48:27 2018 +0100
Committer: Antoine Duprat 
Committed: Wed Feb 28 13:29:32 2018 +0100

--
 mailbox/plugin/spamassassin/pom.xml |   9 ++
 .../mailbox/spamassassin/SpamAssassin.java  |  40 +++
 .../spamassassin/SpamAssassinListener.java  |  75 +
 .../spamassassin/SpamAssassinListenerTest.java  | 105 +++
 4 files changed, 229 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/james-project/blob/bd259078/mailbox/plugin/spamassassin/pom.xml
--
diff --git a/mailbox/plugin/spamassassin/pom.xml 
b/mailbox/plugin/spamassassin/pom.xml
index e88cc2d..b510523 100644
--- a/mailbox/plugin/spamassassin/pom.xml
+++ b/mailbox/plugin/spamassassin/pom.xml
@@ -37,6 +37,10 @@
 apache-james-mailbox-api
 
 
+${project.groupId}
+apache-james-mailbox-store
+
+
 junit
 junit
 test
@@ -51,6 +55,11 @@
 assertj-core
 test
 
+
+org.mockito
+mockito-core
+test
+
 
 
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/bd259078/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassin.java
--
diff --git 
a/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassin.java
 
b/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassin.java
new file mode 100644
index 000..0dfb30e
--- /dev/null
+++ 
b/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassin.java
@@ -0,0 +1,40 @@
+/
+ * 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.spamassassin;
+
+import java.io.InputStream;
+import java.util.List;
+
+import javax.inject.Inject;
+
+public class SpamAssassin {
+
+private final SpamAssassinConfiguration spamAssassinConfiguration;
+
+@Inject
+public SpamAssassin(SpamAssassinConfiguration spamAssassinConfiguration) {
+this.spamAssassinConfiguration = spamAssassinConfiguration;
+}
+
+public void learnSpam(List messages) {
+if (spamAssassinConfiguration.isEnable()) {
+// Will call SpamAssassinInvoker
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/bd259078/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassinListener.java
--
diff --git 
a/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassinListener.java
 
b/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassinListener.java
new file mode 100644
index 000..d0888f6
--- /dev/null
+++ 
b/mailbox/plugin/spamassassin/src/main/java/org/apache/james/mailbox/spamassassin/SpamAssassinListener.java
@@ -0,0 +1,75 @@
+/
+ 

[3/8] james-project git commit: JAMES-2341 Introduce SpamEventListener, MailboxListener for spam training purpose

2018-02-28 Thread rouazana
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 
Authored: Thu Feb 22 15:07:47 2018 +0100
Committer: Antoine Duprat 
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 000..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  *
+