You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2020/11/18 02:30:16 UTC

[james-project] branch master updated (1495d5e -> 6e89015)

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

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


    from 1495d5e  JAMES-3400 Add user exist command
     new 32c2139  [ADR] JMAP: Avoid ElasticSearch on critical reads
     new 3b189df  [ADR] JMAP: Mention InfiniSpan as a possible alternative
     new d987d40  JAMES-3444 Allow moving JMAP mailets in a local-delivery processor
     new 78cf07a  JAMES-3444 Default configuration should have a local-delivery processor
     new ef18af5  JAMES-1902 Drops duplicate dependencies
     new d15d695  JAMES-1902 Moves guice blob bindings to their own directory
     new 6e89015  JAMES-1902 uses sortpom to fix pom dependencies ordering

The 7 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:
 .../destination/conf/mailetcontainer.xml           |  18 ++-
 .../destination/conf/mailetcontainer.xml           |  18 ++-
 .../destination/conf/mailetcontainer.xml           |  18 ++-
 .../cassandra/destination/conf/mailetcontainer.xml |  18 ++-
 .../memory/destination/conf/mailetcontainer.xml    |  18 ++-
 .../api/src/main/java/org/apache/mailet/Mail.java  |  18 +++
 .../guice/{blob-api-guice => blob/api}/pom.xml     |  12 +-
 .../james/modules/mailbox/BlobStoreAPIModule.java  |   0
 .../modules/mailbox/ConfigurationComponent.java    |   0
 .../{blob-export-guice => blob/export}/pom.xml     |  12 +-
 .../apache/james/modules/BlobExportImplChoice.java |   0
 .../james/modules/BlobExportMechanismModule.java   |   0
 .../modules/LinshareBlobExportMechanismModule.java |   0
 .../LocalFileBlobExportMechanismModule.java        |   0
 .../james/modules/BlobExportImplChoiceTest.java    |   0
 .../modules/BlobExportMechanismModuleTest.java     |   0
 .../james/modules/LinshareGuiceExtension.java      |   0
 .../{blob-memory-guice => blob/memory}/pom.xml     |  12 +-
 .../org/apache/james/modules/BlobMemoryModule.java |   0
 .../guice/{blob-s3-guice => blob/s3}/pom.xml       |   2 +-
 .../modules/objectstorage/DefaultBucketModule.java |   0
 .../S3BlobStoreConfigurationReader.java            |   0
 .../modules/objectstorage/S3BlobStoreModule.java   |   0
 .../aws/s3/AwsS3ConfigurationReader.java           |   0
 .../aws/s3/AwsS3ConfigurationReaderTest.java       |   0
 .../objectstorage/aws/s3/DockerAwsS3TestRule.java  |   0
 .../src/test/resources/mailetcontainer.xml         |  26 ++--
 .../src/test/resources/mailetcontainer.xml         |  15 +-
 .../src/test/resources/mailetcontainer.xml         |  13 +-
 .../src/test/resources/mailetcontainer.xml         |  14 +-
 server/container/guice/jpa-smtp-mariadb/pom.xml    |   4 -
 .../modules/server/CamelMailetContainerModule.java | 101 +++++++++---
 .../server/CamelMailetContainerModuleTest.java     |   2 +-
 .../src/test/resources/mailetcontainer.xml         |  26 ++--
 server/container/guice/pom.xml                     |  33 ++--
 .../org/apache/james/jmap/draft/JMAPModule.java    |  30 +++-
 .../james/jmap/draft/MailetPreconditionTest.java   |  49 +++---
 server/container/guice/queue/memory/pom.xml        |   2 +-
 server/container/guice/queue/rabbitmq/pom.xml      |   8 +-
 server/data/data-cassandra/pom.xml                 |   6 -
 .../0043-avoid-elasticsearch-on-critical-reads.md  | 170 +++++++++++++++++++++
 41 files changed, 478 insertions(+), 167 deletions(-)
 rename server/container/guice/{blob-api-guice => blob/api}/pom.xml (96%)
 rename server/container/guice/{blob-api-guice => blob/api}/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.java (100%)
 rename server/container/guice/{blob-api-guice => blob/api}/src/main/java/org/apache/james/modules/mailbox/ConfigurationComponent.java (100%)
 rename server/container/guice/{blob-export-guice => blob/export}/pom.xml (97%)
 rename server/container/guice/{blob-export-guice => blob/export}/src/main/java/org/apache/james/modules/BlobExportImplChoice.java (100%)
 rename server/container/guice/{blob-export-guice => blob/export}/src/main/java/org/apache/james/modules/BlobExportMechanismModule.java (100%)
 rename server/container/guice/{blob-export-guice => blob/export}/src/main/java/org/apache/james/modules/LinshareBlobExportMechanismModule.java (100%)
 rename server/container/guice/{blob-export-guice => blob/export}/src/main/java/org/apache/james/modules/LocalFileBlobExportMechanismModule.java (100%)
 rename server/container/guice/{blob-export-guice => blob/export}/src/test/java/org/apache/james/modules/BlobExportImplChoiceTest.java (100%)
 rename server/container/guice/{blob-export-guice => blob/export}/src/test/java/org/apache/james/modules/BlobExportMechanismModuleTest.java (100%)
 rename server/container/guice/{blob-export-guice => blob/export}/src/test/java/org/apache/james/modules/LinshareGuiceExtension.java (100%)
 rename server/container/guice/{blob-memory-guice => blob/memory}/pom.xml (97%)
 rename server/container/guice/{blob-memory-guice => blob/memory}/src/main/java/org/apache/james/modules/BlobMemoryModule.java (100%)
 rename server/container/guice/{blob-s3-guice => blob/s3}/pom.xml (97%)
 rename server/container/guice/{blob-s3-guice => blob/s3}/src/main/java/org/apache/james/modules/objectstorage/DefaultBucketModule.java (100%)
 rename server/container/guice/{blob-s3-guice => blob/s3}/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreConfigurationReader.java (100%)
 rename server/container/guice/{blob-s3-guice => blob/s3}/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreModule.java (100%)
 rename server/container/guice/{blob-s3-guice => blob/s3}/src/main/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReader.java (100%)
 rename server/container/guice/{blob-s3-guice => blob/s3}/src/test/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReaderTest.java (100%)
 rename server/container/guice/{blob-s3-guice => blob/s3}/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java (100%)
 create mode 100644 src/adr/0043-avoid-elasticsearch-on-critical-reads.md


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


[james-project] 01/07: [ADR] JMAP: Avoid ElasticSearch on critical reads

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 32c213998336e6db969d8b999964269a0c0e3390
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Nov 11 15:19:37 2020 +0700

    [ADR] JMAP: Avoid ElasticSearch on critical reads
---
 .../0043-avoid-elasticsearch-on-critical-reads.md  | 164 +++++++++++++++++++++
 1 file changed, 164 insertions(+)

