http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/pom.xml 
b/server/container/guice/guice-common/pom.xml
new file mode 100644
index 0000000..291aa47
--- /dev/null
+++ b/server/container/guice/guice-common/pom.xml
@@ -0,0 +1,291 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <parent>
+        <artifactId>james-server</artifactId>
+        <groupId>org.apache.james</groupId>
+        <version>3.0.0-beta5-SNAPSHOT</version>
+        <relativePath>../../../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>james-server-guice-common</artifactId>
+
+    <name>Apache James :: Server :: Guice Common</name>
+    <description>Common modules for Guice implementation of James 
server</description>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>disable-build-for-older-jdk</id>
+            <activation>
+                <jdk>(,1.8)</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-jar-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>default-jar</id>
+                                <phase>none</phase>
+                            </execution>
+                            <execution>
+                                <id>jar</id>
+                                <phase>none</phase>
+                            </execution>
+                            <execution>
+                                <id>test-jar</id>
+                                <phase>none</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>default-compile</id>
+                                <phase>none</phase>
+                            </execution>
+                            <execution>
+                                <id>default-testCompile</id>
+                                <phase>none</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>default-test</id>
+                                <phase>none</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-source-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>attach-sources</id>
+                                <phase>none</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-install-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>default-install</id>
+                                <phase>none</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-resources-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>default-resources</id>
+                                <phase>none</phase>
+                            </execution>
+                            <execution>
+                                <id>default-testResources</id>
+                                <phase>none</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-site-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>attach-descriptor</id>
+                                <phase>none</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>build-for-jdk-8</id>
+            <activation>
+                <jdk>[1.8,)</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-compiler-plugin</artifactId>
+                        <configuration>
+                            <source>1.8</source>
+                            <target>1.8</target>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+            <dependencies>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>apache-james-mailbox-tool</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>apache-mailet-standard</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-cli</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-core</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-data-api</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-data-file</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-data-library</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-dnsservice-api</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-dnsservice-dnsjava</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-dnsservice-library</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-filesystem-api</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-jmap</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-mailets</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-mailetcontainer-api</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-mailetcontainer-camel</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-protocols-imap4</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-protocols-library</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-protocols-lmtp</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-protocols-managesieve</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-protocols-pop3</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-protocols-smtp</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-queue-api</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>${project.groupId}</groupId>
+                    <artifactId>james-server-queue-activemq</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.james.protocols</groupId>
+                    <artifactId>protocols-imap</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.james.protocols</groupId>
+                    <artifactId>protocols-managesieve</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>com.google.inject</groupId>
+                    <artifactId>guice</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>com.google.inject.extensions</groupId>
+                    <artifactId>guice-multibindings</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>com.jayway.awaitility</groupId>
+                    <artifactId>awaitility</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>com.jayway.restassured</groupId>
+                    <artifactId>rest-assured</artifactId>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.apache.onami.lifecycle</groupId>
+                    <artifactId>org.apache.onami.lifecycle.jsr250</artifactId>
+                </dependency>
+                <dependency>
+                    <groupId>org.assertj</groupId>
+                    <artifactId>assertj-core</artifactId>
+                    <version>${assertj-3.version}</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-api</artifactId>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>disable-animal-sniffer</id>
+            <activation>
+                <jdk>[1.6,)</jdk>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>animal-sniffer-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>check_java_6</id>
+                                <phase>none</phase>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/cassandra.properties
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/cassandra.properties 
b/server/container/guice/guice-common/sample-configuration/cassandra.properties
new file mode 100644
index 0000000..1358332
--- /dev/null
+++ 
b/server/container/guice/guice-common/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

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/dnsservice.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/dnsservice.xml 
b/server/container/guice/guice-common/sample-configuration/dnsservice.xml
new file mode 100644
index 0000000..0978a00
--- /dev/null
+++ b/server/container/guice/guice-common/sample-configuration/dnsservice.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+  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.                                           
+ -->
+
+<dnsservice>
+  <servers>
+    <server>8.8.8.8</server>
+    <server>62.210.16.6</server>
+  </servers>
+  <autodiscover>false</autodiscover>
+  <authoritative>false</authoritative>
+  <maxcachesize>50000</maxcachesize>
+</dnsservice>

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/domainlist.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/domainlist.xml 
b/server/container/guice/guice-common/sample-configuration/domainlist.xml
new file mode 100644
index 0000000..8d00118
--- /dev/null
+++ b/server/container/guice/guice-common/sample-configuration/domainlist.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+  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.                                           
+ -->
+
+<domainlist class="org.apache.james.domainlist.jpa.JPADomainList">
+    <domainnames>
+        <domainname>james.apache.org</domainname>
+    </domainnames>
+    <autodetect>true</autodetect>
+    <autodetectIP>true</autodetectIP>
+    <defaultDomain>localhost</defaultDomain>
+</domainlist>

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/elasticsearch.properties
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/elasticsearch.properties
 
