JAMES-1983 Split WebAdmin to match orthogonal Guice architecture
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/cca0f398 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/cca0f398 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/cca0f398 Branch: refs/heads/master Commit: cca0f39895d526cdf33a76987ecaafb8facc0d03 Parents: 6a8b56b Author: benwa <btell...@linagora.com> Authored: Sat Apr 1 00:22:32 2017 +0700 Committer: benwa <btell...@linagora.com> Committed: Sat Apr 1 15:24:29 2017 +0700 ---------------------------------------------------------------------- server/container/guice/cassandra-guice/pom.xml | 8 + .../apache/james/CassandraJamesServerMain.java | 6 +- server/container/guice/jpa-guice/pom.xml | 8 + .../org/apache/james/JPAJamesServerMain.java | 6 +- .../james/modules/server/NoJwtModule.java | 34 - server/container/guice/jpa-smtp/pom.xml | 8 + .../org/apache/james/JPAJamesServerMain.java | 8 +- server/container/guice/memory-guice/pom.xml | 8 + .../org/apache/james/MemoryJamesServerMain.java | 4 + server/container/guice/pom.xml | 12 + .../guice/protocols/webadmin-data/pom.xml | 206 +++++ .../james/modules/server/DataRoutesModules.java | 37 + .../guice/protocols/webadmin-mailbox/pom.xml | 206 +++++ .../modules/server/MailboxRoutesModule.java | 37 + .../container/guice/protocols/webadmin/pom.xml | 2 +- .../james/modules/server/NoJwtModule.java | 34 + .../modules/server/WebAdminServerModule.java | 11 - server/pom.xml | 20 +- .../protocols/webadmin-integration-test/pom.xml | 12 +- server/protocols/webadmin/pom.xml | 314 -------- .../org/apache/james/webadmin/CORSFilter.java | 40 - .../org/apache/james/webadmin/Constants.java | 27 - .../org/apache/james/webadmin/FixedPort.java | 54 -- .../java/org/apache/james/webadmin/Port.java | 26 - .../org/apache/james/webadmin/RandomPort.java | 50 -- .../java/org/apache/james/webadmin/Routes.java | 28 - .../apache/james/webadmin/TlsConfiguration.java | 124 --- .../james/webadmin/WebAdminConfiguration.java | 169 ---- .../apache/james/webadmin/WebAdminServer.java | 129 --- .../authentication/AuthenticationFilter.java | 25 - .../webadmin/authentication/JwtFilter.java | 76 -- .../authentication/NoAuthenticationFilter.java | 31 - .../james/webadmin/dto/AddUserRequest.java | 39 - .../james/webadmin/dto/MailboxResponse.java | 33 - .../org/apache/james/webadmin/dto/QuotaDTO.java | 73 -- .../apache/james/webadmin/dto/QuotaRequest.java | 39 - .../apache/james/webadmin/dto/UserResponse.java | 33 - .../james/webadmin/metric/MetricPostFilter.java | 37 - .../james/webadmin/metric/MetricPreFilter.java | 41 - .../apache/james/webadmin/routes/CORSRoute.java | 42 - .../james/webadmin/routes/DomainRoutes.java | 118 --- .../webadmin/routes/GlobalQuotaRoutes.java | 130 ---- .../webadmin/routes/UserMailboxesRoutes.java | 128 --- .../james/webadmin/routes/UserRoutes.java | 104 --- .../webadmin/service/UserMailboxesService.java | 143 ---- .../james/webadmin/service/UserService.java | 94 --- .../webadmin/utils/JsonExtractException.java | 27 - .../james/webadmin/utils/JsonExtractor.java | 44 -- .../james/webadmin/utils/JsonTransformer.java | 41 - .../utils/MailboxHaveChildrenException.java | 27 - .../james/webadmin/validation/MailboxName.java | 40 - .../apache/james/webadmin/FixedPortTest.java | 57 -- .../apache/james/webadmin/RandomPortTest.java | 34 - .../james/webadmin/TlsConfigurationTest.java | 88 --- .../webadmin/WebAdminConfigurationTest.java | 181 ----- .../webadmin/authentication/JwtFilterTest.java | 124 --- .../james/webadmin/dto/QuotaRequestTest.java | 59 -- .../james/webadmin/routes/DomainRoutesTest.java | 326 -------- .../webadmin/routes/GlobalQuotaRoutesTest.java | 261 ------- .../routes/UserMailboxesRoutesTest.java | 779 ------------------ .../james/webadmin/routes/UsersRoutesTest.java | 422 ---------- .../james/webadmin/utils/JsonExtractorTest.java | 114 --- server/protocols/webadmin/webadmin-core/pom.xml | 281 +++++++ .../org/apache/james/webadmin/CORSFilter.java | 40 + .../org/apache/james/webadmin/Constants.java | 27 + .../org/apache/james/webadmin/FixedPort.java | 54 ++ .../java/org/apache/james/webadmin/Port.java | 26 + .../org/apache/james/webadmin/RandomPort.java | 50 ++ .../java/org/apache/james/webadmin/Routes.java | 28 + .../apache/james/webadmin/TlsConfiguration.java | 124 +++ .../james/webadmin/WebAdminConfiguration.java | 169 ++++ .../apache/james/webadmin/WebAdminServer.java | 129 +++ .../authentication/AuthenticationFilter.java | 25 + .../webadmin/authentication/JwtFilter.java | 76 ++ .../authentication/NoAuthenticationFilter.java | 31 + .../james/webadmin/metric/MetricPostFilter.java | 37 + .../james/webadmin/metric/MetricPreFilter.java | 41 + .../apache/james/webadmin/routes/CORSRoute.java | 42 + .../webadmin/utils/JsonExtractException.java | 27 + .../james/webadmin/utils/JsonExtractor.java | 44 ++ .../james/webadmin/utils/JsonTransformer.java | 41 + .../apache/james/webadmin/FixedPortTest.java | 57 ++ .../apache/james/webadmin/RandomPortTest.java | 34 + .../james/webadmin/TlsConfigurationTest.java | 88 +++ .../webadmin/WebAdminConfigurationTest.java | 181 +++++ .../webadmin/authentication/JwtFilterTest.java | 124 +++ .../james/webadmin/utils/JsonExtractorTest.java | 114 +++ server/protocols/webadmin/webadmin-data/pom.xml | 280 +++++++ .../james/webadmin/dto/AddUserRequest.java | 39 + .../apache/james/webadmin/dto/UserResponse.java | 33 + .../james/webadmin/routes/DomainRoutes.java | 118 +++ .../james/webadmin/routes/UserRoutes.java | 104 +++ .../james/webadmin/service/UserService.java | 94 +++ .../james/webadmin/routes/DomainRoutesTest.java | 326 ++++++++ .../james/webadmin/routes/UsersRoutesTest.java | 422 ++++++++++ .../protocols/webadmin/webadmin-mailbox/pom.xml | 292 +++++++ .../james/webadmin/dto/MailboxResponse.java | 33 + .../org/apache/james/webadmin/dto/QuotaDTO.java | 73 ++ .../apache/james/webadmin/dto/QuotaRequest.java | 39 + .../webadmin/routes/GlobalQuotaRoutes.java | 130 ++++ .../webadmin/routes/UserMailboxesRoutes.java | 129 +++ .../webadmin/service/UserMailboxesService.java | 143 ++++ .../utils/MailboxHaveChildrenException.java | 27 + .../james/webadmin/validation/MailboxName.java | 40 + .../james/webadmin/dto/QuotaRequestTest.java | 59 ++ .../webadmin/routes/GlobalQuotaRoutesTest.java | 261 +++++++ .../routes/UserMailboxesRoutesTest.java | 780 +++++++++++++++++++ 107 files changed, 5925 insertions(+), 4825 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/cassandra-guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/pom.xml b/server/container/guice/cassandra-guice/pom.xml index 348003e..9e78b34 100644 --- a/server/container/guice/cassandra-guice/pom.xml +++ b/server/container/guice/cassandra-guice/pom.xml @@ -292,6 +292,14 @@ <artifactId>james-server-guice-webadmin</artifactId> </dependency> <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice-webadmin-data</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice-webadmin-mailbox</artifactId> + </dependency> + <dependency> <groupId>${project.groupId}</groupId> <artifactId>james-server-jmap-integration-testing</artifactId> <type>test-jar</type> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java index 289106b..7cd4bb9 100644 --- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java +++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/CassandraJamesServerMain.java @@ -36,8 +36,10 @@ import org.apache.james.modules.protocols.POP3ServerModule; import org.apache.james.modules.protocols.ProtocolHandlerModule; import org.apache.james.modules.protocols.SMTPServerModule; import org.apache.james.modules.server.ActiveMQQueueModule; +import org.apache.james.modules.server.DataRoutesModules; import org.apache.james.modules.server.ESMetricReporterModule; import org.apache.james.modules.server.JMXServerModule; +import org.apache.james.modules.server.MailboxRoutesModule; import org.apache.james.modules.server.WebAdminServerModule; import com.google.inject.Module; @@ -52,7 +54,9 @@ public class CassandraJamesServerMain { new SMTPServerModule(), new LMTPServerModule(), new ManageSieveServerModule(), - new WebAdminServerModule()); + new WebAdminServerModule(), + new DataRoutesModules(), + new MailboxRoutesModule()); public static final Module cassandraServerModule = Modules.combine( new JMAPServerModule(), http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/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 e70712e..fdc62ec 100644 --- a/server/container/guice/jpa-guice/pom.xml +++ b/server/container/guice/jpa-guice/pom.xml @@ -259,6 +259,14 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-webadmin-data</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-webadmin-mailbox</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>james-server-jpa-common-guice</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java index 19a8430..1b64bb2 100644 --- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java +++ b/server/container/guice/jpa-guice/src/main/java/org/apache/james/JPAJamesServerMain.java @@ -31,7 +31,9 @@ import org.apache.james.modules.protocols.POP3ServerModule; import org.apache.james.modules.protocols.ProtocolHandlerModule; import org.apache.james.modules.protocols.SMTPServerModule; import org.apache.james.modules.server.ActiveMQQueueModule; +import org.apache.james.modules.server.DataRoutesModules; import org.apache.james.modules.server.JMXServerModule; +import org.apache.james.modules.server.MailboxRoutesModule; import org.apache.james.modules.server.NoJwtModule; import org.apache.james.modules.server.RawPostDequeueDecoratorModule; import org.apache.james.modules.server.WebAdminServerModule; @@ -48,7 +50,9 @@ public class JPAJamesServerMain { new SMTPServerModule(), new LMTPServerModule(), new ManageSieveServerModule(), - new WebAdminServerModule()); + new WebAdminServerModule(), + new DataRoutesModules(), + new MailboxRoutesModule()); public static final Module jpaServerModule = Modules.combine( new JPAMailboxModule(), http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/server/NoJwtModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/server/NoJwtModule.java b/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/server/NoJwtModule.java deleted file mode 100644 index a500595..0000000 --- a/server/container/guice/jpa-guice/src/main/java/org/apache/james/modules/server/NoJwtModule.java +++ /dev/null @@ -1,34 +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.server; - -import java.util.Optional; - -import org.apache.james.jwt.JwtConfiguration; - -import com.google.inject.AbstractModule; - -public class NoJwtModule extends AbstractModule { - - @Override - protected void configure() { - bind(JwtConfiguration.class).toInstance(new JwtConfiguration(Optional.empty())); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/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 index e10c620..4f2b161 100644 --- a/server/container/guice/jpa-smtp/pom.xml +++ b/server/container/guice/jpa-smtp/pom.xml @@ -222,6 +222,14 @@ <artifactId>james-server-jpa-common-guice</artifactId> </dependency> <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice-webadmin</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice-webadmin-data</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/cca0f398/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 index 51174c6..f8ebc93 100644 --- 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 @@ -25,7 +25,10 @@ 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.DataRoutesModules; +import org.apache.james.modules.server.NoJwtModule; import org.apache.james.modules.server.RawPostDequeueDecoratorModule; +import org.apache.james.modules.server.WebAdminServerModule; import org.apache.openjpa.persistence.OpenJPAPersistence; import com.google.inject.Module; @@ -35,7 +38,10 @@ public class JPAJamesServerMain { public static final Module protocols = Modules.combine( new ProtocolHandlerModule(), - new SMTPServerModule()); + new SMTPServerModule(), + new WebAdminServerModule(), + new DataRoutesModules(), + new NoJwtModule()); public static final Module jpaServerModule = Modules.combine( new JPADataModule(), http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/memory-guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/memory-guice/pom.xml b/server/container/guice/memory-guice/pom.xml index 8496189..8cffde9 100644 --- a/server/container/guice/memory-guice/pom.xml +++ b/server/container/guice/memory-guice/pom.xml @@ -254,6 +254,14 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-webadmin-data</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-webadmin-mailbox</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>apache-mailet-base</artifactId> <type>test-jar</type> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java ---------------------------------------------------------------------- diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java index 0cf291c..bfc412b 100644 --- a/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java +++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/MemoryJamesServerMain.java @@ -30,7 +30,9 @@ import org.apache.james.modules.protocols.ManageSieveServerModule; import org.apache.james.modules.protocols.POP3ServerModule; import org.apache.james.modules.protocols.ProtocolHandlerModule; import org.apache.james.modules.protocols.SMTPServerModule; +import org.apache.james.modules.server.DataRoutesModules; import org.apache.james.modules.server.JMXServerModule; +import org.apache.james.modules.server.MailboxRoutesModule; import org.apache.james.modules.server.MemoryMailQueueModule; import org.apache.james.modules.server.WebAdminServerModule; @@ -48,6 +50,8 @@ public class MemoryJamesServerMain { new LMTPServerModule(), new ManageSieveServerModule(), new WebAdminServerModule(), + new DataRoutesModules(), + new MailboxRoutesModule(), new MemoryDataModule(), new MemoryDataJmapModule(), new MemoryMailboxModule(), http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml index bc00fd7..1d7a263 100644 --- a/server/container/guice/pom.xml +++ b/server/container/guice/pom.xml @@ -97,6 +97,16 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-webadmin-data</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-webadmin-mailbox</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>james-server-jpa-common-guice</artifactId> <version>${project.version}</version> </dependency> @@ -123,6 +133,8 @@ <module>protocols/pop</module> <module>protocols/smtp</module> <module>protocols/webadmin</module> + <module>protocols/webadmin-mailbox</module> + <module>protocols/webadmin-data</module> </modules> </project> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/protocols/webadmin-data/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/protocols/webadmin-data/pom.xml b/server/container/guice/protocols/webadmin-data/pom.xml new file mode 100644 index 0000000..a61d0c4 --- /dev/null +++ b/server/container/guice/protocols/webadmin-data/pom.xml @@ -0,0 +1,206 @@ +<?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/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>james-server-guice</artifactId> + <groupId>org.apache.james</groupId> + <version>3.0.0-beta6-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>james-server-guice-webadmin-data</artifactId> + + <name>Apache James :: Server :: Guice :: Webadmin :: Data</name> + <description>Webadmin data modules for Guice implementation of James server</description> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>disable-build-for-older-jdk</id> + <activation> + <jdk>(,1.8)</jdk> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <phase>none</phase> + </execution> + <execution> + <id>jar</id> + <phase>none</phase> + </execution> + <execution> + <id>test-jar</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <executions> + <execution> + <id>default-compile</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testCompile</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <executions> + <execution> + <id>default-install</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>default-resources</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testResources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <executions> + <execution> + <id>attach-descriptor</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>build-for-jdk-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-configuration</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-webadmin-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-webadmin-data</artifactId> + </dependency> + <dependency> + <groupId>com.google.inject</groupId> + <artifactId>guice</artifactId> + </dependency> + <dependency> + <groupId>com.google.inject.extensions</groupId> + <artifactId>guice-multibindings</artifactId> + </dependency> + </dependencies> + </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> + +</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java ---------------------------------------------------------------------- diff --git a/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java b/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java new file mode 100644 index 0000000..3fb6669 --- /dev/null +++ b/server/container/guice/protocols/webadmin-data/src/main/java/org/apache/james/modules/server/DataRoutesModules.java @@ -0,0 +1,37 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james.modules.server; + +import org.apache.james.webadmin.Routes; +import org.apache.james.webadmin.routes.DomainRoutes; +import org.apache.james.webadmin.routes.UserRoutes; + +import com.google.inject.AbstractModule; +import com.google.inject.multibindings.Multibinder; + +public class DataRoutesModules extends AbstractModule { + + @Override + protected void configure() { + Multibinder<Routes> routesMultibinder = Multibinder.newSetBinder(binder(), Routes.class); + routesMultibinder.addBinding().to(DomainRoutes.class); + routesMultibinder.addBinding().to(UserRoutes.class); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/protocols/webadmin-mailbox/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/protocols/webadmin-mailbox/pom.xml b/server/container/guice/protocols/webadmin-mailbox/pom.xml new file mode 100644 index 0000000..2d8e49d --- /dev/null +++ b/server/container/guice/protocols/webadmin-mailbox/pom.xml @@ -0,0 +1,206 @@ +<?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/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>james-server-guice</artifactId> + <groupId>org.apache.james</groupId> + <version>3.0.0-beta6-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>james-server-guice-webadmin-mailbox</artifactId> + + <name>Apache James :: Server :: Guice :: Webadmin :: Mailbox</name> + <description>Webadmin mailbox modules for Guice implementation of James server</description> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>disable-build-for-older-jdk</id> + <activation> + <jdk>(,1.8)</jdk> + </activation> + <build> + <plugins> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <phase>none</phase> + </execution> + <execution> + <id>jar</id> + <phase>none</phase> + </execution> + <execution> + <id>test-jar</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <executions> + <execution> + <id>default-compile</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testCompile</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <id>default-test</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <executions> + <execution> + <id>default-install</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>default-resources</id> + <phase>none</phase> + </execution> + <execution> + <id>default-testResources</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <executions> + <execution> + <id>attach-descriptor</id> + <phase>none</phase> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>build-for-jdk-8</id> + <activation> + <jdk>[1.8,)</jdk> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>james-server-guice-configuration</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-webadmin-core</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-webadmin-mailbox</artifactId> + </dependency> + <dependency> + <groupId>com.google.inject</groupId> + <artifactId>guice</artifactId> + </dependency> + <dependency> + <groupId>com.google.inject.extensions</groupId> + <artifactId>guice-multibindings</artifactId> + </dependency> + </dependencies> + </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> + +</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/protocols/webadmin-mailbox/src/main/java/org/apache/james/modules/server/MailboxRoutesModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/protocols/webadmin-mailbox/src/main/java/org/apache/james/modules/server/MailboxRoutesModule.java b/server/container/guice/protocols/webadmin-mailbox/src/main/java/org/apache/james/modules/server/MailboxRoutesModule.java new file mode 100644 index 0000000..7faba1f --- /dev/null +++ b/server/container/guice/protocols/webadmin-mailbox/src/main/java/org/apache/james/modules/server/MailboxRoutesModule.java @@ -0,0 +1,37 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james.modules.server; + +import org.apache.james.webadmin.Routes; +import org.apache.james.webadmin.routes.GlobalQuotaRoutes; +import org.apache.james.webadmin.routes.UserMailboxesRoutes; + +import com.google.inject.AbstractModule; +import com.google.inject.multibindings.Multibinder; + +public class MailboxRoutesModule extends AbstractModule { + + @Override + protected void configure() { + Multibinder<Routes> routesMultibinder = Multibinder.newSetBinder(binder(), Routes.class); + routesMultibinder.addBinding().to(UserMailboxesRoutes.class); + routesMultibinder.addBinding().to(GlobalQuotaRoutes.class); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/protocols/webadmin/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/protocols/webadmin/pom.xml b/server/container/guice/protocols/webadmin/pom.xml index 9f33f23..b4d2a6d 100644 --- a/server/container/guice/protocols/webadmin/pom.xml +++ b/server/container/guice/protocols/webadmin/pom.xml @@ -155,7 +155,7 @@ </dependency> <dependency> <groupId>org.apache.james</groupId> - <artifactId>james-server-webadmin</artifactId> + <artifactId>james-server-webadmin-core</artifactId> </dependency> <dependency> <groupId>com.google.inject</groupId> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/NoJwtModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/NoJwtModule.java b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/NoJwtModule.java new file mode 100644 index 0000000..a500595 --- /dev/null +++ b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/NoJwtModule.java @@ -0,0 +1,34 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james.modules.server; + +import java.util.Optional; + +import org.apache.james.jwt.JwtConfiguration; + +import com.google.inject.AbstractModule; + +public class NoJwtModule extends AbstractModule { + + @Override + protected void configure() { + bind(JwtConfiguration.class).toInstance(new JwtConfiguration(Optional.empty())); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java index f3ed440..c7820cc 100644 --- a/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java +++ b/server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java @@ -36,16 +36,11 @@ import org.apache.james.utils.PropertiesProvider; import org.apache.james.utils.WebAdminGuiceProbe; import org.apache.james.webadmin.FixedPort; import org.apache.james.webadmin.TlsConfiguration; -import org.apache.james.webadmin.Routes; import org.apache.james.webadmin.WebAdminConfiguration; import org.apache.james.webadmin.WebAdminServer; import org.apache.james.webadmin.authentication.AuthenticationFilter; import org.apache.james.webadmin.authentication.JwtFilter; import org.apache.james.webadmin.authentication.NoAuthenticationFilter; -import org.apache.james.webadmin.routes.DomainRoutes; -import org.apache.james.webadmin.routes.GlobalQuotaRoutes; -import org.apache.james.webadmin.routes.UserMailboxesRoutes; -import org.apache.james.webadmin.routes.UserRoutes; import org.apache.james.webadmin.utils.JsonTransformer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,12 +72,6 @@ public class WebAdminServerModule extends AbstractModule { bind(JsonTransformer.class).in(Scopes.SINGLETON); bind(WebAdminServer.class).in(Scopes.SINGLETON); - Multibinder<Routes> routesMultibinder = Multibinder.newSetBinder(binder(), Routes.class); - routesMultibinder.addBinding().to(DomainRoutes.class); - routesMultibinder.addBinding().to(UserRoutes.class); - routesMultibinder.addBinding().to(UserMailboxesRoutes.class); - routesMultibinder.addBinding().to(GlobalQuotaRoutes.class); - Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(WebAdminServerModuleConfigurationPerformer.class); Multibinder.newSetBinder(binder(), GuiceProbe.class).addBinding().to(WebAdminGuiceProbe.class); } http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/pom.xml ---------------------------------------------------------------------- diff --git a/server/pom.xml b/server/pom.xml index d7791ed..cfffd6f 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -95,21 +95,23 @@ <module>protocols/protocols-imap4</module> <module>protocols/jmap</module> <module>protocols/jmap-integration-testing</module> + <module>protocols/jwt</module> <module>protocols/protocols-library</module> <module>protocols/protocols-lmtp</module> <module>protocols/protocols-managesieve</module> <module>protocols/protocols-pop3</module> <module>protocols/protocols-smtp</module> + <module>protocols/webadmin/webadmin-core</module> + <module>protocols/webadmin/webadmin-data</module> + <module>protocols/webadmin/webadmin-mailbox</module> + <module>protocols/webadmin-integration-test</module> <module>queue/queue-api</module> <module>queue/queue-file</module> <module>queue/queue-jms</module> <module>queue/queue-activemq</module> - <module>protocols/webadmin</module> - <module>protocols/webadmin-integration-test</module> <module>testing</module> - <module>protocols/jwt</module> </modules> <distributionManagement> @@ -683,7 +685,17 @@ </dependency> <dependency> <groupId>org.apache.james</groupId> - <artifactId>james-server-webadmin</artifactId> + <artifactId>james-server-webadmin-core</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-webadmin-data</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-webadmin-mailbox</artifactId> <version>${project.version}</version> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin-integration-test/pom.xml ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin-integration-test/pom.xml b/server/protocols/webadmin-integration-test/pom.xml index 0817987..9a6ec14 100644 --- a/server/protocols/webadmin-integration-test/pom.xml +++ b/server/protocols/webadmin-integration-test/pom.xml @@ -172,7 +172,17 @@ </dependency> <dependency> <groupId>org.apache.james</groupId> - <artifactId>james-server-webadmin</artifactId> + <artifactId>james-server-webadmin-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-webadmin-data</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-webadmin-mailbox</artifactId> <scope>test</scope> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/pom.xml ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/pom.xml b/server/protocols/webadmin/pom.xml deleted file mode 100644 index 3703c7a..0000000 --- a/server/protocols/webadmin/pom.xml +++ /dev/null @@ -1,314 +0,0 @@ -<?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> - <artifactId>james-server</artifactId> - <groupId>org.apache.james</groupId> - <version>3.0.0-beta6-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> - - <artifactId>james-server-webadmin</artifactId> - <packaging>jar</packaging> - - <name>Apache James :: Server :: Web Admin</name> - - <profiles> - <profile> - <id>noTest</id> - <activation> - <os> - <family>windows</family> - </os> - </activation> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skipTests>true</skipTests> - </configuration> - </plugin> - </plugins> - </build> - </profile> - <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> - <dependencies> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>apache-james-mailbox-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>apache-james-mailbox-memory</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>james-server-util-java8</artifactId> - </dependency> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>james-server-lifecycle-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>james-server-jwt</artifactId> - </dependency> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>james-server-data-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>james-server-data-memory</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>metrics-api</artifactId> - </dependency> - <dependency> - <groupId>org.apache.james</groupId> - <artifactId>metrics-logger</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </dependency> - <dependency> - <groupId>com.github.fge</groupId> - <artifactId>throwing-lambdas</artifactId> - </dependency> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - </dependency> - <dependency> - <groupId>com.jayway.restassured</groupId> - <artifactId>rest-assured</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>com.sparkjava</groupId> - <artifactId>spark-core</artifactId> - <version>2.5.5</version> - </dependency> - <dependency> - <groupId>de.bechte.junit</groupId> - <artifactId>junit-hierarchicalcontextrunner</artifactId> - <version>4.11.3</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>javax.inject</groupId> - <artifactId>javax.inject</artifactId> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</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> - <dependency> - <groupId>org.hamcrest</groupId> - <artifactId>java-hamcrest</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - <dependency> - <groupId>nl.jqno.equalsverifier</groupId> - <artifactId>equalsverifier</artifactId> - <version>1.7.6</version> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-simple</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-assembly-plugin</artifactId> - <configuration> - <archive> - <manifest> - <mainClass>fully.qualified.MainClass</mainClass> - </manifest> - </archive> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> - </configuration> - </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> - </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> -</project> http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/CORSFilter.java ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/CORSFilter.java b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/CORSFilter.java deleted file mode 100644 index c4cfb29..0000000 --- a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/CORSFilter.java +++ /dev/null @@ -1,40 +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.webadmin; - -import spark.Filter; -import spark.Request; -import spark.Response; - - -public class CORSFilter implements Filter { - private final String urlCORSOrigin; - - public CORSFilter(String urlCORSOrigin) { - this.urlCORSOrigin = urlCORSOrigin; - } - - @Override - public void handle(Request request, Response response) throws Exception { - response.header("Access-Control-Allow-Origin", urlCORSOrigin); - response.header("Access-Control-Request-Method", "DELETE, GET, POST, PUT"); - response.header("Access-Control-Allow-Headers", "Content-Type, Authorization, Accept"); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Constants.java ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Constants.java b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Constants.java deleted file mode 100644 index 1031a86..0000000 --- a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Constants.java +++ /dev/null @@ -1,27 +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.webadmin; - -public interface Constants { - - String SEPARATOR = "/"; - String EMPTY_BODY = ""; - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java deleted file mode 100644 index 7ada8a1..0000000 --- a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/FixedPort.java +++ /dev/null @@ -1,54 +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.webadmin; - -import java.util.Objects; - -import com.google.common.base.Preconditions; - -public class FixedPort implements Port { - - private final int port; - - public FixedPort(int port) { - Preconditions.checkArgument(port > 0 && port < 65536, "Port should be strictly contained between 0 and 65536"); - this.port = port; - } - - @Override - public int toInt() { - return port; - } - - @Override - public final boolean equals(Object o) { - if (o instanceof FixedPort) { - FixedPort that = (FixedPort) o; - - return Objects.equals(this.port, that.port); - } - return false; - } - - @Override - public final int hashCode() { - return Objects.hash(port); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Port.java ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Port.java b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Port.java deleted file mode 100644 index ff7a50b..0000000 --- a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Port.java +++ /dev/null @@ -1,26 +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.webadmin; - -public interface Port { - - int toInt(); - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/RandomPort.java ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/RandomPort.java b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/RandomPort.java deleted file mode 100644 index 2b3ab5d..0000000 --- a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/RandomPort.java +++ /dev/null @@ -1,50 +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.webadmin; - -import java.io.IOException; -import java.net.ServerSocket; - -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import com.google.common.base.Throwables; - -public class RandomPort implements Port { - - public static int findFreePort() { - try (ServerSocket socket = new ServerSocket(0)) { - return socket.getLocalPort(); - } catch (IOException e) { - throw Throwables.propagate(e); - } - } - - private final Supplier<Integer> portSupplier; - - public RandomPort() { - portSupplier = Suppliers.memoize(RandomPort::findFreePort); - } - - @Override - public int toInt() { - return portSupplier.get(); - } - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Routes.java ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Routes.java b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Routes.java deleted file mode 100644 index bc8554a..0000000 --- a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/Routes.java +++ /dev/null @@ -1,28 +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.webadmin; - -import spark.Service; - -public interface Routes { - - void define(Service service); - -} http://git-wip-us.apache.org/repos/asf/james-project/blob/cca0f398/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java b/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java deleted file mode 100644 index d549ea3..0000000 --- a/server/protocols/webadmin/src/main/java/org/apache/james/webadmin/TlsConfiguration.java +++ /dev/null @@ -1,124 +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.webadmin; - -import java.util.Objects; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.base.Preconditions; - -public class TlsConfiguration { - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private String keystoreFilePath; - private String keystorePassword; - private String truststoreFilePath; - private String truststorePassword; - - public Builder raw(String keystoreFilePath, - String keystorePassword, - String truststoreFilePath, - String truststorePassword){ - Preconditions.checkNotNull(keystoreFilePath); - Preconditions.checkNotNull(keystorePassword); - - this.keystoreFilePath = keystoreFilePath; - this.keystorePassword = keystorePassword; - this.truststoreFilePath = truststoreFilePath; - this.truststorePassword = truststorePassword; - return this; - } - - public Builder selfSigned(String keystoreFilePath, String keystorePassword){ - Preconditions.checkNotNull(keystoreFilePath); - Preconditions.checkNotNull(keystorePassword); - - this.keystoreFilePath = keystoreFilePath; - this.keystorePassword = keystorePassword; - return this; - } - - public TlsConfiguration build() { - Preconditions.checkState(hasKeystoreInformation(), "If enabled, you need to provide keystore information"); - Preconditions.checkState(optionalHasTrustStoreInformation(), "You need to provide both information about trustStore"); - return new TlsConfiguration(keystoreFilePath, keystorePassword, truststoreFilePath, truststorePassword); - } - - private boolean optionalHasTrustStoreInformation() { - return (truststoreFilePath == null) == (truststorePassword == null); - } - - private boolean hasKeystoreInformation() { - return keystorePassword != null && keystoreFilePath != null; - } - - } - - private final String keystoreFilePath; - private final String keystorePassword; - private final String truststoreFilePath; - private final String truststorePassword; - - @VisibleForTesting - TlsConfiguration(String keystoreFilePath, String keystorePassword, String truststoreFilePath, String truststorePassword) { - this.keystoreFilePath = keystoreFilePath; - this.keystorePassword = keystorePassword; - this.truststoreFilePath = truststoreFilePath; - this.truststorePassword = truststorePassword; - } - - public String getKeystoreFilePath() { - return keystoreFilePath; - } - - public String getKeystorePassword() { - return keystorePassword; - } - - public String getTruststoreFilePath() { - return truststoreFilePath; - } - - public String getTruststorePassword() { - return truststorePassword; - } - - @Override - public final boolean equals(Object o) { - if (o instanceof TlsConfiguration) { - TlsConfiguration that = (TlsConfiguration) o; - - return Objects.equals(this.keystoreFilePath, that.keystoreFilePath) - && Objects.equals(this.keystorePassword, that.keystorePassword) - && Objects.equals(this.truststoreFilePath, that.truststoreFilePath) - && Objects.equals(this.truststorePassword, that.truststorePassword); - } - return false; - } - - @Override - public final int hashCode() { - return Objects.hash(keystoreFilePath, keystorePassword, truststoreFilePath, truststorePassword); - } -} --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org