diff --git a/src/adr/0043-avoid-elasticsearch-on-critical-reads.md b/src/adr/0043-avoid-elasticsearch-on-critical-reads.md
new file mode 100644
index 0000000..e3954ca6
--- /dev/null
+++ b/src/adr/0043-avoid-elasticsearch-on-critical-reads.md
@@ -0,0 +1,164 @@
+# 43. Avoid ElasticSearch on critical reads
+
+Date: 2020-11-11
+
+## Status
+
+Accepted (lazy consensus).
+
+Scope: Distributed James
+
+## Context
+
+A user willing to use a webmail powered by the JMAP protocol will end up doing the following operations:
+ - `Mailbox/get` to retrieve the mailboxes. This call is resolved against metadata stored in Cassandra.
+ - `Email/query` to retrieve the list of emails. This call is nowadays resolved on ElasticSearch for Email search after
+ a right resolution pass against Cassandra.
+ - `Email/get` to retrieve various levels of details. Depending on requested properties, this is either
+ retrieved from Cassandra alone or from ObjectStorage.
+
+So, ElasticSearch is queried on every JMAP interaction for listing emails. Administrators thus need to enforce availability and good performance
+for this component.
+
+Relying on more services for every read also harms our resiliency as ElasticSearch outages have major impacts.
+
+Also we should mention our ElasticSearch implementation in Distributed James suffers the following flaws:
+ - Updates of flags lead to updates of the all Email object, leading to sparse segments
+ - We currently rely on scrolling for JMAP (in order to ensure messageId uniqueness in the response while respecting limit & position)
+ - We noticed some very slow traces against ElasticSearch, even for simple queries.
+
+Regarding Distributed James data-stores responsibilities:
+ - Cassandra is the source of truth for metadata, its storage needs to be adapted to known access patterns.
+ - ElasticSearch allows resolution of arbitrary queries, and performs full text search.
+
+## Decision
+
+Provide an optional view for most common `Email/query` requests both on Draft and RFC-8621 implementations.
+This includes filters and sorts on 'sentAt'.
+
+This view will be stored into Cassandra, and updated asynchronously via a MailboxListener.
+
+## Consequences
+
+A migration task will be provided for new adopters.
+
+Administrators would be offered a configuration option to turn this view on and off as needed.
+
+If enabled, given clients following well defined Email/query requests, administrators would no longer need
+to ensure high availability and good performances for ElasticSearch to ensure availability of basic usages
+(mailbox content listing).
+
+Given these pre-requisites, we thus expect a decrease in overall ElasticSearch load, allowing savings compared
+to actual deployments. Furthermore, we expect better performances by resolving such queries against Cassandra.
+
+The expected added load to Cassandra is low, as the search is a simple Cassandra read. As we only store messageId,
+Cassandra dataset size will only grow of a few percents if enabled.
+
+## Alternatives
+
+Those not willing to adopt this view will not be affected. By disabling the listener and the view usage, they will keep
+resolving all `Email/query` against ElasticSearch.
+
+## Example of optimized JMAP requests
+
+### A: Email list sorted by sentAt, with limit
+
+RFC-8621:
+
+```
+["Email/query",
+ {
+   "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+   "filter: {
+       "inMailbox":"abcd"
+   }
+   "comparator": [{
+     "property":"sentAt",
+     "isAscending": false
+   }],
+   "position": 30,
+   "limit": 30
+ },
+ "c1"]
+```
+
+Draft:
+
+```
+[["getMessageList", {"filter":{"inMailboxes": ["abcd"]}, "sort": ["date desc"]}, "#0"]]
+```
+
+### B: Email list sorted by sentAt, with limit, after a given receivedAt date
+
+RFC-8621:
+
+```
+["Email/query",
+ {
+   "accountId": "29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
+   "filter: {
+       "inMailbox":"abcd",
+       "after": "aDate"
+   }
+   "comparator": [{
+     "property":"sentAt",
+     "isAscending": false
+   }],
+   "position": 30,
+   "limit": 30
+ },
+ "c1"]
+```
+
+Draft: Draft do only expose a single date property thus do not differenciate sentAt from receivedAt. Draft adopts sentAt
+to back the date property up, thus the above request cannot be written using draft syntax.
+
+### C: Email list sorted by sentAt, with limit, after a given sentAt date
+
+Draft:
+
+```
+[["getMessageList", {"filter":{"after":"aDate", "inMailboxes": ["abcd"]}, "sort": ["date desc"]}, "#0"]]
+```
+
+RFC-8621: There is no filter properties targeting "sentAt" thus the above request cannot be written.
+
+## Cassandra table structure
+
+Several tables are required in order to implement this view on top of Cassandra.
+
+Eventual denormalization consistency can be enforced by using BATCH statements.
+
+A table allows sorting messages of a mailbox by sentAt, allows answering A and C:
+
+```
+TABLE email_query_view_sent_at
+PRIMARY KEY mailboxId
+CLUSTERING COLUMN sentAt
+CLUSTERING COLUMN messageId
+ORDERED BY sentAt
+```
+
+A table allows filtering emails after a receivedAt date. Given a limited number of results, soft sorting and limits can
+be applied using the sentAt column. This allows answering B:
+
+```
+TABLE email_query_view_sent_at
+PRIMARY KEY mailboxId
+CLUSTERING COLUMN receivedAt
+CLUSTERING COLUMN messageId
+COLUMN sentAt
+ORDERED BY receivedAt
+```
+
+Finally upon deletes, receivedAt and sentAt should be known. Thus we need to provide a lookup table:
+
+```
+TABLE email_query_view_date_lookup
+PRIMARY KEY mailboxId
+CLUSTERING COLUMN messageId
+COLUMN sentAt
+COLUMN receivedAt
+```
+
+Note that to handle position & limit, we need to fetch `position + limit` ordered items then removing `position` firsts items.


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


[james-project] 06/07: JAMES-1902 Moves guice blob bindings to their own directory

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d15d695bf40589883ae319147910cb39e6fe0517
Author: Jean Helou <jh...@codamens.fr>
AuthorDate: Mon Nov 16 13:58:42 2020 +0100

    JAMES-1902 Moves guice blob bindings to their own directory
---
 server/container/guice/{blob-api-guice => blob/api}/pom.xml  | 12 ++++++------
 .../org/apache/james/modules/mailbox/BlobStoreAPIModule.java |  0
 .../apache/james/modules/mailbox/ConfigurationComponent.java |  0
 .../guice/{blob-export-guice => blob/export}/pom.xml         | 12 ++++++------
 .../java/org/apache/james/modules/BlobExportImplChoice.java  |  0
 .../org/apache/james/modules/BlobExportMechanismModule.java  |  0
 .../james/modules/LinshareBlobExportMechanismModule.java     |  0
 .../james/modules/LocalFileBlobExportMechanismModule.java    |  0
 .../org/apache/james/modules/BlobExportImplChoiceTest.java   |  0
 .../apache/james/modules/BlobExportMechanismModuleTest.java  |  0
 .../org/apache/james/modules/LinshareGuiceExtension.java     |  0
 .../guice/{blob-memory-guice => blob/memory}/pom.xml         | 12 ++++++------
 .../main/java/org/apache/james/modules/BlobMemoryModule.java |  0
 server/container/guice/{blob-s3-guice => blob/s3}/pom.xml    |  2 +-
 .../james/modules/objectstorage/DefaultBucketModule.java     |  0
 .../objectstorage/S3BlobStoreConfigurationReader.java        |  0
 .../james/modules/objectstorage/S3BlobStoreModule.java       |  0
 .../objectstorage/aws/s3/AwsS3ConfigurationReader.java       |  0
 .../objectstorage/aws/s3/AwsS3ConfigurationReaderTest.java   |  0
 .../modules/objectstorage/aws/s3/DockerAwsS3TestRule.java    |  0
 server/container/guice/pom.xml                               |  8 ++++----
 21 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/server/container/guice/blob-api-guice/pom.xml b/server/container/guice/blob/api/pom.xml
similarity index 96%
rename from server/container/guice/blob-api-guice/pom.xml
rename to server/container/guice/blob/api/pom.xml
index 2d07501..eacf1a4 100644
--- a/server/container/guice/blob-api-guice/pom.xml
+++ b/server/container/guice/blob/api/pom.xml
@@ -25,7 +25,7 @@
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
         <version>3.6.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
+        <relativePath>../../pom.xml</relativePath>
     </parent>
 
     <artifactId>blob-api-guice</artifactId>
@@ -40,13 +40,13 @@
             <artifactId>blob-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-        </dependency>
-        <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>testing-base</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/server/container/guice/blob-api-guice/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.java b/server/container/guice/blob/api/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.java
similarity index 100%
rename from server/container/guice/blob-api-guice/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.java
rename to server/container/guice/blob/api/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.java
diff --git a/server/container/guice/blob-api-guice/src/main/java/org/apache/james/modules/mailbox/ConfigurationComponent.java b/server/container/guice/blob/api/src/main/java/org/apache/james/modules/mailbox/ConfigurationComponent.java
similarity index 100%
rename from server/container/guice/blob-api-guice/src/main/java/org/apache/james/modules/mailbox/ConfigurationComponent.java
rename to server/container/guice/blob/api/src/main/java/org/apache/james/modules/mailbox/ConfigurationComponent.java
diff --git a/server/container/guice/blob-export-guice/pom.xml b/server/container/guice/blob/export/pom.xml
similarity index 97%
rename from server/container/guice/blob-export-guice/pom.xml
rename to server/container/guice/blob/export/pom.xml
index 9f4f840..7890354 100644
--- a/server/container/guice/blob-export-guice/pom.xml
+++ b/server/container/guice/blob/export/pom.xml
@@ -25,7 +25,7 @@
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
         <version>3.6.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
+        <relativePath>../../pom.xml</relativePath>
     </parent>
 
     <artifactId>blob-export-guice</artifactId>
@@ -58,16 +58,16 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-guice-configuration</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-guice-common</artifactId>
             <type>test-jar</type>
             <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-guice-configuration</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>testing-base</artifactId>
             <scope>test</scope>
         </dependency>
@@ -77,4 +77,4 @@
             <scope>test</scope>
         </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/server/container/guice/blob-export-guice/src/main/java/org/apache/james/modules/BlobExportImplChoice.java b/server/container/guice/blob/export/src/main/java/org/apache/james/modules/BlobExportImplChoice.java