b/server/container/guice/guice-common/sample-configuration/elasticsearch.properties
new file mode 100644
index 0000000..924404c
--- /dev/null
+++ 
b/server/container/guice/guice-common/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

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/imapserver.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/imapserver.xml 
b/server/container/guice/guice-common/sample-configuration/imapserver.xml
new file mode 100644
index 0000000..c03b978
--- /dev/null
+++ b/server/container/guice/guice-common/sample-configuration/imapserver.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+
+<!--
+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.
+-->
+
+
+<imapservers>
+       <imapserver enabled="true">
+               <jmxName>imapserver</jmxName>
+               <bind>0.0.0.0:1143</bind>
+               <connectionBacklog>200</connectionBacklog>
+               <tls socketTLS="false" startTLS="true">
+                       <!-- To create a new keystore execute:
+            keytool -genkey -alias james -keyalg RSA -keystore 
/path/to/james/conf/keystore
+              -->
+                       <keystore>file://conf/keystore</keystore>
+                       <secret>james72laBalle</secret>
+                       
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+               </tls>
+               <connectionLimit>0</connectionLimit>
+               <connectionLimitPerIP>0</connectionLimitPerIP>
+       </imapserver>
+       <imapserver enabled="true">
+               <jmxName>imapserver-ssl</jmxName>
+               <bind>0.0.0.0:1993</bind>
+               <connectionBacklog>200</connectionBacklog>
+               <tls socketTLS="true" startTLS="false">
+                       <!-- To create a new keystore execute:
+              keytool -genkey -alias james -keyalg RSA -keystore 
/path/to/james/conf/keystore
+             -->
+                       <keystore>file://conf/keystore</keystore>
+                       <secret>james72laBalle</secret>
+                       
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+               </tls>
+               <connectionLimit>0</connectionLimit>
+               <connectionLimitPerIP>0</connectionLimitPerIP>
+       </imapserver>
+</imapservers>

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/jcr-repository.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/jcr-repository.xml 
b/server/container/guice/guice-common/sample-configuration/jcr-repository.xml
new file mode 100644
index 0000000..c1b998a
--- /dev/null
+++ 
b/server/container/guice/guice-common/sample-configuration/jcr-repository.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<!--
+   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 -->
+
+<!DOCTYPE Repository
+        PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 2.0//EN"
+        "http://jackrabbit.apache.org/dtd/repository-2.0.dtd";>
+
+<Repository>
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+        <param name="path" value="${rep.home}/repository"/>
+    </FileSystem>
+    <DataStore class="org.apache.jackrabbit.core.data.FileDataStore"/>
+    <Security appName="Jackrabbit">
+        <SecurityManager 
class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" 
workspaceName="security">
+        </SecurityManager>
+        <AccessManager 
class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
+        </AccessManager>
+        <LoginModule 
class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
+            <param name="anonymousId" value="anonymous"/>
+            <param name="adminId" value="admin"/>
+        </LoginModule>
+    </Security>
+    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="james"/>
+    <Workspace name="${wsp.name}">
+        <FileSystem 
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+            <param name="path" value="${wsp.home}"/>
+        </FileSystem>
+        <PersistenceManager 
class="org.apache.jackrabbit.core.persistence.pool.DerbyPersistenceManager">
+            <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
+            <param name="schemaObjectPrefix" value="${wsp.name}_"/>
+        </PersistenceManager>
+        <SearchIndex 
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+            <param name="path" value="${wsp.home}/index"/>
+            <param name="supportHighlighting" value="true"/>
+        </SearchIndex>
+    </Workspace>
+    <Versioning rootPath="${rep.home}/version">
+        <FileSystem 
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+            <param name="path" value="${rep.home}/version" />
+        </FileSystem>
+        <PersistenceManager 
class="org.apache.jackrabbit.core.persistence.pool.DerbyPersistenceManager">
+            <param name="url" 
value="jdbc:derby:${rep.home}/version/db;create=true"/>
+            <param name="schemaObjectPrefix" value="version_"/>
+        </PersistenceManager>
+    </Versioning>
+    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+        <param name="path" value="${rep.home}/repository/index"/>
+        <param name="supportHighlighting" value="true"/>
+    </SearchIndex>
+</Repository>

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/jmap.properties
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/jmap.properties 
b/server/container/guice/guice-common/sample-configuration/jmap.properties
new file mode 100644
index 0000000..d785ccd
--- /dev/null
+++ b/server/container/guice/guice-common/sample-configuration/jmap.properties
@@ -0,0 +1,11 @@
+# Configuration file for JMAP
+
+tls.keystoreURL=file://conf/keystore
+tls.secret=james72laBalle
+
+#
+# If you wish to use OAuth authentication, you should provide a valid JWT 
public key.
+# The following entry specify the link to the URL of the public key file,
+# which should be a PEM format file.
+#
+jwt.publickeypem.url=
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/jmx.properties
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/jmx.properties 
b/server/container/guice/guice-common/sample-configuration/jmx.properties
new file mode 100644
index 0000000..a1dbdf8
--- /dev/null
+++ b/server/container/guice/guice-common/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

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/lmtpserver.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/lmtpserver.xml 
b/server/container/guice/guice-common/sample-configuration/lmtpserver.xml
new file mode 100644
index 0000000..87a0caa
--- /dev/null
+++ b/server/container/guice/guice-common/sample-configuration/lmtpserver.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!--
+  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.                                           
+ -->
+
+<lmtpservers>
+
+    <lmtpserver enabled="false">
+        <jmxName>lmtpserver</jmxName>
+        <!-- LMTP should not be reachable from outside your network so bind it 
to loopback-->
+        <bind>127.0.0.1:1024</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <connectiontimeout>1200</connectiontimeout>
+        <!-- Set the maximum simultaneous incoming connections for this 
service -->
+        <connectionLimit>0</connectionLimit>
+        <!-- Set the maximum simultaneous incoming connections per IP for this 
service -->
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <!--  This sets the maximum allowed message size (in kilobytes) for 
this -->
+        <!--  LMTP service. If unspecified, the value defaults to 0, which 
means no limit. -->
+        <maxmessagesize>0</maxmessagesize>
+        <handlerchain>
+            <handler class="org.apache.james.lmtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+    </lmtpserver>
+
+</lmtpservers>

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/mailetcontainer.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/mailetcontainer.xml 
b/server/container/guice/guice-common/sample-configuration/mailetcontainer.xml
new file mode 100644
index 0000000..968b59c
--- /dev/null
+++ 
b/server/container/guice/guice-common/sample-configuration/mailetcontainer.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+ -->
+
+<mailetcontainer enableJmx="true">
+
+    <context>
+        <postmaster>postmas...@james.minet.net</postmaster>
+    </context>
+
+    <spooler>
+        <threads>20</threads>
+    </spooler>
+
+    <processors>
+        <processor state="root" enableJmx="true">
+            <mailet match="All" class="PostmasterAlias"/>
+            <mailet match="RelayLimit=30" class="Null"/>
+            <!-- Hook on sievemana...@james.linagora.com
+                 Mail send to this address will get interpreted with SIEVE 
Manage -->
+            <mailet match="RecipientIs=sievemana...@james.linagora.com" 
class="ToProcessor">
+                <processor>sieve-manager-check</processor>
+            </mailet>
+            <mailet match="HasMailAttribute=spamChecked" class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+            <mailet match="All" class="SetMailAttribute">
+                <spamChecked>true</spamChecked>
+            </mailet>
+            <mailet match="SMTPAuthSuccessful" class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+            <mailet match="InSpammerBlacklist=query.bondedsender.org." 
class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+            <!-- Check for delivery from a known spam server -->
+            <!-- This set of matchers/mailets redirect all emails from known 
-->
+            <!-- black holes, open relays, and spam servers to the spam 
processor -->
+            <!-- For this set to function properly, the spam processor must be 
configured. -->
+            <mailet match="InSpammerBlacklist=dnsbl.njabl.org." 
class="ToProcessor">
+                <processor>spam</processor>
+                <notice>550 Requested action not taken: rejected - see 
http://njabl.org/</notice>
+            </mailet>
+            <mailet match="All" class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+        </processor>
+
+        <processor state="error" enableJmx="true">
+            <mailet match="All" class="Bounce"/>
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>file://var/mail/error/</repositoryPath>
+            </mailet>
+        </processor>
+
+
+        <processor state="transport" enableJmx="true">
+            <mailet match="SMTPAuthSuccessful" class="SetMimeHeader">
+                <name>X-UserIsAuth</name>
+                <value>true</value>
+            </mailet>
+            <mailet 
match="HasMailAttribute=org.apache.james.SMIMECheckSignature" 
class="SetMimeHeader">
+                <name>X-WasSigned</name>
+                <value>true</value>
+            </mailet>
+            <mailet match="All" class="RecipientRewriteTable" />
+            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="HostIsLocal" class="ToProcessor">
+                <processor>local-address-error</processor>
+                <notice>550 - Requested action not taken: no such user 
here</notice>
+            </mailet>
+            <mailet match="SMTPAuthSuccessful" class="RemoteDelivery">
+                <outgoingQueue>outgoing</outgoingQueue>
+                <delayTime>5000, 100000, 500000</delayTime>
+                <maxRetries>25</maxRetries>
+                <maxDnsProblemRetries>0</maxDnsProblemRetries>
+                <deliveryThreads>10</deliveryThreads>
+                <sendpartial>true</sendpartial>
+                <bounceProcessor>bounces</bounceProcessor>
+            </mailet>
+            <mailet match="All" class="ToProcessor">
+                <processor>relay-denied</processor>
+            </mailet>
+        </processor>
+
+        <processor state="spam" enableJmx="true">
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>file://var/mail/spam/</repositoryPath>
+            </mailet>
+        </processor>
+
+        <processor state="local-address-error" enableJmx="true">
+            <mailet match="All" class="Bounce">
+                <attachment>none</attachment>
+            </mailet>
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>file://var/mail/address-error/</repositoryPath>
+            </mailet>
+        </processor>
+
+        <processor state="relay-denied" enableJmx="true">
+            <mailet match="All" class="Bounce">
+                <attachment>none</attachment>
+            </mailet>
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
+                <notice>Warning: You are sending an e-mail to a remote server. 
You must be authentified to perform such an operation</notice>
+            </mailet>
+        </processor>
+
+        <processor state="bounces" enableJmx="true">
+            <mailet match="All" class="DSNBounce">
+                <passThrough>false</passThrough>
+            </mailet>
+        </processor>
+    </processors>
+
+</mailetcontainer>
+
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/mailrepositorystore.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/mailrepositorystore.xml
 
