diff --git a/README.txt b/README.txt
index 144ba280015..5bdedabefad 100644
--- a/README.txt
+++ b/README.txt
@@ -57,30 +57,29 @@ First step, you have to build the Docker image
$ docker build -t james/project dockerfiles/compilation/java-6
In order to run the build, you have to launch the following command:
-$ docker run -v $PWD/.m2:/root/.m2 -v $PWD:/origin -v $PWD/dockerfiles/destination:/destination -t james/project -s SHA1
+$ docker run -v $PWD/.m2:/root/.m2 -v $PWD:/origin -v $PWD/dockerfiles/run/spring/destination:/destination -t james/project -s SHA1
Where:
- $PWD/.m2:/root/.m2: is the first volume used to share the maven repository,
as we don't want to download all dependencies on each build
-- $PWD/dockerfiles/destination:/destination: is the third volume used to get the compiled elements,
+- $PWD/dockerfiles/run/spring/destination:/destination: is the third volume used to get the compiled elements,
as it is needed by the container that will run James.
- SHA1 (optional): is the given git SHA1 of the james-project repository to build or trunk if none.
- -s option: given tests will not be played while building. Not specifying means play tests.
-
* Java 8
First step, you have to build the Docker image
$ docker build -t james/project dockerfiles/compilation/java-8
In order to run the build, you have to launch the following command:
-$ docker run -v $PWD/.m2:/root/.m2 -v $PWD:/origin -v $PWD/dockerfiles/destination:/destination -t james/project -s SHA1
+$ docker run -v $PWD/.m2:/root/.m2 -v $PWD:/origin -v $PWD/dockerfiles/run/spring/destination:/destination -t james/project -s SHA1
Where:
- $PWD/.m2:/root/.m2: is the first volume used to share the maven repository,
as we don't want to download all dependencies on each build
-- $PWD/dockerfiles/destination:/destination: is the third volume used to get the compiled elements,
+- $PWD/dockerfiles/run/spring/destination:/destination: is the third volume used to get the compiled elements,
as it is needed by the container that will run James.
- SHA1 (optional): is the given git SHA1 of the james-project repository to build or trunk if none.
- -s option: given tests will not be played while building. Not specifying means play tests.
@@ -92,7 +91,7 @@ This feature is only available for Java 8 / Cassandra mailbox backend yet.
* Requirements
-You should have the zip resulting of the build in the ./dockerfiles/destination folder.
+You should have the zip resulting of the build in the ./dockerfiles/run/spring/destination folder.
* Howto ?
@@ -104,11 +103,11 @@ $ docker run -d --name=elasticsearch elasticsearch:1.5.2
We need to provide the key we will use for TLS. For obvious reasons, this is not provided in this git.
-Copy your TSL keys to destination/conf/keystore or generate it using the following command. The password must be james72laBalle to match default configuration.
-$ keytool -genkey -alias james -keyalg RSA -keystore dockerfiles/destination/conf/keystore
+Copy your TSL keys to destination/run/spring/conf/keystore or generate it using the following command. The password must be james72laBalle to match default configuration.
+$ keytool -genkey -alias james -keyalg RSA -keystore dockerfiles/run/spring/destination/conf/keystore
Then we need to build james container :
-$ docker build -t james_run dockerfiles
+$ docker build -t james_run dockerfiles/run/spring/
To run this container :
$ docker run --hostname HOSTNAME -p "25:25" -p "110:110" -p "143:143" -p "465:465" -p "587:587" -p "993:993" --link cassandra:cassandra --link elasticsearch:elasticsearch --name james_run -t james_run
@@ -160,6 +159,16 @@ Where :
Beware : you will have concurrency issues if multiple containers are running on this single volume.
+How to run James in Docker using guice container
+================================================
+
+You have to follow above documentation and replace spring by guice in paths.
+
+Once you run the container, you have to use the following command to launch the cli :
+
+$ docker exec james_run java -jar /root/james-cli.jar -h localhost
+
+
Running deployement Tests
=========================
diff --git a/backends-common/cassandra/pom.xml b/backends-common/cassandra/pom.xml
index 983b7f45625..97a3a3dd22f 100644
--- a/backends-common/cassandra/pom.xml
+++ b/backends-common/cassandra/pom.xml
@@ -140,6 +140,10 @@
commons-lang2.6
+
+ javax.inject
+ javax.inject
+ org.assertjassertj-core
diff --git a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java
index 9d94d039c10..a1f852e5a87 100644
--- a/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java
+++ b/backends-common/cassandra/src/main/java/org/apache/james/backends/cassandra/init/CassandraTypesProvider.java
@@ -21,6 +21,8 @@
import java.util.Optional;
+import javax.inject.Inject;
+
import com.datastax.driver.core.Session;
import com.datastax.driver.core.UserType;
import com.google.common.collect.ImmutableMap;
@@ -31,6 +33,7 @@
public class CassandraTypesProvider {
private final ImmutableMap userTypes;
+ @Inject
public CassandraTypesProvider(CassandraModule module, Session session) {
userTypes = module.moduleTypes()
.stream()
diff --git a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java
index dfe2c1aa3f8..d60e3430e87 100644
--- a/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java
+++ b/backends-common/cassandra/src/test/java/org/apache/james/backends/cassandra/CassandraCluster.java
@@ -77,9 +77,8 @@ public void clearAllTables() {
private Optional tryInitializeSession() {
try {
- Cluster cluster = ClusterFactory.createClusterForSingleServerWithoutPassWord(CLUSTER_IP, CLUSTER_PORT_TEST);
Cluster clusterWithInitializedKeyspace = ClusterWithKeyspaceCreatedFactory
- .clusterWithInitializedKeyspace(cluster, KEYSPACE_NAME, REPLICATION_FACTOR);
+ .clusterWithInitializedKeyspace(getCluster(), KEYSPACE_NAME, REPLICATION_FACTOR);
return Optional.of(new SessionWithInitializedTablesFactory(module).createSession(clusterWithInitializedKeyspace, KEYSPACE_NAME));
} catch (NoHostAvailableException exception) {
sleep(SLEEP_BEFORE_RETRY);
@@ -87,6 +86,10 @@ private Optional tryInitializeSession() {
}
}
+ public Cluster getCluster() {
+ return ClusterFactory.createClusterForSingleServerWithoutPassWord(CLUSTER_IP, CLUSTER_PORT_TEST);
+ }
+
private void sleep(long sleepMs) {
try {
Thread.sleep(sleepMs);
diff --git a/backends-common/pom.xml b/backends-common/pom.xml
index 7e753295cfe..d682ba8cfc5 100644
--- a/backends-common/pom.xml
+++ b/backends-common/pom.xml
@@ -44,6 +44,11 @@
guava16.0
+
+ javax.inject
+ javax.inject
+ 1
+ org.assertjassertj-core
diff --git a/dockerfiles/compilation/java-8/compile.sh b/dockerfiles/compilation/java-8/compile.sh
index b95a88af585..0e68d1bb6a4 100755
--- a/dockerfiles/compilation/java-8/compile.sh
+++ b/dockerfiles/compilation/java-8/compile.sh
@@ -53,4 +53,8 @@ fi
if [ $? -eq 0 ]; then
cp server/app/target/james-server-app-*-app.zip $DESTINATION
+ cp server/container/cassandra-guice/target/james-server-cassandra-guice-*-SNAPSHOT.jar $DESTINATION
+ cp -r server/container/cassandra-guice/target/james-server-cassandra-guice-*-SNAPSHOT.lib $DESTINATION
+ cp server/container/cli/target/james-server-cli-*.jar $DESTINATION
+ cp -r server/container/cli/target/james-server-cli-*.lib $DESTINATION
fi
diff --git a/dockerfiles/run/guice/Dockerfile b/dockerfiles/run/guice/Dockerfile
new file mode 100644
index 00000000000..cd03111d340
--- /dev/null
+++ b/dockerfiles/run/guice/Dockerfile
@@ -0,0 +1,27 @@
+# Run James
+#
+# VERSION 1.0
+
+FROM java:openjdk-8-jdk
+
+# Ports that are used
+#
+# 25 SMTP without authentication
+# 110 POP3
+# 143 IMAP with startTLS enabled
+# 465 SMTP with authentication and socketTLS enabled
+# 587 SMTP with authentication and startTLS enabled
+# 993 IMAP with socketTLS enabled
+
+EXPOSE 25 110 143 465 587 993
+
+WORKDIR /root
+
+# Get data we need to run James : build results and configuration
+ADD destination/james-server-cassandra-guice-*.jar /root/james-server.jar
+ADD destination/james-server-cassandra-guice-3.0.0-beta5-SNAPSHOT.lib /root/james-server-cassandra-guice-3.0.0-beta5-SNAPSHOT.lib
+ADD destination/james-server-cli-3.0.0-beta5-SNAPSHOT.jar /root/james-cli.jar
+ADD destination/james-server-cli-3.0.0-beta5-SNAPSHOT.lib /root/james-server-cli-3.0.0-beta5-SNAPSHOT.lib
+ADD destination/conf /root/conf
+
+ENTRYPOINT java -Dworking.directory=/root/ -jar james-server.jar
diff --git a/dockerfiles/destination/conf/META-INF/jpa-mappings-template.xml b/dockerfiles/run/guice/destination/conf/META-INF/jpa-mappings-template.xml
similarity index 100%
rename from dockerfiles/destination/conf/META-INF/jpa-mappings-template.xml
rename to dockerfiles/run/guice/destination/conf/META-INF/jpa-mappings-template.xml
diff --git a/dockerfiles/destination/conf/META-INF/persistence-template.xml b/dockerfiles/run/guice/destination/conf/META-INF/persistence-template.xml
similarity index 100%
rename from dockerfiles/destination/conf/META-INF/persistence-template.xml
rename to dockerfiles/run/guice/destination/conf/META-INF/persistence-template.xml
diff --git a/dockerfiles/destination/conf/META-INF/persistence.xml b/dockerfiles/run/guice/destination/conf/META-INF/persistence.xml
similarity index 100%
rename from dockerfiles/destination/conf/META-INF/persistence.xml
rename to dockerfiles/run/guice/destination/conf/META-INF/persistence.xml
diff --git a/dockerfiles/destination/conf/cassandra.properties b/dockerfiles/run/guice/destination/conf/cassandra.properties
similarity index 100%
rename from dockerfiles/destination/conf/cassandra.properties
rename to dockerfiles/run/guice/destination/conf/cassandra.properties
diff --git a/dockerfiles/destination/conf/dnsservice.xml b/dockerfiles/run/guice/destination/conf/dnsservice.xml
similarity index 100%
rename from dockerfiles/destination/conf/dnsservice.xml
rename to dockerfiles/run/guice/destination/conf/dnsservice.xml
diff --git a/dockerfiles/run/guice/destination/conf/domainlist.xml b/dockerfiles/run/guice/destination/conf/domainlist.xml
new file mode 100644
index 00000000000..fc64fd214a1
--- /dev/null
+++ b/dockerfiles/run/guice/destination/conf/domainlist.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ james.linagora.com
+
+ true
+ true
+ localhost
+
diff --git a/dockerfiles/run/guice/destination/conf/elasticsearch.properties b/dockerfiles/run/guice/destination/conf/elasticsearch.properties
new file mode 100644
index 00000000000..2eec9530711
--- /dev/null
+++ b/dockerfiles/run/guice/destination/conf/elasticsearch.properties
@@ -0,0 +1,26 @@
+# 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.
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# Configuration file for ElasticSearch
+
+elasticsearch.masterHost=elasticsearch
+elasticsearch.port=9300
+elasticsearch.nb.shards=1
+elasticsearch.nb.replica=0
diff --git a/dockerfiles/destination/conf/fetchmail.xml b/dockerfiles/run/guice/destination/conf/fetchmail.xml
similarity index 100%
rename from dockerfiles/destination/conf/fetchmail.xml
rename to dockerfiles/run/guice/destination/conf/fetchmail.xml
diff --git a/dockerfiles/destination/conf/imapserver.xml b/dockerfiles/run/guice/destination/conf/imapserver.xml
similarity index 100%
rename from dockerfiles/destination/conf/imapserver.xml
rename to dockerfiles/run/guice/destination/conf/imapserver.xml
diff --git a/dockerfiles/destination/conf/indexer.xml b/dockerfiles/run/guice/destination/conf/indexer.xml
similarity index 100%
rename from dockerfiles/destination/conf/indexer.xml
rename to dockerfiles/run/guice/destination/conf/indexer.xml
diff --git a/dockerfiles/destination/conf/james-database.properties b/dockerfiles/run/guice/destination/conf/james-database.properties
similarity index 100%
rename from dockerfiles/destination/conf/james-database.properties
rename to dockerfiles/run/guice/destination/conf/james-database.properties
diff --git a/dockerfiles/destination/conf/jcr-repository.xml b/dockerfiles/run/guice/destination/conf/jcr-repository.xml
similarity index 100%
rename from dockerfiles/destination/conf/jcr-repository.xml
rename to dockerfiles/run/guice/destination/conf/jcr-repository.xml
diff --git a/dockerfiles/destination/conf/jmx.properties b/dockerfiles/run/guice/destination/conf/jmx.properties
similarity index 100%
rename from dockerfiles/destination/conf/jmx.properties
rename to dockerfiles/run/guice/destination/conf/jmx.properties
diff --git a/dockerfiles/destination/conf/lib/README.txt b/dockerfiles/run/guice/destination/conf/lib/README.txt
similarity index 100%
rename from dockerfiles/destination/conf/lib/README.txt
rename to dockerfiles/run/guice/destination/conf/lib/README.txt
diff --git a/dockerfiles/destination/conf/lmtpserver.xml b/dockerfiles/run/guice/destination/conf/lmtpserver.xml
similarity index 100%
rename from dockerfiles/destination/conf/lmtpserver.xml
rename to dockerfiles/run/guice/destination/conf/lmtpserver.xml
diff --git a/dockerfiles/destination/conf/log4j.properties b/dockerfiles/run/guice/destination/conf/log4j.properties
similarity index 100%
rename from dockerfiles/destination/conf/log4j.properties
rename to dockerfiles/run/guice/destination/conf/log4j.properties
diff --git a/dockerfiles/destination/conf/mailetcontainer.xml b/dockerfiles/run/guice/destination/conf/mailetcontainer.xml
similarity index 100%
rename from dockerfiles/destination/conf/mailetcontainer.xml
rename to dockerfiles/run/guice/destination/conf/mailetcontainer.xml
diff --git a/dockerfiles/destination/conf/mailrepositorystore.xml b/dockerfiles/run/guice/destination/conf/mailrepositorystore.xml
similarity index 100%
rename from dockerfiles/destination/conf/mailrepositorystore.xml
rename to dockerfiles/run/guice/destination/conf/mailrepositorystore.xml
diff --git a/dockerfiles/destination/conf/managesieve.help.txt b/dockerfiles/run/guice/destination/conf/managesieve.help.txt
similarity index 100%
rename from dockerfiles/destination/conf/managesieve.help.txt
rename to dockerfiles/run/guice/destination/conf/managesieve.help.txt
diff --git a/dockerfiles/destination/conf/pop3server.xml b/dockerfiles/run/guice/destination/conf/pop3server.xml
similarity index 100%
rename from dockerfiles/destination/conf/pop3server.xml
rename to dockerfiles/run/guice/destination/conf/pop3server.xml
diff --git a/dockerfiles/destination/conf/quota.xml b/dockerfiles/run/guice/destination/conf/quota.xml
similarity index 100%
rename from dockerfiles/destination/conf/quota.xml
rename to dockerfiles/run/guice/destination/conf/quota.xml
diff --git a/dockerfiles/run/guice/destination/conf/recipientrewritetable.xml b/dockerfiles/run/guice/destination/conf/recipientrewritetable.xml
new file mode 100644
index 00000000000..fde339bd5c3
--- /dev/null
+++ b/dockerfiles/run/guice/destination/conf/recipientrewritetable.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+ true
+ 10
+
+
diff --git a/dockerfiles/destination/conf/smtpserver.xml b/dockerfiles/run/guice/destination/conf/smtpserver.xml
similarity index 100%
rename from dockerfiles/destination/conf/smtpserver.xml
rename to dockerfiles/run/guice/destination/conf/smtpserver.xml
diff --git a/dockerfiles/destination/conf/sqlResources.xml b/dockerfiles/run/guice/destination/conf/sqlResources.xml
similarity index 100%
rename from dockerfiles/destination/conf/sqlResources.xml
rename to dockerfiles/run/guice/destination/conf/sqlResources.xml
diff --git a/dockerfiles/run/guice/destination/conf/usersrepository.xml b/dockerfiles/run/guice/destination/conf/usersrepository.xml
new file mode 100644
index 00000000000..85046b30835
--- /dev/null
+++ b/dockerfiles/run/guice/destination/conf/usersrepository.xml
@@ -0,0 +1,25 @@
+
+
+
+
+ MD5
+ true
+
+
diff --git a/dockerfiles/Dockerfile b/dockerfiles/run/spring/Dockerfile
similarity index 100%
rename from dockerfiles/Dockerfile
rename to dockerfiles/run/spring/Dockerfile
diff --git a/dockerfiles/destination/.gitignore b/dockerfiles/run/spring/destination/.gitignore
similarity index 100%
rename from dockerfiles/destination/.gitignore
rename to dockerfiles/run/spring/destination/.gitignore
diff --git a/dockerfiles/run/spring/destination/conf/META-INF/jpa-mappings-template.xml b/dockerfiles/run/spring/destination/conf/META-INF/jpa-mappings-template.xml
new file mode 100644
index 00000000000..fe76d25d0ac
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/META-INF/jpa-mappings-template.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/META-INF/persistence-template.xml b/dockerfiles/run/spring/destination/conf/META-INF/persistence-template.xml
new file mode 100644
index 00000000000..950e1ab6bbb
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/META-INF/persistence-template.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+ META-INF/jpa-mappings-template.xml
+
+
+ org.apache.james.mailbox.jpa.mail.model.JPAMailbox
+ org.apache.james.mailbox.jpa.mail.model.JPAUserFlag
+ org.apache.james.mailbox.jpa.mail.model.openjpa.AbstractJPAMessage
+
+
+
+
+ org.apache.james.mailbox.jpa.mail.model.openjpa.JPAMessage
+
+ org.apache.james.mailbox.jpa.mail.model.JPAProperty
+ org.apache.james.mailbox.jpa.user.model.JPASubscription
+
+
+ org.apache.james.domainlist.jpa.model.JPADomain
+
+
+ org.apache.james.user.jpa.model.JPAUser
+
+
+ org.apache.james.rrt.jpa.model.JPARecipientRewrite
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/META-INF/persistence.xml b/dockerfiles/run/spring/destination/conf/META-INF/persistence.xml
new file mode 100644
index 00000000000..66462619c08
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/META-INF/persistence.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+ org.apache.james.mailbox.jpa.mail.model.JPAMailbox
+ org.apache.james.mailbox.jpa.mail.model.JPAUserFlag
+ org.apache.james.mailbox.jpa.mail.model.openjpa.AbstractJPAMessage
+ org.apache.james.mailbox.jpa.mail.model.openjpa.JPAMessage
+ org.apache.james.mailbox.jpa.mail.model.JPAProperty
+ org.apache.james.mailbox.jpa.user.model.JPASubscription
+ org.apache.james.domainlist.jpa.model.JPADomain
+ org.apache.james.user.jpa.model.JPAUser
+ org.apache.james.rrt.jpa.model.JPARecipientRewrite
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/cassandra.properties b/dockerfiles/run/spring/destination/conf/cassandra.properties
new file mode 100644
index 00000000000..c6a7342fcfa
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/cassandra.properties
@@ -0,0 +1,6 @@
+# Configuration file for cassandra mailbox
+
+cassandra.ip=cassandra
+cassandra.port=9042
+cassandra.keyspace=apache_james
+cassandra.replication.factor=1
\ No newline at end of file
diff --git a/dockerfiles/run/spring/destination/conf/dnsservice.xml b/dockerfiles/run/spring/destination/conf/dnsservice.xml
new file mode 100644
index 00000000000..0978a00b899
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/dnsservice.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ 8.8.8.8
+ 62.210.16.6
+
+ false
+ false
+ 50000
+
diff --git a/dockerfiles/destination/conf/domainlist.xml b/dockerfiles/run/spring/destination/conf/domainlist.xml
similarity index 100%
rename from dockerfiles/destination/conf/domainlist.xml
rename to dockerfiles/run/spring/destination/conf/domainlist.xml
diff --git a/dockerfiles/destination/conf/elasticsearch.properties b/dockerfiles/run/spring/destination/conf/elasticsearch.properties
similarity index 100%
rename from dockerfiles/destination/conf/elasticsearch.properties
rename to dockerfiles/run/spring/destination/conf/elasticsearch.properties
diff --git a/dockerfiles/run/spring/destination/conf/fetchmail.xml b/dockerfiles/run/spring/destination/conf/fetchmail.xml
new file mode 100644
index 00000000000..96aa9460fc4
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/fetchmail.xml
@@ -0,0 +1,288 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+
+
+ fetchmail
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ pop.server.com
+
+
+ 600000
+
+
+
+ pop3
+
+
+ INBOX
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ wibble@localhost, flobble@localhost
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/imapserver.xml b/dockerfiles/run/spring/destination/conf/imapserver.xml
new file mode 100644
index 00000000000..8ccb1179c9a
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/imapserver.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+ imapserver
+ 0.0.0.0:143
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 0
+ 0
+
+
+ imapserver-ssl
+ 0.0.0.0:993
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 0
+ 0
+
+
diff --git a/dockerfiles/run/spring/destination/conf/indexer.xml b/dockerfiles/run/spring/destination/conf/indexer.xml
new file mode 100644
index 00000000000..ced1a62274e
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/indexer.xml
@@ -0,0 +1,23 @@
+
+
+
+
+ elasticsearch
+
diff --git a/dockerfiles/run/spring/destination/conf/james-database.properties b/dockerfiles/run/spring/destination/conf/james-database.properties
new file mode 100644
index 00000000000..b3ac7ebc6e5
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/james-database.properties
@@ -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.
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# See http://james.apache.org/server/3/config.html for usage
+
+# Use derby as default
+database.driverClassName=org.apache.derby.jdbc.EmbeddedDriver
+database.url=jdbc:derby:../var/store/derby;create=true
+database.username=app
+database.password=app
+
+# Supported adapters are:
+# DB2, DERBY, H2, HSQL, INFORMIX, MYSQL, ORACLE, POSTGRESQL, SQL_SERVER, SYBASE
+vendorAdapter.database=DERBY
+
+# Use streaming for Blobs
+# This is only supported on a limited set of databases atm. You should check if its supported by your DB before enable
+# it.
+#
+# See:
+# http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_mapping_jpa.html #7.11. LOB Streaming
+#
+openjpa.streaming=false
\ No newline at end of file
diff --git a/dockerfiles/run/spring/destination/conf/jcr-repository.xml b/dockerfiles/run/spring/destination/conf/jcr-repository.xml
new file mode 100644
index 00000000000..c1b998a75f7
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/jcr-repository.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/jmx.properties b/dockerfiles/run/spring/destination/conf/jmx.properties
new file mode 100644
index 00000000000..a1dbdf8924b
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/jmx.properties
@@ -0,0 +1,28 @@
+# 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.
+#
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# See http://james.apache.org/server/3/config.html for usage
+
+jmx.address=127.0.0.1
+jmx.port=9999
diff --git a/dockerfiles/run/spring/destination/conf/lib/README.txt b/dockerfiles/run/spring/destination/conf/lib/README.txt
new file mode 100644
index 00000000000..d536d44b732
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/lib/README.txt
@@ -0,0 +1 @@
+# Put every jar you want to have included in the classpath in here
\ No newline at end of file
diff --git a/dockerfiles/run/spring/destination/conf/lmtpserver.xml b/dockerfiles/run/spring/destination/conf/lmtpserver.xml
new file mode 100644
index 00000000000..ce079b0e4d1
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/lmtpserver.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ lmtpserver
+
+ 127.0.0.1:24
+ 200
+ 1200
+
+ 0
+
+ 0
+
+
+ 0
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/log4j.properties b/dockerfiles/run/spring/destination/conf/log4j.properties
new file mode 100644
index 00000000000..cdcfbd866ac
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/log4j.properties
@@ -0,0 +1,137 @@
+# 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.
+
+# See http://james.apache.org/server/3/config.html for usage
+
+log4j.rootLogger=DEBUG
+
+log4j.appender.CONS=org.apache.log4j.ConsoleAppender
+log4j.appender.CONS.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONS.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.FILE.File=../log/james-server.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.MAILBOXMANAGER=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.MAILBOXMANAGER.File=../log/mailboxmanager.log
+log4j.appender.MAILBOXMANAGER.DatePattern='.'yyyy-MM-dd
+log4j.appender.MAILBOXMANAGER.layout=org.apache.log4j.PatternLayout
+log4j.appender.MAILBOXMANAGER.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.IMAPSERVER=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.IMAPSERVER.File=../log/imapserver.log
+log4j.appender.IMAPSERVER.DatePattern='.'yyyy-MM-dd
+log4j.appender.IMAPSERVER.layout=org.apache.log4j.PatternLayout
+log4j.appender.IMAPSERVER.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.MAILETCONTAINER=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.MAILETCONTAINER.File=../log/mailetcontainer.log
+log4j.appender.MAILETCONTAINER.DatePattern='.'yyyy-MM-dd
+log4j.appender.MAILETCONTAINER.layout=org.apache.log4j.PatternLayout
+log4j.appender.MAILETCONTAINER.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.DNSSERVICE=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.DNSSERVICE.File=../log/dnsservice.log
+log4j.appender.DNSSERVICE.DatePattern='.'yyyy-MM-dd
+log4j.appender.DNSSERVICE.layout=org.apache.log4j.PatternLayout
+log4j.appender.DNSSERVICE.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.POP3SERVER=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.POP3SERVER.File=../log/pop3server.log
+log4j.appender.POP3SERVER.DatePattern='.'yyyy-MM-dd
+log4j.appender.POP3SERVER.layout=org.apache.log4j.PatternLayout
+log4j.appender.POP3SERVER.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.SMTPSERVER=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.SMTPSERVER.File=../log/smtpserver.log
+log4j.appender.SMTPSERVER.DatePattern='.'yyyy-MM-dd
+log4j.appender.SMTPSERVER.layout=org.apache.log4j.PatternLayout
+log4j.appender.SMTPSERVER.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.LMTPSERVER=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.LMTPSERVER.File=../log/lmtpserver.log
+log4j.appender.LMTPSERVER.DatePattern='.'yyyy-MM-dd
+log4j.appender.LMTPSERVER.layout=org.apache.log4j.PatternLayout
+log4j.appender.LMTPSERVER.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.MAILREPOSITORYSTORE=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.MAILREPOSITORYSTORE.File=../log/mailrepositorystore.log
+log4j.appender.MAILREPOSITORYSTORE.DatePattern='.'yyyy-MM-dd
+log4j.appender.MAILREPOSITORYSTORE.layout=org.apache.log4j.PatternLayout
+log4j.appender.MAILREPOSITORYSTORE.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.USERSREPOSITORY=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.USERSREPOSITORY.File=../log/usersrepository.log
+log4j.appender.USERSREPOSITORY.DatePattern='.'yyyy-MM-dd
+log4j.appender.USERSREPOSITORY.layout=org.apache.log4j.PatternLayout
+log4j.appender.USERSREPOSITORY.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.FETCHMAIL=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.FETCHMAIL.File=../log/fetchmail.log
+log4j.appender.FETCHMAIL.DatePattern='.'yyyy-MM-dd
+log4j.appender.FETCHMAIL.layout=org.apache.log4j.PatternLayout
+log4j.appender.FETCHMAIL.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.DOMAINLIST=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.DOMAINLIST.File=../log/domainlist.log
+log4j.appender.DOMAINLIST.DatePattern='.'yyyy-MM-dd
+log4j.appender.DOMAINLIST.layout=org.apache.log4j.PatternLayout
+log4j.appender.DOMAINLIST.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.VIRTUALUSERTABLE=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.VIRTUALUSERTABLE.File=../log/virtualusertable.log
+log4j.appender.VIRTUALUSERTABLE.DatePattern='.'yyyy-MM-dd
+log4j.appender.VIRTUALUSERTABLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.VIRTUALUSERTABLE.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.appender.MAILQUEUEFACTORY=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.MAILQUEUEFACTORY.File=../log/mailqueuefactory.log
+log4j.appender.MAILQUEUEFACTORY.DatePattern='.'yyyy-MM-dd
+log4j.appender.MAILQUEUEFACTORY.layout=org.apache.log4j.PatternLayout
+log4j.appender.MAILQUEUEFACTORY.layout.ConversionPattern=%-5p %d{HH:mm:ss,SSS} | %c | %m%n
+
+log4j.logger.org.apache.jackrabbit=ERROR, CONS, FILE
+
+log4j.logger.org.apache.xbean.spring=WARN, CONS, FILE
+log4j.logger.org.apache.activemq=WARN, CONS, FILE
+
+log4j.logger.org.apache.camel=WARN, CONS, FILE
+log4j.logger.org.springframework=WARN, CONS, FILE
+log4j.logger.org.apache.james=DEBUG, CONS, FILE
+
+log4j.logger.james=WARN, CONS, FILE
+log4j.logger=DEBUG, CONS, FILE
+
+log4j.logger.james.mailboxmanager=DEBUG, MAILBOXMANAGER
+log4j.logger.james.imapserver=DEBUG, IMAPSERVER
+log4j.logger.james.mailetcontainer=DEBUG, MAILETCONTAINER
+log4j.logger.james.mailetcontext=DEBUG, MAILETCONTAINER
+log4j.logger.james.mailspooler=DEBUG, MAILETCONTAINER
+log4j.logger.james.mailprocessor=DEBUG, MAILETCONTAINER
+log4j.logger.james.dnsservice=DEBUG, DNSSERVICE
+log4j.logger.james.pop3server=DEBUG, POP3SERVER
+log4j.logger.james.smtpserver=DEBUG, SMTPSERVER
+log4j.logger.james.lmtpserver=DEBUG, LMTPSERVER
+log4j.logger.james.mailrepositorystore=DEBUG, MAILREPOSITORYSTORE
+log4j.logger.james.usersrepository=DEBUG, USERSREPOSITORY
+log4j.logger.james.fetchmail=DEBUG, FETCHMAIL
+log4j.logger.james.domainlist=DEBUG, DOMAINLIST
+log4j.logger.james.virtualusertable=DEBUG, VIRTUALUSERTABLE
+log4j.logger.james.mailqueuefactory=DEBUG, MAILQUEUEFACTORY
+log4j.logger.etm.core.monitor.EtmMonitor= DEBUG, CONS, FILE
diff --git a/dockerfiles/destination/conf/mailbox.xml b/dockerfiles/run/spring/destination/conf/mailbox.xml
similarity index 100%
rename from dockerfiles/destination/conf/mailbox.xml
rename to dockerfiles/run/spring/destination/conf/mailbox.xml
diff --git a/dockerfiles/run/spring/destination/conf/mailetcontainer.xml b/dockerfiles/run/spring/destination/conf/mailetcontainer.xml
new file mode 100644
index 00000000000..678c344e5e7
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/mailetcontainer.xml
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+ postmaster@james.minet.net
+
+
+
+ 20
+
+
+
+
+
+
+
+
+ sieve-manager-check
+
+
+ transport
+
+
+ true
+
+
+ transport
+
+
+ transport
+
+
+
+
+
+
+ spam
+ 550 Requested action not taken: rejected - see http://njabl.org/
+
+
+ transport
+
+
+
+
+
+
+ file://var/mail/error/
+
+
+
+
+
+
+ X-UserIsAuth
+ true
+
+
+ X-WasSigned
+ true
+
+
+
+
+ local-address-error
+ 550 - Requested action not taken: no such user here
+
+
+ outgoing
+ 5000, 100000, 500000
+ 25
+ 0
+ 10
+ true
+ bounces
+
+
+ relay-denied
+
+
+
+
+
+ file://var/mail/spam/
+
+
+
+
+
+ none
+
+
+ file://var/mail/address-error/
+
+
+
+
+
+ none
+
+
+ file://var/mail/relay-denied/
+ Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation
+
+
+
+
+
+ false
+
+
+
+
+
+
+ sieve-manager
+
+
+
+ heads
+ none
+ false
+ [REJECTED]
+
+ You can't send messages to configure SIEVE on this serveur unless you are the official SIEVE manager.
+
+
+
+
+
+
+
+ true
+
+
+ file:/root/james-server-app-3.0.0-beta5-SNAPSHOT/conf/managesieve.help.txt
+
+
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/mailrepositorystore.xml b/dockerfiles/run/spring/destination/conf/mailrepositorystore.xml
new file mode 100644
index 00000000000..acca810221d
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/mailrepositorystore.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+ file
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/managesieve.help.txt b/dockerfiles/run/spring/destination/conf/managesieve.help.txt
new file mode 100644
index 00000000000..f45c78dba7c
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/managesieve.help.txt
@@ -0,0 +1,112 @@
+managesieve implements the commands defined by RFC 5804 ((http://tools.ietf.org/html/rfc5804) to manage sieve scripts via mail messages. A mail is sent to the managesieve user with the command and parameters in the subject header. Sieve scripts are exchanged as mail attachments.
+
+Consult your mail administrator for the name of the managesieve user configured for your installation.
+
+Users MUST be SMTP authenticated to execute all except the CAPABILITY and HELP commands (see note (1) below).
+
+Commands are executed and answered within the namespace of the sending user as denoted by the sender header of the mail. Thus, a command such as LISTSCRIPTS lists the scripts within namespace of the user identified by the sender header.
+
+The supported commands are summarised in "Command Summary" below. Generally the responses are self describing. For full details see RFC 5804 - Commands (http://tools.ietf.org/html/rfc5804#section-2).
+
+In these descriptions the following keywords apply:
+
+- sieve-name
+ The name of a sieve script enclosed in parentheses, eg: "my script". An empty name is not allowed.
+- active-sieve-name
+ As sieve-name, except an empty name, eg: "", is allowed.
+- old-sieve-name
+ As sieve-name
+- new-sieve-name
+ As sieve-name
+- sieve-script
+ A mail attachment recognised as a sieve script. This is the first attachment in a mail satisfying any of these characteristics:
+ - A MIME type of "application/sieve"
+ - A filename with the suffix ".sieve"
+ - A filename with the suffix ".siv"
+ Returned sieve-scripts always have the MIME type of "application/sieve"
+
+Command Summary
+---------------
+
+CAPABILITY
+ Subject:
+ CAPABILITY
+ Attachments:
+ none
+Answers the capabilities of the underlying sieve inplementation.
+
+CHECKSCRIPT
+ Subject:
+ CHECKSCRIPT
+ Attachments:
+ sieve-script
+Verifies the attached sieve-script without storing it on the server.
+
+DELETESCRIPT
+ Subject:
+ DELETESCRIPT sieve-name
+ Attachments:
+ none
+Deletes the named sieve script.
+
+GETACTIVE
+ Subject:
+ GETACTIVE
+ Attachments:
+ none
+Answers the active sieve script as an attachment.
+
+GETSCRIPT
+ Subject:
+ GETSCRIPT sieve-name
+ Attachments:
+ none
+Answers the named sieve script as an attachment.
+
+HAVESPACE
+ Subject:
+ HAVESPACE sieve-name number
+ Attachments:
+ none
+Answers OK if there is available space to store a script with the given name of the given size, else NO.
+
+HELP
+ Subject:
+ HELP
+ Attachments:
+ none
+Answers this text.
+
+LISTSCRIPTS
+ Subject:
+ LISTSCRIPTS
+ Attachments:
+ none
+Answers a list of the sieve scripts stored on the server, indicating which, if any, is the active script.
+
+PUTSCRIPT
+ Subject:
+ PUTSCRIPT sieve-name
+ Attachments:
+ sieve-script
+Verifies the attached sieve-script and if there are no errors stores it on the server using the given name.
+
+RENAMESCRIPT
+ Subject:
+ RENAMESCRIPT old-sieve-name new-sieve-name
+ Attachments:
+ none
+Renames the script stored on the server named old-sieve-name to new-sieve-name.
+
+SETACTIVE
+ Subject:
+ SETACTIVE active-sieve-name
+ Attachments:
+ none
+Sets the active script on the server to the given name. Use an empty string, "", to deactivate all scripts.
+
+Notes
+-----
+1) Some mail servers optionally allow configurations that enable local clients to post without SMTP authentication, such configurations will fail as managesieve requires SMTP authentication in all circumstances. To repeat, users MUST be SMTP authenticated to execute all except the CAPABILITY and HELP commands.
+
+
diff --git a/dockerfiles/run/spring/destination/conf/pop3server.xml b/dockerfiles/run/spring/destination/conf/pop3server.xml
new file mode 100644
index 00000000000..df8fbef9ea8
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/pop3server.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ pop3server
+ 0.0.0.0:110
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 1200
+ 0
+ 0
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/quota.xml b/dockerfiles/run/spring/destination/conf/quota.xml
new file mode 100644
index 00000000000..70162e0d4fd
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/quota.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+ default
+
+
+ cassandra
+
+
+ cassandra
+
+
+ store
+
+
+ event
+
+
diff --git a/dockerfiles/destination/conf/recipientrewritetable.xml b/dockerfiles/run/spring/destination/conf/recipientrewritetable.xml
similarity index 100%
rename from dockerfiles/destination/conf/recipientrewritetable.xml
rename to dockerfiles/run/spring/destination/conf/recipientrewritetable.xml
diff --git a/dockerfiles/run/spring/destination/conf/smtpserver.xml b/dockerfiles/run/spring/destination/conf/smtpserver.xml
new file mode 100644
index 00000000000..bc609bee0f7
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/smtpserver.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ smtpserver-global
+ 0.0.0.0:25
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+ false
+ 0.0.0.0/0
+ true
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+ smtpserver-TLS
+ 0.0.0.0:465
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+
+ true
+ 0.0.0.0/0
+
+ false
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+ smtpserver-authenticated
+ 0.0.0.0:587
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+
+ true
+ 0.0.0.0/0
+
+ false
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+
+
diff --git a/dockerfiles/run/spring/destination/conf/sqlResources.xml b/dockerfiles/run/spring/destination/conf/sqlResources.xml
new file mode 100644
index 00000000000..82cfa2605b1
--- /dev/null
+++ b/dockerfiles/run/spring/destination/conf/sqlResources.xml
@@ -0,0 +1,931 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${table}
+
+
+ SELECT username, pwdHash, pwdAlgorithm, useForwarding,
+ forwardDestination, useAlias, alias
+ FROM ${table}
+ ORDER BY username
+
+
+
+
+
+ SELECT username, pwdHash, pwdAlgorithm, useForwarding,
+ forwardDestination, useAlias, alias
+ FROM ${table}
+ WHERE lower(username) = ?
+
+
+
+ SELECT username, pwdHash, pwdAlgorithm, useForwarding,
+ forwardDestination, useAlias, alias
+ FROM ${table}
+ WHERE username = ?
+
+
+
+ INSERT INTO ${table}
+ (username, pwdHash, pwdAlgorithm, useForwarding, forwardDestination, useAlias, alias)
+ VALUES (?,?,?,?,?,?,?)
+
+
+
+ UPDATE ${table} SET
+ pwdHash = ?, pwdAlgorithm = ?, useForwarding = ?, forwardDestination = ?, useAlias = ?, alias = ?
+ WHERE username = ?
+
+
+
+ DELETE FROM ${table} WHERE username = ?
+
+
+ CREATE CACHED TABLE ${table} (username VARCHAR(64) NOT NULL, pwdHash VARCHAR(50), pwdAlgorithm VARCHAR(20), useForwarding INTEGER, forwardDestination VARCHAR(255), useAlias INTEGER, alias VARCHAR(255), PRIMARY KEY(username))
+ CREATE TABLE ${table} (username VARCHAR(64) NOT NULL, pwdHash VARCHAR(50), pwdAlgorithm VARCHAR(20), useForwarding SMALLINT, forwardDestination VARCHAR(255), useAlias SMALLINT, alias VARCHAR(255), PRIMARY KEY(username))
+
+
+
+
+ ${table}
+
+
+ SELECT username, pwdHash, pwdAlgorithm
+ FROM ${table}
+
+
+
+ INSERT INTO ${table}
+ (username, pwdHash, pwdAlgorithm)
+ VALUES (?,?,?)
+
+
+
+ UPDATE ${table} SET
+ pwdHash = ?, pwdAlgorithm = ?
+ WHERE username = ?
+
+
+
+ DELETE FROM ${table} WHERE username = ?
+
+
+ CREATE CACHED TABLE ${table} (username VARCHAR(64) NOT NULL, pwdHash VARCHAR(50), pwdAlgorithm VARCHAR(20), PRIMARY KEY(username))
+ CREATE TABLE ${table} (username VARCHAR(64) NOT NULL, pwdHash VARCHAR(50), pwdAlgorithm VARCHAR(20), PRIMARY KEY(username))
+
+
+
+
+
+
+ ${table}
+
+
+ SELECT listSubscriber
+ FROM ${table}
+ WHERE listName = '${key}'
+
+
+
+ INSERT INTO ${table}
+ (listSubscriber, listName)
+ VALUES (?, '${key}')
+
+
+
+ UPDATE ${table} SET
+ listSubscriber = ?
+ WHERE listSubscriber = ? AND listName = '${key}'
+
+
+
+ DELETE FROM ${table}
+ WHERE listSubscriber = ? AND listName = '${key}'
+
+
+
+ CREATE CACHED TABLE ${table} (listName VARCHAR(64) NOT NULL, listSubscriber VARCHAR(255) NOT NULL, PRIMARY KEY(listName, listSubscriber))
+ CREATE TABLE ${table} (listName VARCHAR(64) NOT NULL, listSubscriber VARCHAR(255) NOT NULL, PRIMARY KEY(listName, listSubscriber))
+
+
+
+
+
+ SELECT count(*) FROM ${table} WHERE message_name = ? AND repository_name = ?
+
+
+ UPDATE ${table} SET message_state = ?, error_message = ?, sender = ?, recipients = ?, remote_host = ?, remote_addr = ?, last_updated = ? WHERE message_name = ? AND repository_name = ?
+
+
+ UPDATE ${table} SET message_body = ? WHERE message_name = ? AND repository_name = ?
+
+
+ UPDATE ${table} SET message_attributes = ? WHERE message_name = ? AND repository_name = ?
+
+
+ INSERT INTO ${table} (message_name,
+ repository_name, message_state, error_message, sender, recipients,
+ remote_host, remote_addr, last_updated, message_body,
+ message_attributes) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
+
+
+ SELECT message_state, error_message, sender, recipients, remote_host, remote_addr, last_updated FROM ${table} WHERE message_name = ? AND repository_name = ?
+
+
+ SELECT message_body FROM ${table} WHERE message_name = ? AND repository_name = ?
+
+
+ SELECT message_attributes FROM ${table} WHERE message_name = ? AND repository_name = ?
+
+
+
+ SELECT datalength(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+ SELECT length(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+ SELECT length(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+ SELECT length(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+ SELECT length(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+ SELECT dbms_lob.getlength(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+ SELECT length(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+ SELECT length(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+ SELECT length(message_body) FROM ${table} WHERE message_name = ? AND repository_name = ?
+
+
+ DELETE FROM ${table} WHERE message_name = ? AND repository_name = ?
+
+
+ SELECT message_name, message_state, last_updated FROM ${table} WHERE repository_name = ? ORDER BY last_updated ASC
+
+
+
+ CREATE TABLE ${table} (
+ message_name varchar (200) NOT NULL,
+ repository_name varchar (100) NOT NULL,
+ message_state varchar (30) NOT NULL ,
+ error_message varchar (200) NULL ,
+ sender varchar (255) NULL ,
+ recipients text NOT NULL ,
+ remote_host varchar (255) NOT NULL ,
+ remote_addr varchar (20) NOT NULL ,
+ message_body longblob NOT NULL ,
+ message_attributes longblob NULL ,
+ last_updated datetime NOT NULL,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+ CREATE CACHED TABLE ${table} (
+ message_name varchar (200) NOT NULL,
+ repository_name varchar (255) NOT NULL,
+ message_state varchar (30) NOT NULL ,
+ error_message varchar (200) NULL ,
+ sender varchar (255) NULL ,
+ recipients varchar NOT NULL ,
+ remote_host varchar (255) NOT NULL ,
+ remote_addr varchar (20) NOT NULL ,
+ message_body varchar NOT NULL ,
+ message_attributes varchar NULL ,
+ last_updated timestamp NOT NULL,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+ CREATE CACHED TABLE ${table} (
+ message_name varchar (200) NOT NULL,
+ repository_name varchar (255) NOT NULL,
+ message_state varchar (30) NOT NULL ,
+ error_message varchar (200) NULL ,
+ sender varchar (255) NULL ,
+ recipients varchar NOT NULL ,
+ remote_host varchar (255) NOT NULL ,
+ remote_addr varchar (20) NOT NULL ,
+ message_body varchar NOT NULL ,
+ message_attributes varchar NULL ,
+ last_updated timestamp NOT NULL,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+ CREATE TABLE [${table}] (
+ [message_name] [varchar] (200) NOT NULL,
+ [repository_name] [varchar] (255) NOT NULL,
+ [message_state] [varchar] (30) NOT NULL ,
+ [error_message] [varchar] (1000) NULL ,
+ [sender] [varchar] (255) NULL ,
+ [recipients] [text] NOT NULL ,
+ [remote_host] [varchar] (255) NOT NULL ,
+ [remote_addr] [varchar] (20) NOT NULL ,
+ [message_body] [image] NOT NULL ,
+ [message_attributes] [image] NULL ,
+ [last_updated] [datetime] NOT NULL,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+ CREATE TABLE ${table} (
+ message_name varchar2(200) NOT NULL ,
+ repository_name varchar2(255) NOT NULL ,
+ message_state varchar2(30) NOT NULL ,
+ error_message varchar2(200) NULL ,
+ sender varchar2(255) ,
+ recipients varchar2(1000) NOT NULL ,
+ remote_host varchar2(100) NOT NULL ,
+ remote_addr varchar2(20) NOT NULL ,
+ message_body blob NOT NULL ,
+ message_attributes blob NULL ,
+ last_updated date NOT NULL ,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+ CREATE TABLE ${table} (
+ message_name varchar (200) NOT NULL,
+ repository_name varchar (255) NOT NULL,
+ message_state varchar (30) NOT NULL ,
+ error_message varchar (200) NULL ,
+ sender varchar (255) NULL ,
+ recipients text NOT NULL ,
+ remote_host varchar (255) NOT NULL ,
+ remote_addr varchar (20) NOT NULL ,
+ message_body bytea NOT NULL ,
+ message_attributes bytea NULL ,
+ last_updated timestamp NOT NULL,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+ CREATE TABLE ${table} (
+ message_name varchar (200) NOT NULL,
+ repository_name varchar (200) NOT NULL,
+ message_state varchar (30) NOT NULL ,
+ error_message varchar (200) NULL ,
+ sender varchar (200) NULL ,
+ recipients long NOT NULL ,
+ remote_host varchar (100) NOT NULL ,
+ remote_addr varchar (20) NOT NULL ,
+ message_body long byte NOT NULL ,
+ message_attributes long byte NULL ,
+ last_updated date NOT NULL,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+ CREATE TABLE ${table} (
+ message_name varchar(200) NOT NULL ,
+ repository_name varchar(255) NOT NULL ,
+ message_state varchar(30) NOT NULL ,
+ error_message varchar(200) ,
+ sender varchar(255) ,
+ recipients varchar(1000) NOT NULL ,
+ remote_host varchar(100) NOT NULL ,
+ remote_addr varchar(20) NOT NULL ,
+ message_body blob NOT NULL ,
+ message_attributes blob ,
+ last_updated timestamp NOT NULL ,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+ CREATE TABLE ${table} (
+ message_name varchar (200) NOT NULL,
+ repository_name varchar (255) NOT NULL,
+ message_state varchar (30) NOT NULL ,
+ error_message varchar (200) ,
+ sender varchar (255) ,
+ recipients LONG VARCHAR NOT NULL ,
+ remote_host varchar (255) NOT NULL ,
+ remote_addr varchar (20) NOT NULL ,
+ message_body LONG BYTE NOT NULL ,
+ message_attributes LONG BYTE ,
+ last_updated DATE NOT NULL
+ )
+
+
+ CREATE TABLE ${table} (
+ message_name varchar (200) NOT NULL,
+ repository_name varchar (255) NOT NULL,
+ message_state varchar (30) NOT NULL ,
+ error_message varchar (200) ,
+ sender varchar (255) ,
+ recipients long varchar NOT NULL ,
+ remote_host varchar (255) NOT NULL ,
+ remote_addr varchar (20) NOT NULL ,
+ message_body blob NOT NULL ,
+ message_attributes blob ,
+ last_updated timestamp NOT NULL,
+ PRIMARY KEY (repository_name, message_name)
+ )
+
+
+
+
+
+ bayesiananalysis_ham
+ bayesiananalysis_spam
+ bayesiananalysis_messagecounts
+
+
+ SELECT HAMCOUNT, SPAMCOUNT FROM bayesiananalysis_messagecounts
+
+
+ INSERT INTO bayesiananalysis_messagecounts (HAMCOUNT, SPAMCOUNT) VALUES (0,0)
+
+
+ UPDATE bayesiananalysis_messagecounts SET HAMCOUNT=(HAMCOUNT + ?)
+
+
+ UPDATE bayesiananalysis_messagecounts SET SPAMCOUNT=(SPAMCOUNT + ?)
+
+
+ SELECT TOKEN, OCCURRENCES FROM bayesiananalysis_ham
+
+
+ SELECT TOKEN, OCCURRENCES FROM bayesiananalysis_spam
+
+
+ INSERT INTO bayesiananalysis_ham (TOKEN, OCCURRENCES) VALUES (?,?)
+
+
+ INSERT INTO bayesiananalysis_spam (TOKEN, OCCURRENCES) VALUES (?,?)
+
+
+ UPDATE bayesiananalysis_ham SET OCCURRENCES=(OCCURRENCES + ?) WHERE (TOKEN=?)
+
+
+ UPDATE bayesiananalysis_spam SET OCCURRENCES=(OCCURRENCES + ?) WHERE (TOKEN=?)
+
+
+ DELETE FROM bayesiananalysis_ham
+
+
+ DELETE FROM bayesiananalysis_spam
+
+
+ DELETE FROM bayesiananalysis_messagecounts
+
+
+
+
+ CREATE TABLE bayesiananalysis_ham (
+ token varchar(128) binary NOT NULL default '',
+ occurrences int(11) NOT NULL default '0',
+ PRIMARY KEY (token)
+ ) TYPE=InnoDB
+
+
+ CREATE TABLE [bayesiananalysis_ham] (
+ [token] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL,
+ [occurrences] [int] NOT NULL default (0),
+ PRIMARY KEY (token)
+ )
+
+
+ CREATE TABLE bayesiananalysis_ham (
+ token varchar(128) NOT NULL,
+ occurrences INTEGER NOT NULL default 0,
+ PRIMARY KEY (token)
+ )
+
+
+ CREATE TABLE bayesiananalysis_ham (
+ token varchar(128) NOT NULL,
+ occurrences int NOT NULL default 0,
+ PRIMARY KEY (token)
+ )
+
+
+
+
+ CREATE TABLE bayesiananalysis_spam (
+ token varchar(128) binary NOT NULL default '',
+ occurrences int(11) NOT NULL default '0',
+ PRIMARY KEY (token)
+ ) TYPE=InnoDB
+
+
+ CREATE TABLE [bayesiananalysis_spam] (
+ [token] [varchar] (128) COLLATE Latin1_General_CS_AS NOT NULL,
+ [occurrences] [int] NOT NULL default (0),
+ PRIMARY KEY (token)
+ )
+
+
+ CREATE TABLE bayesiananalysis_spam (
+ token varchar (128) NOT NULL,
+ occurrences INTEGER NOT NULL default 0,
+ PRIMARY KEY (token)
+ )
+
+
+ CREATE TABLE bayesiananalysis_spam (
+ token varchar (128) NOT NULL,
+ occurrences int NOT NULL default 0,
+ PRIMARY KEY (token)
+ )
+
+
+
+
+ CREATE TABLE bayesiananalysis_messagecounts (
+ hamcount int(11) NOT NULL default '0',
+ spamcount int(11) NOT NULL default '0'
+ ) TYPE=InnoDB
+
+
+ CREATE TABLE [bayesiananalysis_messagecounts] (
+ [hamcount] [int] NOT NULL default (0),
+ [spamcount] [int] NOT NULL default (0)
+ )
+
+
+ CREATE TABLE bayesiananalysis_messagecounts (
+ hamcount INTEGER NOT NULL default 0,
+ spamcount INTEGER NOT NULL default 0
+ )
+
+
+ CREATE TABLE bayesiananalysis_messagecounts (
+ hamcount int NOT NULL default 0,
+ spamcount int NOT NULL default 0
+ )
+
+
+
+
+
+ whitelist
+
+
+ SELECT localUser, localHost FROM whitelist where (localUser=? AND localHost=? AND remoteUser=? AND remoteHost=?)
+
+
+ SELECT remoteUser, remoteHost FROM whitelist where (localUser=? AND localHost=?) ORDER BY remoteUser, remoteHost
+
+
+ INSERT INTO whitelist (localUser, localHost, remoteUser, remoteHost) VALUES (?,?,?,?)
+
+
+ DELETE FROM whitelist where (localUser=? AND localHost=? AND remoteUser=? AND remoteHost=?)
+
+
+
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+ CREATE CACHED TABLE ${table} (
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) character set latin1 NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) character set latin1 NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ ) TYPE=InnoDB
+
+
+ CREATE TABLE [whitelist] (
+ [localUser] [varchar] (64) NOT NULL,
+ [localHost] [varchar] (255) NOT NULL,
+ [remoteUser] [varchar] (64) NOT NULL,
+ [remoteHost] [varchar] (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+
+ CREATE TABLE whitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ remoteUser varchar (64) NOT NULL,
+ remoteHost varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost, remoteUser, remoteHost)
+ )
+
+
+
+
+
+
+ networkWhitelist
+
+
+ SELECT network FROM networkWhitelist where (localUser=? AND localHost=?)
+
+
+
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ network varchar (255) NOT NULL,
+ PRIMARY KEY (localUser, localHost)
+ )
+
+ CREATE CACHED TABLE ${table} (
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ network varchar (255) NOT NULL
+ )
+
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) character set latin1 NOT NULL,
+ network varchar (255) NOT NULL
+ ) TYPE=InnoDB
+
+
+ CREATE TABLE [networkWhitelist] (
+ [localUser] [varchar] (64) NOT NULL,
+ [localHost] [varchar] (255) NOT NULL,
+ [network] [varchar] (255) NOT NULL
+ )
+
+
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ network varchar (255) NOT NULL
+ )
+
+
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ network varchar (255) NOT NULL
+ )
+
+
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ network varchar (255) NOT NULL
+ )
+
+
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ network varchar (255) NOT NULL
+ )
+
+
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ network varchar (255) NOT NULL
+ )
+
+
+ CREATE TABLE networkWhitelist (
+ localUser varchar (64) NOT NULL,
+ localHost varchar (255) NOT NULL,
+ network varchar (255) NOT NULL
+ )
+
+
+
+
+
+
+ greylist
+
+
+ SELECT create_time,count FROM greylist WHERE ipaddress = ? AND sender = ? AND recip = ?
+
+
+ INSERT INTO greylist (ipaddress,sender,recip,count,create_time) values (?,?,?,?,?)
+
+
+ DELETE FROM greylist WHERE create_time < ? AND count = 0
+
+
+ DELETE FROM greylist WHERE create_time < ?
+
+
+ UPDATE greylist SET create_time = ? , count = ? WHERE ipaddress = ? AND sender = ? AND recip = ?
+
+
+
+ CREATE TABLE greylist (
+ ipaddress varchar (20) NOT NULL,
+ sender varchar (255) NOT NULL,
+ recip varchar (255) NOT NULL,
+ count int NOT NULL,
+ create_time datetime NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+
+ CREATE CACHED TABLE ${table} (
+ CREATE TABLE greylist (
+ ipaddress varchar (20) NOT NULL,
+ sender varchar (255) NOT NULL,
+ recip varchar (255) NOT NULL,
+ count int NOT NULL,
+ create_time timestamo NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+ CREATE TABLE greylist (
+ ipaddress varchar (20) NOT NULL,
+ sender varchar (255) NOT NULL,
+ recip varchar (255) NOT NULL,
+ count int NOT NULL,
+ create_time datetime NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ ) TYPE=InnoDB
+
+
+ CREATE TABLE [greylist] (
+ [ipaddress] [varchar] (20) NOT NULL,
+ [sender] [varchar] (255) NOT NULL,
+ [recip] [varchar] (255) NOT NULL,
+ [count] [int] NOT NULL,
+ [create_time] [datetime] NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+
+ CREATE TABLE greylist (
+ ipaddress varchar2(20) NOT NULL,
+ sender varchar2(255) NOT NULL,
+ recip varchar2(255) NOT NULL,
+ count int NOT NULL,
+ create_time datetime NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+
+ CREATE TABLE greylist (
+ ipaddress varchar (20) NOT NULL,
+ sender varchar (255) NOT NULL,
+ recip varchar (255) NOT NULL,
+ count int NOT NULL,
+ create_time timestamp NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+
+ CREATE TABLE greylist (
+ ipaddress varchar (20) NOT NULL,
+ sender varchar (255) NOT NULL,
+ recip varchar (255) NOT NULL,
+ count int NOT NULL,
+ create_time date NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+
+ CREATE TABLE greylist (
+ ipaddress varchar (20) NOT NULL,
+ sender varchar (255) NOT NULL,
+ recip varchar (255) NOT NULL,
+ count int NOT NULL,
+ create_time timestamp NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+
+ CREATE TABLE greylist (
+ ipaddress varchar (20) NOT NULL,
+ sender varchar (255) NOT NULL,
+ recip varchar (255) NOT NULL,
+ count int NOT NULL,
+ create_time date NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+
+ CREATE TABLE greylist (
+ ipaddress varchar (20) NOT NULL,
+ sender varchar (255) NOT NULL,
+ recip varchar (255) NOT NULL,
+ count int NOT NULL,
+ create_time timestamp NOT NULL,
+ PRIMARY KEY (ipaddress,sender,recip)
+ )
+
+
+
+
+
+
+ select RecipientRewriteTable.target_address,(RecipientRewriteTable."user" || '@' ||RecipientRewriteTable.domain) from RecipientRewriteTable, RecipientRewriteTable as VUTDomains where ((RecipientRewriteTable."user") like ? or (RecipientRewriteTable."user") = '*') and (RecipientRewriteTable.domain like ? or (RecipientRewriteTable.domain = '*')) order by 2 desc
+ select RecipientRewriteTable.target_address from RecipientRewriteTable, RecipientRewriteTable as VUTDomains where (RecipientRewriteTable.user like ? or RecipientRewriteTable.user = '*') and (RecipientRewriteTable.domain like ? or (RecipientRewriteTable.domain = '*')) order by concat(RecipientRewriteTable.user,'@',RecipientRewriteTable.domain) desc limit 1
+ select RecipientRewriteTable.target_address from RecipientRewriteTable, RecipientRewriteTable as VUTDomains where (RecipientRewriteTable.user like ? or RecipientRewriteTable.user = '*') and (RecipientRewriteTable.domain like ? or (RecipientRewriteTable.domain = '*')) order by (RecipientRewriteTable.user || '@' || RecipientRewriteTable.domain) desc limit 1
+
+ select RecipientRewriteTable.target_address from RecipientRewriteTable where RecipientRewriteTable."user" = ? and RecipientRewriteTable.domain = ?
+ select RecipientRewriteTable.target_address from RecipientRewriteTable where RecipientRewriteTable.user = ? and RecipientRewriteTable.domain = ?
+
+ delete from RecipientRewriteTable where RecipientRewriteTable."user" = ? and RecipientRewriteTable.domain = ? and RecipientRewriteTable.target_address = ?
+
+ update RecipientRewriteTable set RecipientRewriteTable.target_address = ? where RecipientRewriteTable."user" = ? and RecipientRewriteTable.domain = ?
+
+ insert into RecipientRewriteTable values(?,?,?)
+
+ select * from RecipientRewriteTable
+
+
+
+ CREATE TABLE RecipientRewriteTable (
+ user varchar(64) NOT NULL default '',
+ domain varchar(255) NOT NULL default '',
+ target_address varchar(255) NOT NULL default '',
+ PRIMARY KEY (user,domain)
+ )
+
+
+
+
+ CREATE TABLE RecipientRewriteTable (
+ "user" varchar(64) NOT NULL default '',
+ domain varchar(255) NOT NULL default '',
+ target_address varchar(255) NOT NULL default '',
+ PRIMARY KEY ("user",domain)
+ )
+
+
+ CREATE TABLE RecipientRewriteTable (
+ "user" varchar (64) NOT NULL default '',
+ domain varchar (255) NOT NULL default '',
+ target_address varchar (255) NOT NULL default '',
+ PRIMARY KEY ("user",domain)
+ )
+
+
+
+
+
diff --git a/dockerfiles/destination/conf/usersrepository.xml b/dockerfiles/run/spring/destination/conf/usersrepository.xml
similarity index 100%
rename from dockerfiles/destination/conf/usersrepository.xml
rename to dockerfiles/run/spring/destination/conf/usersrepository.xml
diff --git a/dockerfiles/destination/var/.gitignore b/dockerfiles/run/spring/destination/var/.gitignore
similarity index 100%
rename from dockerfiles/destination/var/.gitignore
rename to dockerfiles/run/spring/destination/var/.gitignore
diff --git a/mailbox/cassandra/pom.xml b/mailbox/cassandra/pom.xml
index f5dd50d7889..7a3dd6829b9 100644
--- a/mailbox/cassandra/pom.xml
+++ b/mailbox/cassandra/pom.xml
@@ -151,6 +151,10 @@
guava16.0
+
+ javax.inject
+ javax.inject
+ ${javax.mail.groupId}${javax.mail.artifactId}
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
index 8e4be618cbb..40f7f511175 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxManager.java
@@ -19,6 +19,9 @@
package org.apache.james.mailbox.cassandra;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
import org.apache.james.mailbox.MailboxPathLocker;
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.acl.SimpleGroupMembershipResolver;
@@ -31,13 +34,16 @@
import org.apache.james.mailbox.store.StoreMessageManager;
import org.apache.james.mailbox.store.mail.model.Mailbox;
import org.apache.james.mailbox.store.mail.model.impl.SimpleMailbox;
+import org.apache.james.mailbox.store.search.MessageSearchIndex;
/**
* Cassandra implementation of {@link StoreMailboxManager}
*/
+@Singleton
public class CassandraMailboxManager extends StoreMailboxManager {
private MailboxPathLocker locker;
+ @Inject
public CassandraMailboxManager(CassandraMailboxSessionMapperFactory mapperFactory, Authenticator authenticator, final MailboxPathLocker locker) {
super(mapperFactory,
authenticator,
@@ -47,6 +53,12 @@ public CassandraMailboxManager(CassandraMailboxSessionMapperFactory mapperFactor
this.locker = locker;
}
+ @Override
+ @Inject
+ public void setMessageSearchIndex(MessageSearchIndex index) {
+ super.setMessageSearchIndex(index);
+ }
+
@Override
protected Mailbox doCreateMailbox(MailboxPath mailboxPath, MailboxSession session) throws MailboxException {
SimpleMailbox cassandraMailbox = new SimpleMailbox<>(mailboxPath, randomUidValidity());
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxSessionMapperFactory.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxSessionMapperFactory.java
index 8a54650a7c7..9ae3b2d9dee 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxSessionMapperFactory.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraMailboxSessionMapperFactory.java
@@ -20,6 +20,7 @@
package org.apache.james.mailbox.cassandra;
import org.apache.james.backends.cassandra.init.CassandraTypesProvider;
+import javax.inject.Inject;
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.cassandra.mail.CassandraMailboxMapper;
import org.apache.james.mailbox.cassandra.mail.CassandraMessageMapper;
@@ -45,6 +46,7 @@ public class CassandraMailboxSessionMapperFactory extends MailboxSessionMapperFa
private final CassandraTypesProvider typesProvider;
private int maxRetry;
+ @Inject
public CassandraMailboxSessionMapperFactory(UidProvider uidProvider, ModSeqProvider modSeqProvider, Session session, CassandraTypesProvider typesProvider) {
this.uidProvider = uidProvider;
this.modSeqProvider = modSeqProvider;
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManager.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManager.java
index c1428e9be9c..401f388b941 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManager.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/CassandraSubscriptionManager.java
@@ -19,6 +19,8 @@
package org.apache.james.mailbox.cassandra;
+import javax.inject.Inject;
+
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.store.StoreSubscriptionManager;
import org.apache.james.mailbox.store.user.model.Subscription;
@@ -30,6 +32,7 @@
*/
public class CassandraSubscriptionManager extends StoreSubscriptionManager {
+ @Inject
public CassandraSubscriptionManager(CassandraMailboxSessionMapperFactory mapperFactory) {
super(mapperFactory);
}
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
index 772a7e3e867..a30e49bc8b8 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraModSeqProvider.java
@@ -29,6 +29,7 @@
import static org.apache.james.mailbox.cassandra.table.CassandraMessageModseqTable.TABLE_NAME;
import java.util.Optional;
+import javax.inject.Inject;
import org.apache.james.backends.cassandra.utils.CassandraConstants;
import org.apache.james.backends.cassandra.utils.LightweightTransactionException;
@@ -60,6 +61,7 @@ public CassandraModSeqProvider(Session session, int maxRetry) {
this.runner = new FunctionRunnerWithRetry(maxRetry);
}
+ @Inject
public CassandraModSeqProvider(Session session) {
this(session, DEFAULT_MAX_RETRY);
}
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
index 2783347539a..59e0ead3ae5 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/mail/CassandraUidProvider.java
@@ -19,8 +19,6 @@
package org.apache.james.mailbox.cassandra.mail;
-import java.util.Optional;
-
import static com.datastax.driver.core.querybuilder.QueryBuilder.eq;
import static com.datastax.driver.core.querybuilder.QueryBuilder.insertInto;
import static com.datastax.driver.core.querybuilder.QueryBuilder.select;
@@ -32,6 +30,10 @@
import com.datastax.driver.core.querybuilder.BuiltStatement;
import com.google.common.base.Throwables;
import org.apache.james.backends.cassandra.utils.LightweightTransactionException;
+
+import java.util.Optional;
+import javax.inject.Inject;
+
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.cassandra.CassandraId;
import org.apache.james.backends.cassandra.utils.FunctionRunnerWithRetry;
@@ -39,11 +41,11 @@
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.store.mail.UidProvider;
import org.apache.james.mailbox.store.mail.model.Mailbox;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Session;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class CassandraUidProvider implements UidProvider {
public final static int DEFAULT_MAX_RETRY = 100000;
@@ -58,6 +60,7 @@ public CassandraUidProvider(Session session, int maxRetry) {
this.runner = new FunctionRunnerWithRetry(maxRetry);
}
+ @Inject
public CassandraUidProvider(Session session) {
this(session, DEFAULT_MAX_RETRY);
}
diff --git a/mailbox/elasticsearch/pom.xml b/mailbox/elasticsearch/pom.xml
index 89abaad02e8..4782639ae59 100644
--- a/mailbox/elasticsearch/pom.xml
+++ b/mailbox/elasticsearch/pom.xml
@@ -201,6 +201,10 @@
awaitility1.6.3
+
+ javax.inject
+ javax.inject
+ ${javax.mail.groupId}${javax.mail.artifactId}
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java
index 821f10a0a21..6317fdc4d15 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java
@@ -27,6 +27,8 @@
import com.google.common.base.Preconditions;
+import javax.inject.Inject;
+
public class ElasticSearchIndexer {
public static final String MAILBOX_INDEX = "mailbox";
@@ -34,6 +36,7 @@ public class ElasticSearchIndexer {
private final ClientProvider clientProvider;
+ @Inject
public ElasticSearchIndexer(ClientProvider clientProvider) {
this.clientProvider = clientProvider;
}
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
index 968a406e4d5..ece821d8718 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
@@ -20,6 +20,7 @@
import java.util.Iterator;
+import javax.inject.Inject;
import javax.mail.Flags;
import org.apache.james.mailbox.MailboxSession;
@@ -48,6 +49,7 @@ public class ElasticSearchListeningMessageSearchIndex exte
private final ElasticSearchSearcher searcher;
private final MessageToElasticSearchJson messageToElasticSearchJson;
+ @Inject
public ElasticSearchListeningMessageSearchIndex(MessageMapperFactory factory, ElasticSearchIndexer indexer,
ElasticSearchSearcher searcher, MessageToElasticSearchJson messageToElasticSearchJson) {
super(factory);
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
index 21e6e14c7f6..291643cccc0 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJson.java
@@ -19,6 +19,7 @@
package org.apache.james.mailbox.elasticsearch.json;
+import javax.inject.Inject;
import javax.mail.Flags;
import java.time.ZoneId;
@@ -45,6 +46,7 @@ public MessageToElasticSearchJson(TextExtractor textExtractor, ZoneId zoneId) {
this.mapper.registerModule(new Jdk8Module());
}
+ @Inject
public MessageToElasticSearchJson(TextExtractor textExtractor) {
this(textExtractor, ZoneId.systemDefault());
}
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/query/QueryConverter.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/query/QueryConverter.java
index 00061f5c9b3..4ea0b5ef6b7 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/query/QueryConverter.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/query/QueryConverter.java
@@ -23,6 +23,8 @@
import org.apache.james.mailbox.model.SearchQuery;
import org.elasticsearch.common.lang3.tuple.Pair;
import org.elasticsearch.index.query.QueryBuilder;
+
+import javax.inject.Inject;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Stream;
@@ -36,6 +38,7 @@ public class QueryConverter implements Function, Query
private final CriterionConverter criterionConverter;
+ @Inject
public QueryConverter(CriterionConverter criterionConverter) {
this.criterionConverter = criterionConverter;
}
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/search/ElasticSearchSearcher.java b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/search/ElasticSearchSearcher.java
index 58655a52fa5..b0f17348133 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/search/ElasticSearchSearcher.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/search/ElasticSearchSearcher.java
@@ -40,6 +40,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.inject.Inject;
+
public class ElasticSearchSearcher {
private static final Logger LOGGER = LoggerFactory.getLogger(ElasticSearchSearcher.class);
@@ -47,6 +49,7 @@ public class ElasticSearchSearcher {
private final ClientProvider clientProvider;
private final QueryConverter queryConverter;
+ @Inject
public ElasticSearchSearcher(ClientProvider clientProvider, QueryConverter queryConverter) {
this.clientProvider = clientProvider;
this.queryConverter = queryConverter;
diff --git a/mailbox/store/pom.xml b/mailbox/store/pom.xml
index 784a00d1843..48ab78e7f84 100644
--- a/mailbox/store/pom.xml
+++ b/mailbox/store/pom.xml
@@ -56,6 +56,10 @@
${javax.mail.groupId}${javax.mail.artifactId}
+
+ javax.inject
+ javax.inject
+ commons-langcommons-lang
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 885d98c4d7e..01924f7bcb2 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
@@ -26,6 +26,10 @@
import java.util.Locale;
import java.util.Random;
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
import org.apache.james.mailbox.MailboxListener;
import org.apache.james.mailbox.MailboxManager;
import org.apache.james.mailbox.MailboxPathLocker;
@@ -75,6 +79,7 @@
*
* @param
*/
+@Singleton
public class StoreMailboxManager implements MailboxManager {
public static final char SQL_WILDCARD_CHAR = '%';
@@ -111,6 +116,7 @@ public class StoreMailboxManager implements MailboxManager
private int fetchBatchSize = DEFAULT_FETCH_BATCH_SIZE;
+ @Inject
public StoreMailboxManager(MailboxSessionMapperFactory mailboxSessionMapperFactory, final Authenticator authenticator, final MailboxPathLocker locker, final MailboxACLResolver aclResolver, final GroupMembershipResolver groupMembershipResolver) {
this.authenticator = authenticator;
this.locker = locker;
@@ -158,6 +164,7 @@ public void setFetchBatchSize(int fetchBatchSize) {
* @throws MailboxException
*/
@SuppressWarnings("rawtypes")
+ @PostConstruct
public void init() throws MailboxException {
// The dispatcher need to have the delegating listener added
dispatcher = new MailboxEventDispatcher(getDelegationListener());
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java
index 667892f5412..7a14bfe5d43 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/SimpleMessageSearchIndex.java
@@ -23,6 +23,9 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
import org.apache.james.mailbox.MailboxSession;
import org.apache.james.mailbox.exception.MailboxException;
import org.apache.james.mailbox.model.MessageRange;
@@ -47,9 +50,12 @@
*
* @param
*/
+@Singleton
public class SimpleMessageSearchIndex implements MessageSearchIndex {
private final MessageMapperFactory factory;
+
+ @Inject
public SimpleMessageSearchIndex(MessageMapperFactory factory) {
this.factory = factory;
}
diff --git a/pom.xml b/pom.xml
index 179009d76e6..4467ad968e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -567,7 +567,7 @@
org.apache.felixmaven-bundle-plugin
- 2.3.7
+ 2.4.0true
diff --git a/protocols/api/pom.xml b/protocols/api/pom.xml
index 8cc2710be27..bd2b44dbdbe 100644
--- a/protocols/api/pom.xml
+++ b/protocols/api/pom.xml
@@ -34,8 +34,11 @@
Apache James :: Protocols :: API
-
-
+
+ commons-configuration
+ commons-configuration
+
+
org.slf4jslf4j-api
diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java
index 803caea5bbc..9575acb1641 100644
--- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java
+++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/AbstractProtocolHandlerChain.java
@@ -81,8 +81,8 @@ public void wireExtensibleHandlers() throws WiringException {
* @see org.apache.james.protocols.api.handler.ProtocolHandlerChain#destroy()
*/
public void destroy() {
- List handlers = getHandlers(LifecycleAwareProtocolHandler.class);
- for (LifecycleAwareProtocolHandler handler: handlers) {
+ List handlers = getHandlers(ProtocolHandler.class);
+ for (ProtocolHandler handler: handlers) {
handler.destroy();
}
}
diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java
index 040d56986ba..5e6d3e2c873 100644
--- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java
+++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java
@@ -29,6 +29,8 @@
import java.util.List;
import java.util.Locale;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.BaseRequest;
import org.apache.james.protocols.api.ProtocolSession;
import org.apache.james.protocols.api.Request;
@@ -60,7 +62,17 @@ public CommandDispatcher(Collection mandatoryCommands) {
public CommandDispatcher() {
this(Collections.emptyList());
}
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Add it to map (key as command name, value is an array list of CommandHandlers)
*
diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java
index f366c13d505..47ac3ea04e3 100644
--- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java
+++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandlerResultLogger.java
@@ -18,6 +18,8 @@
****************************************************************/
package org.apache.james.protocols.api.handler;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.logger.Logger;
@@ -53,4 +55,13 @@ protected void log(ProtocolSession session, Response response, String logmessage
}
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ProtocolHandler.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ProtocolHandler.java
index 9a85e3e452f..930cae50b51 100644
--- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ProtocolHandler.java
+++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ProtocolHandler.java
@@ -19,6 +19,8 @@
package org.apache.james.protocols.api.handler;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
/**
* Just the base interface for all kind of "protocol" handlers.
@@ -27,5 +29,18 @@
*
*/
public interface ProtocolHandler {
+
+ /**
+ * Init with the given {@link Configuration}
+ *
+ * @param config
+ * @throws ConfigurationException
+ */
+ void init(Configuration config) throws ConfigurationException;
+
+ /**
+ * Destroy object
+ */
+ void destroy();
}
diff --git a/protocols/imap/src/main/java/org/apache/james/protocols/imap/core/IMAPCommandDispatcher.java b/protocols/imap/src/main/java/org/apache/james/protocols/imap/core/IMAPCommandDispatcher.java
index 30bba9df7ae..073f847e82c 100644
--- a/protocols/imap/src/main/java/org/apache/james/protocols/imap/core/IMAPCommandDispatcher.java
+++ b/protocols/imap/src/main/java/org/apache/james/protocols/imap/core/IMAPCommandDispatcher.java
@@ -23,6 +23,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
@@ -44,7 +46,17 @@ protected Request parseRequest(IMAPSession session, ByteBuffer buffer) throws Ex
MultiLineHandler handler = new MultiLineHandler() {
private static final String BYTES_READ = "BYTES_READ";
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/*
* (non-Javadoc)
* @see org.apache.james.protocols.api.handler.MultiLineHandler#isReady(org.apache.james.protocols.api.ProtocolSession, java.nio.ByteBuffer)
diff --git a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java
index 61c22652dd5..be88803eadd 100644
--- a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java
+++ b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java
@@ -27,6 +27,8 @@
import java.util.Iterator;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.net.smtp.RelayPath;
import org.apache.commons.net.smtp.SMTPClient;
import org.apache.commons.net.smtp.SMTPReply;
@@ -328,7 +330,16 @@ public HookResult deliver(SMTPSession session, MailAddress recipient, MailEnvelo
}
return result;
}
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
private final class TestDeliverHook implements DeliverToRecipientHook {
@@ -351,6 +362,16 @@ public HookResult deliver(SMTPSession session, MailAddress recipient, MailEnvelo
public List getDelivered() {
return delivered;
}
- };
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+ }
}
diff --git a/protocols/pom.xml b/protocols/pom.xml
index 1594fa8d2ef..a9fe77196e9 100644
--- a/protocols/pom.xml
+++ b/protocols/pom.xml
@@ -121,6 +121,21 @@
commons-codec${commons-codec.version}
+
+ commons-configuration
+ commons-configuration
+ 1.9
+
+
+ commons-digester
+ commons-digester
+
+
+ commons-beanutils-core
+ commons-beanutils
+
+
+ commons-langcommons-lang
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java
index e33c547a9ac..39ef455af84 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/CapaCmdHandler.java
@@ -28,6 +28,8 @@
import java.util.Set;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -44,6 +46,16 @@ public class CapaCmdHandler implements CommandHandler, ExtensibleHa
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("CAPA"));
private static final Set CAPS = Collections.unmodifiableSet(new HashSet(Arrays.asList("PIPELINING")));
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* @see
* org.apache.james.protocols.api.handler.CommandHandler
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/DeleCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/DeleCmdHandler.java
index 1439adead5d..68a464d097b 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/DeleCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/DeleCmdHandler.java
@@ -24,6 +24,8 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
@@ -41,6 +43,16 @@ public class DeleCmdHandler implements CommandHandler {
private static final Response SYNTAX_ERROR = new POP3Response(POP3Response.ERR_RESPONSE, "Usage: DELE [mail number]").immutable();
private static final Response DELETED = new POP3Response(POP3Response.OK_RESPONSE, "Message deleted").immutable();
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a DELE command. This command
* deletes a particular mail message from the mailbox.
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java
index 7f00f594db8..2ae770b0d8b 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/ListCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
@@ -37,8 +39,19 @@
* Handles LIST command
*/
public class ListCmdHandler implements CommandHandler {
+
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("LIST"));
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a LIST command. Returns the number
* of messages in the mailbox and its aggregate size, or optionally, the
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/NoopCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/NoopCmdHandler.java
index 6cd05b2b143..754f5499c58 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/NoopCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/NoopCmdHandler.java
@@ -23,6 +23,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -33,8 +35,19 @@
* Handles NOOP command
*/
public class NoopCmdHandler implements CommandHandler {
+
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("NOOP"));
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a NOOP command. Like all good
* NOOPs, does nothing much.
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/QuitCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/QuitCmdHandler.java
index edb77d75c76..d63b1e2132f 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/QuitCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/QuitCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.ProtocolSession.State;
@@ -37,9 +39,11 @@
* Handles QUIT command
*/
public class QuitCmdHandler implements CommandHandler {
+
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("QUIT"));
private static final Response SIGN_OFF;
private static final Response SIGN_OFF_NOT_CLEAN;
+
static {
POP3Response response = new POP3Response(POP3Response.OK_RESPONSE, "Apache James POP3 Server signing off.");
response.setEndSession(true);
@@ -49,6 +53,17 @@ public class QuitCmdHandler implements CommandHandler {
response.setEndSession(true);
SIGN_OFF_NOT_CLEAN = response.immutable();
}
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a QUIT command. This method handles
* cleanup of the POP3Handler state.
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/RetrCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/RetrCmdHandler.java
index 5ce0fa43a3a..6969b71b053 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/RetrCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/RetrCmdHandler.java
@@ -26,6 +26,8 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
@@ -44,6 +46,16 @@ public class RetrCmdHandler implements CommandHandler {
private static final Response SYNTAX_ERROR = new POP3Response(POP3Response.ERR_RESPONSE, "Usage: RETR [mail number]").immutable();
private static final Response ERROR_MESSAGE_RETRIEVE = new POP3Response(POP3Response.ERR_RESPONSE, "Error while retrieving message.").immutable();
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a RETR command. This command
* retrieves a particular mail message from the mailbox.
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/RsetCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/RsetCmdHandler.java
index 6faf7987984..369516b3802 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/RsetCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/RsetCmdHandler.java
@@ -27,6 +27,8 @@
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.ProtocolSession.State;
@@ -41,6 +43,16 @@
public class RsetCmdHandler implements CommandHandler {
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("RSET"));
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a RSET command. Calls stat() to
* reset the mailbox.
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java
index 5b8fdee9137..5f634a885fe 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StatCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.ProtocolSession.State;
@@ -39,6 +41,16 @@
public class StatCmdHandler implements CommandHandler {
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("STAT"));
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a STAT command. Returns the number
* of messages in the mailbox and its aggregate size.
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StlsCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StlsCmdHandler.java
index 04e9e5a3743..0175b136aaf 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StlsCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/StlsCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.HashSet;
import java.util.Set;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -37,10 +39,22 @@
* with the STSL command
*/
public class StlsCmdHandler implements CommandHandler, CapaCapability {
+
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("STLS"));
private static final Set CAPS = Collections.unmodifiableSet(new HashSet(Arrays.asList("STLS")));
private static final Response BEGIN_TLS = new POP3StartTlsResponse(POP3Response.OK_RESPONSE, "Begin TLS negotiation").immutable();
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* @see CommandHandler#onCommand(org.apache.james.protocols.api.ProtocolSession, Request)
*/
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UidlCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UidlCmdHandler.java
index 45db866d199..9b4c5b1f3b0 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UidlCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UidlCmdHandler.java
@@ -28,6 +28,8 @@
import java.util.Set;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.ProtocolSession.State;
@@ -43,6 +45,16 @@ public class UidlCmdHandler implements CommandHandler, CapaCapabili
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("UIDL"));
private static final Set CAPS = Collections.unmodifiableSet(new HashSet(Arrays.asList("UIDL")));
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a UIDL command. Returns a listing
* of message ids to the client.
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UnknownCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UnknownCmdHandler.java
index 77f4bbea8dd..39576e9e5ca 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UnknownCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UnknownCmdHandler.java
@@ -19,6 +19,8 @@
package org.apache.james.protocols.pop3.core;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.UnknownCommandHandler;
@@ -36,4 +38,14 @@ public class UnknownCmdHandler extends UnknownCommandHandler {
public Response onCommand(POP3Session session, Request request) {
return POP3Response.ERR;
}
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UserCmdHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UserCmdHandler.java
index b03a826f217..172bb75cd20 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UserCmdHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/UserCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.HashSet;
import java.util.Set;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -39,6 +41,15 @@ public class UserCmdHandler implements CommandHandler, CapaCapabili
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList("USER"));
private static final Set CAPS = Collections.unmodifiableSet(new HashSet(Arrays.asList("USER")));
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
/**
* Handler method called upon receipt of a USER command. Reads in the user
diff --git a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/WelcomeMessageHandler.java b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/WelcomeMessageHandler.java
index 4a2e615a232..81236c7ea6d 100644
--- a/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/WelcomeMessageHandler.java
+++ b/protocols/pop3/src/main/java/org/apache/james/protocols/pop3/core/WelcomeMessageHandler.java
@@ -19,6 +19,8 @@
package org.apache.james.protocols.pop3.core;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.ConnectHandler;
@@ -27,6 +29,16 @@
public class WelcomeMessageHandler implements ConnectHandler {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* @see org.apache.james.protocols.api.handler.ConnectHandler
* #onConnect(org.apache.james.pop3server.POP3Session)
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AcceptRecipientIfRelayingIsAllowed.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AcceptRecipientIfRelayingIsAllowed.java
index 21462a1a036..373a1334403 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AcceptRecipientIfRelayingIsAllowed.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AcceptRecipientIfRelayingIsAllowed.java
@@ -18,6 +18,8 @@
****************************************************************/
package org.apache.james.protocols.smtp.core;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookResult;
@@ -40,4 +42,13 @@ public HookResult doRcpt(SMTPSession session, MailAddress sender,
return HookResult.declined();
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataCmdHandler.java
index 530635bf75f..ed722fdaa45 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataCmdHandler.java
@@ -26,6 +26,8 @@
import java.util.LinkedList;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
@@ -62,6 +64,16 @@ public SMTPResponse onLine(SMTPSession session, ByteBuffer line) {
}
return null;
}
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
public static final class DataLineFilterWrapper implements LineHandler {
@@ -84,13 +96,32 @@ public Response onLine(SMTPSession session, ByteBuffer line) {
Response r = filter.onLine(session, line, next);
return r;
}
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
public final static String MAILENV = "MAILENV";
private LineHandler lineHandler;
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* process DATA command
*
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java
index 9a75daaaaa7..213f18c2c77 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/DataLineMessageHookHandler.java
@@ -27,6 +27,8 @@
import java.util.LinkedList;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.ExtensibleHandler;
@@ -55,8 +57,16 @@ public class DataLineMessageHookHandler implements DataLineFilter, ExtensibleHan
private List> messageHandlers;
private List> rHooks;
-
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
/*
* (non-Javadoc)
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/ExpnCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/ExpnCmdHandler.java
index dac0758c407..39e26e843ed 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/ExpnCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/ExpnCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -61,4 +63,13 @@ public Collection getImplCommands() {
return COMMANDS;
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/HeloCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/HeloCmdHandler.java
index 05fe3dc1d68..8995be95c48 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/HeloCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/HeloCmdHandler.java
@@ -23,6 +23,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Response;
@@ -48,6 +50,17 @@ public class HeloCmdHandler extends AbstractHookableCmdHandler {
DSNStatus.getStatus(DSNStatus.PERMANENT,
DSNStatus.DELIVERY_INVALID_ARG)
+ " Domain address required: " + COMMAND_NAME).immutable();
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* @see org.apache.james.protocols.api.handler.CommandHandler#getImplCommands()
*/
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/HelpCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/HelpCmdHandler.java
index ecdfc8d1d11..66e440f5981 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/HelpCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/HelpCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -58,4 +60,14 @@ public Response onCommand(SMTPSession session, Request request){
public Collection getImplCommands() {
return COMMANDS;
}
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
index cbb08e2dd57..2cd248e030f 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/MailCmdHandler.java
@@ -29,6 +29,8 @@
import java.util.Map;
import java.util.StringTokenizer;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
@@ -69,6 +71,16 @@ public class MailCmdHandler extends AbstractHookableCmdHandler {
*/
private Map paramHooks;
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* @see
* org.apache.james.protocols.smtp.core.AbstractHookableCmdHandler
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/NoopCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/NoopCmdHandler.java
index d1be904b63d..99e71c4c112 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/NoopCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/NoopCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -61,4 +63,13 @@ public Collection getImplCommands() {
return COMMANDS;
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/PostmasterAbuseRcptHook.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/PostmasterAbuseRcptHook.java
index 82af79fb28a..81f6605601e 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/PostmasterAbuseRcptHook.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/PostmasterAbuseRcptHook.java
@@ -18,6 +18,8 @@
****************************************************************/
package org.apache.james.protocols.smtp.core;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookResult;
@@ -40,4 +42,13 @@ public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rc
}
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/QuitCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/QuitCmdHandler.java
index f3395c5bd75..0d74d54c0d3 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/QuitCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/QuitCmdHandler.java
@@ -23,6 +23,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.smtp.SMTPResponse;
import org.apache.james.protocols.smtp.SMTPRetCode;
@@ -51,7 +53,17 @@ public class QuitCmdHandler extends AbstractHookableCmdHandler {
response.setEndSession(true);
SYNTAX_ERROR = response.immutable();
}
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a QUIT command. This method informs
* the client that the connection is closing.
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RcptCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RcptCmdHandler.java
index 82fc14ab19b..9ced3a57d46 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RcptCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RcptCmdHandler.java
@@ -26,6 +26,8 @@
import java.util.Locale;
import java.util.StringTokenizer;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -50,6 +52,17 @@ public class RcptCmdHandler extends AbstractHookableCmdHandler impleme
private static final Response SYNTAX_ERROR_ARGS = new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_ARGUMENTS, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_SYNTAX) + " Usage: RCPT TO:").immutable();
private static final Response SYNTAX_ERROR_DELIVERY = new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_ARGUMENTS, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_SYNTAX) + " Syntax error in parameters or arguments").immutable();
private static final Response SYNTAX_ERROR_ADDRESS = new SMTPResponse(SMTPRetCode.SYNTAX_ERROR_MAILBOX, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.ADDRESS_SYNTAX) + " Syntax error in recipient address").immutable();
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a RCPT command. Reads recipient.
* Does some connection validation.
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
index a1ef93dbb27..740b796d96d 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/ReceivedDataLineFilter.java
@@ -26,6 +26,8 @@
import java.util.List;
import java.util.Locale;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPSession;
@@ -47,6 +49,16 @@ protected DateFormat initialValue() {
}
};
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Return the service type which will be used in the Received headers.
*
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RsetCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RsetCmdHandler.java
index 7084e1678c5..bcd375039fb 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RsetCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/RsetCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -75,5 +77,14 @@ private Response doRSET(SMTPSession session, String argument) {
public Collection getImplCommands() {
return COMMANDS;
}
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/UnknownCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/UnknownCmdHandler.java
index 35b7d9bf757..62eb2151891 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/UnknownCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/UnknownCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.handler.UnknownCommandHandler;
import org.apache.james.protocols.api.Response;
@@ -45,6 +47,16 @@ public class UnknownCmdHandler extends AbstractHookableCmdHandler{
*/
private static final Collection COMMANDS = Collections.unmodifiableCollection(Arrays.asList(UnknownCommandHandler.COMMAND_IDENTIFIER));
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* @see org.apache.james.protocols.api.handler.CommandHandler#getImplCommands()
*/
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/VrfyCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/VrfyCmdHandler.java
index b3f584ccb35..831daedf2ad 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/VrfyCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/VrfyCmdHandler.java
@@ -25,6 +25,8 @@
import java.util.Collection;
import java.util.Collections;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -59,4 +61,13 @@ public Collection getImplCommands() {
return COMMANDS;
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java
index c2271a07b12..8deb4e0ef29 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/WelcomeMessageHandler.java
@@ -20,6 +20,8 @@
package org.apache.james.protocols.smtp.core;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.ConnectHandler;
import org.apache.james.protocols.smtp.SMTPResponse;
@@ -58,4 +60,14 @@ public Response onConnect(SMTPSession session) {
protected String getServiceType(SMTPSession session) {
return SERVICE_TYPE;
}
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
index 7c23ab7f178..b6b8dfdc961 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
@@ -32,6 +32,8 @@
import java.util.StringTokenizer;
import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -127,7 +129,17 @@ private Response handleCommand(SMTPSession session, String line) {
private List hooks;
private List rHooks;
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* handles AUTH command
*
@@ -164,6 +176,16 @@ private Response doAUTH(SMTPSession session, String argument) {
protected Response onCommand(SMTPSession session, String l) {
return doPlainAuthPass(session, l);
}
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
});
return AUTH_READY_PLAIN;
} else {
@@ -177,6 +199,16 @@ protected Response onCommand(SMTPSession session, String l) {
protected Response onCommand(SMTPSession session, String l) {
return doLoginAuthPass(session, l);
}
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
});
return AUTH_READY_USERNAME_LOGIN;
} else {
@@ -296,7 +328,16 @@ public LineHandler setUser(String user) {
protected Response onCommand(SMTPSession session, String l) {
return doLoginAuthPassCheck(session, user, l);
}
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}.setUser(user));
return AUTH_READY_PASSWORD_LOGIN;
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java
index 264fcbb74cf..593d70a5b32 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/EhloCmdHandler.java
@@ -24,6 +24,8 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.smtp.SMTPResponse;
@@ -50,6 +52,16 @@ public class EhloCmdHandler extends AbstractHookableCmdHandler impleme
private List ehloExtensions;
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a EHLO command. Responds with a
* greeting and informs the client whether client authentication is
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java
index 3052a95d3d3..4a48b63e080 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java
@@ -24,6 +24,8 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.api.handler.LineHandler;
@@ -49,7 +51,15 @@ public class MailSizeEsmtpExtension implements MailParametersHook, EhloExtension
private static final HookResult SYNTAX_ERROR = new HookResult(HookReturnCode.DENY, SMTPRetCode.SYNTAX_ERROR_ARGUMENTS, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.DELIVERY_INVALID_ARG) + " Syntactically incorrect value for SIZE parameter");
private static final HookResult QUOTA_EXCEEDED = new HookResult(HookReturnCode.DENY, SMTPRetCode.QUOTA_EXCEEDED, DSNStatus.getStatus(DSNStatus.PERMANENT, DSNStatus.SYSTEM_MSG_TOO_BIG) + " Message size exceeds fixed maximum message size");
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+ }
+
+ @Override
+ public void destroy() {
+
+ }
/**
* @see org.apache.james.protocols.smtp.hook.MailParametersHook#doMailParameter(org.apache.james.protocols.smtp.SMTPSession, java.lang.String, java.lang.String)
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java
index 7a13628fe23..fc0272cb15a 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/StartTlsCmdHandler.java
@@ -24,6 +24,8 @@
import java.util.Collections;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.Request;
import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.CommandHandler;
@@ -55,6 +57,16 @@ public Collection getImplCommands() {
return COMMANDS;
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Handler method called upon receipt of a STARTTLS command. Resets
* message-specific, but not authenticated user, state.
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java
index e44e19130a0..e8b4bd35ab5 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandler.java
@@ -24,6 +24,8 @@
import java.util.Collections;
import java.util.StringTokenizer;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPSession;
@@ -50,7 +52,17 @@ public class DNSRBLHandler implements RcptHook {
public static final String RBL_BLOCKLISTED_MAIL_ATTRIBUTE_NAME = "org.apache.james.smtpserver.rbl.blocklisted";
public static final String RBL_DETAIL_MAIL_ATTRIBUTE_NAME = "org.apache.james.smtpserver.rbl.detail";
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Set the whitelist array
*
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandler.java
index 5e10787e41a..30606915c53 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandler.java
@@ -22,6 +22,8 @@
package org.apache.james.protocols.smtp.core.fastfail;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPRetCode;
import org.apache.james.protocols.smtp.SMTPSession;
@@ -59,4 +61,14 @@ public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rc
return HookResult.declined();
}
}
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandler.java
index 7491e8218d3..f182b7d614a 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandler.java
@@ -20,6 +20,8 @@
package org.apache.james.protocols.smtp.core.fastfail;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookResult;
@@ -36,8 +38,18 @@ public class MaxUnknownCmdHandler implements UnknownHook{
public final static int DEFAULT_MAX_UNKOWN = 5;
private final static String UNKOWN_COMMAND_COUNT = "UNKNOWN_COMMAND_COUNT";
- private int maxUnknown = DEFAULT_MAX_UNKOWN;;
-
+ private int maxUnknown = DEFAULT_MAX_UNKOWN;
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public void setMaxUnknownCmdCount(int maxUnknown) {
this.maxUnknown = maxUnknown;
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandler.java
index 990f76345d1..b3a47eb12fb 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandler.java
@@ -23,6 +23,8 @@
import java.net.UnknownHostException;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPRetCode;
@@ -41,6 +43,16 @@ public class ResolvableEhloHeloHandler implements RcptHook, HeloHook {
public final static String BAD_EHLO_HELO = "BAD_EHLO_HELO";
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Check if EHLO/HELO is resolvable
*
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandler.java
index 738e752aac9..597dc5bb863 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandler.java
@@ -25,6 +25,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookResult;
@@ -42,9 +44,18 @@ public class SpamTrapHandler implements RcptHook {
private Collection spamTrapRecips = new ArrayList();
/** Default blocktime 12 hours */
- protected long blockTime = 4320000;
-
-
+ protected long blockTime = 4320000;
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public void setSpamTrapRecipients(Collection spamTrapRecips) {
this.spamTrapRecips = spamTrapRecips;
}
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/SupressDuplicateRcptHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/SupressDuplicateRcptHandler.java
index d4a9f7cb876..fb363f9923f 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/SupressDuplicateRcptHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/fastfail/SupressDuplicateRcptHandler.java
@@ -24,6 +24,8 @@
import java.util.Collection;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPRetCode;
@@ -39,6 +41,16 @@
*/
public class SupressDuplicateRcptHandler implements RcptHook {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* @see org.apache.james.protocols.smtp.hook.RcptHook#doRcpt(org.apache.james.protocols.smtp.SMTPSession, org.apache.mailet.MailAddress, org.apache.mailet.MailAddress)
*/
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/log/HookResultLogger.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/log/HookResultLogger.java
index af4d4c2afe3..431e84e9b6a 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/log/HookResultLogger.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/log/HookResultLogger.java
@@ -18,6 +18,8 @@
****************************************************************/
package org.apache.james.protocols.smtp.core.log;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.Hook;
import org.apache.james.protocols.smtp.hook.HookResult;
@@ -32,6 +34,16 @@
*/
public class HookResultLogger implements HookResultHook{
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult onHookResult(SMTPSession session, HookResult hResult, long executionTime, Hook hook) {
boolean match = false;
boolean info = false;
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/SimpleHook.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/SimpleHook.java
index 01b72196719..ffc3bc6387a 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/SimpleHook.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/hook/SimpleHook.java
@@ -19,6 +19,8 @@
package org.apache.james.protocols.smtp.hook;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.MailEnvelope;
import org.apache.james.protocols.smtp.SMTPSession;
@@ -32,6 +34,16 @@
*/
public class SimpleHook implements HeloHook, MailHook, RcptHook, MessageHook {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
/**
* Return {@link HookResult} with {@link HookReturnCode#OK}
*/
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java
index fd6e5b58aae..1e73b35de8b 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java
@@ -27,6 +27,8 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.net.smtp.SMTPClient;
import org.apache.commons.net.smtp.SMTPReply;
import org.apache.james.protocols.api.Protocol;
@@ -442,6 +444,16 @@ public void testHeloEnforcementDisabled() throws Exception {
public void testHeloHookPermanentError() throws Exception {
HeloHook hook = new HeloHook() {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult doHelo(SMTPSession session, String helo) {
return new HookResult(HookReturnCode.DENY);
}
@@ -481,6 +493,16 @@ public HookResult doHelo(SMTPSession session, String helo) {
public void testHeloHookTempraryError() throws Exception {
HeloHook hook = new HeloHook() {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult doHelo(SMTPSession session, String helo) {
return new HookResult(HookReturnCode.DENYSOFT);
}
@@ -519,6 +541,16 @@ public HookResult doHelo(SMTPSession session, String helo) {
public void testMailHookPermanentError() throws Exception {
MailHook hook = new MailHook() {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult doMail(SMTPSession session, MailAddress sender) {
return new HookResult(HookReturnCode.DENY);
}
@@ -560,6 +592,16 @@ public HookResult doMail(SMTPSession session, MailAddress sender) {
public void testMailHookTemporaryError() throws Exception {
MailHook hook = new MailHook() {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult doMail(SMTPSession session, MailAddress sender) {
return new HookResult(HookReturnCode.DENYSOFT);
}
@@ -602,6 +644,16 @@ public HookResult doMail(SMTPSession session, MailAddress sender) {
public void testRcptHookPermanentError() throws Exception {
RcptHook hook = new RcptHook() {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rcpt) {
if (RCPT1.equals(rcpt.toString())) {
return new HookResult(HookReturnCode.DENY);
@@ -657,6 +709,16 @@ public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rc
public void testRcptHookTemporaryError() throws Exception {
RcptHook hook = new RcptHook() {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult doRcpt(SMTPSession session, MailAddress sender, MailAddress rcpt) {
if (RCPT1.equals(rcpt.toString())) {
return new HookResult(HookReturnCode.DENYSOFT);
@@ -749,6 +811,16 @@ public void testMessageHookPermanentError() throws Exception {
MessageHook hook = new MessageHook() {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult onMessage(SMTPSession session, MailEnvelope mail) {
return new HookResult(HookReturnCode.DENY);
}
@@ -803,7 +875,16 @@ public void testMessageHookTemporaryError() throws Exception {
MessageHook hook = new MessageHook() {
-
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public HookResult onMessage(SMTPSession session, MailEnvelope mail) {
return new HookResult(HookReturnCode.DENYSOFT);
}
@@ -857,7 +938,16 @@ public HookResult onMessage(SMTPSession session, MailEnvelope mail) {
public void testConnectHandlerPermananet() throws Exception {
ConnectHandler connectHandler = new ConnectHandler() {
-
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public Response onConnect(SMTPSession session) {
return new SMTPResponse("554", "Bye Bye");
}
@@ -892,7 +982,16 @@ public Response onConnect(SMTPSession session) {
public void testConnectHandlerTemporary() throws Exception {
ConnectHandler connectHandler = new ConnectHandler() {
-
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
public Response onConnect(SMTPSession session) {
return new SMTPResponse("451", "Bye Bye");
}
@@ -927,8 +1026,17 @@ public void testDisconnectHandler() throws Exception {
final AtomicBoolean called = new AtomicBoolean(false);
DisconnectHandler handler = new DisconnectHandler() {
-
- public void onDisconnect(SMTPSession session) {
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
+ public void onDisconnect(SMTPSession session) {
called.set(true);
}
};
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java
index 22198be963d..bc31dc4c7a9 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java
@@ -24,6 +24,8 @@
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.MailAddressException;
@@ -36,7 +38,17 @@ public class ValidSenderDomainHandlerTest {
private ValidSenderDomainHandler createHandler() {
return new ValidSenderDomainHandler() {
-
+
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+
@Override
protected boolean hasMXRecord(SMTPSession session, String domain) {
if (domain.equals("test.james.apache.org")) {
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/TestMessageHook.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/TestMessageHook.java
index 4ad2375eb40..d9fffa1e6a7 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/TestMessageHook.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/utils/TestMessageHook.java
@@ -21,6 +21,8 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.smtp.MailEnvelope;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookResult;
@@ -40,4 +42,13 @@ public List getQueued() {
return queued;
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/server/container/cassandra-guice/README.adoc b/server/container/cassandra-guice/README.adoc
new file mode 100644
index 00000000000..e3648fff971
--- /dev/null
+++ b/server/container/cassandra-guice/README.adoc
@@ -0,0 +1,45 @@
+= Guice-Cassandra Module How-to
+
+== Building
+
+=== Requirements
+
+ * Java 8 SDK
+ * Docker
+ * Maven
+
+=== Building the artifacts
+
+An usual compilation using maven will produce two artifacts into target directory :
+
+ * james-server-cassandra-guice-${version}.jar
+ * james-server-cassandra-guice-${version}.lib
+
+== Running
+
+=== Requirements
+
+ * Cassandra
+ * ElasticSearch 1.5.2
+
+=== James Launch
+
+To run james, you have to create a directory containing required configuration files.
+
+A sample directory (appropriately named sample-directory) is provided with some
+default value you may need to replace.
+
+You also need to generate a keystore with the following command :
+[source]
+----
+$ keytool -genkey -alias james -keyalg RSA -keystore conf/keystore
+----
+
+You need to have a Cassandra and an ElasticSearch instance running.
+
+Once everything is set up, you just have to run the jar with :
+
+[source]
+----
+$ java -Dworking.directory=sample-configuration -jar target/james-server-cassandra-guice-${version}.jar
+----
diff --git a/server/container/cassandra-guice/pom.xml b/server/container/cassandra-guice/pom.xml
new file mode 100644
index 00000000000..e7ed82eb312
--- /dev/null
+++ b/server/container/cassandra-guice/pom.xml
@@ -0,0 +1,448 @@
+
+
+
+
+ 4.0.0
+
+
+ org.apache.james
+ james-server
+ 3.0.0-beta5-SNAPSHOT
+ ../../pom.xml
+
+
+ james-server-cassandra-guice
+ jar
+
+ Apache James :: Server :: Cassandra - guice injection
+ An advanced email server - Cassandra backend with guice injection
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ true
+
+
+
+
+
+
+ disable-build-for-older-jdk
+
+ (,1.8)
+
+
+
+
+ maven-jar-plugin
+
+
+ default-jar
+ none
+
+
+ jar
+ none
+
+
+ test-jar
+ none
+
+
+
+
+ maven-compiler-plugin
+
+
+ default-compile
+ none
+
+
+ default-testCompile
+ none
+
+
+
+
+ maven-surefire-plugin
+
+
+ default-test
+ none
+
+
+
+
+ maven-source-plugin
+
+
+ attach-sources
+ none
+
+
+
+
+ maven-install-plugin
+
+
+ default-install
+ none
+
+
+
+
+ maven-resources-plugin
+
+
+ default-resources
+ none
+
+
+ default-testResources
+ none
+
+
+
+
+ maven-site-plugin
+
+
+ attach-descriptor
+ none
+
+
+
+
+
+
+
+ build-for-jdk-8
+
+ [1.8,)
+
+
+
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-dependencies
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/${project.build.finalName}.lib
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+ ${project.build.finalName}.lib/
+ org.apache.james.CassandraJamesServerMain
+ false
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+
+
+
+
+
+ org.apache.james
+ apache-james-backends-cassandra
+ test-jar
+
+
+ ${project.groupId}
+ apache-james-mailbox-cassandra
+
+
+ ${project.groupId}
+ apache-james-mailbox-cassandra
+ test
+ test-jar
+
+
+ ${project.groupId}
+ apache-james-mailbox-elasticsearch
+
+
+ ${project.groupId}
+ apache-james-mailbox-elasticsearch
+ test-jar
+ test
+
+
+ ${project.groupId}
+ apache-james-mailbox-tika
+
+
+ ${project.groupId}
+ apache-james-mailbox-tool
+
+
+ ${project.groupId}
+ apache-jsieve-manager-jsieve
+
+
+ ${project.groupId}
+ apache-jsieve-manager-mailet
+
+
+ ${project.groupId}
+ apache-mailet-standard
+
+
+ ${project.groupId}
+ james-server-cli
+
+
+ ${project.groupId}
+ james-server-core
+
+
+ ${project.groupId}
+ james-server-data-api
+
+
+ ${project.groupId}
+ james-server-data-file
+
+
+ ${project.groupId}
+ james-server-data-cassandra
+
+
+
+ ${project.groupId}
+ james-server-data-library
+
+
+ ${project.groupId}
+ james-server-dnsservice-api
+
+
+ ${project.groupId}
+ james-server-dnsservice-dnsjava
+
+
+ ${project.groupId}
+ james-server-dnsservice-library
+
+
+ ${project.groupId}
+ james-server-fetchmail
+
+
+ ${project.groupId}
+ james-server-filesystem-api
+
+
+ ${project.groupId}
+ james-server-lifecycle-api
+
+
+ ${project.groupId}
+ james-server-mailbox-adapter
+
+
+ ${project.groupId}
+ james-server-mailets
+
+
+ ${project.groupId}
+ james-server-mailetcontainer-api
+
+
+ ${project.groupId}
+ james-server-mailetcontainer-camel
+
+
+ ${project.groupId}
+ james-server-protocols-imap4
+
+
+ ${project.groupId}
+ james-server-protocols-library
+
+
+ ${project.groupId}
+ james-server-protocols-lmtp
+
+
+ ${project.groupId}
+ james-server-protocols-pop3
+
+
+ ${project.groupId}
+ james-server-protocols-smtp
+
+
+ ${project.groupId}
+ james-server-queue-api
+
+
+ ${project.groupId}
+ james-server-queue-activemq
+
+
+ ${project.groupId}
+ james-server-queue-file
+
+
+ ${project.groupId}
+ james-server-queue-jms
+
+
+ ${project.groupId}
+ james-server-util
+
+
+ org.apache.james.protocols
+ protocols-imap
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.3.3
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-guava
+ 2.3.3
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jdk8
+ 2.4.3
+
+
+ com.google.guava
+ guava
+
+
+ com.google.inject
+ guice
+
+
+ com.google.inject.extensions
+ guice-multibindings
+
+
+ com.jayway.awaitility
+ awaitility
+
+
+ commons-daemon
+ commons-daemon
+
+
+ javax.inject
+ javax.inject
+
+
+ org.antlr
+ antlr-runtime
+ 3.2
+ test
+
+
+ org.apache.camel
+ camel-core
+
+
+ tools
+ com.sun
+
+
+
+
+ org.apache.onami.lifecycle
+ org.apache.onami.lifecycle.jsr250
+
+
+ org.assertj
+ assertj-core
+ 3.0.0
+ test
+
+
+ org.cassandraunit
+ cassandra-unit
+ 2.0.2.2
+ test
+
+
+ org.elasticsearch
+ elasticsearch
+ 1.5.2
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-simple
+ runtime
+
+
+
+
+ disable-animal-sniffer
+
+ [1.6,)
+
+
+
+
+ org.codehaus.mojo
+ animal-sniffer-maven-plugin
+
+
+ check_java_6
+ none
+
+
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/cassandra.properties b/server/container/cassandra-guice/sample-configuration/cassandra.properties
new file mode 100644
index 00000000000..1358332a51e
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/cassandra.properties
@@ -0,0 +1,6 @@
+# Configuration file for cassandra mailbox
+
+cassandra.ip=172.17.0.2
+cassandra.port=9042
+cassandra.keyspace=apache_james
+cassandra.replication.factor=1
\ No newline at end of file
diff --git a/server/container/cassandra-guice/sample-configuration/dnsservice.xml b/server/container/cassandra-guice/sample-configuration/dnsservice.xml
new file mode 100644
index 00000000000..0978a00b899
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/dnsservice.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ 8.8.8.8
+ 62.210.16.6
+
+ false
+ false
+ 50000
+
diff --git a/server/container/cassandra-guice/sample-configuration/domainlist.xml b/server/container/cassandra-guice/sample-configuration/domainlist.xml
new file mode 100644
index 00000000000..8d001185bbb
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/domainlist.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+ james.apache.org
+
+ true
+ true
+ localhost
+
diff --git a/server/container/cassandra-guice/sample-configuration/elasticsearch.properties b/server/container/cassandra-guice/sample-configuration/elasticsearch.properties
new file mode 100644
index 00000000000..924404c41c7
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/elasticsearch.properties
@@ -0,0 +1,26 @@
+# 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.
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# Configuration file for ElasticSearch
+
+elasticsearch.masterHost=172.17.0.1
+elasticsearch.port=9300
+elasticsearch.nb.shards=1
+elasticsearch.nb.replica=0
\ No newline at end of file
diff --git a/server/container/cassandra-guice/sample-configuration/imapserver.xml b/server/container/cassandra-guice/sample-configuration/imapserver.xml
new file mode 100644
index 00000000000..c03b978fb5a
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/imapserver.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+ imapserver
+ 0.0.0.0:1143
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 0
+ 0
+
+
+ imapserver-ssl
+ 0.0.0.0:1993
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 0
+ 0
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/jcr-repository.xml b/server/container/cassandra-guice/sample-configuration/jcr-repository.xml
new file mode 100644
index 00000000000..c1b998a75f7
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/jcr-repository.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/jmx.properties b/server/container/cassandra-guice/sample-configuration/jmx.properties
new file mode 100644
index 00000000000..a1dbdf8924b
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/jmx.properties
@@ -0,0 +1,28 @@
+# 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.
+#
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# This template file can be used as example for James Server configuration
+# DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# See http://james.apache.org/server/3/config.html for usage
+
+jmx.address=127.0.0.1
+jmx.port=9999
diff --git a/server/container/cassandra-guice/sample-configuration/lmtpserver.xml b/server/container/cassandra-guice/sample-configuration/lmtpserver.xml
new file mode 100644
index 00000000000..87a0caaf793
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/lmtpserver.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ lmtpserver
+
+ 127.0.0.1:1024
+ 200
+ 1200
+
+ 0
+
+ 0
+
+
+ 0
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/mailetcontainer.xml b/server/container/cassandra-guice/sample-configuration/mailetcontainer.xml
new file mode 100644
index 00000000000..968b59c4d0e
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/mailetcontainer.xml
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+ postmaster@james.minet.net
+
+
+
+ 20
+
+
+
+
+
+
+
+
+ sieve-manager-check
+
+
+ transport
+
+
+ true
+
+
+ transport
+
+
+ transport
+
+
+
+
+
+
+ spam
+ 550 Requested action not taken: rejected - see http://njabl.org/
+
+
+ transport
+
+
+
+
+
+
+ file://var/mail/error/
+
+
+
+
+
+
+ X-UserIsAuth
+ true
+
+
+ X-WasSigned
+ true
+
+
+
+
+ local-address-error
+ 550 - Requested action not taken: no such user here
+
+
+ outgoing
+ 5000, 100000, 500000
+ 25
+ 0
+ 10
+ true
+ bounces
+
+
+ relay-denied
+
+
+
+
+
+ file://var/mail/spam/
+
+
+
+
+
+ none
+
+
+ file://var/mail/address-error/
+
+
+
+
+
+ none
+
+
+ file://var/mail/relay-denied/
+ Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation
+
+
+
+
+
+ false
+
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/mailrepositorystore.xml b/server/container/cassandra-guice/sample-configuration/mailrepositorystore.xml
new file mode 100644
index 00000000000..acca810221d
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/mailrepositorystore.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+ file
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/pop3server.xml b/server/container/cassandra-guice/sample-configuration/pop3server.xml
new file mode 100644
index 00000000000..c57c8324d6f
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/pop3server.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ pop3server
+ 0.0.0.0:1110
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 1200
+ 0
+ 0
+
+
+
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/recipientrewritetable.xml b/server/container/cassandra-guice/sample-configuration/recipientrewritetable.xml
new file mode 100644
index 00000000000..7e7f586a3c8
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/recipientrewritetable.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+ true
+ 10
+ some@domain=some
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/smtpserver.xml b/server/container/cassandra-guice/sample-configuration/smtpserver.xml
new file mode 100644
index 00000000000..c34fcd1c37c
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/smtpserver.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ smtpserver-global
+ 0.0.0.0:1025
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+ false
+ 0.0.0.0/0
+ true
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+ smtpserver-TLS
+ 0.0.0.0:1465
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+
+ true
+ 0.0.0.0/0
+
+ false
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+ smtpserver-authenticated
+ 0.0.0.0:1587
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+
+ true
+ 0.0.0.0/0
+
+ false
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/sample-configuration/usersrepository.xml b/server/container/cassandra-guice/sample-configuration/usersrepository.xml
new file mode 100644
index 00000000000..43afa130870
--- /dev/null
+++ b/server/container/cassandra-guice/sample-configuration/usersrepository.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+ MD5
+ true
+
+
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServer.java b/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServer.java
new file mode 100644
index 00000000000..b4ea65d08b8
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServer.java
@@ -0,0 +1,48 @@
+/****************************************************************
+ * 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;
+
+import org.apache.james.utils.ConfigurationsPerformer;
+import org.apache.onami.lifecycle.jsr250.PreDestroyModule;
+
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Module;
+import com.google.inject.util.Modules;
+
+public class CassandraJamesServer {
+
+ private final Module serverModule;
+ private final PreDestroyModule preDestroyModule;
+
+ public CassandraJamesServer(Module serverModule) {
+ this.serverModule = serverModule;
+ this.preDestroyModule = new PreDestroyModule();
+ }
+
+ public void start() throws Exception {
+ Injector injector = Guice.createInjector(Modules.combine(serverModule, preDestroyModule));
+ injector.getInstance(ConfigurationsPerformer.class).initModules();
+ }
+
+ public void stop() {
+ preDestroyModule.getStager().stage();
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
new file mode 100644
index 00000000000..1ddab6e2e7a
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java
@@ -0,0 +1,78 @@
+/****************************************************************
+ * 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;
+
+import org.apache.james.modules.CommonServicesModule;
+import org.apache.james.modules.data.CassandraDomainListModule;
+import org.apache.james.modules.data.CassandraRecipientRewriteTableModule;
+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.protocols.IMAPServerModule;
+import org.apache.james.modules.protocols.LMTPServerModule;
+import org.apache.james.modules.protocols.POP3ServerModule;
+import org.apache.james.modules.protocols.ProtocolHandlerModule;
+import org.apache.james.modules.protocols.SMTPServerModule;
+import org.apache.james.modules.server.ActiveMQQueueModule;
+import org.apache.james.modules.server.CamelMailetContainerModule;
+import org.apache.james.modules.server.ConfigurationPerformerModule;
+import org.apache.james.modules.server.ConfigurationProviderModule;
+import org.apache.james.modules.server.DNSServiceModule;
+import org.apache.james.modules.server.JMXServerModule;
+import org.apache.james.modules.server.MailStoreRepositoryModule;
+import org.apache.james.modules.server.QuotaModule;
+import org.apache.james.modules.server.SieveModule;
+
+import com.google.inject.Module;
+import com.google.inject.util.Modules;
+
+public class CassandraJamesServerMain {
+
+ public static final Module defaultModule = Modules.combine(
+ new CommonServicesModule(),
+ new ConfigurationPerformerModule(),
+ new CassandraMailboxModule(),
+ new CassandraSessionModule(),
+ new ElasticSearchMailboxModule(),
+ new CassandraUsersRepositoryModule(),
+ new CassandraDomainListModule(),
+ new CassandraRecipientRewriteTableModule(),
+ new DNSServiceModule(),
+ new IMAPServerModule(),
+ new ProtocolHandlerModule(),
+ new POP3ServerModule(),
+ new SMTPServerModule(),
+ new LMTPServerModule(),
+ new ActiveMQQueueModule(),
+ new SieveModule(),
+ new MailStoreRepositoryModule(),
+ new CamelMailetContainerModule(),
+ new QuotaModule(),
+ new ConfigurationProviderModule());
+
+ public static void main(String[] args) throws Exception {
+ CassandraJamesServer server = new CassandraJamesServer(Modules.combine(
+ defaultModule,
+ new JMXServerModule()));
+ server.start();
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/CommonServicesModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/CommonServicesModule.java
new file mode 100644
index 00000000000..b380d2e72c7
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/CommonServicesModule.java
@@ -0,0 +1,61 @@
+/****************************************************************
+ * 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;
+
+import java.util.Optional;
+
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import org.apache.commons.cli.MissingArgumentException;
+import org.apache.james.core.JamesServerResourceLoader;
+import org.apache.james.core.filesystem.FileSystemImpl;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.filesystem.api.JamesDirectoriesProvider;
+import org.apache.james.utils.ConfigurationProvider;
+import org.apache.james.utils.FileConfigurationProvider;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+
+public class CommonServicesModule extends AbstractModule {
+
+ public static final String CONFIGURATION_PATH = "configurationPath";
+
+ @Override
+ protected void configure() {
+ bind(FileSystem.class).to(FileSystemImpl.class);
+ bind(ConfigurationProvider.class).to(FileConfigurationProvider.class);
+ }
+
+ @Provides @Singleton @Named(CONFIGURATION_PATH)
+ public String configurationPath() {
+ return FileSystem.FILE_PROTOCOL_AND_CONF;
+ }
+
+ @Provides @Singleton
+ public JamesDirectoriesProvider directories() throws MissingArgumentException {
+ String rootDirectory = Optional
+ .ofNullable(System.getProperty("working.directory"))
+ .orElseThrow(() -> new MissingArgumentException("Server needs a working.directory env entry"));
+ return new JamesServerResourceLoader(rootDirectory);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraDomainListModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraDomainListModule.java
new file mode 100644
index 00000000000..890356d72f1
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraDomainListModule.java
@@ -0,0 +1,37 @@
+/****************************************************************
+ * 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.data;
+
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.domainlist.cassandra.CassandraDomainList;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+
+public class CassandraDomainListModule extends AbstractModule {
+
+ @Override
+ public void configure() {
+ bind(DomainList.class).to(CassandraDomainList.class);
+ Multibinder cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class);
+ cassandraDataDefinitions.addBinding().to(org.apache.james.domainlist.cassandra.CassandraDomainListModule.class);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraRecipientRewriteTableModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraRecipientRewriteTableModule.java
new file mode 100644
index 00000000000..c28ca2055ab
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraRecipientRewriteTableModule.java
@@ -0,0 +1,38 @@
+/****************************************************************
+ * 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.data;
+
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.rrt.api.RecipientRewriteTable;
+import org.apache.james.rrt.cassandra.CassandraRRTModule;
+import org.apache.james.rrt.cassandra.CassandraRecipientRewriteTable;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+
+public class CassandraRecipientRewriteTableModule extends AbstractModule {
+
+ @Override
+ public void configure() {
+ bind(RecipientRewriteTable.class).to(CassandraRecipientRewriteTable.class);
+ Multibinder cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class);
+ cassandraDataDefinitions.addBinding().to(CassandraRRTModule.class);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraUsersRepositoryModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraUsersRepositoryModule.java
new file mode 100644
index 00000000000..a776626dda6
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraUsersRepositoryModule.java
@@ -0,0 +1,38 @@
+/****************************************************************
+ * 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.data;
+
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.user.cassandra.CassandraUsersRepository;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+
+public class CassandraUsersRepositoryModule extends AbstractModule {
+
+ @Override
+ public void configure() {
+ bind(UsersRepository.class).to(CassandraUsersRepository.class);
+ Multibinder cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class);
+ cassandraDataDefinitions.addBinding().to(org.apache.james.user.cassandra.CassandraUsersRepositoryModule.class);
+
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
new file mode 100644
index 00000000000..0c7073c12dd
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraMailboxModule.java
@@ -0,0 +1,76 @@
+/****************************************************************
+ * 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 javax.inject.Singleton;
+
+import org.apache.james.adapter.mailbox.store.UserRepositoryAuthenticator;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.MailboxPathLocker;
+import org.apache.james.mailbox.SubscriptionManager;
+import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.cassandra.CassandraMailboxManager;
+import org.apache.james.mailbox.cassandra.CassandraMailboxSessionMapperFactory;
+import org.apache.james.mailbox.cassandra.CassandraSubscriptionManager;
+import org.apache.james.mailbox.cassandra.mail.CassandraModSeqProvider;
+import org.apache.james.mailbox.cassandra.mail.CassandraUidProvider;
+import org.apache.james.mailbox.elasticsearch.events.ElasticSearchListeningMessageSearchIndex;
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.store.Authenticator;
+import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
+import org.apache.james.mailbox.store.NoMailboxPathLocker;
+import org.apache.james.mailbox.store.mail.MessageMapperFactory;
+import org.apache.james.mailbox.store.mail.ModSeqProvider;
+import org.apache.james.mailbox.store.mail.UidProvider;
+import org.apache.james.mailbox.store.search.MessageSearchIndex;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Named;
+
+public class CassandraMailboxModule extends AbstractModule {
+
+ public static final String MAILBOXMANAGER_NAME = "mailboxmanager";
+
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral>(){}).to(new TypeLiteral>(){});
+
+ bind(SubscriptionManager.class).to(CassandraSubscriptionManager.class);
+ bind(new TypeLiteral>(){}).to(CassandraMailboxSessionMapperFactory.class);
+ bind(MailboxSessionMapperFactory.class).to(CassandraMailboxSessionMapperFactory.class);
+
+ bind(MailboxPathLocker.class).to(NoMailboxPathLocker.class);
+ bind(Authenticator.class).to(UserRepositoryAuthenticator.class);
+
+ bind(new TypeLiteral>(){}).to(new TypeLiteral(){});
+ bind(new TypeLiteral>(){}).to(new TypeLiteral(){});
+ Multibinder cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class);
+ cassandraDataDefinitions.addBinding().to(org.apache.james.mailbox.cassandra.CassandraMailboxModule.class);
+ }
+
+ @Provides @Named(MAILBOXMANAGER_NAME) @Singleton
+ public MailboxManager provideMailboxManager(CassandraMailboxManager cassandraMailboxManager) throws MailboxException {
+ cassandraMailboxManager.init();
+ return cassandraMailboxManager;
+ }
+}
\ No newline at end of file
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
new file mode 100644
index 00000000000..c3588ba3e6f
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraSessionModule.java
@@ -0,0 +1,77 @@
+/****************************************************************
+ * 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.io.FileNotFoundException;
+import java.util.Set;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.backends.cassandra.init.CassandraModuleComposite;
+import org.apache.james.backends.cassandra.init.ClusterFactory;
+import org.apache.james.backends.cassandra.init.ClusterWithKeyspaceCreatedFactory;
+import org.apache.james.backends.cassandra.init.SessionWithInitializedTablesFactory;
+import org.apache.james.filesystem.api.FileSystem;
+
+import com.datastax.driver.core.Cluster;
+import com.datastax.driver.core.Session;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+
+public class CassandraSessionModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ }
+
+ @Provides
+ @Singleton
+ CassandraModule composeDataDefinitions(Set modules) {
+ return new CassandraModuleComposite(modules.toArray(new CassandraModule[0]));
+ }
+
+ @Provides
+ @Singleton
+ Session provideSession(FileSystem fileSystem, Cluster cluster, CassandraModule cassandraModule)
+ throws FileNotFoundException, ConfigurationException{
+ PropertiesConfiguration configuration = getConfiguration(fileSystem);
+ String keyspace = configuration.getString("cassandra.keyspace");
+ return new SessionWithInitializedTablesFactory(cassandraModule).createSession(cluster, keyspace);
+ }
+
+ @Provides
+ @Singleton
+ Cluster provideCluster(FileSystem fileSystem) throws FileNotFoundException, ConfigurationException {
+ PropertiesConfiguration configuration = getConfiguration(fileSystem);
+
+ return ClusterWithKeyspaceCreatedFactory.clusterWithInitializedKeyspace(
+ ClusterFactory.createClusterForSingleServerWithoutPassWord(
+ configuration.getString("cassandra.ip"),
+ configuration.getInt("cassandra.port")),
+ configuration.getString("cassandra.keyspace"),
+ configuration.getInt("cassandra.replication.factor"));
+ }
+
+ private PropertiesConfiguration getConfiguration(FileSystem fileSystem) throws FileNotFoundException, ConfigurationException {
+ return new PropertiesConfiguration(fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + "cassandra.properties"));
+ }
+
+}
\ No newline at end of file
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java
new file mode 100644
index 00000000000..4ba750ff5b2
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.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.modules.mailbox;
+
+import java.io.FileNotFoundException;
+
+import javax.inject.Singleton;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.elasticsearch.ClientProvider;
+import org.apache.james.mailbox.elasticsearch.ClientProviderImpl;
+import org.apache.james.mailbox.elasticsearch.IndexCreationFactory;
+import org.apache.james.mailbox.elasticsearch.NodeMappingFactory;
+import org.apache.james.mailbox.elasticsearch.events.ElasticSearchListeningMessageSearchIndex;
+import org.apache.james.mailbox.store.extractor.TextExtractor;
+import org.apache.james.mailbox.store.search.MessageSearchIndex;
+import org.apache.james.mailbox.tika.extractor.TikaTextExtractor;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+
+public class ElasticSearchMailboxModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral>(){}).to(new TypeLiteral>() {});
+ bind(TextExtractor.class).to(TikaTextExtractor.class);
+ bind(new TypeLiteral>() {})
+ .to(new TypeLiteral>() {});
+ }
+
+ @Provides
+ @Singleton
+ protected ClientProvider provideClientProvider(FileSystem fileSystem) throws ConfigurationException, FileNotFoundException {
+ PropertiesConfiguration propertiesReader = new PropertiesConfiguration(fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + "elasticsearch.properties"));
+ ClientProvider clientProvider = new ClientProviderImpl(propertiesReader.getString("elasticsearch.masterHost"),
+ propertiesReader.getInt("elasticsearch.port"));
+ IndexCreationFactory.createIndex(clientProvider,
+ propertiesReader.getInt("elasticsearch.nb.shards"),
+ propertiesReader.getInt("elasticsearch.nb.replica"));
+ NodeMappingFactory.applyMapping(clientProvider);
+ return clientProvider;
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
new file mode 100644
index 00000000000..1b9b8ac990a
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
@@ -0,0 +1,103 @@
+/****************************************************************
+ * 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.protocols;
+
+import org.apache.james.imap.api.process.ImapProcessor;
+import org.apache.james.imap.decode.ImapDecoder;
+import org.apache.james.imap.encode.ImapEncoder;
+import org.apache.james.imap.encode.main.DefaultImapEncoderFactory;
+import org.apache.james.imap.main.DefaultImapDecoderFactory;
+import org.apache.james.imap.processor.main.DefaultImapProcessorFactory;
+import org.apache.james.imapserver.netty.IMAPServerFactory;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.SubscriptionManager;
+import org.apache.james.mailbox.quota.QuotaManager;
+import org.apache.james.mailbox.quota.QuotaRootResolver;
+import org.apache.james.modules.mailbox.CassandraMailboxModule;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Named;
+
+public class IMAPServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(IMAPServerModule.class);
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(IMAPModuleConfigurationPerformer.class);
+ }
+
+ @Provides
+ @Singleton
+ ImapProcessor provideImapProcessor(
+ @Named(CassandraMailboxModule.MAILBOXMANAGER_NAME)MailboxManager mailboxManager,
+ SubscriptionManager subscriptionManager,
+ QuotaManager quotaManager,
+ QuotaRootResolver quotaRootResolver) {
+ return DefaultImapProcessorFactory.createXListSupportingProcessor(
+ mailboxManager,
+ subscriptionManager,
+ null,
+ quotaManager,
+ quotaRootResolver,
+ 120,
+ ImmutableSet.of("ACL", "MOVE"));
+ }
+
+ @Provides
+ @Singleton
+ ImapDecoder provideImapDecoder() {
+ return DefaultImapDecoderFactory.createDecoder();
+ }
+
+ @Provides
+ @Singleton
+ ImapEncoder provideImapEncoder() {
+ return new DefaultImapEncoderFactory().buildImapEncoder();
+ }
+
+ @Singleton
+ public static class IMAPModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final IMAPServerFactory imapServerFactory;
+
+ @Inject
+ public IMAPModuleConfigurationPerformer(ConfigurationProvider configurationProvider, IMAPServerFactory imapServerFactory) {
+ this.configurationProvider = configurationProvider;
+ this.imapServerFactory = imapServerFactory;
+ }
+
+ @Override
+ public void initModule() throws Exception {
+ imapServerFactory.setLog(LOGGER);
+ imapServerFactory.configure(configurationProvider.getConfiguration("imapserver"));
+ imapServerFactory.init();
+ }
+ }
+}
\ No newline at end of file
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
new file mode 100644
index 00000000000..a7b7c835a6f
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/LMTPServerModule.java
@@ -0,0 +1,62 @@
+/****************************************************************
+ * 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.protocols;
+
+import org.apache.james.lmtpserver.netty.LMTPServerFactory;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class LMTPServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(LMTPServerModule.class);
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(LMTPModuleConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class LMTPModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final LMTPServerFactory lmtpServerFactory;
+
+ @Inject
+ public LMTPModuleConfigurationPerformer(ConfigurationProvider configurationProvider, LMTPServerFactory lmtpServerFactory) {
+ this.configurationProvider = configurationProvider;
+ this.lmtpServerFactory = lmtpServerFactory;
+ }
+
+ @Override
+ public void initModule() throws Exception {
+ lmtpServerFactory.setLog(LOGGER);
+ lmtpServerFactory.configure(configurationProvider.getConfiguration("lmtpserver"));
+ lmtpServerFactory.init();
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
new file mode 100644
index 00000000000..2bbe6a82e79
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/POP3ServerModule.java
@@ -0,0 +1,62 @@
+/****************************************************************
+ * 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.protocols;
+
+import org.apache.james.pop3server.netty.POP3ServerFactory;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class POP3ServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(POP3ServerModule.class);
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(POP3ModuleConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class POP3ModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final POP3ServerFactory pop3ServerFactory;
+
+ @Inject
+ public POP3ModuleConfigurationPerformer(ConfigurationProvider configurationProvider, POP3ServerFactory pop3ServerFactory) {
+ this.configurationProvider = configurationProvider;
+ this.pop3ServerFactory = pop3ServerFactory;
+ }
+
+ @Override
+ public void initModule() throws Exception {
+ pop3ServerFactory.setLog(LOGGER);
+ pop3ServerFactory.configure(configurationProvider.getConfiguration("pop3server"));
+ pop3ServerFactory.init();
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/ProtocolHandlerModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/ProtocolHandlerModule.java
new file mode 100644
index 00000000000..10d20d258b0
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/ProtocolHandlerModule.java
@@ -0,0 +1,34 @@
+/****************************************************************
+ * 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.protocols;
+
+import org.apache.james.protocols.lib.handler.ProtocolHandlerLoader;
+import org.apache.james.utils.GuiceProtocolHandlerLoader;
+
+import com.google.inject.AbstractModule;
+
+public class ProtocolHandlerModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(ProtocolHandlerLoader.class).to(GuiceProtocolHandlerLoader.class);
+ }
+
+}
\ No newline at end of file
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
new file mode 100644
index 00000000000..62758225165
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/protocols/SMTPServerModule.java
@@ -0,0 +1,68 @@
+/****************************************************************
+ * 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.protocols;
+
+import org.apache.james.smtpserver.SendMailHandler;
+import org.apache.james.smtpserver.netty.SMTPServerFactory;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class SMTPServerModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(SMTPServerModule.class);
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(SMTPModuleConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class SMTPModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final SMTPServerFactory smtpServerFactory;
+ private final SendMailHandler sendMailHandler;
+
+ @Inject
+ public SMTPModuleConfigurationPerformer(ConfigurationProvider configurationProvider,
+ SMTPServerFactory smtpServerFactory,
+ SendMailHandler sendMailHandler) {
+ this.configurationProvider = configurationProvider;
+ this.smtpServerFactory = smtpServerFactory;
+ this.sendMailHandler = sendMailHandler;
+ }
+
+ @Override
+ public void initModule() throws Exception {
+ smtpServerFactory.setLog(LOGGER);
+ smtpServerFactory.configure(configurationProvider.getConfiguration("smtpserver"));
+ smtpServerFactory.init();
+ sendMailHandler.init(null);
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ActiveMQQueueModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ActiveMQQueueModule.java
new file mode 100644
index 00000000000..95d114fdf22
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ActiveMQQueueModule.java
@@ -0,0 +1,57 @@
+/****************************************************************
+ * 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.server;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import org.apache.james.queue.activemq.ActiveMQMailQueueFactory;
+import org.apache.james.queue.api.MailQueueFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.ConnectionFactory;
+
+public class ActiveMQQueueModule extends AbstractModule {
+
+ private static Logger LOGGER = LoggerFactory.getLogger(ActiveMQQueueModule.class);
+
+ @Override
+ protected void configure() {
+
+ }
+
+ @Provides
+ @Singleton
+ ConnectionFactory provideEmbededActiveMQ(EmbeddedActiveMQ embeddedActiveMQ) {
+ return embeddedActiveMQ.getConnectionFactory();
+ }
+
+ @Provides
+ @Singleton
+ public MailQueueFactory createActiveMailQueueFactory(ConnectionFactory connectionFactory, ActiveMQMailQueueFactory activeMQMailQueueFactory) {
+ activeMQMailQueueFactory.setUseJMX(true);
+ activeMQMailQueueFactory.setConnectionFactory(connectionFactory);
+ activeMQMailQueueFactory.setLog(LOGGER);
+ activeMQMailQueueFactory.init();
+ return activeMQMailQueueFactory;
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
new file mode 100644
index 00000000000..5bd769d8f90
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
@@ -0,0 +1,108 @@
+/****************************************************************
+ * 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.server;
+
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.james.dnsservice.api.DNSService;
+import org.apache.james.domainlist.api.DomainList;
+import org.apache.james.mailetcontainer.api.MailProcessor;
+import org.apache.james.mailetcontainer.api.MailetLoader;
+import org.apache.james.mailetcontainer.api.MatcherLoader;
+import org.apache.james.mailetcontainer.api.jmx.MailSpoolerMBean;
+import org.apache.james.mailetcontainer.impl.JamesMailSpooler;
+import org.apache.james.mailetcontainer.impl.JamesMailetContext;
+import org.apache.james.mailetcontainer.impl.camel.CamelCompositeProcessor;
+import org.apache.james.user.api.UsersRepository;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.apache.james.utils.GuiceMailetLoader;
+import org.apache.james.utils.GuiceMatcherLoader;
+import org.apache.mailet.MailetContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class CamelMailetContainerModule extends AbstractModule {
+
+ private final static Logger LOGGER = LoggerFactory.getLogger(CamelMailetContainerModule.class);
+
+ @Override
+ protected void configure() {
+ bind(MailProcessor.class).to(CamelCompositeProcessor.class);
+ bind(MailSpoolerMBean.class).to(JamesMailSpooler.class);
+ bind(MailetLoader.class).to(GuiceMailetLoader.class);
+ bind(MatcherLoader.class).to(GuiceMatcherLoader.class);
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(IMAPModuleConfigurationPerformer.class);
+ }
+
+ @Provides
+ @Singleton
+ private MailetContext provideMailetContext(MailProcessor processorList,
+ DNSService dns,
+ UsersRepository localusers,
+ DomainList domains) {
+ JamesMailetContext jamesMailetContext = new JamesMailetContext();
+ jamesMailetContext.setLog(LOGGER);
+ jamesMailetContext.setDNSService(dns);
+ jamesMailetContext.setMailProcessor(processorList);
+ jamesMailetContext.setUsersRepository(localusers);
+ jamesMailetContext.setDomainList(domains);
+ return jamesMailetContext;
+ }
+
+ @Singleton
+ public static class IMAPModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final CamelCompositeProcessor camelCompositeProcessor;
+ private final JamesMailSpooler jamesMailSpooler;
+ private final JamesMailetContext mailetContext;
+
+ @Inject
+ public IMAPModuleConfigurationPerformer(ConfigurationProvider configurationProvider,
+ CamelCompositeProcessor camelCompositeProcessor,
+ JamesMailSpooler jamesMailSpooler,
+ JamesMailetContext mailetContext) {
+ this.configurationProvider = configurationProvider;
+ this.camelCompositeProcessor = camelCompositeProcessor;
+ this.jamesMailSpooler = jamesMailSpooler;
+ this.mailetContext = mailetContext;
+ }
+
+ @Override
+ public void initModule() throws Exception {
+ camelCompositeProcessor.setLog(LOGGER);
+ camelCompositeProcessor.setCamelContext(new DefaultCamelContext());
+ camelCompositeProcessor.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("processors"));
+ camelCompositeProcessor.init();
+ jamesMailSpooler.setLog(LOGGER);
+ jamesMailSpooler.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("spooler"));
+ jamesMailSpooler.init();
+ mailetContext.setLog(LOGGER);
+ mailetContext.configure(configurationProvider.getConfiguration("mailetcontainer").configurationAt("context"));
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ConfigurationPerformerModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ConfigurationPerformerModule.java
new file mode 100644
index 00000000000..4aab0a60948
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ConfigurationPerformerModule.java
@@ -0,0 +1,15 @@
+package org.apache.james.modules.server;
+
+import org.apache.james.utils.ConfigurationPerformer;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+
+public class ConfigurationPerformerModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ConfigurationProviderModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ConfigurationProviderModule.java
new file mode 100644
index 00000000000..f9d3cff0af2
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/ConfigurationProviderModule.java
@@ -0,0 +1,33 @@
+/****************************************************************
+ * 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.server;
+
+import org.apache.james.utils.ConfigurationProvider;
+import org.apache.james.utils.FileConfigurationProvider;
+
+import com.google.inject.AbstractModule;
+
+public class ConfigurationProviderModule extends AbstractModule {
+
+ @Override
+ public void configure() {
+ bind(ConfigurationProvider.class).to(FileConfigurationProvider.class);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/DNSServiceModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/DNSServiceModule.java
new file mode 100644
index 00000000000..5d3b49f137f
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/DNSServiceModule.java
@@ -0,0 +1,62 @@
+/****************************************************************
+ * 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.server;
+
+import org.apache.james.dnsservice.api.DNSService;
+import org.apache.james.dnsservice.dnsjava.DNSJavaService;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+public class DNSServiceModule extends AbstractModule {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(DNSServiceModule.class);
+
+ @Override
+ protected void configure() {
+ bind(DNSService.class).to(DNSJavaService.class);
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(DNSServiceConfigurationPerformer.class);
+ }
+
+ @Singleton
+ public static class DNSServiceConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final DNSJavaService dnsService;
+
+ @Inject
+ public DNSServiceConfigurationPerformer(ConfigurationProvider configurationProvider,
+ DNSJavaService dnsService) {
+ this.configurationProvider = configurationProvider;
+ this.dnsService = dnsService;
+ }
+
+ public void initModule() throws Exception {
+ dnsService.setLog(LOGGER);
+ dnsService.configure(configurationProvider.getConfiguration("dnsservice"));
+ dnsService.init();
+ }
+ }
+}
\ No newline at end of file
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/EmbeddedActiveMQ.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/EmbeddedActiveMQ.java
new file mode 100644
index 00000000000..3d510693ef1
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/EmbeddedActiveMQ.java
@@ -0,0 +1,104 @@
+/****************************************************************
+ * 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.server;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.ActiveMQPrefetchPolicy;
+import org.apache.activemq.blob.BlobTransferPolicy;
+import org.apache.activemq.broker.BrokerPlugin;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.jmx.ManagementContext;
+import org.apache.activemq.plugin.StatisticsBrokerPlugin;
+import org.apache.activemq.store.amq.AMQPersistenceAdapter;
+import org.apache.james.queue.activemq.FileSystemBlobTransferPolicy;
+
+import javax.annotation.PreDestroy;
+import javax.jms.ConnectionFactory;
+
+@Singleton
+public class EmbeddedActiveMQ {
+
+ private ActiveMQConnectionFactory activeMQConnectionFactory;
+ private BrokerService brokerService;
+
+ @Inject private EmbeddedActiveMQ() {
+ try {
+ launchEmbeddedBroker();
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ activeMQConnectionFactory = createActiveMQConnectionFactory(createBlobTransferPolicy());
+ }
+
+ public ConnectionFactory getConnectionFactory() {
+ return activeMQConnectionFactory;
+ }
+
+ @PreDestroy
+ public void stop() throws Exception {
+ brokerService.stop();
+ }
+
+ private ActiveMQConnectionFactory createActiveMQConnectionFactory(BlobTransferPolicy blobTransferPolicy) {
+ ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("vm://james?create=false");
+ connectionFactory.setBlobTransferPolicy(blobTransferPolicy);
+ connectionFactory.setPrefetchPolicy(createActiveMQPrefetchPolicy());
+ return connectionFactory;
+ }
+
+ private ActiveMQPrefetchPolicy createActiveMQPrefetchPolicy() {
+ ActiveMQPrefetchPolicy prefetchPolicy = new ActiveMQPrefetchPolicy();
+ prefetchPolicy.setQueuePrefetch(0);
+ prefetchPolicy.setTopicPrefetch(0);
+ return prefetchPolicy;
+ }
+
+ private BlobTransferPolicy createBlobTransferPolicy() {
+ BlobTransferPolicy blobTransferPolicy = new FileSystemBlobTransferPolicy();
+ blobTransferPolicy.setDefaultUploadUrl("file://var/store/activemq/blob-transfer");
+ return blobTransferPolicy;
+ }
+
+ private void launchEmbeddedBroker() throws Exception {
+ brokerService = new BrokerService();
+ brokerService.setBrokerName("james");
+ brokerService.setUseJmx(false);
+ brokerService.setPersistent(true);
+ brokerService.setDataDirectory("filesystem=file://var/store/activemq/brokers");
+ brokerService.setUseShutdownHook(false);
+ brokerService.setSchedulerSupport(false);
+ brokerService.setBrokerId("broker");
+ String[] uris = {"tcp://localhost:0"};
+ brokerService.setTransportConnectorURIs(uris);
+ ManagementContext managementContext = new ManagementContext();
+ managementContext.setCreateConnector(false);
+ brokerService.setManagementContext(managementContext);
+ brokerService.setPersistenceAdapter(new AMQPersistenceAdapter());
+ BrokerPlugin[] brokerPlugins = {new StatisticsBrokerPlugin()};
+ brokerService.setPlugins(brokerPlugins);
+ String[] transportConnectorsURIs = {"tcp://localhost:0"};
+ brokerService.setTransportConnectorURIs(transportConnectorsURIs);
+ brokerService.start();
+ System.out.println("Started : " + brokerService.isStarted());
+ }
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/JMXServer.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/JMXServer.java
new file mode 100644
index 00000000000..4b4e63d4a70
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/JMXServer.java
@@ -0,0 +1,125 @@
+/****************************************************************
+ * 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.server;
+
+import java.io.IOException;
+import java.lang.management.ManagementFactory;
+import java.rmi.registry.LocateRegistry;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.util.RestrictingRMISocketFactory;
+
+import com.google.common.base.Throwables;
+import com.google.common.collect.ImmutableMap;
+
+public class JMXServer {
+
+ private final FileSystem fileSystem;
+ private final Set registeredKeys;
+ private final Object lock;
+ private JMXConnectorServer jmxConnectorServer;
+ private boolean isStarted;
+
+ @Inject
+ public JMXServer(FileSystem fileSystem) {
+ this.fileSystem = fileSystem;
+ isStarted = false;
+ registeredKeys = new HashSet<>();
+ lock = new Object();
+ }
+
+ public void start() {
+ synchronized (lock) {
+ if (isStarted) {
+ return;
+ }
+ isStarted = true;
+ doStart();
+ }
+ }
+
+ @PreDestroy
+ public void stop() {
+ synchronized (lock) {
+ if (!isStarted) {
+ return;
+ }
+ isStarted = false;
+ doStop();
+ }
+ }
+
+ public void register(String key, Object remote) throws Exception {
+ ManagementFactory.getPlatformMBeanServer().registerMBean(remote, new ObjectName(key));
+ synchronized (lock) {
+ registeredKeys.add(key);
+ }
+ }
+
+ private void doStart() {
+ try {
+ PropertiesConfiguration configuration = new PropertiesConfiguration(fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + "jmx.properties"));
+ String address = configuration.getString("jmx.address");
+ int port = configuration.getInt("jmx.port");
+ String serviceURL = "service:jmx:rmi://" + address + "/jndi/rmi://" + address+ ":" + port +"/jmxrmi";
+ RestrictingRMISocketFactory restrictingRMISocketFactory = new RestrictingRMISocketFactory(address);
+ LocateRegistry.createRegistry(port, restrictingRMISocketFactory, restrictingRMISocketFactory);
+
+ Map environment = ImmutableMap.of();
+ jmxConnectorServer = JMXConnectorServerFactory.newJMXConnectorServer(new JMXServiceURL(serviceURL),
+ environment,
+ ManagementFactory.getPlatformMBeanServer());
+
+ jmxConnectorServer.start();
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ private void doStop() {
+ try {
+ MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
+ registeredKeys.forEach(key -> {
+ try {
+ mBeanServer.unregisterMBean(new ObjectName(key));
+ } catch (Exception e) {
+ throw Throwables.propagate(e);
+ }
+ });
+ registeredKeys.clear();
+ jmxConnectorServer.stop();
+ } catch (IOException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/JMXServerModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/JMXServerModule.java
new file mode 100644
index 00000000000..019b546e9df
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/JMXServerModule.java
@@ -0,0 +1,114 @@
+/****************************************************************
+ * 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.server;
+
+import org.apache.james.adapter.mailbox.MailboxCopierManagement;
+import org.apache.james.adapter.mailbox.MailboxCopierManagementMBean;
+import org.apache.james.adapter.mailbox.MailboxManagerManagement;
+import org.apache.james.adapter.mailbox.MailboxManagerManagementMBean;
+import org.apache.james.adapter.mailbox.MailboxManagerResolver;
+import org.apache.james.domainlist.api.DomainListManagementMBean;
+import org.apache.james.domainlist.lib.DomainListManagement;
+import org.apache.james.mailbox.cassandra.CassandraMailboxManager;
+import org.apache.james.mailbox.copier.MailboxCopier;
+import org.apache.james.mailbox.copier.MailboxCopierImpl;
+import org.apache.james.mailetcontainer.api.jmx.MailSpoolerMBean;
+import org.apache.james.mailetcontainer.impl.JamesMailSpooler;
+import org.apache.james.rrt.api.RecipientRewriteTableManagementMBean;
+import org.apache.james.rrt.lib.RecipientRewriteTableManagement;
+import org.apache.james.user.api.UsersRepositoryManagementMBean;
+import org.apache.james.user.lib.UsersRepositoryManagement;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.GuiceMailboxManagerResolver;
+import org.apache.james.utils.MailboxManagerDefinition;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Names;
+
+public class JMXServerModule extends AbstractModule {
+
+ private static final String JMX_COMPONENT_DOMAINLIST = "org.apache.james:type=component,name=domainlist";
+ private static final String JMX_COMPONENT_USERS_REPOSITORY = "org.apache.james:type=component,name=usersrepository";
+ private static final String JMX_COMPONENT_RECIPIENTREWRITETABLE = "org.apache.james:type=component,name=recipientrewritetable";
+ private static final String JMX_COMPONENT_NAME_MAILBOXMANAGERBEAN = "org.apache.james:type=component,name=mailboxmanagerbean";
+ private static final String JMX_COMPONENT_MAILBOXCOPIER = "org.apache.james:type=component,name=mailboxcopier";
+
+ @Override
+ protected void configure() {
+ bind(MailboxCopier.class).annotatedWith(Names.named("mailboxcopier")).to(MailboxCopierImpl.class);
+ bind(MailboxCopierManagementMBean.class).to(MailboxCopierManagement.class);
+ bind(MailboxManagerResolver.class).to(GuiceMailboxManagerResolver.class);
+ bind(DomainListManagementMBean.class).to(DomainListManagement.class);
+ bind(UsersRepositoryManagementMBean.class).to(UsersRepositoryManagement.class);
+ bind(MailboxManagerManagementMBean.class).to(MailboxManagerManagement.class);
+ bind(RecipientRewriteTableManagementMBean.class).to(RecipientRewriteTableManagement.class);
+ bind(MailSpoolerMBean.class).to(JamesMailSpooler.class);
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JMXModuleConfigurationPerformer.class);
+ Multibinder.newSetBinder(binder(), MailboxManagerDefinition.class).addBinding().to(CassandraMailboxManagerDefinition.class);
+ }
+
+ @Singleton
+ private static class CassandraMailboxManagerDefinition extends MailboxManagerDefinition {
+ @Inject
+ private CassandraMailboxManagerDefinition(CassandraMailboxManager manager) {
+ super("cassandra-mailboxmanager", manager);
+ }
+ }
+
+ @Singleton
+ public static class JMXModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final JMXServer jmxServer;
+ private final DomainListManagementMBean domainListManagementMBean;
+ private final UsersRepositoryManagementMBean usersRepositoryManagementMBean;
+ private final RecipientRewriteTableManagementMBean recipientRewriteTableManagementMBean;
+ private final MailboxManagerManagementMBean mailboxManagerManagementMBean;
+ private final MailboxCopierManagementMBean mailboxCopierManagementMBean;
+
+ @Inject
+ public JMXModuleConfigurationPerformer(JMXServer jmxServer,
+ DomainListManagementMBean domainListManagementMBean,
+ UsersRepositoryManagementMBean usersRepositoryManagementMBean,
+ RecipientRewriteTableManagementMBean recipientRewriteTableManagementMBean,
+ MailboxManagerManagementMBean mailboxManagerManagementMBean,
+ MailboxCopierManagementMBean mailboxCopierManagementMBean) {
+ this.jmxServer = jmxServer;
+ this.domainListManagementMBean = domainListManagementMBean;
+ this.usersRepositoryManagementMBean = usersRepositoryManagementMBean;
+ this.recipientRewriteTableManagementMBean = recipientRewriteTableManagementMBean;
+ this.mailboxManagerManagementMBean = mailboxManagerManagementMBean;
+ this.mailboxCopierManagementMBean = mailboxCopierManagementMBean;
+ }
+
+ @Override
+ public void initModule() throws Exception {
+ jmxServer.start();
+ jmxServer.register(JMX_COMPONENT_DOMAINLIST, domainListManagementMBean);
+ jmxServer.register(JMX_COMPONENT_USERS_REPOSITORY, usersRepositoryManagementMBean);
+ jmxServer.register(JMX_COMPONENT_RECIPIENTREWRITETABLE, recipientRewriteTableManagementMBean);
+ jmxServer.register(JMX_COMPONENT_NAME_MAILBOXMANAGERBEAN, mailboxManagerManagementMBean);
+ jmxServer.register(JMX_COMPONENT_MAILBOXCOPIER, mailboxCopierManagementMBean);
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/MailStoreRepositoryModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/MailStoreRepositoryModule.java
new file mode 100644
index 00000000000..39d6b543185
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/MailStoreRepositoryModule.java
@@ -0,0 +1,88 @@
+/****************************************************************
+ * 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.server;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+import com.google.inject.multibindings.Multibinder;
+
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.mailrepository.api.MailRepository;
+import org.apache.james.mailrepository.api.MailRepositoryStore;
+import org.apache.james.mailrepository.file.FileMailRepository;
+import org.apache.james.utils.ConfigurationProvider;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.InMemoryMailRepositoryStore;
+import org.apache.james.utils.MailRepositoryProvider;
+
+public class MailStoreRepositoryModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(MailRepositoryStore.class).to(InMemoryMailRepositoryStore.class);
+ Multibinder multibinder = Multibinder.newSetBinder(binder(), MailRepositoryProvider.class);
+ multibinder.addBinding().to(FileMailRepositoryProvider.class);
+ Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MailRepositoryStoreModuleConfigurationPerformer.class);
+ }
+
+ public static class FileMailRepositoryProvider implements MailRepositoryProvider {
+
+ private final FileSystem fileSystem;
+
+ @Inject
+ public FileMailRepositoryProvider(FileSystem fileSystem) {
+ this.fileSystem = fileSystem;
+ }
+
+ @Override
+ public String canonicalName() {
+ return FileMailRepository.class.getCanonicalName();
+ }
+
+ @Override
+ public MailRepository get() {
+ FileMailRepository fileMailRepository = new FileMailRepository();
+ fileMailRepository.setFileSystem(fileSystem);
+ return fileMailRepository;
+ }
+ }
+
+ @Singleton
+ public static class MailRepositoryStoreModuleConfigurationPerformer implements ConfigurationPerformer {
+
+ private final ConfigurationProvider configurationProvider;
+ private final InMemoryMailRepositoryStore javaMailRepositoryStore;
+
+ @Inject
+ public MailRepositoryStoreModuleConfigurationPerformer(ConfigurationProvider configurationProvider,
+ InMemoryMailRepositoryStore javaMailRepositoryStore) {
+ this.configurationProvider = configurationProvider;
+ this.javaMailRepositoryStore = javaMailRepositoryStore;
+ }
+
+ @Override
+ public void initModule() throws Exception {
+ javaMailRepositoryStore.configure(configurationProvider.getConfiguration("mailrepositorystore"));
+ javaMailRepositoryStore.init();
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/QuotaModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/QuotaModule.java
new file mode 100644
index 00000000000..3901efff055
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/QuotaModule.java
@@ -0,0 +1,37 @@
+/****************************************************************
+ * 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.server;
+
+import org.apache.james.mailbox.quota.QuotaManager;
+import org.apache.james.mailbox.quota.QuotaRootResolver;
+import org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver;
+import org.apache.james.mailbox.store.quota.NoQuotaManager;
+
+import com.google.inject.AbstractModule;
+
+public class QuotaModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(QuotaManager.class).to(NoQuotaManager.class);
+ bind(QuotaRootResolver.class).to(DefaultQuotaRootResolver.class);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/SieveModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/SieveModule.java
new file mode 100644
index 00000000000..229b479d314
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/SieveModule.java
@@ -0,0 +1,37 @@
+/****************************************************************
+ * 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.server;
+
+import org.apache.james.managesieve.api.SieveParser;
+import org.apache.james.managesieve.jsieve.Parser;
+import org.apache.james.sieverepository.api.SieveRepository;
+import org.apache.james.sieverepository.file.SieveFileRepository;
+
+import com.google.inject.AbstractModule;
+
+public class SieveModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(SieveParser.class).to(Parser.class);
+ bind(SieveRepository.class).to(SieveFileRepository.class);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/SimpleMessageSearchModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/SimpleMessageSearchModule.java
new file mode 100644
index 00000000000..28529865992
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/server/SimpleMessageSearchModule.java
@@ -0,0 +1,17 @@
+package org.apache.james.modules.server;
+
+import org.apache.james.mailbox.cassandra.CassandraId;
+import org.apache.james.mailbox.store.search.MessageSearchIndex;
+import org.apache.james.mailbox.store.search.SimpleMessageSearchIndex;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.TypeLiteral;
+
+public class SimpleMessageSearchModule extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ bind(new TypeLiteral>(){}).to(new TypeLiteral>(){});
+ }
+
+}
diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/LifecycleAwareProtocolHandler.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
similarity index 80%
rename from protocols/api/src/main/java/org/apache/james/protocols/api/handler/LifecycleAwareProtocolHandler.java
rename to server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
index 8f0882cce2e..ae2ef871749 100644
--- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/LifecycleAwareProtocolHandler.java
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationPerformer.java
@@ -1,34 +1,27 @@
-/****************************************************************
- * 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.protocols.api.handler;
-
-
-/**
- * This interface allows to handle lifecycles for handlers and hooks
- *
- */
-public interface LifecycleAwareProtocolHandler extends ProtocolHandler{
-
- /**
- * Destroy object
- */
- void destroy();
-
-
-}
+/****************************************************************
+ * 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.utils;
+
+
+public interface ConfigurationPerformer {
+
+ void initModule() throws Exception;
+
+}
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/lifecycle/InitializingLifecycleAwareProtocolHandler.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationProvider.java
similarity index 71%
rename from server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/lifecycle/InitializingLifecycleAwareProtocolHandler.java
rename to server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationProvider.java
index 882395f8077..cf3126e07f7 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/lifecycle/InitializingLifecycleAwareProtocolHandler.java
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationProvider.java
@@ -16,20 +16,15 @@
* specific language governing permissions and limitations *
* under the License. *
****************************************************************/
-package org.apache.james.protocols.lib.lifecycle;
-import org.apache.commons.configuration.Configuration;
+package org.apache.james.utils;
+
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.protocols.api.handler.LifecycleAwareProtocolHandler;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+
+public interface ConfigurationProvider {
+
+ HierarchicalConfiguration getConfiguration(String component)
+ throws ConfigurationException;
-public interface InitializingLifecycleAwareProtocolHandler extends LifecycleAwareProtocolHandler {
-
- /**
- * Init with the given {@link Configuration}
- *
- * @param config
- * @throws ConfigurationException
- */
- public void init(Configuration config) throws ConfigurationException;
-
-}
+}
\ No newline at end of file
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationsPerformer.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationsPerformer.java
new file mode 100644
index 00000000000..f64d640dbab
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/ConfigurationsPerformer.java
@@ -0,0 +1,41 @@
+/****************************************************************
+ * 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.utils;
+
+import com.google.inject.Inject;
+
+import java.util.Set;
+
+public class ConfigurationsPerformer {
+
+ private final Set configurationPerformers;
+
+ @Inject
+ public ConfigurationsPerformer(Set configurationPerformers) throws Exception {
+ this.configurationPerformers = configurationPerformers;
+ }
+
+ public void initModules() throws Exception {
+ for(ConfigurationPerformer configurationPerformer : configurationPerformers) {
+ configurationPerformer.initModule();
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/FileConfigurationProvider.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/FileConfigurationProvider.java
new file mode 100644
index 00000000000..b28a94a5dd2
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/FileConfigurationProvider.java
@@ -0,0 +1,90 @@
+/****************************************************************
+ * 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.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.commons.cli.MissingArgumentException;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.modules.CommonServicesModule;
+
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
+import com.google.common.collect.Iterables;
+import com.google.inject.Singleton;
+
+@Singleton
+public class FileConfigurationProvider implements ConfigurationProvider {
+
+ private static final String CONFIGURATION_FILE_SUFFIX = ".xml";
+
+ private final FileSystem fileSystem;
+ private final String configurationPrefix;
+
+ @Inject
+ public FileConfigurationProvider(FileSystem fileSystem, @Named(CommonServicesModule.CONFIGURATION_PATH) String configurationPrefix) throws MissingArgumentException {
+ this.fileSystem = fileSystem;
+ this.configurationPrefix = configurationPrefix;
+ }
+
+ @Override
+ public HierarchicalConfiguration getConfiguration(String component) throws ConfigurationException {
+ Preconditions.checkNotNull(component);
+ List configPathParts = Splitter.on(".").splitToList(component);
+ Preconditions.checkArgument(!configPathParts.isEmpty());
+ HierarchicalConfiguration config = getConfig(retrieveConfigInputStream(configPathParts.get(0)));
+ return selectHierarchicalConfigPart(config, Iterables.skip(configPathParts, 1));
+ }
+
+ private InputStream retrieveConfigInputStream(String configurationFileWithoutExtension) throws ConfigurationException {
+ Preconditions.checkArgument(!Strings.isNullOrEmpty(configurationFileWithoutExtension), "The configuration file name should not be empty or null");
+ try {
+ return fileSystem.getResource(configurationPrefix + configurationFileWithoutExtension + CONFIGURATION_FILE_SUFFIX);
+ } catch (IOException e) {
+ throw new ConfigurationException("Unable to locate configuration file " + configurationFileWithoutExtension + CONFIGURATION_FILE_SUFFIX, e);
+ }
+ }
+
+ private XMLConfiguration getConfig(InputStream configStream) throws ConfigurationException {
+ XMLConfiguration config = new XMLConfiguration();
+ config.setDelimiterParsingDisabled(true);
+ config.setAttributeSplittingDisabled(true);
+ config.load(configStream);
+ return config;
+ }
+
+ private HierarchicalConfiguration selectHierarchicalConfigPart(HierarchicalConfiguration config, Iterable configsPathParts) {
+ HierarchicalConfiguration currentConfig = config;
+ for (String nextPathPart : configsPathParts) {
+ currentConfig = currentConfig.configurationAt(nextPathPart);
+ }
+ return currentConfig;
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceGenericLoader.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceGenericLoader.java
new file mode 100644
index 00000000000..31175b34225
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceGenericLoader.java
@@ -0,0 +1,46 @@
+/****************************************************************
+ * 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.utils;
+
+import com.google.inject.Injector;
+
+public class GuiceGenericLoader {
+
+ private final Injector injector;
+ private final String defaultPackageName;
+
+ public GuiceGenericLoader(Injector injector, String defaultPackageName) {
+ this.injector = injector;
+ this.defaultPackageName = defaultPackageName;
+ }
+
+ public T instanciate(String className) throws Exception {
+ Class clazz = (Class) ClassLoader.getSystemClassLoader().loadClass(constructFullName(className));
+ return injector.getInstance(clazz);
+ }
+
+ private String constructFullName(String name) {
+ if (! name.contains(".")) {
+ return defaultPackageName + name;
+ }
+ return name;
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMailboxManagerResolver.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMailboxManagerResolver.java
new file mode 100644
index 00000000000..d87b3c36d0c
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMailboxManagerResolver.java
@@ -0,0 +1,59 @@
+/****************************************************************
+ * 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.utils;
+
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.james.adapter.mailbox.MailboxManagerResolver;
+import org.apache.james.adapter.mailbox.MailboxManagerResolverException;
+import org.apache.james.mailbox.MailboxManager;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Inject;
+
+public class GuiceMailboxManagerResolver implements MailboxManagerResolver {
+
+ private ImmutableMap managers;
+
+ @Inject
+ private GuiceMailboxManagerResolver(Set managers) {
+ this.managers = indexManagersByName(managers);
+ }
+
+ private static ImmutableMap indexManagersByName(Set managers) {
+ return ImmutableMap.copyOf(managers.stream().collect(
+ Collectors.toMap(MailboxManagerDefinition::getName, MailboxManagerDefinition::getManager)));
+ }
+
+ @Override
+ public Map getMailboxManagerBeans() {
+ return managers;
+ }
+
+ @Override
+ public MailboxManager resolveMailboxManager(String mailboxManagerClassName) {
+ return Optional.ofNullable(managers.get(mailboxManagerClassName)).orElseThrow(
+ () -> new MailboxManagerResolverException("Unable to find a mailbox manager with name " + mailboxManagerClassName));
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMailetLoader.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMailetLoader.java
new file mode 100644
index 00000000000..3efdce67348
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMailetLoader.java
@@ -0,0 +1,52 @@
+/****************************************************************
+ * 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.utils;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import org.apache.james.mailetcontainer.api.MailetLoader;
+import org.apache.mailet.Mailet;
+import org.apache.mailet.MailetConfig;
+
+import javax.mail.MessagingException;
+
+public class GuiceMailetLoader implements MailetLoader {
+
+ private static final String STANDARD_PACKAGE = "org.apache.james.transport.mailets.";
+
+ private final GuiceGenericLoader genericLoader;
+
+ @Inject
+ public GuiceMailetLoader(Injector injector) {
+ this.genericLoader = new GuiceGenericLoader<>(injector, STANDARD_PACKAGE);
+ }
+
+ @Override
+ public Mailet getMailet(MailetConfig config) throws MessagingException {
+ try {
+ Mailet result = genericLoader.instanciate(config.getMailetName());
+ result.init(config);
+ return result;
+ } catch (Exception e) {
+ throw new MessagingException("Can not load mailet " + config.getMailetName(), e);
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java
new file mode 100644
index 00000000000..a6d966be50b
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceMatcherLoader.java
@@ -0,0 +1,52 @@
+/****************************************************************
+ * 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.utils;
+
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import org.apache.james.mailetcontainer.api.MatcherLoader;
+import org.apache.mailet.Matcher;
+import org.apache.mailet.MatcherConfig;
+
+import javax.mail.MessagingException;
+
+public class GuiceMatcherLoader implements MatcherLoader {
+
+ private static final String STANDARD_PACKAGE = "org.apache.james.transport.matchers.";
+
+ private final GuiceGenericLoader genericLoader;
+
+ @Inject
+ public GuiceMatcherLoader(Injector injector) {
+ this.genericLoader = new GuiceGenericLoader<>(injector, STANDARD_PACKAGE);
+ }
+
+ @Override
+ public Matcher getMatcher(MatcherConfig config) throws MessagingException {
+ try {
+ Matcher result = genericLoader.instanciate(config.getMatcherName());
+ result.init(config);
+ return result;
+ } catch (Exception e) {
+ throw new MessagingException("Can not load matcher " + config.getMatcherName(), e);
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceProtocolHandlerLoader.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceProtocolHandlerLoader.java
new file mode 100644
index 00000000000..8b5b0cae3cc
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/GuiceProtocolHandlerLoader.java
@@ -0,0 +1,59 @@
+/****************************************************************
+ * 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.utils;
+
+import com.google.common.base.Throwables;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.protocols.api.handler.ProtocolHandler;
+import org.apache.james.protocols.lib.handler.ProtocolHandlerLoader;
+
+public class GuiceProtocolHandlerLoader implements ProtocolHandlerLoader {
+
+ private final Injector injector;
+
+ @Inject
+ public GuiceProtocolHandlerLoader(Injector injector) {
+ this.injector = injector;
+ }
+
+ @Override
+ public ProtocolHandler load(String name, Configuration config) throws LoadingException {
+ ProtocolHandler handler = createProtocolHandler(name);
+ try {
+ handler.init(config);
+ } catch (ConfigurationException e) {
+ throw Throwables.propagate(e);
+ }
+ return handler;
+ }
+
+ private ProtocolHandler createProtocolHandler(String name) throws LoadingException {
+ try {
+ Class clazz = (Class) ClassLoader.getSystemClassLoader().loadClass(name);
+ return injector.getInstance(clazz);
+ } catch (ClassNotFoundException e) {
+ throw new LoadingException("Can not load " + name);
+ }
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/InMemoryMailRepositoryStore.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/InMemoryMailRepositoryStore.java
new file mode 100644
index 00000000000..16273800664
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/InMemoryMailRepositoryStore.java
@@ -0,0 +1,158 @@
+/****************************************************************
+ * 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.utils;
+
+import com.google.inject.Inject;
+import org.apache.commons.configuration.CombinedConfiguration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.DefaultConfigurationBuilder;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.james.lifecycle.api.Configurable;
+import org.apache.james.lifecycle.api.LogEnabled;
+import org.apache.james.mailrepository.api.MailRepository;
+import org.apache.james.mailrepository.api.MailRepositoryStore;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Singleton;
+import java.util.Set;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.stream.Collectors;
+
+@Singleton
+public class InMemoryMailRepositoryStore implements MailRepositoryStore {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(InMemoryMailRepositoryStore.class);
+
+ private Set mailRepositories;
+ private ConcurrentMap destinationToRepositoryAssociations;
+ private Map protocolToRepositoryProvider;
+ private Map perProtocolMailRepositoryDefaultConfiguration;
+ private HierarchicalConfiguration configuration;
+
+ @Inject
+ public InMemoryMailRepositoryStore(Set mailRepositories) {
+ this.mailRepositories = mailRepositories;
+ this.destinationToRepositoryAssociations = new ConcurrentHashMap<>();
+ this.protocolToRepositoryProvider = new HashMap<>();
+ this.perProtocolMailRepositoryDefaultConfiguration = new HashMap<>();
+ }
+
+ @Override
+ public List getUrls() {
+ return destinationToRepositoryAssociations.keySet()
+ .stream()
+ .collect(Collectors.toList());
+ }
+
+ public void configure(HierarchicalConfiguration configuration) throws ConfigurationException {
+ this.configuration = configuration;
+ }
+
+ public void init() throws Exception {
+ LOGGER.info("JamesMailStore init... " + this);
+ List registeredClasses = configuration.configurationsAt("mailrepositories.mailrepository");
+ for (HierarchicalConfiguration registeredClass : registeredClasses) {
+ readConfigurationEntry(registeredClass);
+ }
+ }
+
+ @Override
+ public MailRepository select(String destination) throws MailRepositoryStoreException {
+ MailRepository mailRepository = destinationToRepositoryAssociations.get(destination);
+ if (mailRepository != null) {
+ return mailRepository;
+ }
+ String protocol = retrieveProtocol(destination);
+ mailRepository = retrieveMailRepository(protocol);
+ mailRepository = initialiseNewRepository(mailRepository, createRepositoryCombinedConfig(destination, protocol));
+ destinationToRepositoryAssociations.putIfAbsent(destination, mailRepository);
+ return mailRepository;
+ }
+
+ private void readConfigurationEntry(HierarchicalConfiguration repositoryConfiguration) throws ConfigurationException {
+ String className = repositoryConfiguration.getString("[@class]");
+ MailRepositoryProvider usedMailRepository = mailRepositories.stream()
+ .filter(mailRepositoryProvider -> mailRepositoryProvider.canonicalName().equals(className))
+ .findAny()
+ .orElseThrow(() -> new ConfigurationException("MailRepository " + className + " has not been registered"));
+ for (String protocol : repositoryConfiguration.getStringArray("protocols.protocol")) {
+ protocolToRepositoryProvider.put(protocol, usedMailRepository);
+ registerRepositoryDefaultConfiguration(repositoryConfiguration, protocol);
+ }
+ }
+
+ private void registerRepositoryDefaultConfiguration(HierarchicalConfiguration repositoryConfiguration, String protocol) {
+ HierarchicalConfiguration defConf = null;
+ if (repositoryConfiguration.getKeys("config").hasNext()) {
+ defConf = repositoryConfiguration.configurationAt("config");
+ }
+ if (defConf != null) {
+ perProtocolMailRepositoryDefaultConfiguration.put(protocol, defConf);
+ }
+ }
+
+ private CombinedConfiguration createRepositoryCombinedConfig(String destination, String protocol) {
+ final CombinedConfiguration config = new CombinedConfiguration();
+ HierarchicalConfiguration defaultProtocolConfig = perProtocolMailRepositoryDefaultConfiguration.get(protocol);
+ if (defaultProtocolConfig != null) {
+ config.addConfiguration(defaultProtocolConfig);
+ }
+ DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+ builder.addProperty("[@destinationURL]", destination);
+ config.addConfiguration(builder);
+ return config;
+ }
+
+ private MailRepository initialiseNewRepository(MailRepository mailRepository, CombinedConfiguration config) throws MailRepositoryStoreException {
+ try {
+ if (mailRepository instanceof LogEnabled) {
+ ((LogEnabled) mailRepository).setLog(LOGGER);
+ }
+ if (mailRepository instanceof Configurable) {
+ ((Configurable) mailRepository).configure(config);
+ }
+ return mailRepository;
+ } catch (Exception e) {
+ throw new MailRepositoryStoreException("Cannot init mail repository", e);
+ }
+ }
+
+ private MailRepository retrieveMailRepository(String protocol) throws MailRepositoryStoreException {
+ MailRepositoryProvider repositoryProvider = protocolToRepositoryProvider.get(protocol);
+ if (repositoryProvider == null) {
+ throw new MailRepositoryStoreException("No Mail Repository associated with " + protocol);
+ }
+ return repositoryProvider.get();
+ }
+
+ private String retrieveProtocol(String destination) throws MailRepositoryStoreException {
+ int protocolSeparatorPosition = destination.indexOf(':');
+ if (protocolSeparatorPosition == -1) {
+ throw new MailRepositoryStoreException("Destination is malformed. Must be a valid URL: " + destination);
+ }
+ return destination.substring(0, protocolSeparatorPosition);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/MailRepositoryProvider.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/MailRepositoryProvider.java
new file mode 100644
index 00000000000..52b7d15a9f4
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/MailRepositoryProvider.java
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.utils;
+
+import org.apache.james.mailrepository.api.MailRepository;
+
+import javax.inject.Provider;
+
+public interface MailRepositoryProvider extends Provider {
+
+ String canonicalName();
+}
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/MailboxManagerDefinition.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/MailboxManagerDefinition.java
new file mode 100644
index 00000000000..211398a2cf0
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/MailboxManagerDefinition.java
@@ -0,0 +1,57 @@
+/****************************************************************
+ * 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.utils;
+
+import org.apache.james.mailbox.MailboxManager;
+
+import com.google.common.base.Objects;
+
+public class MailboxManagerDefinition {
+
+ private final String name;
+ private final MailboxManager manager;
+
+ public MailboxManagerDefinition(String name, MailboxManager manager) {
+ this.name = name;
+ this.manager = manager;
+ }
+
+ public MailboxManager getManager() {
+ return manager;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(name, manager);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof MailboxManagerDefinition) {
+ MailboxManagerDefinition other = (MailboxManagerDefinition) obj;
+ return Objects.equal(name, other.name) && Objects.equal(manager, other.manager);
+ }
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/utils/PropertiesReader.java b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/PropertiesReader.java
new file mode 100644
index 00000000000..e859ff738b4
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/utils/PropertiesReader.java
@@ -0,0 +1,43 @@
+/****************************************************************
+ * 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.utils;
+
+import com.google.common.base.Throwables;
+
+import java.io.IOException;
+import java.util.Properties;
+
+public class PropertiesReader {
+
+ private final Properties properties;
+
+ public PropertiesReader(String fileName) {
+ properties = new Properties();
+ try {
+ properties.load(ClassLoader.getSystemResourceAsStream(fileName));
+ } catch (IOException e) {
+ throw Throwables.propagate(e);
+ }
+ }
+
+ public String getProperty(String key) {
+ return properties.getProperty(key);
+ }
+}
diff --git a/server/container/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java b/server/container/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
new file mode 100644
index 00000000000..bdf656d2089
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
@@ -0,0 +1,129 @@
+/****************************************************************
+ * 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;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+import java.nio.charset.Charset;
+
+import org.apache.james.backends.cassandra.CassandraCluster;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
+import org.apache.james.modules.TestElasticSearchModule;
+import org.apache.james.modules.TestFilesystemModule;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.rules.TemporaryFolder;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.util.Modules;
+
+public class CassandraJamesServerTest {
+
+ private static final int IMAP_PORT = 1143; // You need to be root (superuser) to bind to ports under 1024.
+ private static final int IMAP_PORT_SSL = 1993;
+ private static final int POP3_PORT = 1110;
+ private static final int SMTP_PORT = 1025;
+ private static final int LMTP_PORT = 1024;
+ public static final int BUFFER_SIZE = 1000;
+
+ private CassandraJamesServer server;
+ private TemporaryFolder temporaryFolder = new TemporaryFolder();
+ private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder);
+ private SocketChannel socketChannel;
+
+ @Rule
+ public RuleChain chain = RuleChain.outerRule(temporaryFolder).around(embeddedElasticSearch);
+
+ @Before
+ public void setup() throws Exception {
+ server = new CassandraJamesServer(Modules.override(CassandraJamesServerMain.defaultModule)
+ .with(new TestElasticSearchModule(embeddedElasticSearch),
+ new TestFilesystemModule(temporaryFolder.newFolder()),
+ new AbstractModule() {
+
+ @Override
+ protected void configure() {
+ }
+
+ @Provides
+ @Singleton
+ com.datastax.driver.core.Session provideSession(CassandraModule cassandraModule) {
+ CassandraCluster cassandra = CassandraCluster.create(cassandraModule);
+ return cassandra.getConf();
+ }
+
+ }));
+ socketChannel = SocketChannel.open();
+
+ server.start();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ server.stop();
+ }
+
+ @Test
+ public void connectIMAPServerShouldSendShabangOnConnect() throws Exception {
+ socketChannel.connect(new InetSocketAddress("127.0.0.1", IMAP_PORT));
+ assertThat(getServerConnectionResponse(socketChannel)).startsWith("* OK JAMES IMAP4rev1 Server");
+ }
+
+ @Test
+ public void connectOnSecondaryIMAPServerIMAPServerShouldSendShabangOnConnect() throws Exception {
+ socketChannel.connect(new InetSocketAddress("127.0.0.1", IMAP_PORT_SSL));
+ assertThat(getServerConnectionResponse(socketChannel)).startsWith("* OK JAMES IMAP4rev1 Server");
+ }
+
+ @Test
+ public void connectPOP3ServerShouldSendShabangOnConnect() throws Exception {
+ socketChannel.connect(new InetSocketAddress("127.0.0.1", POP3_PORT));
+ assertThat(getServerConnectionResponse(socketChannel)).contains("POP3 server (JAMES POP3 Server ) ready");
+ }
+
+ @Test
+ public void connectSMTPServerShouldSendShabangOnConnect() throws Exception {
+ socketChannel.connect(new InetSocketAddress("127.0.0.1", SMTP_PORT));
+ assertThat(getServerConnectionResponse(socketChannel)).startsWith("220 JAMES Linagora's SMTP awesome Server");
+ }
+
+ @Test
+ public void connectLMTPServerShouldSendShabangOnConnect() throws Exception {
+ socketChannel.connect(new InetSocketAddress("127.0.0.1", LMTP_PORT));
+ assertThat(getServerConnectionResponse(socketChannel)).contains("LMTP Server (JAMES Protocols Server) ready");
+ }
+
+ private String getServerConnectionResponse(SocketChannel socketChannel) throws IOException {
+ ByteBuffer byteBuffer = ByteBuffer.allocate(1000);
+ socketChannel.read(byteBuffer);
+ byte[] bytes = byteBuffer.array();
+ return new String(bytes, Charset.forName("UTF-8"));
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestElasticSearchModule.java b/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestElasticSearchModule.java
new file mode 100644
index 00000000000..6da278fbff5
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestElasticSearchModule.java
@@ -0,0 +1,52 @@
+/****************************************************************
+ * 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;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import org.apache.james.mailbox.elasticsearch.ClientProvider;
+import org.apache.james.mailbox.elasticsearch.EmbeddedElasticSearch;
+import org.apache.james.mailbox.elasticsearch.IndexCreationFactory;
+import org.apache.james.mailbox.elasticsearch.NodeMappingFactory;
+import org.apache.james.mailbox.elasticsearch.utils.TestingClientProvider;
+
+import javax.inject.Singleton;
+
+public class TestElasticSearchModule extends AbstractModule{
+
+ private final EmbeddedElasticSearch embeddedElasticSearch;
+
+ public TestElasticSearchModule(EmbeddedElasticSearch embeddedElasticSearch) {
+ this.embeddedElasticSearch = embeddedElasticSearch;
+ }
+
+ @Override
+ protected void configure() {
+
+ }
+
+ @Provides
+ @Singleton
+ protected ClientProvider provideClientProvider() {
+ return NodeMappingFactory.applyMapping(
+ IndexCreationFactory.createIndex(new TestingClientProvider(embeddedElasticSearch.getNode()))
+ );
+ }
+}
diff --git a/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestFilesystemModule.java b/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestFilesystemModule.java
new file mode 100644
index 00000000000..63b46b47e2d
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/java/org/apache/james/modules/TestFilesystemModule.java
@@ -0,0 +1,46 @@
+/****************************************************************
+ * 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;
+
+import java.io.File;
+
+import org.apache.james.core.JamesServerResourceLoader;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.filesystem.api.JamesDirectoriesProvider;
+import org.apache.james.modules.CommonServicesModule;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.name.Names;
+
+public class TestFilesystemModule extends AbstractModule {
+
+ private File workingDirectory;
+
+ public TestFilesystemModule(File workingDirectory) {
+ this.workingDirectory = workingDirectory;
+ }
+
+ @Override
+ protected void configure() {
+ bind(JamesDirectoriesProvider.class).toInstance(new JamesServerResourceLoader(workingDirectory.getAbsolutePath()));
+ bindConstant().annotatedWith(Names.named(CommonServicesModule.CONFIGURATION_PATH)).to(FileSystem.CLASSPATH_PROTOCOL);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/test/java/org/apache/james/utils/FileConfigurationProviderTest.java b/server/container/cassandra-guice/src/test/java/org/apache/james/utils/FileConfigurationProviderTest.java
new file mode 100644
index 00000000000..4fe0360caae
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/java/org/apache/james/utils/FileConfigurationProviderTest.java
@@ -0,0 +1,119 @@
+/****************************************************************
+ * 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.utils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.commons.cli.MissingArgumentException;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.james.core.JamesServerResourceLoader;
+import org.apache.james.core.filesystem.FileSystemImpl;
+import org.apache.james.filesystem.api.FileSystem;
+import org.junit.Before;
+import org.junit.Test;
+
+public class FileConfigurationProviderTest {
+
+ private static final String CONFIG_KEY_1 = "test2";
+ private static final String CONFIG_KEY_2 = "property";
+ private static final String CONFIG_KEY_4 = "james";
+ private static final String CONFIG_KEY_5 = "internal";
+ private static final String VALUE_1 = "0";
+ private static final String VALUE_2 = "awesome";
+ private static final String VALUE_3 = "james";
+ private static final String FAKE_CONFIG_KEY = "fake";
+ private static final String ROOT_CONFIG_KEY = "test";
+ private static final String CONFIG_SEPARATOR = ".";
+
+ private FileConfigurationProvider configurationProvider;
+
+ @Before
+ public void setUp() throws MissingArgumentException {
+ FileSystemImpl fileSystem = new FileSystemImpl(new JamesServerResourceLoader("../"));
+ configurationProvider = new FileConfigurationProvider(fileSystem, FileSystem.CLASSPATH_PROTOCOL);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void emptyArgumentShouldThrow() throws Exception {
+ configurationProvider.getConfiguration("");
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void nullArgumentShouldThrow() throws Exception {
+ configurationProvider.getConfiguration(null);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void configSeparatorArgumentShouldThrow() throws Exception {
+ configurationProvider.getConfiguration(CONFIG_SEPARATOR);
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void emptyFileNameShouldThrow() throws Exception {
+ configurationProvider.getConfiguration(CONFIG_SEPARATOR + ROOT_CONFIG_KEY);
+ }
+
+ @Test
+ public void getConfigurationShouldLoadCorrespondingXMLFile() throws Exception {
+ HierarchicalConfiguration hierarchicalConfiguration = configurationProvider.getConfiguration(ROOT_CONFIG_KEY);
+ assertThat(hierarchicalConfiguration.getKeys()).containsOnly(CONFIG_KEY_1,
+ String.join(CONFIG_SEPARATOR, CONFIG_KEY_4, CONFIG_KEY_2),
+ String.join(CONFIG_SEPARATOR, CONFIG_KEY_4, CONFIG_KEY_5, CONFIG_KEY_2));
+ assertThat(hierarchicalConfiguration.getProperty(CONFIG_KEY_1)).isEqualTo(VALUE_1);
+ }
+
+ @Test
+ public void getConfigurationShouldLoadCorrespondingXMLFilePart() throws Exception {
+ HierarchicalConfiguration hierarchicalConfiguration = configurationProvider.getConfiguration(
+ String.join(CONFIG_SEPARATOR, ROOT_CONFIG_KEY, CONFIG_KEY_4));
+ assertThat(hierarchicalConfiguration.getKeys()).containsOnly(CONFIG_KEY_2,
+ String.join(CONFIG_SEPARATOR, CONFIG_KEY_5, CONFIG_KEY_2));
+ assertThat(hierarchicalConfiguration.getProperty(CONFIG_KEY_2)).isEqualTo(VALUE_2);
+ }
+
+ @Test
+ public void getConfigurationShouldLoadCorrespondingXMLFileWhenAPathIsProvidedPart() throws Exception {
+ HierarchicalConfiguration hierarchicalConfiguration = configurationProvider.getConfiguration(
+ String.join(CONFIG_SEPARATOR, ROOT_CONFIG_KEY, CONFIG_KEY_4, CONFIG_KEY_5));
+ assertThat(hierarchicalConfiguration.getKeys()).containsOnly(CONFIG_KEY_2);
+ assertThat(hierarchicalConfiguration.getProperty(CONFIG_KEY_2)).isEqualTo(VALUE_3);
+ }
+
+ @Test
+ public void multiplesSeparatorsShouldBeTolerated() throws Exception {
+ HierarchicalConfiguration hierarchicalConfiguration = configurationProvider.getConfiguration(
+ ROOT_CONFIG_KEY + CONFIG_SEPARATOR + CONFIG_SEPARATOR + CONFIG_KEY_4);
+ assertThat(hierarchicalConfiguration.getKeys()).containsOnly(CONFIG_KEY_2,
+ String.join(CONFIG_SEPARATOR, CONFIG_KEY_5, CONFIG_KEY_2));
+ assertThat(hierarchicalConfiguration.getProperty(CONFIG_KEY_2)).isEqualTo(VALUE_2);
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void getConfigurationShouldThrowOnNonExistingXMLFile() throws Exception {
+ assertThat(configurationProvider.getConfiguration(FAKE_CONFIG_KEY)).isNotNull();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void getConfigurationShouldThrowOnNonExistingXMLFilePart() throws Exception {
+ configurationProvider.getConfiguration(String.join(CONFIG_SEPARATOR, ROOT_CONFIG_KEY, FAKE_CONFIG_KEY));
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/test/java/org/apache/james/utils/InMemoryMailRepositoryStoreTest.java b/server/container/cassandra-guice/src/test/java/org/apache/james/utils/InMemoryMailRepositoryStoreTest.java
new file mode 100644
index 00000000000..d8582b3f5db
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/java/org/apache/james/utils/InMemoryMailRepositoryStoreTest.java
@@ -0,0 +1,109 @@
+/****************************************************************
+ * 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.utils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.james.core.JamesServerResourceLoader;
+import org.apache.james.core.filesystem.FileSystemImpl;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.mailrepository.api.MailRepositoryStore;
+import org.apache.james.mailrepository.file.FileMailRepository;
+import org.apache.james.modules.server.MailStoreRepositoryModule;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.Sets;
+
+public class InMemoryMailRepositoryStoreTest {
+
+ private InMemoryMailRepositoryStore repositoryStore;
+ private FileSystemImpl fileSystem;
+
+ @Before
+ public void setUp() throws Exception {
+ fileSystem = new FileSystemImpl(new JamesServerResourceLoader("../"));
+ repositoryStore = new InMemoryMailRepositoryStore(Sets.newHashSet(
+ new MailStoreRepositoryModule.FileMailRepositoryProvider(
+ fileSystem)));
+ repositoryStore.configure(new FileConfigurationProvider(fileSystem, FileSystem.CLASSPATH_PROTOCOL).getConfiguration("mailrepositorystore"));
+ repositoryStore.init();
+ }
+
+ @Test(expected = MailRepositoryStore.MailRepositoryStoreException.class)
+ public void selectingANonRegisteredProtocolShouldFail() throws Exception {
+ repositoryStore.select("proto://repo");
+ }
+
+ @Test
+ public void selectingARegisteredProtocolShouldWork() throws Exception {
+ assertThat(repositoryStore.select("file://repo")).isInstanceOf(FileMailRepository.class);
+ }
+
+ @Test
+ public void selectingTwiceARegisteredProtocolWithSameDestinationShouldReturnTheSameResult() throws Exception {
+ assertThat(repositoryStore.select("file://repo")).isEqualTo(repositoryStore.select("file://repo"));
+ }
+
+ @Test
+ public void selectingTwiceARegisteredProtocolWithDifferentDestinationShouldReturnDifferentResults() throws Exception {
+ assertThat(repositoryStore.select("file://repo")).isNotEqualTo(repositoryStore.select("file://repo1"));
+ }
+
+ @Test(expected = ConfigurationException.class)
+ public void configureShouldThrowWhenNonValidClassesAreProvided() throws Exception {
+ try {
+ repositoryStore = new InMemoryMailRepositoryStore(Sets.newHashSet(
+ new MailStoreRepositoryModule.FileMailRepositoryProvider(
+ fileSystem)));
+ repositoryStore.configure(new FileConfigurationProvider(fileSystem, FileSystem.CLASSPATH_PROTOCOL).getConfiguration("fakemailrepositorystore"));
+ } catch (ConfigurationException e) {
+ fail("Unexpected failure : ", e);
+ }
+ repositoryStore.init();
+ }
+
+ @Test
+ public void getUrlsShouldBeEmptyIfNoSelectWerePerformed() {
+ assertThat(repositoryStore.getUrls()).isEmpty();
+ }
+
+ @Test
+ public void getUrlsShouldReturnUsedUrls() throws Exception {
+ String url1 = "file://repo1";
+ String url2 = "file://repo2";
+ String url3 = "file://repo3";
+ repositoryStore.select(url1);
+ repositoryStore.select(url2);
+ repositoryStore.select(url3);
+ assertThat(repositoryStore.getUrls()).containsOnly(url1, url2, url3);
+ }
+
+ @Test
+ public void getUrlsResultsShouldNotBeDuplicated() throws Exception {
+ String url1 = "file://repo1";
+ repositoryStore.select(url1);
+ repositoryStore.select(url1);
+ assertThat(repositoryStore.getUrls()).containsExactly(url1);
+ }
+
+}
diff --git a/server/container/cassandra-guice/src/test/java/org/apache/james/utils/PropertiesReadTest.java b/server/container/cassandra-guice/src/test/java/org/apache/james/utils/PropertiesReadTest.java
new file mode 100644
index 00000000000..1d3de346778
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/java/org/apache/james/utils/PropertiesReadTest.java
@@ -0,0 +1,44 @@
+/****************************************************************
+ * 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.utils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.Test;
+
+public class PropertiesReadTest {
+
+ @Test
+ public void getPropertyShouldWork() throws Exception {
+ PropertiesReader propertiesReader = new PropertiesReader("test.properties");
+ assertThat(propertiesReader.getProperty("cassandra.ip")).isEqualTo("127.0.0.1");
+ }
+
+ @Test
+ public void getAbsentPropertyShouldReturnNull() throws Exception {
+ PropertiesReader propertiesReader = new PropertiesReader("test.properties");
+ assertThat(propertiesReader.getProperty("cassandra.isslow")).isNull();
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void buildingAPropertiesReaderOnNonExistingValuesShouldThrow() throws Exception {
+ new PropertiesReader("fake.properties");
+ }
+}
diff --git a/server/container/cassandra-guice/src/test/resources/dnsservice.xml b/server/container/cassandra-guice/src/test/resources/dnsservice.xml
new file mode 100644
index 00000000000..0978a00b899
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/dnsservice.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+ 8.8.8.8
+ 62.210.16.6
+
+ false
+ false
+ 50000
+
diff --git a/server/container/cassandra-guice/src/test/resources/fakemailrepositorystore.xml b/server/container/cassandra-guice/src/test/resources/fakemailrepositorystore.xml
new file mode 100644
index 00000000000..2d19a802da9
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/fakemailrepositorystore.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+ file
+
+
+
+
+
diff --git a/server/container/cassandra-guice/src/test/resources/imapserver.xml b/server/container/cassandra-guice/src/test/resources/imapserver.xml
new file mode 100644
index 00000000000..ff478a9cd70
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/imapserver.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+ imapserver
+ 0.0.0.0:1143
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 0
+ 0
+
+
+ imapserver-ssl
+ 0.0.0.0:1993
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 0
+ 0
+
+
diff --git a/server/container/cassandra-guice/src/test/resources/lmtpserver.xml b/server/container/cassandra-guice/src/test/resources/lmtpserver.xml
new file mode 100644
index 00000000000..5c4a9c74ce8
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/lmtpserver.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+ lmtpserver
+
+ 127.0.0.1:1024
+ 200
+ 1200
+
+ 0
+
+ 0
+
+
+ 0
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/src/test/resources/mailetcontainer.xml b/server/container/cassandra-guice/src/test/resources/mailetcontainer.xml
new file mode 100644
index 00000000000..1bd6f71f285
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/mailetcontainer.xml
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+ postmaster@james.minet.net
+
+
+
+ 20
+
+
+
+
+
+
+
+
+ sieve-manager-check
+
+
+ transport
+
+
+ true
+
+
+ transport
+
+
+ transport
+
+
+
+
+
+
+ spam
+ 550 Requested action not taken: rejected - see http://njabl.org/
+
+
+ transport
+
+
+
+
+
+
+ file://var/mail/error/
+
+
+
+
+
+
+ X-UserIsAuth
+ true
+
+
+ X-WasSigned
+ true
+
+
+
+
+ local-address-error
+ 550 - Requested action not taken: no such user here
+
+
+ outgoing
+ 5000, 100000, 500000
+ 25
+ 0
+ 10
+ true
+ bounces
+
+
+ relay-denied
+
+
+
+
+
+ file://var/mail/spam/
+
+
+
+
+
+ none
+
+
+ file://var/mail/address-error/
+
+
+
+
+
+ none
+
+
+ file://var/mail/relay-denied/
+ Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation
+
+
+
+
+
+ false
+
+
+
+
+
+
+ sieve-manager
+
+
+
+ heads
+ none
+ false
+ [REJECTED]
+
+ You can't send messages to configure SIEVE on this serveur unless you are the official SIEVE manager.
+
+
+
+
+
+
+
+ true
+
+
+ file:/root/james-server-app-3.0.0-beta5-SNAPSHOT/conf/managesieve.help.txt
+
+
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/src/test/resources/mailrepositorystore.xml b/server/container/cassandra-guice/src/test/resources/mailrepositorystore.xml
new file mode 100644
index 00000000000..3ca4a1d0056
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/mailrepositorystore.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+ file
+
+
+
+
+
diff --git a/server/container/cassandra-guice/src/test/resources/pop3server.xml b/server/container/cassandra-guice/src/test/resources/pop3server.xml
new file mode 100644
index 00000000000..e4187da352b
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/pop3server.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+ pop3server
+ 0.0.0.0:1110
+ 200
+
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+
+ 1200
+ 0
+ 0
+
+
+
+
+
diff --git a/server/container/cassandra-guice/src/test/resources/smtpserver.xml b/server/container/cassandra-guice/src/test/resources/smtpserver.xml
new file mode 100644
index 00000000000..a3d4b8f05a0
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/smtpserver.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ smtpserver-global
+ 0.0.0.0:1025
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+ false
+ 0.0.0.0/0
+ true
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+ smtpserver-TLS
+ 0.0.0.0:10465
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+
+ true
+ 0.0.0.0/0
+
+ false
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+ smtpserver-authenticated
+ 0.0.0.0:1587
+ 200
+
+ file://conf/keystore
+ james72laBalle
+ org.bouncycastle.jce.provider.BouncyCastleProvider
+ SunX509
+
+ 360
+ 0
+ 0
+
+ true
+ 0.0.0.0/0
+
+ false
+ 0
+ true
+ JAMES Linagora's SMTP awesome Server
+
+
+
+
+
+
+
+
diff --git a/server/container/cassandra-guice/src/test/resources/test.properties b/server/container/cassandra-guice/src/test/resources/test.properties
new file mode 100644
index 00000000000..b4db9c1f7a8
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/test.properties
@@ -0,0 +1,6 @@
+# Configuration file for cassandra mailbox
+
+cassandra.ip=127.0.0.1
+cassandra.port=9142
+cassandra.keyspace=apache_james
+cassandra.replication.factor=1
\ No newline at end of file
diff --git a/server/container/cassandra-guice/src/test/resources/test.xml b/server/container/cassandra-guice/src/test/resources/test.xml
new file mode 100644
index 00000000000..8d89ecc444b
--- /dev/null
+++ b/server/container/cassandra-guice/src/test/resources/test.xml
@@ -0,0 +1,28 @@
+
+
+
+ 0
+
+ awesome
+
+ james
+
+
+
\ No newline at end of file
diff --git a/server/container/cli/pom.xml b/server/container/cli/pom.xml
index 68bda12bc2d..479e6e1b89c 100644
--- a/server/container/cli/pom.xml
+++ b/server/container/cli/pom.xml
@@ -93,6 +93,36 @@
maven-bundle-plugintrue
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-dependencies
+ package
+
+ copy-dependencies
+
+
+ ${project.build.directory}/${project.build.finalName}.lib
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ true
+ ${project.build.finalName}.lib/
+ org.apache.james.cli.ServerCmd
+ false
+
+
+
+
diff --git a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxServerProbe.java b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxServerProbe.java
index cdb77f49357..fedbb071362 100644
--- a/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxServerProbe.java
+++ b/server/container/cli/src/main/java/org/apache/james/cli/probe/impl/JmxServerProbe.java
@@ -44,12 +44,12 @@
public class JmxServerProbe implements ServerProbe {
// TODO: Move this to somewhere else
- private final static String DOMAINLIST_OBJECT_NAME = "org.apache.james:type=component,name=domainlist";
- private final static String VIRTUALUSERTABLE_OBJECT_NAME = "org.apache.james:type=component,name=recipientrewritetable";
- private final static String USERSREPOSITORY_OBJECT_NAME = "org.apache.james:type=component,name=usersrepository";
- private final static String MAILBOXCOPIER_OBJECT_NAME = "org.apache.james:type=component,name=mailboxcopier";
- private final static String MAILBOXMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=mailboxmanagerbean";
- private final static String QUOTAMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=quotamanagerbean";
+ public final static String DOMAINLIST_OBJECT_NAME = "org.apache.james:type=component,name=domainlist";
+ public final static String VIRTUALUSERTABLE_OBJECT_NAME = "org.apache.james:type=component,name=recipientrewritetable";
+ public final static String USERSREPOSITORY_OBJECT_NAME = "org.apache.james:type=component,name=usersrepository";
+ public final static String MAILBOXCOPIER_OBJECT_NAME = "org.apache.james:type=component,name=mailboxcopier";
+ public final static String MAILBOXMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=mailboxmanagerbean";
+ public final static String QUOTAMANAGER_OBJECT_NAME = "org.apache.james:type=component,name=quotamanagerbean";
private JMXConnector jmxc;
diff --git a/server/container/core/src/main/java/org/apache/james/core/JamesServerResourceLoader.java b/server/container/core/src/main/java/org/apache/james/core/JamesServerResourceLoader.java
index 456771198db..4b3e5cb9d77 100644
--- a/server/container/core/src/main/java/org/apache/james/core/JamesServerResourceLoader.java
+++ b/server/container/core/src/main/java/org/apache/james/core/JamesServerResourceLoader.java
@@ -22,6 +22,12 @@
public class JamesServerResourceLoader implements JamesDirectoriesProvider {
+ private final String rootDirectory;
+
+ public JamesServerResourceLoader(String rootDirectory) {
+ this.rootDirectory = rootDirectory;
+ }
+
/**
* @see org.apache.james.container.spring.resource.JamesResourceLoader#getAbsoluteDirectory()
*/
@@ -60,7 +66,7 @@ public String getExternalLibraryDirectory() {
* org.apache.james.container.spring.resource.JamesResourceLoader#getRootDirectory()
*/
public String getRootDirectory() {
- return "../";
+ return rootDirectory;
}
}
\ No newline at end of file
diff --git a/server/container/core/src/main/java/org/apache/james/core/filesystem/FileSystemImpl.java b/server/container/core/src/main/java/org/apache/james/core/filesystem/FileSystemImpl.java
index 012b6fdcaa5..7724d769214 100644
--- a/server/container/core/src/main/java/org/apache/james/core/filesystem/FileSystemImpl.java
+++ b/server/container/core/src/main/java/org/apache/james/core/filesystem/FileSystemImpl.java
@@ -23,14 +23,19 @@
import java.io.IOException;
import java.io.InputStream;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
import org.apache.james.filesystem.api.FileSystem;
import org.apache.james.filesystem.api.JamesDirectoriesProvider;
+@Singleton
public class FileSystemImpl implements FileSystem {
private final JamesDirectoriesProvider directoryProvider;
private final ResourceFactory resourceLoader;
+ @Inject
public FileSystemImpl(JamesDirectoriesProvider directoryProvider) {
this.directoryProvider = directoryProvider;
this.resourceLoader = new ResourceFactory(directoryProvider);
diff --git a/server/container/core/src/test/java/org/apache/james/core/filesystem/FileSystemImplTest.java b/server/container/core/src/test/java/org/apache/james/core/filesystem/FileSystemImplTest.java
index 7dda1cd84a7..28c9de4ef23 100644
--- a/server/container/core/src/test/java/org/apache/james/core/filesystem/FileSystemImplTest.java
+++ b/server/container/core/src/test/java/org/apache/james/core/filesystem/FileSystemImplTest.java
@@ -26,20 +26,7 @@ public class FileSystemImplTest extends AbstractFileSystemTest {
@Override
protected FileSystem buildFileSystem(String configurationRootDirectory) {
- return new FileSystemImpl(new TestDirectoryProvider(configurationRootDirectory));
+ return new FileSystemImpl(new JamesServerResourceLoader(configurationRootDirectory));
}
- private class TestDirectoryProvider extends JamesServerResourceLoader {
- private String configurationRootDirectory;
-
- public TestDirectoryProvider(String configurationRootDirectory) {
- this.configurationRootDirectory = configurationRootDirectory;
- }
-
- @Override
- public String getRootDirectory() {
- return configurationRootDirectory;
- }
- }
-
}
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxCopierManagement.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxCopierManagement.java
index c2961427d4f..c4e61b3ff61 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxCopierManagement.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxCopierManagement.java
@@ -22,7 +22,6 @@
import java.util.HashMap;
import java.util.Map;
-import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
@@ -46,9 +45,7 @@ public class MailboxCopierManagement implements MailboxCopierManagementMBean {
private MailboxManagerResolver resolver;
@Inject
- @Named("mailboxcopier")
- @Resource(name = "mailboxcopier")
- public void setMailboxCopier(MailboxCopier copier) {
+ public void setMailboxCopier(@Named("mailboxcopier") MailboxCopier copier) {
this.copier = copier;
}
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
index d9e1f516a24..098af84511d 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerManagement.java
@@ -22,7 +22,6 @@
import java.util.Collections;
import java.util.List;
-import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
import javax.management.NotCompliantMBeanException;
@@ -48,7 +47,6 @@ public class MailboxManagerManagement extends StandardMBean implements MailboxMa
private Logger log;
@Inject
- @Resource(name = "mailboxmanager")
public void setMailboxManager(@Named("mailboxmanager") MailboxManager mailboxManager) {
this.mailboxManager = mailboxManager;
}
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerResolverException.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerResolverException.java
index 80cf7d80f98..d80f3caaf80 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerResolverException.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/MailboxManagerResolverException.java
@@ -20,8 +20,16 @@
public class MailboxManagerResolverException extends RuntimeException {
+ public MailboxManagerResolverException() {
+ super();
+ }
+
public MailboxManagerResolverException(Throwable cause) {
super(cause);
}
+ public MailboxManagerResolverException(String message) {
+ super(message);
+ }
+
}
\ No newline at end of file
diff --git a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java
index c69e3063b5e..6d6f4b3e56f 100644
--- a/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java
+++ b/server/container/mailbox-adapter/src/main/java/org/apache/james/adapter/mailbox/store/UserRepositoryAuthenticator.java
@@ -19,9 +19,7 @@
package org.apache.james.adapter.mailbox.store;
-import javax.annotation.Resource;
import javax.inject.Inject;
-import javax.inject.Named;
import org.apache.james.lifecycle.api.LogEnabled;
import org.apache.james.mailbox.store.Authenticator;
@@ -39,8 +37,7 @@ public class UserRepositoryAuthenticator implements Authenticator, LogEnabled {
private Logger log;
@Inject
- @Resource(name = "usersrepository")
- public void setUsersRepository(@Named("usersrepository") UsersRepository repos) {
+ public void setUsersRepository(UsersRepository repos) {
this.repos = repos;
}
diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java
index ecb7e06bed9..2f06d1e955c 100644
--- a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java
+++ b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factory/protocols/ProtocolHandlerLoaderBeanFactory.java
@@ -21,10 +21,8 @@
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.container.spring.bean.factory.AbstractBeanFactory;
-import org.apache.james.protocols.api.handler.LifecycleAwareProtocolHandler;
import org.apache.james.protocols.api.handler.ProtocolHandler;
import org.apache.james.protocols.lib.handler.ProtocolHandlerLoader;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
@@ -38,9 +36,7 @@ public ProtocolHandler load(String name, Configuration config) throws LoadingExc
// Use the classloader which is used for bean instance stuff
Class c = (Class) getBeanFactory().getBeanClassLoader().loadClass(name);
ProtocolHandler handler = (ProtocolHandler) getBeanFactory().createBean(c, AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT, true);
- if (handler instanceof LifecycleAwareProtocolHandler) {
- ((InitializingLifecycleAwareProtocolHandler) handler).init(config);
- }
+ handler.init(config);
return handler;
} catch (ClassNotFoundException e) {
throw new LoadingException("Unable to load handler", e);
diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/context/JamesServerApplicationContext.java b/server/container/spring/src/main/java/org/apache/james/container/spring/context/JamesServerApplicationContext.java
index 1d6d11a3192..06dba52b10c 100644
--- a/server/container/spring/src/main/java/org/apache/james/container/spring/context/JamesServerApplicationContext.java
+++ b/server/container/spring/src/main/java/org/apache/james/container/spring/context/JamesServerApplicationContext.java
@@ -34,7 +34,7 @@ public class JamesServerApplicationContext extends ClassPathXmlApplicationContex
* The resourceloader to use. This must be defined as static, otherwise it
* will fail to startup..
*/
- private final static JamesResourceLoader resourceLoader = new DefaultJamesResourceLoader(new JamesServerResourceLoader());
+ private final static JamesResourceLoader resourceLoader = new DefaultJamesResourceLoader(new JamesServerResourceLoader("../"));
public JamesServerApplicationContext(String[] configs) {
super(configs);
diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/tool/James23Importer.java b/server/container/spring/src/main/java/org/apache/james/container/spring/tool/James23Importer.java
index be11684c13e..2e71bdc5926 100644
--- a/server/container/spring/src/main/java/org/apache/james/container/spring/tool/James23Importer.java
+++ b/server/container/spring/src/main/java/org/apache/james/container/spring/tool/James23Importer.java
@@ -56,21 +56,18 @@ public class James23Importer implements LogEnabled {
* James 3.0 users repository.
*/
@Inject
- @Named("usersrepository")
private UsersRepository james30UsersRepository;
/**
* James 3.0 users repository.
*/
@Inject
- @Named("mailrepositorystore")
private MailRepositoryStore mailRepositoryStore;
/**
* James 3.0 domain list.
*/
@Inject
- @Named("domainlist")
private DomainList domainList;
/**
diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagement.java b/server/container/spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagement.java
index f131f7df4d1..b1a5e49be47 100644
--- a/server/container/spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagement.java
+++ b/server/container/spring/src/main/java/org/apache/james/container/spring/tool/James23ImporterManagement.java
@@ -23,7 +23,6 @@
import org.apache.james.user.api.UsersRepositoryException;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.mail.MessagingException;
import java.io.IOException;
@@ -33,7 +32,6 @@
public class James23ImporterManagement implements James23ImporterManagementMBean {
@Inject
- @Named("james23importer")
private James23Importer james23Importer;
@Override
diff --git a/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml b/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml
index f6b5f153dac..fe5022289bd 100644
--- a/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml
+++ b/server/container/spring/src/main/resources/META-INF/org/apache/james/spring-server.xml
@@ -21,9 +21,12 @@
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd">
@@ -33,6 +36,9 @@
===========================================================================
-->
+
+
+
@@ -132,6 +138,8 @@
+
+
+
+ com.google.inject
+ guice
+ 4.0
+
+
+ com.google.inject.extensions
+ guice-multibindings
+ 4.0
+
+
+ org.apache.onami.lifecycle
+ org.apache.onami.lifecycle.jsr250
+ 0.2.0-SNAPSHOT
+
+
org.apache.james.karaf
@@ -1254,7 +1293,6 @@
test${hadoop.version}
-
info.cukescucumber-java
@@ -1276,6 +1314,11 @@
${cucumber.version}test
+
+ com.jayway.awaitility
+ awaitility
+ 1.6.3
+
diff --git a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java
index 84da1520fd0..0857f5a3733 100644
--- a/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java
+++ b/server/protocols/fetchmail/src/main/java/org/apache/james/fetchmail/FetchScheduler.java
@@ -70,25 +70,21 @@ public class FetchScheduler implements FetchSchedulerMBean, LogEnabled, Configur
private DomainList domainList;
@Inject
- @Resource
public void setMailQueueFactory(MailQueueFactory queueFactory) {
this.queueFactory = queueFactory;
}
@Inject
- @Resource
public void setDNSService(DNSService dns) {
this.dns = dns;
}
@Inject
- @Resource
public void setUsersRepository(UsersRepository urepos) {
this.urepos = urepos;
}
@Inject
- @Resource
public void setDomainList(DomainList domainList) {
this.domainList = domainList;
}
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
index 4e1d819ebaf..648a57d5801 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServer.java
@@ -22,9 +22,7 @@
import java.util.concurrent.TimeUnit;
-import javax.annotation.Resource;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.net.ssl.SSLEngine;
import org.apache.commons.configuration.ConfigurationException;
@@ -75,17 +73,17 @@ public class IMAPServer extends AbstractConfigurableAsyncServer implements ImapC
public final static int DEFAULT_LITERAL_SIZE_LIMIT = 0;
@Inject
- public void setImapProcessor(@Named("imapProcessor") ImapProcessor processor) {
+ public void setImapProcessor(ImapProcessor processor) {
this.processor = processor;
}
@Inject
- public void setImapDecoder(@Named("imapDecoder") ImapDecoder decoder) {
+ public void setImapDecoder(ImapDecoder decoder) {
this.decoder = decoder;
}
@Inject
- public void setImapEncoder(@Named("imapEncoder") ImapEncoder encoder) {
+ public void setImapEncoder(ImapEncoder encoder) {
this.encoder = encoder;
}
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServerFactory.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServerFactory.java
index 39ba60abd75..84414c6f36d 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServerFactory.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/IMAPServerFactory.java
@@ -22,7 +22,6 @@
import java.util.List;
import javax.inject.Inject;
-import javax.inject.Named;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.james.filesystem.api.FileSystem;
@@ -41,22 +40,22 @@ public class IMAPServerFactory extends AbstractServerFactory {
private ImapProcessor processor;
@Inject
- public final void setFileSystem(@Named("filesystem") FileSystem filesystem) {
+ public final void setFileSystem(FileSystem filesystem) {
this.fileSystem = filesystem;
}
@Inject
- public void setImapProcessor(@Named("imapProcessor") ImapProcessor processor) {
+ public void setImapProcessor(ImapProcessor processor) {
this.processor = processor;
}
@Inject
- public void setImapDecoder(@Named("imapDecoder") ImapDecoder decoder) {
+ public void setImapDecoder(ImapDecoder decoder) {
this.decoder = decoder;
}
@Inject
- public void setImapEncoder(@Named("imapEncoder") ImapEncoder encoder) {
+ public void setImapEncoder(ImapEncoder encoder) {
this.encoder = encoder;
}
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
index 2c1ff0cdf61..a6c270eab65 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/ProtocolHandlerChainImpl.java
@@ -24,11 +24,11 @@
import org.apache.commons.configuration.DefaultConfigurationBuilder;
import org.apache.commons.configuration.HierarchicalConfiguration;
import org.apache.james.protocols.api.handler.ExtensibleHandler;
+import org.apache.james.protocols.api.handler.ProtocolHandler;
import org.apache.james.protocols.api.handler.ProtocolHandlerChain;
import org.apache.james.protocols.api.handler.WiringException;
import org.apache.james.protocols.lib.handler.HandlersPackage;
import org.apache.james.protocols.lib.handler.ProtocolHandlerLoader;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
import java.util.LinkedList;
import java.util.List;
@@ -150,12 +150,12 @@ public LinkedList getHandlers(Class type) {
}
/**
- * Destroy all loaded {@link InitializingLifecycleAwareProtocolHandler}
+ * Destroy all loaded {@link ProtocolHandler}
*/
@Override
public void destroy() {
- LinkedList lHandlers = getHandlers(InitializingLifecycleAwareProtocolHandler.class);
- for (InitializingLifecycleAwareProtocolHandler handler : lHandlers) {
+ LinkedList lHandlers = getHandlers(ProtocolHandler.class);
+ for (ProtocolHandler handler : lHandlers) {
handler.destroy();
}
}
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerResultJMXMonitor.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerResultJMXMonitor.java
index 720caad97c6..64b7d2b92f3 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerResultJMXMonitor.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractCommandHandlerResultJMXMonitor.java
@@ -20,7 +20,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -28,17 +27,12 @@
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession;
import org.apache.james.protocols.api.Response;
-import org.apache.james.protocols.api.handler.CommandHandler;
-import org.apache.james.protocols.api.handler.ExtensibleHandler;
-import org.apache.james.protocols.api.handler.ProtocolHandler;
-import org.apache.james.protocols.api.handler.ProtocolHandlerResultHandler;
-import org.apache.james.protocols.api.handler.WiringException;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import org.apache.james.protocols.api.handler.*;
/**
* Expose JMX statistics for {@link CommandHandler}
*/
-public abstract class AbstractCommandHandlerResultJMXMonitor implements ProtocolHandlerResultHandler, ExtensibleHandler, InitializingLifecycleAwareProtocolHandler {
+public abstract class AbstractCommandHandlerResultJMXMonitor implements ProtocolHandlerResultHandler, ExtensibleHandler, ProtocolHandler {
private final Map cStats = new HashMap();
private String jmxName;
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractConnectHandlerResultJMXMonitor.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractConnectHandlerResultJMXMonitor.java
index 3995d59a98f..da10dc3a158 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractConnectHandlerResultJMXMonitor.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractConnectHandlerResultJMXMonitor.java
@@ -20,27 +20,25 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.protocols.api.ProtocolSession;
-import org.apache.james.protocols.api.Response;
import org.apache.james.protocols.api.handler.ConnectHandler;
import org.apache.james.protocols.api.handler.ExtensibleHandler;
import org.apache.james.protocols.api.handler.ProtocolHandler;
import org.apache.james.protocols.api.handler.ProtocolHandlerResultHandler;
import org.apache.james.protocols.api.handler.WiringException;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import org.apache.james.protocols.api.ProtocolSession;
+import org.apache.james.protocols.api.Response;
/**
* Handler which will gather statistics for {@link ConnectHandler}'s
*
* @param
*/
-public abstract class AbstractConnectHandlerResultJMXMonitor implements ProtocolHandlerResultHandler, ExtensibleHandler, InitializingLifecycleAwareProtocolHandler {
+public abstract class AbstractConnectHandlerResultJMXMonitor implements ProtocolHandlerResultHandler, ExtensibleHandler, ProtocolHandler {
private final Map cStats = new HashMap();
private String jmxName;
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractLineHandlerResultJMXMonitor.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractLineHandlerResultJMXMonitor.java
index ebdf89cfb3f..4cd7b8ccb3a 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractLineHandlerResultJMXMonitor.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/jmx/AbstractLineHandlerResultJMXMonitor.java
@@ -20,7 +20,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -28,19 +27,14 @@
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.ProtocolSession;
import org.apache.james.protocols.api.Response;
-import org.apache.james.protocols.api.handler.ExtensibleHandler;
-import org.apache.james.protocols.api.handler.LineHandler;
-import org.apache.james.protocols.api.handler.ProtocolHandler;
-import org.apache.james.protocols.api.handler.ProtocolHandlerResultHandler;
-import org.apache.james.protocols.api.handler.WiringException;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import org.apache.james.protocols.api.handler.*;
/**
* Handler which will gather statistics for {@link LineHandler}'s
*
* @param
*/
-public abstract class AbstractLineHandlerResultJMXMonitor implements ProtocolHandlerResultHandler, ExtensibleHandler, InitializingLifecycleAwareProtocolHandler {
+public abstract class AbstractLineHandlerResultJMXMonitor implements ProtocolHandlerResultHandler, ExtensibleHandler, ProtocolHandler {
private final Map lStats = new HashMap();
private String jmxName;
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
index 4a0ade9eaf3..3611afb4c8f 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractConfigurableAsyncServer.java
@@ -31,7 +31,6 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import javax.net.ssl.KeyManagerFactory;
@@ -117,7 +116,7 @@ public abstract class AbstractConfigurableAsyncServer extends AbstractAsyncServe
private MBeanServer mbeanServer;
@Inject
- public final void setFileSystem(@Named("filesystem") FileSystem filesystem) {
+ public final void setFileSystem(FileSystem filesystem) {
this.fileSystem = filesystem;
}
diff --git a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractProtocolAsyncServer.java b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractProtocolAsyncServer.java
index f0424ac7a91..ec9903824a1 100644
--- a/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractProtocolAsyncServer.java
+++ b/server/protocols/protocols-library/src/main/java/org/apache/james/protocols/lib/netty/AbstractProtocolAsyncServer.java
@@ -19,7 +19,6 @@
package org.apache.james.protocols.lib.netty;
import javax.inject.Inject;
-import javax.inject.Named;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.HierarchicalConfiguration;
@@ -41,7 +40,7 @@ public abstract class AbstractProtocolAsyncServer extends AbstractConfigurableAs
private HierarchicalConfiguration config;
@Inject
- public void setProtocolHandlerLoader(@Named("protocolhandlerloader") ProtocolHandlerLoader loader) {
+ public void setProtocolHandlerLoader(ProtocolHandlerLoader loader) {
this.loader = loader;
}
diff --git a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
index 8985cf31a8f..4af3a7e662c 100644
--- a/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
+++ b/server/protocols/protocols-library/src/test/java/org/apache/james/protocols/lib/mock/MockProtocolHandlerLoader.java
@@ -25,6 +25,7 @@ public ProtocolHandler load(String name, Configuration config) throws LoadingExc
ProtocolHandler obj = create(name);
injectResources(obj);
postConstruct(obj);
+ init(obj, config);
synchronized (this) {
loaderRegistry.add(obj);
}
@@ -35,13 +36,19 @@ public ProtocolHandler load(String name, Configuration config) throws LoadingExc
}
private final Map servicesByName = new HashMap();
+ private final Map, Object> servicesByType = new HashMap, Object>();
+
public Object get(String name) {
- Object service = servicesByName.get(name);
- return service;
+ return servicesByName.get(name);
}
- public void put(String role, Object service) {
- servicesByName.put(role, service);
+ public Object get(Class> type) {
+ return servicesByType.get(type);
+ }
+
+ public void put(String role, Class serviceType, U instance) {
+ servicesByName.put(role, instance);
+ servicesByType.put(serviceType, instance);
}
private final List
*/
-public class SpamAssassinHandler implements JamesMessageHook, InitializingLifecycleAwareProtocolHandler {
+public class SpamAssassinHandler implements JamesMessageHook, ProtocolHandler {
/** The port spamd is listen on */
private int spamdPort = 783;
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java
index 07ff445ae9f..72c5b2e1a18 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/SpamTrapHandler.java
@@ -21,11 +21,11 @@
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import org.apache.james.protocols.api.handler.ProtocolHandler;
import java.util.Arrays;
-public class SpamTrapHandler extends org.apache.james.protocols.smtp.core.fastfail.SpamTrapHandler implements InitializingLifecycleAwareProtocolHandler {
+public class SpamTrapHandler extends org.apache.james.protocols.smtp.core.fastfail.SpamTrapHandler implements ProtocolHandler {
@Override
public void init(Configuration config) throws ConfigurationException {
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/URIRBLHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/URIRBLHandler.java
index f5e570696c5..78f8d5bae12 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/URIRBLHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/URIRBLHandler.java
@@ -26,7 +26,6 @@
import java.util.Iterator;
import javax.inject.Inject;
-import javax.inject.Named;
import javax.mail.MessagingException;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
@@ -37,7 +36,7 @@
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.protocols.api.ProtocolSession.State;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import org.apache.james.protocols.api.handler.ProtocolHandler;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.dsn.DSNStatus;
import org.apache.james.protocols.smtp.hook.HookResult;
@@ -51,7 +50,7 @@
* Extract domains from message and check against URIRBLServer. For more
* informations see www.surbl.org
*/
-public class URIRBLHandler implements JamesMessageHook, InitializingLifecycleAwareProtocolHandler {
+public class URIRBLHandler implements JamesMessageHook, ProtocolHandler {
/** This log is the fall back shared by all instances */
private static final Logger FALLBACK_LOG = LoggerFactory.getLogger(URIRBLHandler.class);
@@ -88,7 +87,7 @@ public final DNSService getDNSService() {
* the dnsService to set
*/
@Inject
- public final void setDNSService(@Named("dnsservice") DNSService dnsService) {
+ public final void setDNSService(DNSService dnsService) {
this.dnsService = dnsService;
}
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java
index 956add8ffc0..782a55056bc 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptHandler.java
@@ -19,13 +19,12 @@
package org.apache.james.smtpserver.fastfail;
import javax.inject.Inject;
-import javax.inject.Named;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.domainlist.api.DomainList;
import org.apache.james.domainlist.api.DomainListException;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import org.apache.james.protocols.api.handler.ProtocolHandler;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.core.fastfail.AbstractValidRcptHandler;
@@ -39,7 +38,7 @@
/**
* Handler which reject invalid recipients
*/
-public class ValidRcptHandler extends AbstractValidRcptHandler implements InitializingLifecycleAwareProtocolHandler {
+public class ValidRcptHandler extends AbstractValidRcptHandler implements ProtocolHandler {
private UsersRepository users;
@@ -65,7 +64,7 @@ public final UsersRepository getUsers() {
* the users to set
*/
@Inject
- public final void setUsersRepository(@Named("usersrepository") UsersRepository users) {
+ public final void setUsersRepository(UsersRepository users) {
this.users = users;
}
@@ -81,7 +80,7 @@ public final void setRecipientRewriteTable(RecipientRewriteTable vut) {
}
@Inject
- public void setDomainList(@Named("domainlist") DomainList domains) {
+ public void setDomainList(DomainList domains) {
this.domains = domains;
}
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java
index 769ec7cede4..f97c2878e4e 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidRcptMX.java
@@ -24,14 +24,13 @@
import java.util.Iterator;
import javax.inject.Inject;
-import javax.inject.Named;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.dnsservice.api.TemporaryResolutionException;
import org.apache.james.dnsservice.library.netmatcher.NetMatcher;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
+import org.apache.james.protocols.api.handler.ProtocolHandler;
import org.apache.james.protocols.smtp.MailAddress;
import org.apache.james.protocols.smtp.SMTPRetCode;
import org.apache.james.protocols.smtp.SMTPSession;
@@ -46,7 +45,7 @@
* This class can be used to reject email with bogus MX which is send from a
* authorized user or an authorized network.
*/
-public class ValidRcptMX implements InitializingLifecycleAwareProtocolHandler, RcptHook {
+public class ValidRcptMX implements RcptHook, ProtocolHandler {
/**
* This log is the fall back shared by all instances
@@ -90,7 +89,7 @@ public final DNSService getDNSService() {
* @param dnsService the dnsService to set
*/
@Inject
- public final void setDNSService(@Named("dnsservice") DNSService dnsService) {
+ public final void setDNSService(DNSService dnsService) {
this.dnsService = dnsService;
}
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
index 9423b347571..b6830d3d44b 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/fastfail/ValidSenderDomainHandler.java
@@ -23,6 +23,8 @@
import javax.inject.Inject;
import javax.inject.Named;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.protocols.smtp.SMTPSession;
@@ -31,7 +33,7 @@ public class ValidSenderDomainHandler extends org.apache.james.protocols.smtp.co
private DNSService dnsService;
@Inject
- public void setDNSService(@Named("dnsservice") DNSService dnsService) {
+ public void setDNSService(DNSService dnsService) {
this.dnsService = dnsService;
}
@@ -53,4 +55,13 @@ protected boolean hasMXRecord(SMTPSession session, String domain) {
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/HookResultJMXMonitor.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/HookResultJMXMonitor.java
index 01f9101cdfd..60b0b1e194c 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/HookResultJMXMonitor.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/HookResultJMXMonitor.java
@@ -20,15 +20,14 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.api.handler.ExtensibleHandler;
+import org.apache.james.protocols.api.handler.ProtocolHandler;
import org.apache.james.protocols.api.handler.WiringException;
-import org.apache.james.protocols.lib.lifecycle.InitializingLifecycleAwareProtocolHandler;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.Hook;
import org.apache.james.protocols.smtp.hook.HookResult;
@@ -38,7 +37,7 @@
* {@link HookResultHook} implementation which will register a
* {@link HookStatsMBean} under JMX for every Hook it processed
*/
-public class HookResultJMXMonitor implements HookResultHook, ExtensibleHandler, InitializingLifecycleAwareProtocolHandler {
+public class HookResultJMXMonitor implements HookResultHook, ExtensibleHandler, ProtocolHandler {
private final Map hookStats = new HashMap();
private String jmxPath;
diff --git a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/JMXHandlersLoader.java b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/JMXHandlersLoader.java
index 2699e304fec..4548ae373ae 100644
--- a/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/JMXHandlersLoader.java
+++ b/server/protocols/protocols-smtp/src/main/java/org/apache/james/smtpserver/jmx/JMXHandlersLoader.java
@@ -21,6 +21,8 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.ConfigurationException;
import org.apache.james.protocols.lib.handler.HandlersPackage;
public class JMXHandlersLoader implements HandlersPackage {
@@ -40,4 +42,13 @@ public List getHandlers() {
return handlers;
}
+ @Override
+ public void init(Configuration config) throws ConfigurationException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
index c045e72de61..6274b0ff50c 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
@@ -48,18 +48,23 @@
import org.apache.commons.net.smtp.SMTPClient;
import org.apache.commons.net.smtp.SMTPReply;
import org.apache.james.dnsservice.api.DNSService;
+import org.apache.james.domainlist.api.DomainList;
import org.apache.james.domainlist.api.mock.SimpleDomainList;
+import org.apache.james.filesystem.api.FileSystem;
import org.apache.james.filesystem.api.mock.MockFileSystem;
+import org.apache.james.mailrepository.api.MailRepositoryStore;
import org.apache.james.mailrepository.mock.MockMailRepositoryStore;
import org.apache.james.protocols.lib.PortUtil;
import org.apache.james.protocols.lib.mock.MockProtocolHandlerLoader;
import org.apache.james.protocols.netty.AbstractChannelPipelineFactory;
+import org.apache.james.queue.api.MailQueueFactory;
import org.apache.james.queue.api.mock.MockMailQueue;
import org.apache.james.queue.api.mock.MockMailQueueFactory;
import org.apache.james.rrt.api.RecipientRewriteTable;
import org.apache.james.rrt.api.RecipientRewriteTableException;
import org.apache.james.rrt.lib.Mappings;
import org.apache.james.smtpserver.netty.SMTPServer;
+import org.apache.james.user.api.UsersRepository;
import org.apache.james.user.lib.mock.MockUsersRepository;
import org.apache.mailet.HostAddress;
import org.apache.mailet.Mail;
@@ -219,19 +224,18 @@ protected void setUpFakeLoader() {
chain = new MockProtocolHandlerLoader();
- chain.put("usersrepository", usersRepository);
+ chain.put("usersrepository", UsersRepository.class, usersRepository);
dnsServer = new AlterableDNSServer();
- chain.put("dnsservice", dnsServer);
+ chain.put("dnsservice", DNSService.class, dnsServer);
store = new MockMailRepositoryStore();
- chain.put("mailStore", store);
+ chain.put("mailStore", MailRepositoryStore.class, store);
fileSystem = new MockFileSystem();
- chain.put("fileSystem", fileSystem);
- chain.put("org.apache.james.smtpserver.protocol.DNSService", dnsService);
+ chain.put("fileSystem", FileSystem.class, fileSystem);
- chain.put("recipientrewritetable", new RecipientRewriteTable() {
+ chain.put("recipientrewritetable", RecipientRewriteTable.class, new RecipientRewriteTable() {
@Override
public void addRegexMapping(String user, String domain, String regex) throws RecipientRewriteTableException {
@@ -307,11 +311,10 @@ public Mappings getMappings(String user, String domain) throws ErrorMappingExcep
}
});
- chain.put("org.apache.james.smtpserver.protocol.DNSService", dnsService);
queueFactory = new MockMailQueueFactory();
queue = (MockMailQueue) queueFactory.getQueue(MockMailQueueFactory.SPOOL);
- chain.put("mailqueuefactory", queueFactory);
- chain.put("domainlist", new SimpleDomainList() {
+ chain.put("mailqueuefactory", MailQueueFactory.class, queueFactory);
+ chain.put("domainlist", DomainList.class, new SimpleDomainList() {
@Override
public boolean containsDomain(String serverName) {
@@ -1337,7 +1340,7 @@ public void testDNSRBLRejectWorks() throws Exception {
smtpProtocol.setSender(sender);
smtpProtocol.addRecipient("mail@sample.com");
- assertEquals("reject", 550, smtpProtocol.getReplyCode());
+ assertEquals("reject", 554, smtpProtocol.getReplyCode());
smtpProtocol.sendShortMessageData("Subject: test\r\n\r\nTest body testDNSRBLRejectWorks\r\n");
diff --git a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobTransferPolicy.java b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobTransferPolicy.java
index 6b0c104b99b..a3482fea0e4 100644
--- a/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobTransferPolicy.java
+++ b/server/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/FileSystemBlobTransferPolicy.java
@@ -18,9 +18,7 @@
****************************************************************/
package org.apache.james.queue.activemq;
-import javax.annotation.Resource;
import javax.inject.Inject;
-import javax.inject.Named;
import org.apache.activemq.blob.BlobDownloadStrategy;
import org.apache.activemq.blob.BlobTransferPolicy;
@@ -39,8 +37,7 @@ public class FileSystemBlobTransferPolicy extends BlobTransferPolicy {
private FileSystemBlobStrategy strategy;
@Inject
- @Resource(name = "filesystem")
- public void setFileSystem(@Named("filesystem") FileSystem fileSystem) {
+ public void setFileSystem(FileSystem fileSystem) {
this.fileSystem = fileSystem;
}
diff --git a/server/queue/queue-activemq/src/main/resources/META-INF/spring/activemq-queue-context.xml b/server/queue/queue-activemq/src/main/resources/META-INF/spring/activemq-queue-context.xml
index af8858e714d..5f307bd7951 100644
--- a/server/queue/queue-activemq/src/main/resources/META-INF/spring/activemq-queue-context.xml
+++ b/server/queue/queue-activemq/src/main/resources/META-INF/spring/activemq-queue-context.xml
@@ -24,7 +24,9 @@
http://activemq.apache.org/schema/core/activemq-core.xsd">
-
+
+
+
+
+
+
+ Apache James Server 3 - Cassandra Configuration
+
+
+
+
+
+
+
See also more specific configurations related to TLS,
+ Sieve and
+ Antispam.
+
+
+
+
+
+
diff --git a/server/src/site/xdoc/index.xml b/server/src/site/xdoc/index.xml
index d7c0e144d62..ca4bf79c62e 100644
--- a/server/src/site/xdoc/index.xml
+++ b/server/src/site/xdoc/index.xml
@@ -64,6 +64,12 @@
manage, monitor
and develop Apache James Server.
+
+ We are currently working on an experimental module which goal is to simplify the configuration process.
+ This module only supports the Cassandra backend yet,
+ and may be started with docker.
+
+
Download Apache James Mail Server 3.0-beta4 and quick-start it!
@@ -118,12 +124,14 @@
-
+
-
Configure the stores,... via the well-known Spring framework - read more.
diff --git a/server/src/site/xdoc/quick-start-cassandra.xml b/server/src/site/xdoc/quick-start-cassandra.xml
new file mode 100644
index 00000000000..ae9cc5f5647
--- /dev/null
+++ b/server/src/site/xdoc/quick-start-cassandra.xml
@@ -0,0 +1,187 @@
+
+
+
+
+
+ Apache James Server 3 - Quick Start for Cassandra backend
+
+
+
+
+
+
+
The goal of the document is to allow anyone to start with James on Docker as an operational mail server.
+
The method described bellow should not be used in production.
+
+
+Step 0: Requirements
+####################
+
+ * Java 8 SDK
+ * 512MB RAM (launches with -Xmx512M - can use less, can need more, depending on load)
+ * Docker 1.7.1+
+ * Maven 3.3
+
+Step 1: Download
+#################
+
+ * Clone the James git repository
+
+$ git clone git://git.apache.org/james-project.git
+
+Step 3: Compile
+###############
+
+ * Compile the Guice Cassandra project
+
+$ mvn package -DskipTests -am -pl server/container/cassandra-guice
+
+Step 3: Deploy
+##############
+
+3.1. Deploy Cassandra (optional)
+You may skip this part if you already have a running Cassandra on your network.
+
+$ docker run --name=cassandra cassandra
+
+3.2. Deploy ElasticSearch (optional)
+You may skip this part if you already have a running ElasticSearch on your network.
+
+$ docker run --name=elasticsearch elasticsearch:1.5.2
+
+Step 4: Configure
+#################
+
+ * Follow the Cassandra guice configuration documentation.
+ * We need to provide the key we will use for TLS. For obvious reasons, this is not provided in this git.
+
+Copy your TSL keys to ./conf/keystore or generate it using :
+
+$ keytool -genkey -alias james -keyalg RSA -keystore ./conf/keystore
+
+You will have to put the keystore password in the right xml files (imapserver.xml, pop3server.xml, smtpserver.xml)
+
+Step 5: Start
+#############
+
+ * Run James
+
+$ java -Dworking.directory=WORKING_PATH -jar server/container/cassandra-guice/target/james-server-cassandra-guice-beta5-SNAPSHOT.jar
+
+Where :
+- WORKING_PATH is the path where are located your configuration file folder.
+
+Step 6: Create Domains and Users
+################################
+
+Time to add domains and users.
+
+$ java -jar server/container/cli/target/james-server-cli-3.0.0-beta5-SNAPSHOT.jar -h 127.0.0.1 -p 9999 adddomain DOMAIN
+
+$ java -jar server/container/cli/target/james-server-cli-3.0.0-beta5-SNAPSHOT.jar -h 127.0.0.1 -p 9999 adduser USER_MAIL_ADDRESSPASSWORD
+
+Where :
+- DOMAIN is the domain you want to handle with this server.
+- USER_MAIL_ADDRESS is the mail address that will be used by this user.
+- PASSWORD is the password that will be used by this user.
+
+Step 8: Test
+############
+
+$ telnet HOSTNAME 25
+Trying HOSTNAME...
+Connected to HOSTNAME.
+Escape character is '^]'.
+220 172.16.1.131 SMTP Server (JAMES SMTP Server 3.0-beta4) ready Sat, 6 Nov 2010 17:31:33 +0100 (CET)
+ehlo test
+250-172.16.1.131 Hello test (aoscommunity.com [127.0.0.1])
+250-PIPELINING
+250-ENHANCEDSTATUSCODES
+250 8BITMIME
+mail from:<YOUR_NAME@YOUR_DOMAIN>
+250 2.1.0 Sender <YOUR_NAME@YOUR_DOMAIN> OK
+rcpt to:<YOUR_NAME@YOUR_DOMAIN>
+250 2.1.5 Recipient <YOUR_NAME@YOUR_DOMAIN> OK
+data
+354 Ok Send data ending with <CRLF>.<CRLF>
+subject: test
+
+this is a test
+.
+250 2.6.0 Message received
+quit
+Connection closed by foreign host.
+
+Step 8: Manage
+##############
+
+8.1. Manage via james-cli
+
+ usage:
+$ java -jar server/container/cli/target/james-server-cli-3.0.0-beta5-SNAPSHOT.jar -h 127.0.0.1 -p 9999
+
+ Available commands:
+ adduser </username> </password>
+ removeuser </username>
+ listusers
+ adddomain </domainname>
+ removedomain </domainname>
+ listdomains
+
+8.2. Manage via JMX
+
+ * Launch jconsole (or any other JMX client) and connect on URL=service:jmx:rmi:///jndi/rmi://localhost:HOSTNAME/jmxrmi
+ * Select the MBeans tab and open the org.apache.james node to view attributes and execute operations.
+
+Step 9: Monitor
+###############
+
+ * Monitor the ./log/james-server.log log file.
+
+ * Monitor via JMX (launch any JMX client and connect to URL=service:jmx:rmi:///jndi/rmi://HOSTNAME:9999/jmxrmi)
+
+ * Check ./var folder usage
+
+ mail
+ +-error
+ +-address-error
+ +-relay-denied
+ +-spam
+
+ store
+ +-maildir
+ +-derby
+ +-jackrabbit
+ +-activemq
+ +-brokers
+ +-james
+ +-blob-transfer
+ +-outgoing
+ +-spool
+
+ * Check /tmp folder usage
+
+
+
+
+
+
+
+