similarity index 100%
rename from server/container/guice/blob-export-guice/src/main/java/org/apache/james/modules/BlobExportImplChoice.java
rename to server/container/guice/blob/export/src/main/java/org/apache/james/modules/BlobExportImplChoice.java
diff --git a/server/container/guice/blob-export-guice/src/main/java/org/apache/james/modules/BlobExportMechanismModule.java b/server/container/guice/blob/export/src/main/java/org/apache/james/modules/BlobExportMechanismModule.java
similarity index 100%
rename from server/container/guice/blob-export-guice/src/main/java/org/apache/james/modules/BlobExportMechanismModule.java
rename to server/container/guice/blob/export/src/main/java/org/apache/james/modules/BlobExportMechanismModule.java
diff --git a/server/container/guice/blob-export-guice/src/main/java/org/apache/james/modules/LinshareBlobExportMechanismModule.java b/server/container/guice/blob/export/src/main/java/org/apache/james/modules/LinshareBlobExportMechanismModule.java
similarity index 100%
rename from server/container/guice/blob-export-guice/src/main/java/org/apache/james/modules/LinshareBlobExportMechanismModule.java
rename to server/container/guice/blob/export/src/main/java/org/apache/james/modules/LinshareBlobExportMechanismModule.java
diff --git a/server/container/guice/blob-export-guice/src/main/java/org/apache/james/modules/LocalFileBlobExportMechanismModule.java b/server/container/guice/blob/export/src/main/java/org/apache/james/modules/LocalFileBlobExportMechanismModule.java
similarity index 100%
rename from server/container/guice/blob-export-guice/src/main/java/org/apache/james/modules/LocalFileBlobExportMechanismModule.java
rename to server/container/guice/blob/export/src/main/java/org/apache/james/modules/LocalFileBlobExportMechanismModule.java
diff --git a/server/container/guice/blob-export-guice/src/test/java/org/apache/james/modules/BlobExportImplChoiceTest.java b/server/container/guice/blob/export/src/test/java/org/apache/james/modules/BlobExportImplChoiceTest.java
similarity index 100%
rename from server/container/guice/blob-export-guice/src/test/java/org/apache/james/modules/BlobExportImplChoiceTest.java
rename to server/container/guice/blob/export/src/test/java/org/apache/james/modules/BlobExportImplChoiceTest.java
diff --git a/server/container/guice/blob-export-guice/src/test/java/org/apache/james/modules/BlobExportMechanismModuleTest.java b/server/container/guice/blob/export/src/test/java/org/apache/james/modules/BlobExportMechanismModuleTest.java
similarity index 100%
rename from server/container/guice/blob-export-guice/src/test/java/org/apache/james/modules/BlobExportMechanismModuleTest.java
rename to server/container/guice/blob/export/src/test/java/org/apache/james/modules/BlobExportMechanismModuleTest.java
diff --git a/server/container/guice/blob-export-guice/src/test/java/org/apache/james/modules/LinshareGuiceExtension.java b/server/container/guice/blob/export/src/test/java/org/apache/james/modules/LinshareGuiceExtension.java
similarity index 100%
rename from server/container/guice/blob-export-guice/src/test/java/org/apache/james/modules/LinshareGuiceExtension.java
rename to server/container/guice/blob/export/src/test/java/org/apache/james/modules/LinshareGuiceExtension.java
diff --git a/server/container/guice/blob-memory-guice/pom.xml b/server/container/guice/blob/memory/pom.xml
similarity index 97%
rename from server/container/guice/blob-memory-guice/pom.xml
rename to server/container/guice/blob/memory/pom.xml
index e06bbc7..3c1f6d9 100644
--- a/server/container/guice/blob-memory-guice/pom.xml
+++ b/server/container/guice/blob/memory/pom.xml
@@ -25,7 +25,7 @@
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
         <version>3.6.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
+        <relativePath>../../pom.xml</relativePath>
     </parent>
 
     <artifactId>blob-memory-guice</artifactId>
@@ -44,13 +44,13 @@
             <artifactId>blob-memory</artifactId>
         </dependency>
         <dependency>
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-        </dependency>
-        <dependency>
             <groupId>${james.groupId}</groupId>
             <artifactId>testing-base</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.inject</groupId>
+            <artifactId>guice</artifactId>
+        </dependency>
     </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/server/container/guice/blob-memory-guice/src/main/java/org/apache/james/modules/BlobMemoryModule.java b/server/container/guice/blob/memory/src/main/java/org/apache/james/modules/BlobMemoryModule.java
similarity index 100%
rename from server/container/guice/blob-memory-guice/src/main/java/org/apache/james/modules/BlobMemoryModule.java
rename to server/container/guice/blob/memory/src/main/java/org/apache/james/modules/BlobMemoryModule.java
diff --git a/server/container/guice/blob-s3-guice/pom.xml b/server/container/guice/blob/s3/pom.xml
similarity index 97%
rename from server/container/guice/blob-s3-guice/pom.xml
rename to server/container/guice/blob/s3/pom.xml
index 7d064f4..0c2c853 100644
--- a/server/container/guice/blob-s3-guice/pom.xml
+++ b/server/container/guice/blob/s3/pom.xml
@@ -25,7 +25,7 @@
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
         <version>3.6.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
+        <relativePath>../../pom.xml</relativePath>
     </parent>
 
     <artifactId>blob-s3-guice</artifactId>
diff --git a/server/container/guice/blob-s3-guice/src/main/java/org/apache/james/modules/objectstorage/DefaultBucketModule.java b/server/container/guice/blob/s3/src/main/java/org/apache/james/modules/objectstorage/DefaultBucketModule.java
similarity index 100%
rename from server/container/guice/blob-s3-guice/src/main/java/org/apache/james/modules/objectstorage/DefaultBucketModule.java
rename to server/container/guice/blob/s3/src/main/java/org/apache/james/modules/objectstorage/DefaultBucketModule.java
diff --git a/server/container/guice/blob-s3-guice/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreConfigurationReader.java b/server/container/guice/blob/s3/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreConfigurationReader.java
similarity index 100%
rename from server/container/guice/blob-s3-guice/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreConfigurationReader.java
rename to server/container/guice/blob/s3/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreConfigurationReader.java
diff --git a/server/container/guice/blob-s3-guice/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreModule.java b/server/container/guice/blob/s3/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreModule.java
similarity index 100%
rename from server/container/guice/blob-s3-guice/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreModule.java
rename to server/container/guice/blob/s3/src/main/java/org/apache/james/modules/objectstorage/S3BlobStoreModule.java
diff --git a/server/container/guice/blob-s3-guice/src/main/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReader.java b/server/container/guice/blob/s3/src/main/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReader.java
similarity index 100%
rename from server/container/guice/blob-s3-guice/src/main/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReader.java
rename to server/container/guice/blob/s3/src/main/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReader.java
diff --git a/server/container/guice/blob-s3-guice/src/test/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReaderTest.java b/server/container/guice/blob/s3/src/test/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReaderTest.java
similarity index 100%
rename from server/container/guice/blob-s3-guice/src/test/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReaderTest.java
rename to server/container/guice/blob/s3/src/test/java/org/apache/james/modules/objectstorage/aws/s3/AwsS3ConfigurationReaderTest.java
diff --git a/server/container/guice/blob-s3-guice/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java b/server/container/guice/blob/s3/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java
similarity index 100%
rename from server/container/guice/blob-s3-guice/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java
rename to server/container/guice/blob/s3/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 7f29105..31e2a18 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -34,10 +34,10 @@
 
     <modules>
 
-        <module>blob-api-guice</module>
-        <module>blob-export-guice</module>
-        <module>blob-memory-guice</module>
-        <module>blob-s3-guice</module>
+        <module>blob/api</module>
+        <module>blob/export</module>
+        <module>blob/memory</module>
+        <module>blob/s3</module>
         <module>cassandra-guice</module>
         <module>cassandra-ldap-guice</module>
         <module>cassandra-rabbitmq-guice</module>


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


[james-project] 07/07: JAMES-1902 uses sortpom to fix pom dependencies ordering

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 6e89015fee56db193add5a7fe7535316c6e18366
Author: Jean Helou <jh...@codamens.fr>
AuthorDate: Mon Nov 16 14:20:30 2020 +0100

    JAMES-1902 uses sortpom to fix pom dependencies ordering
    
    `src/site/xdoc` recommends to run
    `mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort\
    -Dsort.keepBlankLines -Dsort.sortDependencies=groupId,artifactId\
    -Dsort.nrOfIndentSpace=4 -Dsort.createBackupFile=false\
    -Dsort.sortModules=true -Dsort.expandEmptyElements=false\
    -Dsort.predefinedSortOrder="recommended_2008_06"`
    to clean up poms
    
    I did it for blob and this commit addresses sort failures for
    `server/container/guice/queue` pom.xml which were incorrect in the
    previous PR and the `server/container/guice/queue` pom.xml