b/server/container/guice/guice-common/sample-configuration/mailrepositorystore.xml
new file mode 100644
index 0000000..acca810
--- /dev/null
+++ 
b/server/container/guice/guice-common/sample-configuration/mailrepositorystore.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+ -->
+
+<mailrepositorystore>
+    <mailrepositories>
+        <!-- File based repositories.  These repositories store all message 
data -->
+        <!-- in the file system. -->
+        <mailrepository 
class="org.apache.james.mailrepository.file.FileMailRepository">
+            <protocols>
+                <protocol>file</protocol>
+            </protocols>
+            <!-- Set if the messages should be listed sorted. False by default 
-->
+            <config FIFO="false" CACHEKEYS="true"/>
+        </mailrepository>
+    </mailrepositories>
+</mailrepositorystore>

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/pop3server.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/pop3server.xml 
b/server/container/guice/guice-common/sample-configuration/pop3server.xml
new file mode 100644
index 0000000..c57c832
--- /dev/null
+++ b/server/container/guice/guice-common/sample-configuration/pop3server.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+  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.                                           
+ -->
+
+
+<pop3servers>
+    <pop3server enabled="false">
+        <jmxName>pop3server</jmxName>
+        <bind>0.0.0.0:1110</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="false">
+            <!-- To create a new keystore execute:
+                  keytool -genkey -alias james -keyalg RSA -keystore 
/path/to/james/conf/keystore
+             -->
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+        </tls>
+        <connectiontimeout>1200</connectiontimeout>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <handlerchain>
+            <handler 
class="org.apache.james.pop3server.core.CoreCmdHandlerLoader"/>
+        </handlerchain>
+    </pop3server>
+</pop3servers>

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/recipientrewritetable.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/recipientrewritetable.xml
 
