http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAConfiguration.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAConfiguration.java b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAConfiguration.java new file mode 100644 index 0000000..c0f7d76 --- /dev/null +++ b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAConfiguration.java @@ -0,0 +1,66 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ +package org.apache.james; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Preconditions; + +public class JPAConfiguration { + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String driverName; + private String driverURL; + + public Builder driverName(String driverName) { + this.driverName = driverName; + return this; + } + + public Builder driverURL(String driverURL) { + this.driverURL = driverURL; + return this; + } + + public JPAConfiguration build() { + Preconditions.checkNotNull(driverName); + Preconditions.checkNotNull(driverURL); + return new JPAConfiguration(driverName, driverURL); + } + } + + private final String driverName; + private final String driverURL; + + @VisibleForTesting JPAConfiguration(String driverName, String driverURL) { + this.driverName = driverName; + this.driverURL = driverURL; + } + + public String getDriverName() { + return driverName; + } + + public String getDriverURL() { + return driverURL; + } + +}
http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java new file mode 100644 index 0000000..ce01b8d --- /dev/null +++ b/server/container/guice/jpa-smtp/src/main/java/org/apache/james/JPAJamesServerMain.java @@ -0,0 +1,53 @@ +/**************************************************************** + * 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 javax.persistence.EntityManagerFactory; + +import org.apache.james.modules.data.JPADataModule; +import org.apache.james.modules.protocols.ProtocolHandlerModule; +import org.apache.james.modules.protocols.SMTPServerModule; +import org.apache.james.modules.server.ActiveMQQueueModule; +import org.apache.james.modules.server.JMXServerModule; +import org.apache.james.modules.server.RawPostDequeueDecoratorModule; +import org.apache.openjpa.persistence.OpenJPAPersistence; + +import com.google.inject.Module; +import com.google.inject.util.Modules; + +public class JPAJamesServerMain { + + public static final Module protocols = Modules.combine( + new ProtocolHandlerModule(), + new SMTPServerModule()); + + public static final Module jpaServerModule = Modules.combine( + new JPADataModule(), + (binder) -> binder.bind(EntityManagerFactory.class).toProvider(() -> OpenJPAPersistence.getEntityManagerFactory()), + new ActiveMQQueueModule(), + new RawPostDequeueDecoratorModule()); + + public static void main(String[] args) throws Exception { + GuiceJamesServer server = new GuiceJamesServer() + .combineWith(jpaServerModule, protocols, new JMXServerModule()); + server.start(); + } + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/main/resources/META-INF/persistence.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/main/resources/META-INF/persistence.xml b/server/container/guice/jpa-smtp/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..c2d612a --- /dev/null +++ b/server/container/guice/jpa-smtp/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,41 @@ +<?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. +--> + +<persistence xmlns="http://java.sun.com/xml/ns/persistence" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" + version="2.0"> + + <persistence-unit name="Global" transaction-type="RESOURCE_LOCAL"> + <class>org.apache.james.mailbox.jpa.mail.model.JPAUserFlag</class> + <class>org.apache.james.mailbox.jpa.user.model.JPASubscription</class> + <class>org.apache.james.domainlist.jpa.model.JPADomain</class> + <class>org.apache.james.user.jpa.model.JPAUser</class> + <class>org.apache.james.rrt.jpa.model.JPARecipientRewrite</class> + <properties> + <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> + <property name="openjpa.jdbc.MappingDefaults" value="ForeignKeyDeleteAction=cascade, JoinForeignKeyDeleteAction=cascade"/> + <property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/> + <property name="openjpa.jdbc.QuerySQLCache" value="false"/> + </properties> + + </persistence-unit> + +</persistence> http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/main/resources/logback.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/main/resources/logback.xml b/server/container/guice/jpa-smtp/src/main/resources/logback.xml new file mode 100644 index 0000000..0e1ff22 --- /dev/null +++ b/server/container/guice/jpa-smtp/src/main/resources/logback.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + + <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"> + <resetJUL>true</resetJUL> + </contextListener> + + <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern> + <immediateFlush>false</immediateFlush> + </encoder> + </appender> + + <root level="WARN"> + <appender-ref ref="CONSOLE" /> + </root> + + <logger name="org.apache.james" level="INFO"/> + + +</configuration> http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/java/org/apache/james/JPAJamesServerTest.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/java/org/apache/james/JPAJamesServerTest.java b/server/container/guice/jpa-smtp/src/test/java/org/apache/james/JPAJamesServerTest.java new file mode 100644 index 0000000..7a22c19 --- /dev/null +++ b/server/container/guice/jpa-smtp/src/test/java/org/apache/james/JPAJamesServerTest.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 static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.ByteBuffer; +import java.nio.channels.SocketChannel; +import java.nio.charset.Charset; + +import javax.persistence.EntityManagerFactory; + +import org.apache.james.backends.jpa.JpaTestCluster; +import org.apache.james.domainlist.jpa.model.JPADomain; +import org.apache.james.modules.TestFilesystemModule; +import org.apache.james.rrt.jpa.model.JPARecipientRewrite; +import org.apache.james.user.jpa.model.JPAUser; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; + +public class JPAJamesServerTest { + + private static final int SMTP_PORT = 1025; + + private GuiceJamesServer server; + private SocketChannel socketChannel; + + @Rule + public TemporaryFolder temporaryFolder = new TemporaryFolder(); + + @After + public void teardown() { + server.stop(); + } + + private org.apache.james.GuiceJamesServer createJamesServer() { + return new GuiceJamesServer() + .combineWith(JPAJamesServerMain.jpaServerModule, JPAJamesServerMain.protocols) + .overrideWith( + new TestFilesystemModule(temporaryFolder), + new TestJPAConfigurationModule(), + (binder) -> binder.bind(EntityManagerFactory.class) + .toInstance(JpaTestCluster.create(JPAUser.class, JPADomain.class, JPARecipientRewrite.class) + .getEntityManagerFactory())); + } + + @Before + public void setup() throws Exception { + server = createJamesServer(); + socketChannel = SocketChannel.open(); + server.start(); + } + + @After + public void tearDown() throws Exception { + server.stop(); + } + + @Test + public void connectSMTPServerShouldSendShabangOnConnect() throws Exception { + socketChannel.connect(new InetSocketAddress("127.0.0.1", SMTP_PORT)); + assertThat(getServerConnectionResponse(socketChannel)).startsWith("220 JAMES Linagora's SMTP awesome Server"); + } + + private String getServerConnectionResponse(SocketChannel socketChannel) throws IOException { + ByteBuffer byteBuffer = ByteBuffer.allocate(1000); + socketChannel.read(byteBuffer); + byte[] bytes = byteBuffer.array(); + return new String(bytes, Charset.forName("UTF-8")); + } + +} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/java/org/apache/james/TestJPAConfigurationModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/java/org/apache/james/TestJPAConfigurationModule.java b/server/container/guice/jpa-smtp/src/test/java/org/apache/james/TestJPAConfigurationModule.java new file mode 100644 index 0000000..7c064c4 --- /dev/null +++ b/server/container/guice/jpa-smtp/src/test/java/org/apache/james/TestJPAConfigurationModule.java @@ -0,0 +1,48 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james; + +import java.io.FileNotFoundException; + +import javax.inject.Singleton; + +import org.apache.commons.configuration.ConfigurationException; + +import com.google.inject.AbstractModule; +import com.google.inject.Provides; + +public class TestJPAConfigurationModule extends AbstractModule { + + private static final String JDBC_EMBEDDED_URL = "jdbc:derby:memory:mailboxintegration;create=true"; + private static final String JDBC_EMBEDDED_DRIVER = org.apache.derby.jdbc.EmbeddedDriver.class.getName(); + + @Override + protected void configure() { + } + + @Provides + @Singleton + JPAConfiguration provideConfiguration() throws FileNotFoundException, ConfigurationException{ + return JPAConfiguration.builder() + .driverName(JDBC_EMBEDDED_DRIVER) + .driverURL(JDBC_EMBEDDED_URL) + .build(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/dnsservice.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/resources/dnsservice.xml b/server/container/guice/jpa-smtp/src/test/resources/dnsservice.xml new file mode 100644 index 0000000..0978a00 --- /dev/null +++ b/server/container/guice/jpa-smtp/src/test/resources/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/src/test/resources/fakemailrepositorystore.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/resources/fakemailrepositorystore.xml b/server/container/guice/jpa-smtp/src/test/resources/fakemailrepositorystore.xml new file mode 100644 index 0000000..2d19a80 --- /dev/null +++ b/server/container/guice/jpa-smtp/src/test/resources/fakemailrepositorystore.xml @@ -0,0 +1,31 @@ +<?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> + <mailrepository class="org.apache.james.mailrepository.None"> + <protocols> + <protocol>file</protocol> + </protocols> + <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/src/test/resources/keystore ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/resources/keystore b/server/container/guice/jpa-smtp/src/test/resources/keystore new file mode 100644 index 0000000..536a6c7 Binary files /dev/null and b/server/container/guice/jpa-smtp/src/test/resources/keystore differ http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/mailetcontainer.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/resources/mailetcontainer.xml b/server/container/guice/jpa-smtp/src/test/resources/mailetcontainer.xml new file mode 100644 index 0000000..c51a7fb --- /dev/null +++ b/server/container/guice/jpa-smtp/src/test/resources/mailetcontainer.xml @@ -0,0 +1,123 @@ +<?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>postmaster@localhost</postmaster> + </context> + + <spooler> + <threads>20</threads> + </spooler> + + <processors> + <processor state="root" enableJmx="true"> + <mailet match="All" class="PostmasterAlias"/> + <mailet match="RelayLimit=30" class="Null"/> + + <mailet match="SMTPAuthSuccessful" class="ToProcessor"> + <processor>transport</processor> + </mailet> + + <mailet match="All" class="ToProcessor"> + <processor>transport</processor> + </mailet> + </processor> + + <processor state="error" enableJmx="true"> + <mailet match="All" class="Bounce"> + </mailet> + <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="All" class="RemoveMimeHeader"> + <name>bcc</name> + </mailet> + <mailet match="HasMailAttribute=org.apache.james.SMIMECheckSignature" class="SetMimeHeader"> + <name>X-WasSigned</name> + <value>true</value> + </mailet> + <mailet match="All" class="RemoveMimeHeader"> + <name>bcc</name> + </mailet> + <mailet match="All" class="RecipientRewriteTable" /> + <!-- <mailet match="HostIsLocal" class="ToProcessor"> + <processor>local-address-error</processor> + <notice>550 - Requested action not taken: no such user here</notice> + </mailet> --> + <mailet match="All" class="RemoteDelivery"> + <outgoingQueue>outgoing</outgoingQueue> + <delayTime>5 minutes</delayTime> + <delayTime>10 minutes</delayTime> + <delayTime>45 minutes</delayTime> + <delayTime>2 hours</delayTime> + <delayTime>3 hours</delayTime> + <delayTime>6 hours</delayTime> + <maxRetries>0</maxRetries> + <maxDnsProblemRetries>0</maxDnsProblemRetries> + <deliveryThreads>1</deliveryThreads> + <sendpartial>false</sendpartial> + <bounceProcessor>bounces</bounceProcessor> + </mailet> + <!-- mailet match="All" class="ToProcessor"> + <processor>relay-denied</processor> + </mailet--> + </processor> + + <processor state="local-address-error" enableJmx="true"> + <mailet match="All" class="Bounce"> + <attachment>none</attachment> + <passThrough>true</passThrough> + <debug>true</debug> + </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/src/test/resources/mailrepositorystore.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/resources/mailrepositorystore.xml b/server/container/guice/jpa-smtp/src/test/resources/mailrepositorystore.xml new file mode 100644 index 0000000..3ca4a1d --- /dev/null +++ b/server/container/guice/jpa-smtp/src/test/resources/mailrepositorystore.xml @@ -0,0 +1,31 @@ +<?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> + <mailrepository class="org.apache.james.mailrepository.file.FileMailRepository"> + <protocols> + <protocol>file</protocol> + </protocols> + <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/src/test/resources/managesieveserver.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/resources/managesieveserver.xml b/server/container/guice/jpa-smtp/src/test/resources/managesieveserver.xml new file mode 100644 index 0000000..ec57e09 --- /dev/null +++ b/server/container/guice/jpa-smtp/src/test/resources/managesieveserver.xml @@ -0,0 +1,65 @@ +<?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 --> + +<managesieveservers> + + <managesieveserver enabled="true"> + + <jmxName>managesieveserver</jmxName> + + <bind>0.0.0.0:4190</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> + <!-- The algorithm is optional and only needs to be specified when using something other + than the Sun JCE provider - You could use IbmX509 with IBM Java runtime. --> + <algorithm>SunX509</algorithm> + </tls> + + <!-- connection timeout in secconds --> + <connectiontimeout>360</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> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + + </managesieveserver> + +</managesieveservers> + + http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/jpa-smtp/src/test/resources/smtpserver.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-smtp/src/test/resources/smtpserver.xml b/server/container/guice/jpa-smtp/src/test/resources/smtpserver.xml new file mode 100644 index 0000000..a3d4b8f --- /dev/null +++ b/server/container/guice/jpa-smtp/src/test/resources/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:10465</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> + <!-- + 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="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> +</smtpservers> + + http://git-wip-us.apache.org/repos/asf/james-project/blob/61e1bdca/server/container/guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml index 5824129..76fd74e 100644 --- a/server/container/guice/pom.xml +++ b/server/container/guice/pom.xml @@ -90,6 +90,11 @@ <artifactId>james-server-guice-webadmin</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-jpa-common-guice</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </dependencyManagement> @@ -101,7 +106,9 @@ <module>mailbox</module> <module>mailet</module> <module>memory-guice</module> + <module>jpa-common-guice</module> <module>jpa-guice</module> + <module>jpa-smtp</module> <module>onami</module> <module>protocols/imap</module> <module>protocols/jmap</module> --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org