---
 server/container/guice/pom.xml                | 20 ++++++++++----------
 server/container/guice/queue/memory/pom.xml   |  2 +-
 server/container/guice/queue/rabbitmq/pom.xml |  8 ++++----
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index 31e2a18..f499ffe 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -56,8 +56,8 @@
         <module>mailbox</module>
         <module>mailbox-plugin-deleted-messages-vault-guice</module>
         <module>mailbox-plugin-spamassassin</module>
-        <module>mailrepository-cassandra</module>
         <module>mailet</module>
+        <module>mailrepository-cassandra</module>
         <module>memory-guice</module>
         <module>onami</module>
         <module>protocols/imap</module>
@@ -70,18 +70,18 @@
         <module>protocols/webadmin</module>
         <module>protocols/webadmin-data</module>
         <module>protocols/webadmin-jmap</module>
+        <module>protocols/webadmin-mail-over-web</module>
         <module>protocols/webadmin-mailbox</module>
         <module>protocols/webadmin-mailqueue</module>
         <module>protocols/webadmin-mailrepository</module>
         <module>protocols/webadmin-rabbitmq-mailqueue</module>
         <module>protocols/webadmin-swagger</module>
-        <module>protocols/webadmin-mail-over-web</module>
         <module>queue/activemq</module>
         <module>queue/memory</module>
         <module>queue/rabbitmq</module>
-        <module>testing</module>
         <module>sieve-file</module>
         <module>sieve-jpa</module>
+        <module>testing</module>
     </modules>
 
     <dependencyManagement>
@@ -201,12 +201,12 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-rabbitmq-mailqueue</artifactId>
+                <artifactId>james-server-guice-webadmin-mailrepository</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-guice-webadmin-mailrepository</artifactId>
+                <artifactId>james-server-guice-webadmin-rabbitmq-mailqueue</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>
@@ -216,19 +216,19 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-jpa-common-guice</artifactId>
+                <artifactId>james-server-jmap-rfc-8621</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-jpa-common-guice</artifactId>
-                <type>test-jar</type>
                 <version>${project.version}</version>
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-jmap-rfc-8621</artifactId>
+                <artifactId>james-server-jpa-common-guice</artifactId>
                 <version>${project.version}</version>
+                <type>test-jar</type>
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
@@ -247,12 +247,12 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>queue-rabbitmq-guice</artifactId>
+                <artifactId>queue-memory-guice</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>queue-memory-guice</artifactId>
+                <artifactId>queue-rabbitmq-guice</artifactId>
                 <version>${project.version}</version>
             </dependency>
             <dependency>
diff --git a/server/container/guice/queue/memory/pom.xml b/server/container/guice/queue/memory/pom.xml
index 0dbeb28..c4e3aa7 100644
--- a/server/container/guice/queue/memory/pom.xml
+++ b/server/container/guice/queue/memory/pom.xml
@@ -23,7 +23,7 @@
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
         <version>3.6.0-SNAPSHOT</version>
-	<relativePath>../../pom.xml</relativePath>
+        <relativePath>../../pom.xml</relativePath>
     </parent>
 
     <artifactId>queue-memory-guice</artifactId>
diff --git a/server/container/guice/queue/rabbitmq/pom.xml b/server/container/guice/queue/rabbitmq/pom.xml
index 2981294..35752dd 100644
--- a/server/container/guice/queue/rabbitmq/pom.xml
+++ b/server/container/guice/queue/rabbitmq/pom.xml
@@ -23,7 +23,7 @@
         <groupId>org.apache.james</groupId>
         <artifactId>james-server-guice</artifactId>
         <version>3.6.0-SNAPSHOT</version>
-	<relativePath>../../pom.xml</relativePath>
+        <relativePath>../../pom.xml</relativePath>
     </parent>
 
     <artifactId>queue-rabbitmq-guice</artifactId>
@@ -46,15 +46,15 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-webadmin-rabbitmq</artifactId>
+            <artifactId>james-server-queue-api</artifactId>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-queue-api</artifactId>
+            <artifactId>james-server-queue-rabbitmq</artifactId>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-queue-rabbitmq</artifactId>
+            <artifactId>james-server-webadmin-rabbitmq</artifactId>
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>


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


[james-project] 03/07: JAMES-3444 Allow moving JMAP mailets in a local-delivery processor

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d987d40135b128ca494e54c93cc3ab319e1c30cd
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Nov 13 17:02:44 2020 +0700

    JAMES-3444 Allow moving JMAP mailets in a local-delivery processor
---
 .../api/src/main/java/org/apache/mailet/Mail.java  |  18 ++++
 .../modules/server/CamelMailetContainerModule.java | 101 ++++++++++++++++-----
 .../server/CamelMailetContainerModuleTest.java     |   2 +-
 .../org/apache/james/jmap/draft/JMAPModule.java    |  30 ++++--
 .../james/jmap/draft/MailetPreconditionTest.java   |  49 ++++++----
 5 files changed, 148 insertions(+), 52 deletions(-)

