JAMES-1902 create a smtp only project that pulls only required dependencies
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/61e1bdca Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/61e1bdca Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/61e1bdca Branch: refs/heads/master Commit: 61e1bdca30c8a9d21a86e5baa46b25a7787fe741 Parents: 793dae7 Author: Matthieu Baechler <matthieu.baech...@gmail.com> Authored: Mon Jan 30 11:03:49 2017 +0100 Committer: benwa <btell...@linagora.com> Committed: Tue Mar 14 18:13:55 2017 +0700 ---------------------------------------------------------------------- server/container/guice/jpa-common-guice/pom.xml | 318 ++++++++++++++++++ .../james/modules/data/JPADataModule.java | 32 ++ .../james/modules/data/JPADomainListModule.java | 77 +++++ .../data/JPARecipientRewriteTableModule.java | 78 +++++ .../modules/data/JPAUsersRepositoryModule.java | 79 +++++ server/container/guice/jpa-guice/pom.xml | 4 + .../james/modules/data/JPADataModule.java | 32 -- .../james/modules/data/JPADomainListModule.java | 77 ----- .../data/JPARecipientRewriteTableModule.java | 78 ----- .../modules/data/JPAUsersRepositoryModule.java | 79 ----- server/container/guice/jpa-smtp/README.adoc | 40 +++ server/container/guice/jpa-smtp/pom.xml | 321 +++++++++++++++++++ .../sample-configuration/dnsservice.xml | 29 ++ .../sample-configuration/domainlist.xml | 28 ++ .../james-database.properties | 40 +++ .../sample-configuration/jmx.properties | 28 ++ .../sample-configuration/mailetcontainer.xml | 137 ++++++++ .../mailrepositorystore.xml | 34 ++ .../recipientrewritetable.xml | 27 ++ .../sample-configuration/smtpserver.xml | 105 ++++++ .../sample-configuration/usersrepository.xml | 27 ++ .../java/org/apache/james/JPAConfiguration.java | 66 ++++ .../org/apache/james/JPAJamesServerMain.java | 53 +++ .../src/main/resources/META-INF/persistence.xml | 41 +++ .../jpa-smtp/src/main/resources/logback.xml | 22 ++ .../org/apache/james/JPAJamesServerTest.java | 94 ++++++ .../james/TestJPAConfigurationModule.java | 48 +++ .../jpa-smtp/src/test/resources/dnsservice.xml | 29 ++ .../test/resources/fakemailrepositorystore.xml | 31 ++ .../guice/jpa-smtp/src/test/resources/keystore | Bin 0 -> 2245 bytes .../src/test/resources/mailetcontainer.xml | 123 +++++++ .../src/test/resources/mailrepositorystore.xml | 31 ++ .../src/test/resources/managesieveserver.xml | 65 ++++ .../jpa-smtp/src/test/resources/smtpserver.xml | 105 ++++++ server/container/guice/pom.xml | 7 + 35 files changed, 2119 insertions(+), 266 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-common-guice/pom.xml b/server/container/guice/jpa-common-guice/pom.xml new file mode 100644 index 0000000..34af8d0 --- /dev/null +++ b/server/container/guice/jpa-common-guice/pom.xml @@ -0,0 +1,318 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice</artifactId> + <version>3.0.0-beta6-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>james-server-jpa-common-guice</artifactId> + <packaging>jar</packaging> + + <name>Apache James :: Server :: JPA - guice common</name> + + <properties> + <jpa.includes>empty</jpa.includes> + </properties> + + <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-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/${project.artifactId}.lib</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <goals> + <goal>jar</goal> + </goals> + <configuration> + <finalName>${project.artifactId}</finalName> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>${project.artifactId}.lib/</classpathPrefix> + <mainClass>org.apache.james.JPAJamesServerMain</mainClass> + <useUniqueVersions>false</useUniqueVersions> + </manifest> + </archive> + </configuration> + </execution> + <execution> + <id>test-jar</id> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + <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>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>apache-james-mailbox-jpa</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>apache-james-mailbox-jpa</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>apache-james-mailbox-lucene</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-common</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-common</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.1.7</version> + </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>com.nurkiewicz.asyncretry</groupId> + <artifactId>asyncretry</artifactId> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj-3.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> + <id>jpa</id> + <properties> + <jpa.includes>**/*.java</jpa.includes> + </properties> + </profile> + <profile> + <id>animal-sniffer-java-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <configuration> + <signature> + <groupId>org.codehaus.mojo.signature</groupId> + <artifactId>java18</artifactId> + <version>1.0</version> + </signature> + </configuration> + <executions> + <execution> + <id>check_java_8</id> + <phase>test</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/suite/*.java</exclude> + <exclude>**/suite/**/*.java</exclude> + </excludes> + <includes> + <include>${jpa.includes}</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java new file mode 100644 index 0000000..ec8023e --- /dev/null +++ b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java @@ -0,0 +1,32 @@ +/**************************************************************** + * 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 com.google.inject.AbstractModule; + +public class JPADataModule extends AbstractModule { + + @Override + protected void configure() { + install(new JPAUsersRepositoryModule()); + install(new JPADomainListModule()); + install(new JPARecipientRewriteTableModule()); + } + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java new file mode 100644 index 0000000..4bb0030 --- /dev/null +++ b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.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.data; + +import com.google.common.base.Throwables; +import com.google.common.collect.ImmutableList; +import com.google.inject.AbstractModule; +import com.google.inject.Inject; +import com.google.inject.Scopes; +import com.google.inject.Singleton; +import com.google.inject.multibindings.Multibinder; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.james.domainlist.api.DomainList; +import org.apache.james.domainlist.jpa.JPADomainList; +import org.apache.james.lifecycle.api.Configurable; +import org.apache.james.utils.ConfigurationPerformer; +import org.apache.james.utils.ConfigurationProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +public class JPADomainListModule extends AbstractModule { + + private static final Logger LOGGER = LoggerFactory.getLogger(DomainList.class); + + @Override + public void configure() { + bind(JPADomainList.class).in(Scopes.SINGLETON); + bind(DomainList.class).to(JPADomainList.class); + Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPADomainListConfigurationPerformer.class); + } + + @Singleton + public static class JPADomainListConfigurationPerformer implements ConfigurationPerformer { + + private final ConfigurationProvider configurationProvider; + private final JPADomainList jpaDomainList; + + @Inject + public JPADomainListConfigurationPerformer(ConfigurationProvider configurationProvider, JPADomainList jpaDomainList) { + this.configurationProvider = configurationProvider; + this.jpaDomainList = jpaDomainList; + } + + @Override + public void initModule() { + try { + jpaDomainList.setLog(LOGGER); + jpaDomainList.configure(configurationProvider.getConfiguration("domainlist")); + } catch (ConfigurationException e) { + Throwables.propagate(e); + } + } + + @Override + public List<Class<? extends Configurable>> forClasses() { + return ImmutableList.of(JPADomainList.class); + } + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java new file mode 100644 index 0000000..a1f55b3 --- /dev/null +++ b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.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.modules.data; + +import com.google.common.base.Throwables; +import com.google.common.collect.ImmutableList; +import com.google.inject.AbstractModule; +import com.google.inject.Inject; +import com.google.inject.Scopes; +import com.google.inject.Singleton; +import com.google.inject.multibindings.Multibinder; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.james.lifecycle.api.Configurable; +import org.apache.james.rrt.api.RecipientRewriteTable; +import org.apache.james.rrt.jpa.JPARecipientRewriteTable; +import org.apache.james.utils.ConfigurationPerformer; +import org.apache.james.utils.ConfigurationProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +public class JPARecipientRewriteTableModule extends AbstractModule { + + private static final Logger LOGGER = LoggerFactory.getLogger(RecipientRewriteTable.class); + + @Override + public void configure() { + bind(JPARecipientRewriteTable.class).in(Scopes.SINGLETON); + bind(RecipientRewriteTable.class).to(JPARecipientRewriteTable.class); + Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPARecipientRewriteTablePerformer.class); + } + + @Singleton + public static class JPARecipientRewriteTablePerformer implements ConfigurationPerformer { + + private final ConfigurationProvider configurationProvider; + private final JPARecipientRewriteTable recipientRewriteTable; + + @Inject + public JPARecipientRewriteTablePerformer(ConfigurationProvider configurationProvider, JPARecipientRewriteTable recipientRewriteTable) { + this.configurationProvider = configurationProvider; + this.recipientRewriteTable = recipientRewriteTable; + } + + @Override + public void initModule() { + try { + recipientRewriteTable.setLog(LOGGER); + recipientRewriteTable.configure(configurationProvider.getConfiguration("recipientrewritetable")); + } catch (ConfigurationException e) { + Throwables.propagate(e); + } + } + + @Override + public List<Class<? extends Configurable>> forClasses() { + return ImmutableList.of(JPARecipientRewriteTable.class); + } + } + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java new file mode 100644 index 0000000..ca26073 --- /dev/null +++ b/server/container/guice/jpa-common-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.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.data; + +import com.google.common.base.Throwables; +import com.google.common.collect.ImmutableList; +import com.google.inject.AbstractModule; +import com.google.inject.Inject; +import com.google.inject.Scopes; +import com.google.inject.Singleton; +import com.google.inject.multibindings.Multibinder; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.james.lifecycle.api.Configurable; +import org.apache.james.user.api.UsersRepository; +import org.apache.james.user.jpa.JPAUsersRepository; +import org.apache.james.utils.ConfigurationPerformer; +import org.apache.james.utils.ConfigurationProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +public class JPAUsersRepositoryModule extends AbstractModule { + + private static final Logger LOGGER = LoggerFactory.getLogger(JPAUsersRepositoryModule.class); + + @Override + public void configure() { + bind(JPAUsersRepository.class).in(Scopes.SINGLETON); + bind(UsersRepository.class).to(JPAUsersRepository.class); + + Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPAUsersRepositoryConfigurationPerformer.class); + } + + @Singleton + public static class JPAUsersRepositoryConfigurationPerformer implements ConfigurationPerformer { + + private final ConfigurationProvider configurationProvider; + private final JPAUsersRepository usersRepository; + + @Inject + public JPAUsersRepositoryConfigurationPerformer(ConfigurationProvider configurationProvider, JPAUsersRepository usersRepository) { + this.configurationProvider = configurationProvider; + this.usersRepository = usersRepository; + } + + @Override + public void initModule() { + try { + usersRepository.setLog(LOGGER); + usersRepository.configure(configurationProvider.getConfiguration("usersrepository")); + } catch (ConfigurationException e) { + Throwables.propagate(e); + } + } + + @Override + public List<Class<? extends Configurable>> forClasses() { + return ImmutableList.of(JPAUsersRepository.class); + } + } + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-guice/pom.xml b/server/container/guice/jpa-guice/pom.xml index f02b70c..07ca6bf 100644 --- a/server/container/guice/jpa-guice/pom.xml +++ b/server/container/guice/jpa-guice/pom.xml @@ -226,6 +226,10 @@ <scope>test</scope> </dependency> <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-jpa-common-guice</artifactId> + </dependency> + <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.1.7</version> http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java deleted file mode 100644 index ec8023e..0000000 --- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADataModule.java +++ /dev/null @@ -1,32 +0,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. * - ****************************************************************/ -package org.apache.james.modules.data; - -import com.google.inject.AbstractModule; - -public class JPADataModule extends AbstractModule { - - @Override - protected void configure() { - install(new JPAUsersRepositoryModule()); - install(new JPADomainListModule()); - install(new JPARecipientRewriteTableModule()); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java deleted file mode 100644 index 4bb0030..0000000 --- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPADomainListModule.java +++ /dev/null @@ -1,77 +0,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. * - ****************************************************************/ -package org.apache.james.modules.data; - -import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableList; -import com.google.inject.AbstractModule; -import com.google.inject.Inject; -import com.google.inject.Scopes; -import com.google.inject.Singleton; -import com.google.inject.multibindings.Multibinder; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.james.domainlist.api.DomainList; -import org.apache.james.domainlist.jpa.JPADomainList; -import org.apache.james.lifecycle.api.Configurable; -import org.apache.james.utils.ConfigurationPerformer; -import org.apache.james.utils.ConfigurationProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -public class JPADomainListModule extends AbstractModule { - - private static final Logger LOGGER = LoggerFactory.getLogger(DomainList.class); - - @Override - public void configure() { - bind(JPADomainList.class).in(Scopes.SINGLETON); - bind(DomainList.class).to(JPADomainList.class); - Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPADomainListConfigurationPerformer.class); - } - - @Singleton - public static class JPADomainListConfigurationPerformer implements ConfigurationPerformer { - - private final ConfigurationProvider configurationProvider; - private final JPADomainList jpaDomainList; - - @Inject - public JPADomainListConfigurationPerformer(ConfigurationProvider configurationProvider, JPADomainList jpaDomainList) { - this.configurationProvider = configurationProvider; - this.jpaDomainList = jpaDomainList; - } - - @Override - public void initModule() { - try { - jpaDomainList.setLog(LOGGER); - jpaDomainList.configure(configurationProvider.getConfiguration("domainlist")); - } catch (ConfigurationException e) { - Throwables.propagate(e); - } - } - - @Override - public List<Class<? extends Configurable>> forClasses() { - return ImmutableList.of(JPADomainList.class); - } - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java deleted file mode 100644 index a1f55b3..0000000 --- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPARecipientRewriteTableModule.java +++ /dev/null @@ -1,78 +0,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. * - ****************************************************************/ -package org.apache.james.modules.data; - -import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableList; -import com.google.inject.AbstractModule; -import com.google.inject.Inject; -import com.google.inject.Scopes; -import com.google.inject.Singleton; -import com.google.inject.multibindings.Multibinder; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.james.lifecycle.api.Configurable; -import org.apache.james.rrt.api.RecipientRewriteTable; -import org.apache.james.rrt.jpa.JPARecipientRewriteTable; -import org.apache.james.utils.ConfigurationPerformer; -import org.apache.james.utils.ConfigurationProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -public class JPARecipientRewriteTableModule extends AbstractModule { - - private static final Logger LOGGER = LoggerFactory.getLogger(RecipientRewriteTable.class); - - @Override - public void configure() { - bind(JPARecipientRewriteTable.class).in(Scopes.SINGLETON); - bind(RecipientRewriteTable.class).to(JPARecipientRewriteTable.class); - Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPARecipientRewriteTablePerformer.class); - } - - @Singleton - public static class JPARecipientRewriteTablePerformer implements ConfigurationPerformer { - - private final ConfigurationProvider configurationProvider; - private final JPARecipientRewriteTable recipientRewriteTable; - - @Inject - public JPARecipientRewriteTablePerformer(ConfigurationProvider configurationProvider, JPARecipientRewriteTable recipientRewriteTable) { - this.configurationProvider = configurationProvider; - this.recipientRewriteTable = recipientRewriteTable; - } - - @Override - public void initModule() { - try { - recipientRewriteTable.setLog(LOGGER); - recipientRewriteTable.configure(configurationProvider.getConfiguration("recipientrewritetable")); - } catch (ConfigurationException e) { - Throwables.propagate(e); - } - } - - @Override - public List<Class<? extends Configurable>> forClasses() { - return ImmutableList.of(JPARecipientRewriteTable.class); - } - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java deleted file mode 100644 index ca26073..0000000 --- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/data/JPAUsersRepositoryModule.java +++ /dev/null @@ -1,79 +0,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. * - ****************************************************************/ -package org.apache.james.modules.data; - -import com.google.common.base.Throwables; -import com.google.common.collect.ImmutableList; -import com.google.inject.AbstractModule; -import com.google.inject.Inject; -import com.google.inject.Scopes; -import com.google.inject.Singleton; -import com.google.inject.multibindings.Multibinder; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.james.lifecycle.api.Configurable; -import org.apache.james.user.api.UsersRepository; -import org.apache.james.user.jpa.JPAUsersRepository; -import org.apache.james.utils.ConfigurationPerformer; -import org.apache.james.utils.ConfigurationProvider; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -public class JPAUsersRepositoryModule extends AbstractModule { - - private static final Logger LOGGER = LoggerFactory.getLogger(JPAUsersRepositoryModule.class); - - @Override - public void configure() { - bind(JPAUsersRepository.class).in(Scopes.SINGLETON); - bind(UsersRepository.class).to(JPAUsersRepository.class); - - Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(JPAUsersRepositoryConfigurationPerformer.class); - } - - @Singleton - public static class JPAUsersRepositoryConfigurationPerformer implements ConfigurationPerformer { - - private final ConfigurationProvider configurationProvider; - private final JPAUsersRepository usersRepository; - - @Inject - public JPAUsersRepositoryConfigurationPerformer(ConfigurationProvider configurationProvider, JPAUsersRepository usersRepository) { - this.configurationProvider = configurationProvider; - this.usersRepository = usersRepository; - } - - @Override - public void initModule() { - try { - usersRepository.setLog(LOGGER); - usersRepository.configure(configurationProvider.getConfiguration("usersrepository")); - } catch (ConfigurationException e) { - Throwables.propagate(e); - } - } - - @Override - public List<Class<? extends Configurable>> forClasses() { - return ImmutableList.of(JPAUsersRepository.class); - } - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/README.adoc ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/README.adoc b/server/container/guice/jpa-smtp/README.adoc new file mode 100644 index 0000000..bedf715 --- /dev/null +++ b/server/container/guice/jpa-smtp/README.adoc @@ -0,0 +1,40 @@ += Guice-JPA 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-jpa-smtp-${version}.jar + * james-server-jpa-smtp-${version}.lib + +== Running + +=== Requirements + +=== 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 +---- + +Once everything is set up, you just have to run the jar with : + +[source] +---- +$ java -Dworking.directory=sample-configuration -jar target/james-server-jpa-smtp-${version}.jar +---- http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/pom.xml b/server/container/guice/jpa-smtp/pom.xml new file mode 100644 index 0000000..430fb8f --- /dev/null +++ b/server/container/guice/jpa-smtp/pom.xml @@ -0,0 +1,321 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<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/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice</artifactId> + <version>3.0.0-beta6-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>james-server-jpa-smtp-guice</artifactId> + <packaging>jar</packaging> + + <name>Apache James :: Server :: JPA + SMTP - guice injection</name> + <description>An advanced email server - JPA backend for SMTP with guice injection</description> + + <properties> + <jpa.includes>empty</jpa.includes> + </properties> + + <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-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <phase>package</phase> + <goals> + <goal>copy-dependencies</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/${project.artifactId}.lib</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <goals> + <goal>jar</goal> + </goals> + <configuration> + <finalName>${project.artifactId}</finalName> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>${project.artifactId}.lib/</classpathPrefix> + <mainClass>org.apache.james.JPAJamesServerMain</mainClass> + <useUniqueVersions>false</useUniqueVersions> + </manifest> + </archive> + </configuration> + </execution> + <execution> + <id>test-jar</id> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + <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-backends-jpa</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-data-jpa</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-common</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-common</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-jpa-common-guice</artifactId> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.1.7</version> + </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <scope>test</scope> + </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>com.nurkiewicz.asyncretry</groupId> + <artifactId>asyncretry</artifactId> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>${assertj-3.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> + <id>jpa</id> + <properties> + <jpa.includes>**/*.java</jpa.includes> + </properties> + </profile> + <profile> + <id>animal-sniffer-java-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-maven-plugin</artifactId> + <configuration> + <signature> + <groupId>org.codehaus.mojo.signature</groupId> + <artifactId>java18</artifactId> + <version>1.0</version> + </signature> + </configuration> + <executions> + <execution> + <id>check_java_8</id> + <phase>test</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>**/suite/*.java</exclude> + <exclude>**/suite/**/*.java</exclude> + </excludes> + <includes> + <include>${jpa.includes}</include> + </includes> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/dnsservice.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/dnsservice.xml b/server/container/guice/jpa-smtp/sample-configuration/dnsservice.xml new file mode 100644 index 0000000..0978a00 --- /dev/null +++ b/server/container/guice/jpa-smtp/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/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/domainlist.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/domainlist.xml b/server/container/guice/jpa-smtp/sample-configuration/domainlist.xml new file mode 100644 index 0000000..8d00118 --- /dev/null +++ b/server/container/guice/jpa-smtp/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/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/james-database.properties ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/james-database.properties b/server/container/guice/jpa-smtp/sample-configuration/james-database.properties new file mode 100644 index 0000000..b3ac7eb --- /dev/null +++ b/server/container/guice/jpa-smtp/sample-configuration/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 http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/jmx.properties ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/jmx.properties b/server/container/guice/jpa-smtp/sample-configuration/jmx.properties new file mode 100644 index 0000000..a1dbdf8 --- /dev/null +++ b/server/container/guice/jpa-smtp/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/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/mailetcontainer.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/mailetcontainer.xml b/server/container/guice/jpa-smtp/sample-configuration/mailetcontainer.xml new file mode 100644 index 0000000..968b59c --- /dev/null +++ b/server/container/guice/jpa-smtp/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/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/mailrepositorystore.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/mailrepositorystore.xml b/server/container/guice/jpa-smtp/sample-configuration/mailrepositorystore.xml new file mode 100644 index 0000000..acca810 --- /dev/null +++ b/server/container/guice/jpa-smtp/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/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/recipientrewritetable.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/recipientrewritetable.xml b/server/container/guice/jpa-smtp/sample-configuration/recipientrewritetable.xml new file mode 100644 index 0000000..7e7f586 --- /dev/null +++ b/server/container/guice/jpa-smtp/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/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/smtpserver.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/smtpserver.xml b/server/container/guice/jpa-smtp/sample-configuration/smtpserver.xml new file mode 100644 index 0000000..c34fcd1 --- /dev/null +++ b/server/container/guice/jpa-smtp/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/61e1bdca/server/container/guice/jpa-smtp/sample-configuration/usersrepository.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/sample-configuration/usersrepository.xml b/server/container/guice/jpa-smtp/sample-configuration/usersrepository.xml new file mode 100644 index 0000000..fc76107 --- /dev/null +++ b/server/container/guice/jpa-smtp/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> + --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org