b/server/container/guice/guice-common/sample-configuration/recipientrewritetable.xml
new file mode 100644
index 0000000..7e7f586
--- /dev/null
+++ 
b/server/container/guice/guice-common/sample-configuration/recipientrewritetable.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  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.                                           
+ -->
+
+<!-- The default table for storing James' RecipientRewriteTable mappings. -->
+<recipientrewritetable 
class="org.apache.james.rrt.jpa.JPARecipientRewriteTable">
+  <recursiveMapping>true</recursiveMapping>
+  <mappingLimit>10</mappingLimit>
+  <mapping>some@domain=some</mapping>
+</recipientrewritetable>
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/smtpserver.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/smtpserver.xml 
b/server/container/guice/guice-common/sample-configuration/smtpserver.xml
new file mode 100644
index 0000000..c34fcd1
--- /dev/null
+++ b/server/container/guice/guice-common/sample-configuration/smtpserver.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0"?>
+
+<!--
+  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.
+ -->
+
+<smtpservers>
+    <smtpserver enabled="true">
+        <jmxName>smtpserver-global</jmxName>
+        <bind>0.0.0.0:1025</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="false">
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+            <algorithm>SunX509</algorithm>
+        </tls>
+        <connectiontimeout>360</connectiontimeout>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <authRequired>false</authRequired>
+        <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+        <verifyIdentity>true</verifyIdentity>
+        <maxmessagesize>0</maxmessagesize>
+        <addressBracketsEnforcement>true</addressBracketsEnforcement>
+        <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+        <handlerchain>
+            <handler 
class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+            <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+    </smtpserver>
+    <smtpserver enabled="true">
+        <jmxName>smtpserver-TLS</jmxName>
+        <bind>0.0.0.0:1465</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="true" startTLS="false">
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+            <algorithm>SunX509</algorithm>
+        </tls>
+        <connectiontimeout>360</connectiontimeout>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <!--
+           Authorize only local users
+        -->
+        <authRequired>true</authRequired>
+        <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+        <!-- Trust authenticated users -->
+        <verifyIdentity>false</verifyIdentity>
+        <maxmessagesize>0</maxmessagesize>
+        <addressBracketsEnforcement>true</addressBracketsEnforcement>
+        <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+        <handlerchain>
+            <handler 
class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+            <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+    </smtpserver>
+    <smtpserver enabled="true">
+        <jmxName>smtpserver-authenticated</jmxName>
+        <bind>0.0.0.0:1587</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="true">
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+            <algorithm>SunX509</algorithm>
+        </tls>
+        <connectiontimeout>360</connectiontimeout>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <!--
+           Authorize only local users
+        -->
+        <authRequired>true</authRequired>
+        <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+        <!-- Trust authenticated users -->
+        <verifyIdentity>false</verifyIdentity>
+        <maxmessagesize>0</maxmessagesize>
+        <addressBracketsEnforcement>true</addressBracketsEnforcement>
+        <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting>
+        <handlerchain>
+            <handler 
class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
+            <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
+        </handlerchain>
+    </smtpserver>
+</smtpservers>
+
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/sample-configuration/usersrepository.xml
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/sample-configuration/usersrepository.xml 
b/server/container/guice/guice-common/sample-configuration/usersrepository.xml
new file mode 100644
index 0000000..fc76107
--- /dev/null
+++ 
b/server/container/guice/guice-common/sample-configuration/usersrepository.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<!--
+  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.                                           
+ -->
+
+<usersrepository name="LocalUsers" 
class="org.apache.james.user.jpa.JPAUsersRepository">
+    <destination URL="file://users/"/>
+    <algorithm>MD5</algorithm>
+    <enableVirtualHosting>true</enableVirtualHosting>
+    <enableForwarding>true</enableForwarding>
+</usersrepository>
+

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
new file mode 100644
index 0000000..6071f61
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/GuiceJamesServer.java
@@ -0,0 +1,94 @@
+/****************************************************************
+ * 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 java.util.Arrays;
+
+import javax.annotation.PreDestroy;
+
+import org.apache.james.jmap.JMAPServer;
+import org.apache.james.mailbox.store.mail.model.MailboxId;
+import org.apache.james.modules.CommonServicesModule;
+import org.apache.james.modules.MailetProcessingModule;
+import org.apache.james.modules.ProtocolsModule;
+import org.apache.james.utils.ConfigurationsPerformer;
+import org.apache.james.utils.ExtendedServerProbe;
+import org.apache.james.utils.GuiceGenericType;
+import org.apache.james.utils.GuiceServerProbe;
+import org.apache.onami.lifecycle.core.Stager;
+
+import com.google.common.collect.Iterables;
+import com.google.inject.Guice;
+import com.google.inject.Injector;
+import com.google.inject.Key;
+import com.google.inject.Module;
+import com.google.inject.TypeLiteral;
+import com.google.inject.util.Modules;
+
+public class GuiceJamesServer<Id extends MailboxId> {
+
+    private final TypeLiteral<Id> type;
+    private final Module module;
+    private final GuiceGenericType<Id> guiceGenericType;
+    private Stager<PreDestroy> preDestroy;
+    private GuiceServerProbe<Id> serverProbe;
+    private int jmapPort;
+
+    
+    public GuiceJamesServer(TypeLiteral<Id> type) {
+        this(type, Modules.combine(
+                        new CommonServicesModule<>(type),
+                        new ProtocolsModule<>(type),
+                        new MailetProcessingModule()));
+    }
+
+    private GuiceJamesServer(TypeLiteral<Id> type, Module module) {
+        this.type = type;
+        this.guiceGenericType = new GuiceGenericType<>(type);
+        this.module = module;
+    }
+    
+    public GuiceJamesServer<Id> combineWith(Module... modules) {
+        return new GuiceJamesServer<>(type, 
Modules.combine(Iterables.concat(Arrays.asList(module), 
Arrays.asList(modules))));
+    }
+    
+    public GuiceJamesServer<Id> overrideWith(Module... overrides) {
+        return new GuiceJamesServer<>(type, 
Modules.override(module).with(overrides));
+    }
+    
+    public void start() throws Exception {
+        Injector injector = Guice.createInjector(module);
+        injector.getInstance(ConfigurationsPerformer.class).initModules();
+        preDestroy = injector.getInstance(Key.get(new 
TypeLiteral<Stager<PreDestroy>>() {}));
+        serverProbe = 
injector.getInstance(Key.get(guiceGenericType.newGenericType(GuiceServerProbe.class)));
+        jmapPort = injector.getInstance(JMAPServer.class).getPort();
+    }
+
+    public void stop() {
+        preDestroy.stage();
+    }
+
+    public ExtendedServerProbe<Id> serverProbe() {
+        return serverProbe;
+    }
+
+    public int getJmapPort() {
+        return jmapPort;
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
new file mode 100644
index 0000000..d2ad4b0
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPCommonModule.java
@@ -0,0 +1,70 @@
+/****************************************************************
+ * 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.jmap;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.james.jmap.api.AccessTokenManager;
+import org.apache.james.jmap.api.ContinuationTokenManager;
+import org.apache.james.jmap.api.access.AccessTokenRepository;
+import org.apache.james.jmap.crypto.AccessTokenManagerImpl;
+import org.apache.james.jmap.crypto.JamesSignatureHandler;
+import org.apache.james.jmap.crypto.SignatureHandler;
+import org.apache.james.jmap.crypto.SignedContinuationTokenManager;
+import org.apache.james.jmap.memory.access.MemoryAccessTokenRepository;
+import org.apache.james.jmap.send.MailFactory;
+import org.apache.james.jmap.send.MailSpool;
+import org.apache.james.jmap.utils.DefaultZonedDateTimeProvider;
+import org.apache.james.jmap.utils.ZonedDateTimeProvider;
+
+import com.google.common.collect.ImmutableList;
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.name.Names;
+
+public class JMAPCommonModule extends AbstractModule {
+    
+    private static final long DEFAULT_TOKEN_EXPIRATION_IN_MS = 
TimeUnit.MILLISECONDS.convert(15, TimeUnit.MINUTES);
+
+    @Override
+    protected void configure() {
+        bind(SignatureHandler.class).to(JamesSignatureHandler.class);
+        
bind(ZonedDateTimeProvider.class).to(DefaultZonedDateTimeProvider.class);
+        
bind(ContinuationTokenManager.class).to(SignedContinuationTokenManager.class);
+
+        
bindConstant().annotatedWith(Names.named(AccessTokenRepository.TOKEN_EXPIRATION_IN_MS)).to(DEFAULT_TOKEN_EXPIRATION_IN_MS);
+        
bind(AccessTokenRepository.class).to(MemoryAccessTokenRepository.class);
+        bind(AccessTokenManager.class).to(AccessTokenManagerImpl.class);
+
+        bind(MailSpool.class).in(Singleton.class);
+        bind(MailFactory.class).in(Singleton.class);
+    }
+
+    @Provides
+    public List<AuthenticationStrategy> authStrategies(
+            AccessTokenAuthenticationStrategy 
accessTokenAuthenticationStrategy,
+            JWTAuthenticationStrategy jwtAuthenticationStrategy) {
+
+        return ImmutableList.of(
+                jwtAuthenticationStrategy,
+                accessTokenAuthenticationStrategy);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
new file mode 100644
index 0000000..9a5aee7
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/JMAPModule.java
@@ -0,0 +1,127 @@
+/****************************************************************
+ * 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.jmap;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Optional;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.commons.configuration.PropertiesConfiguration;
+import org.apache.commons.io.FileUtils;
+import org.apache.james.filesystem.api.FileSystem;
+import org.apache.james.jmap.methods.RequestHandler;
+import org.apache.james.mailbox.MailboxManager;
+import org.apache.james.mailbox.store.mail.model.MailboxId;
+import org.apache.james.utils.ConfigurationPerformer;
+import org.apache.james.utils.ConfigurationProvider;
+
+import com.github.fge.lambdas.Throwing;
+import com.google.common.base.Preconditions;
+import com.google.inject.AbstractModule;
+import com.google.inject.Inject;
+import com.google.inject.Provides;
+import com.google.inject.Singleton;
+import com.google.inject.TypeLiteral;
+import com.google.inject.multibindings.Multibinder;
+
+public class JMAPModule<Id extends MailboxId> extends AbstractModule {
+    private static final int DEFAULT_JMAP_PORT = 80;
+    private final TypeLiteral<Id> type;
+
+    public JMAPModule(TypeLiteral<Id> type) {
+        this.type = type;
+    }
+
+    @Override
+    protected void configure() {
+        install(new JMAPCommonModule());
+        install(new MethodsModule<Id>(type));
+        bind(RequestHandler.class).in(Singleton.class);
+        Multibinder<ConfigurationPerformer> preconditions = 
Multibinder.newSetBinder(binder(), ConfigurationPerformer.class);
+        preconditions.addBinding().to(MailetConfigurationPrecondition.class);
+        preconditions.addBinding().to(MoveCapabilityPrecondition.class);
+    }
+
+    @Provides
+    @Singleton
+    JMAPConfiguration provideConfiguration(FileSystem fileSystem) throws 
ConfigurationException, IOException{
+        PropertiesConfiguration configuration = getConfiguration(fileSystem);
+        return JMAPConfiguration.builder()
+                .keystore(configuration.getString("tls.keystoreURL"))
+                .secret(configuration.getString("tls.secret"))
+                .jwtPublicKeyPem(loadPublicKey(fileSystem, 
Optional.ofNullable(configuration.getString("jwt.publickeypem.url"))))
+                .port(configuration.getInt("jmap.port", DEFAULT_JMAP_PORT))
+                .build();
+    }
+
+    private PropertiesConfiguration getConfiguration(FileSystem fileSystem) 
throws FileNotFoundException, ConfigurationException {
+        return new 
PropertiesConfiguration(fileSystem.getFile(FileSystem.FILE_PROTOCOL_AND_CONF + 
"jmap.properties"));
+    }
+
+    private Optional<String> loadPublicKey(FileSystem fileSystem, 
Optional<String> jwtPublickeyPemUrl) {
+        return jwtPublickeyPemUrl.map(Throwing.function(url -> 
FileUtils.readFileToString(fileSystem.getFile(url))));
+    }
+
+    @Singleton
+    public static class MailetConfigurationPrecondition implements 
ConfigurationPerformer {
+
+        private final ConfigurationProvider configurationProvider;
+
+        @Inject
+        public MailetConfigurationPrecondition(ConfigurationProvider 
configurationProvider) {
+            this.configurationProvider = configurationProvider;
+        }
+
+        @Override
+        public void initModule() throws Exception {
+            Optional<HierarchicalConfiguration> removeMimeHeaderMailet = 
configurationProvider.getConfiguration("mailetcontainer")
+                .configurationAt("processors")
+                .configurationsAt("processor")
+                .stream()
+                .filter(processor -> 
processor.getString("[@state]").equals("transport"))
+                .flatMap(transport -> 
transport.configurationsAt("mailet").stream())
+                .filter(mailet -> 
mailet.getString("[@class]").equals("RemoveMimeHeader"))
+                .filter(mailet -> mailet.getString("[@match]").equals("All"))
+                .filter(mailet -> mailet.getProperty("name").equals("bcc"))
+                .findAny();
+            if (!removeMimeHeaderMailet.isPresent()) {
+                throw new ConfigurationException("Missing RemoveMimeHeader in 
mailets configuration (mailetcontainer -> processors -> transport). Should be 
configured to remove Bcc header");
+            }
+        }
+    }
+
+    @Singleton
+    public static class MoveCapabilityPrecondition implements 
ConfigurationPerformer {
+
+        private final MailboxManager mailboxManager;
+
+        @Inject
+        public MoveCapabilityPrecondition(MailboxManager mailboxManager) {
+            this.mailboxManager = mailboxManager;
+        }
+
+        @Override
+        public void initModule() throws Exception {
+            
Preconditions.checkArgument(mailboxManager.getSupportedCapabilities().contains(MailboxManager.Capabilities.Move),
+                    "MOVE support in MailboxManager is required by JMAP 
Module");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java
new file mode 100644
index 0000000..897f4bf
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/jmap/MethodsModule.java
@@ -0,0 +1,74 @@
+/****************************************************************
+ * 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.jmap;
+
+import org.apache.james.jmap.json.ObjectMapperFactory;
+import org.apache.james.jmap.methods.GetMailboxesMethod;
+import org.apache.james.jmap.methods.GetMessageListMethod;
+import org.apache.james.jmap.methods.GetMessagesMethod;
+import org.apache.james.jmap.methods.JmapRequestParser;
+import org.apache.james.jmap.methods.JmapRequestParserImpl;
+import org.apache.james.jmap.methods.JmapResponseWriter;
+import org.apache.james.jmap.methods.JmapResponseWriterImpl;
+import org.apache.james.jmap.methods.Method;
+import org.apache.james.jmap.methods.SetMessagesCreationProcessor;
+import org.apache.james.jmap.methods.SetMessagesDestructionProcessor;
+import org.apache.james.jmap.methods.SetMessagesMethod;
+import org.apache.james.jmap.methods.SetMessagesProcessor;
+import org.apache.james.jmap.methods.SetMessagesUpdateProcessor;
+import org.apache.james.mailbox.store.mail.model.MailboxId;
+import org.apache.james.utils.GuiceGenericType;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Singleton;
+import com.google.inject.TypeLiteral;
+import com.google.inject.multibindings.Multibinder;
+import com.google.inject.name.Names;
+
+public class MethodsModule<Id extends MailboxId> extends AbstractModule {
+
+    private final GuiceGenericType<Id> guiceGenericType;
+
+    public MethodsModule(TypeLiteral<Id> type) {
+        this.guiceGenericType = new GuiceGenericType<>(type);
+    }
+
+    @Override
+    protected void configure() {
+        
bind(JmapRequestParser.class).to(JmapRequestParserImpl.class).in(Singleton.class);
+        
bind(JmapResponseWriter.class).to(JmapResponseWriterImpl.class).in(Singleton.class);
+        bind(ObjectMapperFactory.class).in(Singleton.class);
+
+        
bindConstant().annotatedWith(Names.named(GetMessageListMethod.MAXIMUM_LIMIT)).to(GetMessageListMethod.DEFAULT_MAXIMUM_LIMIT);
+
+        Multibinder<Method> methods = Multibinder.newSetBinder(binder(), 
Method.class);
+        
methods.addBinding().to(guiceGenericType.newGenericType(GetMailboxesMethod.class));
+        
methods.addBinding().to(guiceGenericType.newGenericType(GetMessageListMethod.class));
+        
methods.addBinding().to(guiceGenericType.newGenericType(GetMessagesMethod.class));
+        
methods.addBinding().to(guiceGenericType.newGenericType(SetMessagesMethod.class));
+
+        Multibinder<SetMessagesProcessor<Id>> setMessagesProcessors = 
+                Multibinder.newSetBinder(binder(), 
guiceGenericType.newGenericType(SetMessagesProcessor.class));
+        
setMessagesProcessors.addBinding().to(guiceGenericType.newGenericType(SetMessagesUpdateProcessor.class));
+        
setMessagesProcessors.addBinding().to(guiceGenericType.newGenericType(SetMessagesCreationProcessor.class));
+        
setMessagesProcessors.addBinding().to(guiceGenericType.newGenericType(SetMessagesDestructionProcessor.class));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
new file mode 100644
index 0000000..175a92b
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
@@ -0,0 +1,79 @@
+/****************************************************************
+ * 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.mailbox.store.mail.model.MailboxId;
+import org.apache.james.modules.server.ConfigurationProviderModule;
+import org.apache.james.modules.server.DNSServiceModule;
+import org.apache.james.utils.ConfigurationProvider;
+import org.apache.james.utils.FileConfigurationProvider;
+import org.apache.james.utils.GuiceGenericType;
+import org.apache.james.utils.GuiceServerProbe;
+import org.apache.onami.lifecycle.jsr250.PreDestroyModule;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Provides;
+import com.google.inject.TypeLiteral;
+
+public class CommonServicesModule<Id extends MailboxId> extends AbstractModule 
{
+    
+    public static final String CONFIGURATION_PATH = "configurationPath";
+    private final GuiceGenericType<Id> guiceGenericType;
+    
+    public CommonServicesModule(TypeLiteral<Id> type) {
+        guiceGenericType = new GuiceGenericType<>(type);
+    }
+    
+    @Override
+    protected void configure() {
+        install(new ConfigurationProviderModule());
+        install(new PreDestroyModule());
+        install(new DNSServiceModule());
+        
+        bind(FileSystem.class).to(FileSystemImpl.class);
+        bind(ConfigurationProvider.class).to(FileConfigurationProvider.class);
+        TypeLiteral<GuiceServerProbe<Id>> serverProbe = 
guiceGenericType.newGenericType(GuiceServerProbe.class);
+        bind(serverProbe).in(Singleton.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);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/modules/MailetProcessingModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/MailetProcessingModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/MailetProcessingModule.java
new file mode 100644
index 0000000..507549a
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/MailetProcessingModule.java
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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 org.apache.james.modules.server.CamelMailetContainerModule;
+import org.apache.james.modules.server.MailStoreRepositoryModule;
+import org.apache.james.modules.server.SieveModule;
+
+import com.google.inject.AbstractModule;
+
+public class MailetProcessingModule extends AbstractModule {
+
+    @Override
+    protected void configure() {
+        install(new SieveModule());
+        install(new MailStoreRepositoryModule());
+        install(new CamelMailetContainerModule());
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/modules/Names.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/Names.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/Names.java
new file mode 100644
index 0000000..b37ed14
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/Names.java
@@ -0,0 +1,24 @@
+/****************************************************************
+ * 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;
+
+public class Names {
+    public static final String MAILBOXMANAGER_NAME = "mailboxmanager";
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.java
new file mode 100644
index 0000000..c03575f
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/ProtocolsModule.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 org.apache.james.mailbox.store.mail.model.MailboxId;
+import org.apache.james.modules.protocols.IMAPServerModule;
+import org.apache.james.modules.protocols.JMAPServerModule;
+import org.apache.james.modules.protocols.LMTPServerModule;
+import org.apache.james.modules.protocols.ManageSieveServerModule;
+import org.apache.james.modules.protocols.POP3ServerModule;
+import org.apache.james.modules.protocols.ProtocolHandlerModule;
+import org.apache.james.modules.protocols.SMTPServerModule;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.TypeLiteral;
+
+public class ProtocolsModule<Id extends MailboxId> extends AbstractModule {
+
+    private final TypeLiteral<Id> type;
+
+    public ProtocolsModule(TypeLiteral<Id> type) {
+        this.type = type;
+    }
+
+    @Override
+    protected void configure() {
+        install(new JMAPServerModule<>(type));
+        install(new IMAPServerModule());
+        install(new ProtocolHandlerModule());
+        install(new POP3ServerModule());
+        install(new SMTPServerModule());
+        install(new LMTPServerModule());
+        install(new ManageSieveServerModule());
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/517a4cfe/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
 
b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/protocols/IMAPServerModule.java
new file mode 100644
index 0000000..2aea749
--- /dev/null
+++ 
b/server/container/guice/guice-common/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.Names;
+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(Names.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


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

Reply via email to