diff --git a/mailet/api/src/main/java/org/apache/mailet/Mail.java b/mailet/api/src/main/java/org/apache/mailet/Mail.java
index 2250811..3b37521 100644
--- a/mailet/api/src/main/java/org/apache/mailet/Mail.java
+++ b/mailet/api/src/main/java/org/apache/mailet/Mail.java
@@ -78,10 +78,28 @@ import com.google.common.collect.ImmutableMap;
  * {@link #removeAllAttributes() all} attributes of a Mail instance.
  */
 public interface Mail extends Serializable, Cloneable {
+    /**
+     * "ghost" state applies to mail that should no longer be processed
+     */
     String GHOST = "ghost";
+    /**
+     * "root" state applies to mail entering mail processing
+     */
     String DEFAULT = "root";
+    /**
+     * "error" state applies to mail whose processing fails. This is the default
+     * way of handling errors.
+     */
     String ERROR = "error";
+    /**
+     * "transport" is commonly used for expressing decisions taken on an email
+     * (whether to relay it? Deliver it to local recipients? Etc...).
+     */
     String TRANSPORT = "transport";
+    /**
+     * "local-delivery" is commonly used operations to perform for local recipients upon receiving emails.
+     */
+    String LOCAL_DELIVERY = "local-delivery";
 
     AttributeName SMTP_AUTH_USER = AttributeName.of("org.apache.james.SMTPAuthUser");
     AttributeName MAILET_ERROR = AttributeName.of("org.apache.james.MailetError");
diff --git a/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java b/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
index 532c1cd..68c7d06 100644
--- a/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
+++ b/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
@@ -19,10 +19,12 @@
 
 package org.apache.james.modules.server;
 
-import java.util.List;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.Optional;
 import java.util.Set;
 import java.util.function.Predicate;
+import java.util.stream.Stream;
 
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.SimpleRegistry;
@@ -31,6 +33,7 @@ import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.commons.configuration2.ex.ConfigurationRuntimeException;
 import org.apache.commons.configuration2.tree.ImmutableNode;
+import org.apache.commons.lang3.tuple.Pair;
 import org.apache.james.lifecycle.api.Startable;
 import org.apache.james.mailetcontainer.AutomaticallySentMailDetectorImpl;
 import org.apache.james.mailetcontainer.api.MailProcessor;
@@ -59,8 +62,13 @@ import org.apache.mailet.base.AutomaticallySentMailDetector;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.github.steveash.guavate.Guavate;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableListMultimap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Multimap;
 import com.google.inject.AbstractModule;
 import com.google.inject.Inject;
 import com.google.inject.Provides;
@@ -73,7 +81,8 @@ public class CamelMailetContainerModule extends AbstractModule {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(CamelMailetContainerModule.class);
 
-    public static final TransportProcessorCheck.Impl BCC_Check = new TransportProcessorCheck.Impl(
+    public static final ProcessorsCheck.Impl BCC_Check = new ProcessorsCheck.Impl(
+        "transport",
         All.class,
         RemoveMimeHeader.class,
         pair -> pair.getMailet().getMailetConfig().getInitParameter("name").equals("bcc"),
@@ -101,7 +110,7 @@ public class CamelMailetContainerModule extends AbstractModule {
         Multibinder<InitializationOperation> initialisationOperations = Multibinder.newSetBinder(binder(), InitializationOperation.class);
         initialisationOperations.addBinding().to(MailetModuleInitializationOperation.class);
 
-        Multibinder<CamelMailetContainerModule.TransportProcessorCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), CamelMailetContainerModule.TransportProcessorCheck.class);
+        Multibinder<ProcessorsCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), ProcessorsCheck.class);
         transportProcessorChecks.addBinding().toInstance(BCC_Check);
     }
 
@@ -157,18 +166,18 @@ public class CamelMailetContainerModule extends AbstractModule {
         private final ConfigurationProvider configurationProvider;
         private final CamelCompositeProcessor camelCompositeProcessor;
         private final DefaultProcessorsConfigurationSupplier defaultProcessorsConfigurationSupplier;
-        private final Set<TransportProcessorCheck> transportProcessorCheckSet;
+        private final Set<ProcessorsCheck> processorsCheckSet;
         private final DefaultCamelContext camelContext;
 
         @Inject
         public MailetModuleInitializationOperation(ConfigurationProvider configurationProvider,
                                                    CamelCompositeProcessor camelCompositeProcessor,
-                                                   Set<TransportProcessorCheck> transportProcessorCheckSet,
+                                                   Set<ProcessorsCheck> processorsCheckSet,
                                                    DefaultProcessorsConfigurationSupplier defaultProcessorsConfigurationSupplier,
                                                    DefaultCamelContext camelContext) {
             this.configurationProvider = configurationProvider;
             this.camelCompositeProcessor = camelCompositeProcessor;
-            this.transportProcessorCheckSet = transportProcessorCheckSet;
+            this.processorsCheckSet = processorsCheckSet;
             this.defaultProcessorsConfigurationSupplier = defaultProcessorsConfigurationSupplier;
             this.camelContext = camelContext;
         }
@@ -197,15 +206,22 @@ public class CamelMailetContainerModule extends AbstractModule {
         }
 
         private void checkProcessors() throws ConfigurationException {
-            MailProcessor mailProcessor = Optional.ofNullable(camelCompositeProcessor.getProcessor("transport"))
-                .orElseThrow(() -> new RuntimeException("JMAP needs a transport processor"));
-            if (mailProcessor instanceof CamelMailetProcessor) {
-                List<MatcherMailetPair> matcherMailetPairs = ((CamelMailetProcessor) mailProcessor).getPairs();
-                for (TransportProcessorCheck check : transportProcessorCheckSet) {
-                    check.check(matcherMailetPairs);
-                }
-            } else {
-                throw new RuntimeException("Can not perform checks as transport processor is not an instance of " + MailProcessor.class);
+            ImmutableListMultimap<String, MatcherMailetPair> processors = Arrays.stream(camelCompositeProcessor.getProcessorStates())
+                .flatMap(state -> {
+                    MailProcessor processor = camelCompositeProcessor.getProcessor(state);
+                    if (processor instanceof CamelMailetProcessor) {
+                        CamelMailetProcessor camelProcessor = (CamelMailetProcessor) processor;
+                        return camelProcessor.getPairs().stream()
+                            .map(pair -> Pair.of(state, pair));
+                    } else {
+                        throw new RuntimeException("Can not perform checks as transport processor is not an instance of " + MailProcessor.class);
+                    }
+                })
+                .collect(Guavate.toImmutableListMultimap(
+                    Pair::getKey,
+                    Pair::getValue));
+            for (ProcessorsCheck check : processorsCheckSet) {
+                check.check(processors);
             }
         }
 
@@ -216,24 +232,55 @@ public class CamelMailetContainerModule extends AbstractModule {
     }
 
     @FunctionalInterface
-    public interface TransportProcessorCheck {
-        void check(List<MatcherMailetPair> pairs) throws ConfigurationException;
+    public interface ProcessorsCheck {
+        void check(Multimap<String, MatcherMailetPair> processors) throws ConfigurationException;
+
+        class Or implements ProcessorsCheck {
+            public static ProcessorsCheck of(ProcessorsCheck... checks) {
+                return new Or(ImmutableSet.copyOf(checks));
+            }
+
+            private final Set<ProcessorsCheck> checks;
+
+            public Or(Set<ProcessorsCheck> checks) {
+                Preconditions.checkArgument(checks.size() > 0);
+                this.checks = checks;
+            }
 
-        class Impl implements TransportProcessorCheck {
+            @Override
+            public void check(Multimap<String, MatcherMailetPair> processors) throws ConfigurationException {
+                ImmutableList<ConfigurationException> failures = checks.stream().flatMap(check -> {
+                    try {
+                        check.check(processors);
+                        return Stream.empty();
+                    } catch (ConfigurationException e) {
+                        return Stream.of(e);
+                    }
+                }).collect(Guavate.toImmutableList());
+
+                if (failures.size() == checks.size()) {
+                    throw failures.get(0);
+                }
+            }
+        }
+
+        class Impl implements ProcessorsCheck {
+            private final String processorName;
             private final Class<? extends Matcher> matcherClass;
             private final Class<? extends Mailet> mailetClass;
             private final Optional<Predicate<? super MatcherMailetPair>> additionalFilter;
             private final Optional<String> additionalErrorMessage;
 
-            public Impl(Class<? extends Matcher> matcherClass, Class<? extends Mailet> mailetClass) {
-                this(matcherClass, mailetClass, Optional.empty(), Optional.empty());
+            public Impl(String processorName, Class<? extends Matcher> matcherClass, Class<? extends Mailet> mailetClass) {
+                this(processorName, matcherClass, mailetClass, Optional.empty(), Optional.empty());
             }
 
-            public Impl(Class<? extends Matcher> matcherClass, Class<? extends Mailet> mailetClass, Predicate<? super MatcherMailetPair> additionalFilter, String additionalErrorMessage) {
-                this(matcherClass, mailetClass, Optional.of(additionalFilter), Optional.of(additionalErrorMessage));
+            public Impl(String processorName, Class<? extends Matcher> matcherClass, Class<? extends Mailet> mailetClass, Predicate<? super MatcherMailetPair> additionalFilter, String additionalErrorMessage) {
+                this(processorName, matcherClass, mailetClass, Optional.of(additionalFilter), Optional.of(additionalErrorMessage));
             }
 
-            private Impl(Class<? extends Matcher> matcherClass, Class<? extends Mailet> mailetClass, Optional<Predicate<? super MatcherMailetPair>> additionalFilter, Optional<String> additionalErrorMessage) {
+            private Impl(String processorName, Class<? extends Matcher> matcherClass, Class<? extends Mailet> mailetClass, Optional<Predicate<? super MatcherMailetPair>> additionalFilter, Optional<String> additionalErrorMessage) {
+                this.processorName = processorName;
                 this.matcherClass = matcherClass;
                 this.mailetClass = mailetClass;
                 this.additionalFilter = additionalFilter;
@@ -241,14 +288,18 @@ public class CamelMailetContainerModule extends AbstractModule {
             }
 
             @Override
-            public void check(List<MatcherMailetPair> pairs) throws ConfigurationException {
+            public void check(Multimap<String, MatcherMailetPair> processors) throws ConfigurationException {
+                Collection<MatcherMailetPair> pairs = processors.get(processorName);
+                if (pairs == null) {
+                    throw new ConfigurationException(processorName + " is missing");
+                }
                 Preconditions.checkNotNull(pairs);
                 pairs.stream()
                     .filter(pair -> pair.getMailet().getClass().equals(mailetClass))
                     .filter(pair -> pair.getMatcher().getClass().equals(matcherClass))
                     .filter(additionalFilter.orElse(any -> true))
                     .findAny()
-                    .orElseThrow(() -> new ConfigurationException("Missing " + mailetClass.getName() + " in mailets configuration (mailetcontainer -> processors -> transport). " +
+                    .orElseThrow(() -> new ConfigurationException("Missing " + mailetClass.getName() + " in mailets configuration (mailetcontainer -> processors -> " + processorName + "). " +
                         additionalErrorMessage.orElse("")));
             }
         }
diff --git a/server/container/guice/mailet/src/test/java/org/apache/james/modules/server/CamelMailetContainerModuleTest.java b/server/container/guice/mailet/src/test/java/org/apache/james/modules/server/CamelMailetContainerModuleTest.java
index c740f49..93468b5 100644
--- a/server/container/guice/mailet/src/test/java/org/apache/james/modules/server/CamelMailetContainerModuleTest.java
+++ b/server/container/guice/mailet/src/test/java/org/apache/james/modules/server/CamelMailetContainerModuleTest.java
@@ -43,7 +43,7 @@ import com.google.common.collect.ImmutableSet;
 
 class CamelMailetContainerModuleTest {
 
-    public static final ImmutableSet<CamelMailetContainerModule.TransportProcessorCheck> NO_TRANSPORT_CHECKS = ImmutableSet.of();
+    public static final ImmutableSet<CamelMailetContainerModule.ProcessorsCheck> NO_TRANSPORT_CHECKS = ImmutableSet.of();
 
     @Test
     void getMailetContextConfigurationShouldReturnEmptyWhenNoContextSection() throws Exception {
diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPModule.java
index 7acbe92..934da8e 100644
--- a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPModule.java
+++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPModule.java
@@ -50,10 +50,12 @@ import org.apache.james.mailbox.events.MailboxListener;
 import org.apache.james.modules.server.CamelMailetContainerModule;
 import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
 import org.apache.james.server.core.configuration.FileConfigurationProvider;
+import org.apache.james.transport.matchers.All;
 import org.apache.james.transport.matchers.RecipientIsLocal;
 import org.apache.james.util.Port;
 import org.apache.james.util.html.HtmlTextExtractor;
 import org.apache.james.utils.PropertiesProvider;
+import org.apache.mailet.Mail;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -79,14 +81,26 @@ public class JMAPModule extends AbstractModule {
                 throw new RuntimeException(e);
             }
         };
-    public static final CamelMailetContainerModule.TransportProcessorCheck VACATION_MAILET_CHECK =
-        new CamelMailetContainerModule.TransportProcessorCheck.Impl(
+    public static final CamelMailetContainerModule.ProcessorsCheck VACATION_MAILET_CHECK =
+        CamelMailetContainerModule.ProcessorsCheck.Or.of(
+            new CamelMailetContainerModule.ProcessorsCheck.Impl(
+                Mail.TRANSPORT,
+                RecipientIsLocal.class,
+                VacationMailet.class),
+            new CamelMailetContainerModule.ProcessorsCheck.Impl(
+                Mail.LOCAL_DELIVERY,
+                All.class,
+                VacationMailet.class));
+    public static final CamelMailetContainerModule.ProcessorsCheck FILTERING_MAILET_CHECK =
+        CamelMailetContainerModule.ProcessorsCheck.Or.of(
+        new CamelMailetContainerModule.ProcessorsCheck.Impl(
+            Mail.TRANSPORT,
             RecipientIsLocal.class,
-            VacationMailet.class);
-    public static final CamelMailetContainerModule.TransportProcessorCheck FILTERING_MAILET_CHECK =
-        new CamelMailetContainerModule.TransportProcessorCheck.Impl(
-            RecipientIsLocal.class,
-            JMAPFiltering.class);
+            JMAPFiltering.class),
+        new CamelMailetContainerModule.ProcessorsCheck.Impl(
+            Mail.LOCAL_DELIVERY,
+            All.class,
+            JMAPFiltering.class));
 
     @Override
     protected void configure() {
@@ -104,7 +118,7 @@ public class JMAPModule extends AbstractModule {
         bind(HtmlTextExtractor.class).to(JsoupHtmlTextExtractor.class);
         Multibinder.newSetBinder(binder(), StartUpCheck.class).addBinding().to(RequiredCapabilitiesStartUpCheck.class);
 
-        Multibinder<CamelMailetContainerModule.TransportProcessorCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), CamelMailetContainerModule.TransportProcessorCheck.class);
+        Multibinder<CamelMailetContainerModule.ProcessorsCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), CamelMailetContainerModule.ProcessorsCheck.class);
         transportProcessorChecks.addBinding().toInstance(VACATION_MAILET_CHECK);
         transportProcessorChecks.addBinding().toInstance(FILTERING_MAILET_CHECK);
 
diff --git a/server/container/guice/protocols/jmap/src/test/java/org/apache/james/jmap/draft/MailetPreconditionTest.java b/server/container/guice/protocols/jmap/src/test/java/org/apache/james/jmap/draft/MailetPreconditionTest.java
index 228538c..7706911 100644
--- a/server/container/guice/protocols/jmap/src/test/java/org/apache/james/jmap/draft/MailetPreconditionTest.java
+++ b/server/container/guice/protocols/jmap/src/test/java/org/apache/james/jmap/draft/MailetPreconditionTest.java
@@ -38,6 +38,7 @@ import org.apache.mailet.base.test.FakeMailetConfig;
 import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
 
+import com.google.common.collect.ImmutableMultimap;
 import com.google.common.collect.Lists;
 
 class MailetPreconditionTest {
@@ -49,7 +50,7 @@ class MailetPreconditionTest {
     class VacationMailetCheck {
         @Test
         void vacationMailetCheckShouldThrowOnEmptyList() {
-            assertThatThrownBy(() -> JMAPModule.VACATION_MAILET_CHECK.check(Lists.newArrayList()))
+            assertThatThrownBy(() -> JMAPModule.VACATION_MAILET_CHECK.check(ImmutableMultimap.of()))
                 .isInstanceOf(ConfigurationException.class);
         }
 
@@ -61,25 +62,29 @@ class MailetPreconditionTest {
 
         @Test
         void vacationMailetCheckShouldThrowOnWrongMatcher() {
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), new VacationMailet(null, null, null, null, null)));
-
-            assertThatThrownBy(() -> JMAPModule.VACATION_MAILET_CHECK.check(pairs))
+            assertThatThrownBy(() -> JMAPModule.VACATION_MAILET_CHECK.check(ImmutableMultimap.of(
+                "transport", new MatcherMailetPair(new All(), new VacationMailet(null, null, null, null, null)))))
                 .isInstanceOf(ConfigurationException.class);
         }
 
         @Test
         void vacationMailetCheckShouldThrowOnWrongMailet() {
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new Null()));
-
-            assertThatThrownBy(() -> JMAPModule.VACATION_MAILET_CHECK.check(pairs))
+            assertThatThrownBy(() -> JMAPModule.VACATION_MAILET_CHECK.check(ImmutableMultimap.of(
+                "transport", new MatcherMailetPair(new All(), new Null()))))
                 .isInstanceOf(ConfigurationException.class);
         }
 
         @Test
         void vacationMailetCheckShouldNotThrowIfValidPairPresent() {
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new VacationMailet(null, null, null, null, null)));
+            assertThatCode(() -> JMAPModule.VACATION_MAILET_CHECK.check(ImmutableMultimap.of(
+                "transport", new MatcherMailetPair(new RecipientIsLocal(), new VacationMailet(null, null, null, null, null)))))
+                .doesNotThrowAnyException();
+        }
 
-            assertThatCode(() -> JMAPModule.VACATION_MAILET_CHECK.check(pairs))
+        @Test
+        void vacationMailetCheckShouldSupportLocalDeliveryProcessor() {
+            assertThatCode(() -> JMAPModule.VACATION_MAILET_CHECK.check(ImmutableMultimap.of(
+                "local-delivery", new MatcherMailetPair(new All(), new VacationMailet(null, null, null, null, null)))))
                 .doesNotThrowAnyException();
         }
     }
@@ -88,7 +93,7 @@ class MailetPreconditionTest {
     class FilteringMailetCheck {
         @Test
         void filteringMailetCheckShouldThrowOnEmptyList() {
-            assertThatThrownBy(() -> JMAPModule.FILTERING_MAILET_CHECK.check(Lists.newArrayList()))
+            assertThatThrownBy(() -> JMAPModule.FILTERING_MAILET_CHECK.check(ImmutableMultimap.of()))
                 .isInstanceOf(ConfigurationException.class);
         }
 
@@ -100,7 +105,7 @@ class MailetPreconditionTest {
 
         @Test
         void filteringMailetCheckShouldThrowOnWrongMatcher() {
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), new JMAPFiltering(null, null, null)));
+            ImmutableMultimap<String, MatcherMailetPair> pairs = ImmutableMultimap.of("tansport", new MatcherMailetPair(new All(), new JMAPFiltering(null, null, null)));
 
             assertThatThrownBy(() -> JMAPModule.FILTERING_MAILET_CHECK.check(pairs))
                 .isInstanceOf(ConfigurationException.class);
@@ -108,7 +113,7 @@ class MailetPreconditionTest {
 
         @Test
         void filteringMailetCheckShouldThrowOnWrongMailet() {
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new Null()));
+            ImmutableMultimap<String, MatcherMailetPair> pairs = ImmutableMultimap.of("tansport", new MatcherMailetPair(new All(), new Null()));
 
             assertThatThrownBy(() -> JMAPModule.FILTERING_MAILET_CHECK.check(pairs))
                 .isInstanceOf(ConfigurationException.class);
@@ -116,7 +121,15 @@ class MailetPreconditionTest {
 
         @Test
         void filteringMailetCheckShouldNotThrowIfValidPairPresent() {
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new JMAPFiltering(null, null, null)));
+            ImmutableMultimap<String, MatcherMailetPair> pairs = ImmutableMultimap.of("transport", new MatcherMailetPair(new RecipientIsLocal(), new JMAPFiltering(null, null, null)));
+
+            assertThatCode(() -> JMAPModule.FILTERING_MAILET_CHECK.check(pairs))
+                .doesNotThrowAnyException();
+        }
+
+        @Test
+        void filteringMailetCheckShouldSupportLocalDeliveryProcessor() {
+            ImmutableMultimap<String, MatcherMailetPair> pairs = ImmutableMultimap.of("local-delivery", new MatcherMailetPair(new All(), new JMAPFiltering(null, null, null)));
 
             assertThatCode(() -> JMAPModule.FILTERING_MAILET_CHECK.check(pairs))
                 .doesNotThrowAnyException();
@@ -127,7 +140,7 @@ class MailetPreconditionTest {
     class BccCheck {
         @Test
         void bccMailetCheckShouldThrowOnEmptyList() {
-            assertThatThrownBy(() -> CamelMailetContainerModule.BCC_Check.check(Lists.newArrayList()))
+            assertThatThrownBy(() -> CamelMailetContainerModule.BCC_Check.check(ImmutableMultimap.of()))
                 .isInstanceOf(ConfigurationException.class);
         }
 
@@ -139,7 +152,7 @@ class MailetPreconditionTest {
 
         @Test
         void bccMailetCheckShouldThrowOnWrongMatcher() {
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new RecipientIsLocal(), new RemoveMimeHeader()));
+            ImmutableMultimap<String, MatcherMailetPair> pairs = ImmutableMultimap.of("tansport", new MatcherMailetPair(new RecipientIsLocal(), new RemoveMimeHeader()));
 
             assertThatThrownBy(() -> CamelMailetContainerModule.BCC_Check.check(pairs))
                 .isInstanceOf(ConfigurationException.class);
@@ -147,7 +160,7 @@ class MailetPreconditionTest {
 
         @Test
         void bccMailetCheckShouldThrowOnWrongMailet() {
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), new Null()));
+            ImmutableMultimap<String, MatcherMailetPair> pairs = ImmutableMultimap.of("tansport", new MatcherMailetPair(new All(), new Null()));
 
             assertThatThrownBy(() -> CamelMailetContainerModule.BCC_Check.check(pairs))
                 .isInstanceOf(ConfigurationException.class);
@@ -162,7 +175,7 @@ class MailetPreconditionTest {
                 .setProperty("name", "bad")
                 .build());
 
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), removeMimeHeader));
+            ImmutableMultimap<String, MatcherMailetPair> pairs = ImmutableMultimap.of("tansport", new MatcherMailetPair(new All(), removeMimeHeader));
 
             assertThatThrownBy(() -> CamelMailetContainerModule.BCC_Check.check(pairs))
                 .isInstanceOf(ConfigurationException.class);
@@ -177,7 +190,7 @@ class MailetPreconditionTest {
                 .setProperty("name", BCC)
                 .build());
 
-            List<MatcherMailetPair> pairs = Lists.newArrayList(new MatcherMailetPair(new All(), removeMimeHeader));
+            ImmutableMultimap<String, MatcherMailetPair> pairs = ImmutableMultimap.of("transport", new MatcherMailetPair(new All(), removeMimeHeader));
             assertThatCode(() -> CamelMailetContainerModule.BCC_Check.check(pairs))
                 .doesNotThrowAnyException();
         }


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


[james-project] 02/07: [ADR] JMAP: Mention InfiniSpan as a possible alternative

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3b189dffbe2d496046b17dcaba0957d81a1c171e
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Nov 16 18:56:29 2020 +0700

    [ADR] JMAP: Mention InfiniSpan as a possible alternative
    
    https://github.com/apache/james-project/pull/259#discussion_r522874294
---
 src/adr/0043-avoid-elasticsearch-on-critical-reads.md | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/adr/0043-avoid-elasticsearch-on-critical-reads.md b/src/adr/0043-avoid-elasticsearch-on-critical-reads.md
index e3954ca6..c2e1b7d 100644
--- a/src/adr/0043-avoid-elasticsearch-on-critical-reads.md
+++ b/src/adr/0043-avoid-elasticsearch-on-critical-reads.md
@@ -59,6 +59,12 @@ Cassandra dataset size will only grow of a few percents if enabled.
 Those not willing to adopt this view will not be affected. By disabling the listener and the view usage, they will keep
 resolving all `Email/query` against ElasticSearch.
 
+Another solution is to implement the projecting using a in-memory datagrid such as infinispan. The projection
+would be computed using a MailboxListener and the data would be first fetched from this cache and fallback to
+ElasticSearch. We did not choose it as Cassandra is already there, well mastered, as disk storage is cheaper than
+memory. InfiniSpan would moreover need additional datastore to allow a persistent state. Infinispan on the other hand
+would be faster and would have less restrictions on data filtering and sorting. Also this would require one more software dependency.
+
 ## Example of optimized JMAP requests
 
 ### A: Email list sorted by sentAt, with limit


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


[james-project] 05/07: JAMES-1902 Drops duplicate dependencies

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ef18af5381f97dfca24e0c642ce4bc9fe918fd6d
Author: Jean Helou <jh...@codamens.fr>
AuthorDate: Mon Nov 16 13:54:45 2020 +0100

    JAMES-1902 Drops duplicate dependencies
---
 server/container/guice/jpa-smtp-mariadb/pom.xml | 4 ----
 server/container/guice/pom.xml                  | 5 -----
 server/data/data-cassandra/pom.xml              | 6 ------
 3 files changed, 15 deletions(-)

diff --git a/server/container/guice/jpa-smtp-mariadb/pom.xml b/server/container/guice/jpa-smtp-mariadb/pom.xml
index 8ce871e..1877563 100644
--- a/server/container/guice/jpa-smtp-mariadb/pom.xml
+++ b/server/container/guice/jpa-smtp-mariadb/pom.xml
@@ -62,10 +62,6 @@
             <artifactId>james-server-mailets</artifactId>
         </dependency>
         <dependency>
-            <groupId>${james.groupId}</groupId>
-            <artifactId>james-server-mailets</artifactId>
-        </dependency>
-        <dependency>
             <groupId>org.apache.derby</groupId>
             <artifactId>derby</artifactId>
             <scope>test</scope>
diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml
index dc34571..7f29105 100644
--- a/server/container/guice/pom.xml
+++ b/server/container/guice/pom.xml
@@ -110,11 +110,6 @@
             </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
-                <artifactId>james-server-jmap-rfc-8621</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-guice-jmap</artifactId>
                 <version>${project.version}</version>
             </dependency>
diff --git a/server/data/data-cassandra/pom.xml b/server/data/data-cassandra/pom.xml
index a2f9daa..a3f0427 100644
--- a/server/data/data-cassandra/pom.xml
+++ b/server/data/data-cassandra/pom.xml
@@ -59,12 +59,6 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
-            <artifactId>james-json</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-data-api</artifactId>
         </dependency>
         <dependency>


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


[james-project] 04/07: JAMES-3444 Default configuration should have a local-delivery processor

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 78cf07a9534cdff2797878fb7c65ecfa0fc5e1aa
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Nov 13 17:03:25 2020 +0700

    JAMES-3444 Default configuration should have a local-delivery processor
---
 .../destination/conf/mailetcontainer.xml           | 18 +++++++++------
 .../destination/conf/mailetcontainer.xml           | 18 +++++++++------
 .../destination/conf/mailetcontainer.xml           | 18 +++++++++------
 .../cassandra/destination/conf/mailetcontainer.xml | 18 +++++++++------
 .../memory/destination/conf/mailetcontainer.xml    | 18 +++++++++------
 .../src/test/resources/mailetcontainer.xml         | 26 ++++++++++++++--------
 .../src/test/resources/mailetcontainer.xml         | 15 ++++++++++---
 .../src/test/resources/mailetcontainer.xml         | 13 ++++++++---
 .../src/test/resources/mailetcontainer.xml         | 14 +++++++++---
 .../src/test/resources/mailetcontainer.xml         | 26 ++++++++++++++--------
 10 files changed, 122 insertions(+), 62 deletions(-)

diff --git a/dockerfiles/run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml
index d66b290..663cd32 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/mailetcontainer.xml
@@ -68,25 +68,29 @@
             <mailet match="All" class="RecipientRewriteTable">
                 <errorProcessor>rrt-error</errorProcessor>
             </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="Sieve"/>
-            <mailet match="RecipientIsLocal" class="AddDeliveredToHeader"/>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
+            </mailet>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
             </mailet>
-
             <mailet match="relay-allowed" class="ToProcessor">
                 <processor>relay</processor>
             </mailet>
-
             <mailet match="All" class="ToProcessor">
                 <processor>relay-denied</processor>
             </mailet>
         </processor>
 
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="relay" enableJmx="true">
             <mailet match="All" class="RemoteDelivery">
                 <outgoingQueue>outgoing</outgoingQueue>
diff --git a/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml
index d66b290..663cd32 100644
--- a/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml
+++ b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/mailetcontainer.xml
@@ -68,25 +68,29 @@
             <mailet match="All" class="RecipientRewriteTable">
                 <errorProcessor>rrt-error</errorProcessor>
             </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="Sieve"/>
-            <mailet match="RecipientIsLocal" class="AddDeliveredToHeader"/>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
+            </mailet>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
             </mailet>
-
             <mailet match="relay-allowed" class="ToProcessor">
                 <processor>relay</processor>
             </mailet>
-
             <mailet match="All" class="ToProcessor">
                 <processor>relay-denied</processor>
             </mailet>
         </processor>
 
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="relay" enableJmx="true">
             <mailet match="All" class="RemoteDelivery">
                 <outgoingQueue>outgoing</outgoingQueue>
diff --git a/dockerfiles/run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml
index d66b290..663cd32 100644
--- a/dockerfiles/run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml
+++ b/dockerfiles/run/guice/cassandra-rabbitmq/destination/conf/mailetcontainer.xml
@@ -68,25 +68,29 @@
             <mailet match="All" class="RecipientRewriteTable">
                 <errorProcessor>rrt-error</errorProcessor>
             </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="Sieve"/>
-            <mailet match="RecipientIsLocal" class="AddDeliveredToHeader"/>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
+            </mailet>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
             </mailet>
-
             <mailet match="relay-allowed" class="ToProcessor">
                 <processor>relay</processor>
             </mailet>
-
             <mailet match="All" class="ToProcessor">
                 <processor>relay-denied</processor>
             </mailet>
         </processor>
 
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="relay" enableJmx="true">
             <mailet match="All" class="RemoteDelivery">
                 <outgoingQueue>outgoing</outgoingQueue>
diff --git a/dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml
index d66b290..663cd32 100644
--- a/dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml
+++ b/dockerfiles/run/guice/cassandra/destination/conf/mailetcontainer.xml
@@ -68,25 +68,29 @@
             <mailet match="All" class="RecipientRewriteTable">
                 <errorProcessor>rrt-error</errorProcessor>
             </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="Sieve"/>
-            <mailet match="RecipientIsLocal" class="AddDeliveredToHeader"/>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
+            </mailet>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
             </mailet>
-
             <mailet match="relay-allowed" class="ToProcessor">
                 <processor>relay</processor>
             </mailet>
-
             <mailet match="All" class="ToProcessor">
                 <processor>relay-denied</processor>
             </mailet>
         </processor>
 
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="relay" enableJmx="true">
             <mailet match="All" class="RemoteDelivery">
                 <outgoingQueue>outgoing</outgoingQueue>
diff --git a/dockerfiles/run/guice/memory/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/memory/destination/conf/mailetcontainer.xml
index 716e625..6af0d79 100644
--- a/dockerfiles/run/guice/memory/destination/conf/mailetcontainer.xml
+++ b/dockerfiles/run/guice/memory/destination/conf/mailetcontainer.xml
@@ -68,25 +68,29 @@
             <mailet match="All" class="RecipientRewriteTable">
                 <errorProcessor>rrt-error</errorProcessor>
             </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="Sieve"/>
-            <mailet match="RecipientIsLocal" class="AddDeliveredToHeader"/>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
+            </mailet>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
             </mailet>
-
             <mailet match="relay-allowed" class="ToProcessor">
                 <processor>relay</processor>
             </mailet>
-
             <mailet match="All" class="ToProcessor">
                 <processor>relay-denied</processor>
             </mailet>
         </processor>
 
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="relay" enableJmx="true">
             <mailet match="All" class="RemoteDelivery">
                 <outgoingQueue>outgoing</outgoingQueue>
diff --git a/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml b/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml
index f22ddb7..7855291 100644
--- a/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml
+++ b/server/container/guice/cassandra-guice/src/test/resources/mailetcontainer.xml
@@ -67,16 +67,9 @@
             <mailet match="All" class="RecipientRewriteTable">
                 <errorProcessor>rrt-error</errorProcessor>
             </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="SpamAssassin">
-                <spamdHost>localhost</spamdHost>
-                <spamdPort>783</spamdPort>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
             </mailet>
-            <mailet match="IsMarkedAsSpam" class="WithStorageDirective">
-                <targetFolderName>Spam</targetFolderName>
-            </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
@@ -95,6 +88,21 @@
             </mailet>
         </processor>
 
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="SpamAssassin">
+                <spamdHost>localhost</spamdHost>
+                <spamdPort>783</spamdPort>
+            </mailet>
+            <mailet match="IsMarkedAsSpam" class="WithStorageDirective">
+                <targetFolderName>Spam</targetFolderName>
+            </mailet>
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="local-address-error" enableJmx="false">
             <mailet match="All" class="Bounce">
                 <attachment>none</attachment>
diff --git a/server/container/guice/cassandra-ldap-guice/src/test/resources/mailetcontainer.xml b/server/container/guice/cassandra-ldap-guice/src/test/resources/mailetcontainer.xml
index 2340ac6..5feb464 100644
--- a/server/container/guice/cassandra-ldap-guice/src/test/resources/mailetcontainer.xml
+++ b/server/container/guice/cassandra-ldap-guice/src/test/resources/mailetcontainer.xml
@@ -59,9 +59,9 @@
                 <name>bcc</name>
             </mailet>
             <mailet match="All" class="RecipientRewriteTable" />
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
+            </mailet>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
@@ -80,6 +80,15 @@
             </mailet>
         </processor>
 
+
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="local-address-error" enableJmx="false">
             <mailet match="All" class="Bounce">
                 <attachment>none</attachment>
diff --git a/server/container/guice/cassandra-rabbitmq-guice/src/test/resources/mailetcontainer.xml b/server/container/guice/cassandra-rabbitmq-guice/src/test/resources/mailetcontainer.xml
index d629b8a..13210ce 100644
--- a/server/container/guice/cassandra-rabbitmq-guice/src/test/resources/mailetcontainer.xml
+++ b/server/container/guice/cassandra-rabbitmq-guice/src/test/resources/mailetcontainer.xml
@@ -67,9 +67,9 @@
             <mailet match="All" class="RecipientRewriteTable">
                 <errorProcessor>rrt-error</errorProcessor>
             </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
+            </mailet>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
@@ -88,6 +88,13 @@
             </mailet>
         </processor>
 
+
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="local-address-error" enableJmx="false">
             <mailet match="All" class="Bounce">
                 <attachment>none</attachment>
diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml
index 2340ac6..93e8b54 100644
--- a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml
+++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml
@@ -59,9 +59,9 @@
                 <name>bcc</name>
             </mailet>
             <mailet match="All" class="RecipientRewriteTable" />
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
+            </mailet>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
@@ -80,6 +80,14 @@
             </mailet>
         </processor>
 
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="local-address-error" enableJmx="false">
             <mailet match="All" class="Bounce">
                 <attachment>none</attachment>
diff --git a/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml b/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml
index f14ec95..ea088d1 100644
--- a/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml
+++ b/server/container/guice/memory-guice/src/test/resources/mailetcontainer.xml
@@ -58,16 +58,9 @@
             <mailet match="All" class="RecipientRewriteTable">
                 <errorProcessor>rrt-error</errorProcessor>
             </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
-            <mailet match="RecipientIsLocal" class="SpamAssassin">
-                <spamdHost>localhost</spamdHost>
-                <spamdPort>783</spamdPort>
+            <mailet match="RecipientIsLocal" class="ToProcessor">
+                <processor>local-delivery</processor>
             </mailet>
-            <mailet match="IsMarkedAsSpam" class="WithStorageDirective">
-                <targetFolderName>Spam</targetFolderName>
-            </mailet>
-            <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
-            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <mailet match="HostIsLocal" class="ToProcessor">
                 <processor>local-address-error</processor>
                 <notice>550 - Requested action not taken: no such user here</notice>
@@ -98,6 +91,21 @@
             </mailet>
         </processor>
 
+        <processor state="local-delivery" enableJmx="true">
+            <mailet match="All" class="SpamAssassin">
+                <spamdHost>localhost</spamdHost>
+                <spamdPort>783</spamdPort>
+            </mailet>
+            <mailet match="IsMarkedAsSpam" class="WithStorageDirective">
+                <targetFolderName>Spam</targetFolderName>
+            </mailet>
+            <mailet match="All" class="org.apache.james.jmap.mailet.VacationMailet"/>
+            <mailet match="All" class="Sieve"/>
+            <mailet match="All" class="AddDeliveredToHeader"/>
+            <mailet match="All" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
+            <mailet match="All" class="LocalDelivery"/>
+        </processor>
+
         <processor state="spam" enableJmx="false">
             <mailet match="All" class="ToRepository">
                 <repositoryPath>memory://var/mail/spam/</repositoryPath>


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