JAMES-2525 extracts common blob store guice module
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/53eeb3fb Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/53eeb3fb Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/53eeb3fb Branch: refs/heads/master Commit: 53eeb3fbb0f4c5a392b03d6c1a9f3e8d1c8c26d2 Parents: 27ef335 Author: Jean Helou <[email protected]> Authored: Tue Sep 4 10:25:21 2018 +0200 Committer: Benoit Tellier <[email protected]> Committed: Thu Oct 11 09:26:14 2018 +0700 ---------------------------------------------------------------------- pom.xml | 11 ++++ server/container/guice/blob-api-guice/pom.xml | 58 ++++++++++++++++++++ .../modules/mailbox/BlobStoreAPIModule.java | 34 ++++++++++++ server/container/guice/cassandra-guice/pom.xml | 5 ++ .../apache/james/CassandraJamesServerMain.java | 2 + .../mailbox/CassandraObjectStoreModule.java | 4 -- server/container/guice/pom.xml | 1 + 7 files changed, 111 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/53eeb3fb/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 6a3dda1..0b43776 100644 --- a/pom.xml +++ b/pom.xml @@ -1050,6 +1050,17 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>blob-api-guice</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>blob-api-guice</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>blob-cassandra</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/53eeb3fb/server/container/guice/blob-api-guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/blob-api-guice/pom.xml b/server/container/guice/blob-api-guice/pom.xml new file mode 100644 index 0000000..41f5881 --- /dev/null +++ b/server/container/guice/blob-api-guice/pom.xml @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice</artifactId> + <version>3.2.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>blob-api-guice</artifactId> + <packaging>jar</packaging> + + <name>Apache James :: Server :: Blob Store API - guice injection</name> + <description>An advanced email server - Common object storage bindings</description> + + <dependencies> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>blob-api</artifactId> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> + <artifactId>james-server-guice-common</artifactId> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <reuseForks>true</reuseForks> + </configuration> + </plugin> + </plugins> + </build> +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/53eeb3fb/server/container/guice/blob-api-guice/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/blob-api-guice/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.java b/server/container/guice/blob-api-guice/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.java new file mode 100644 index 0000000..4887488 --- /dev/null +++ b/server/container/guice/blob-api-guice/src/main/java/org/apache/james/modules/mailbox/BlobStoreAPIModule.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.mailbox; + +import org.apache.james.blob.api.BlobId; +import org.apache.james.blob.api.HashBlobId; + +import com.google.inject.AbstractModule; +import com.google.inject.Scopes; + +public class BlobStoreAPIModule extends AbstractModule { + @Override + protected void configure() { + bind(HashBlobId.Factory.class).in(Scopes.SINGLETON); + bind(BlobId.Factory.class).to(HashBlobId.Factory.class); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/53eeb3fb/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 d741c11..01865bb 100644 --- a/server/container/guice/cassandra-guice/pom.xml +++ b/server/container/guice/cassandra-guice/pom.xml @@ -98,6 +98,11 @@ </dependency> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>blob-api-guice</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>blob-cassandra</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/53eeb3fb/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 25768c0..77b6556 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 @@ -29,6 +29,7 @@ import org.apache.james.modules.data.CassandraRecipientRewriteTableModule; import org.apache.james.modules.data.CassandraSieveRepositoryModule; import org.apache.james.modules.data.CassandraUsersRepositoryModule; import org.apache.james.modules.eventstore.CassandraEventStoreModule; +import org.apache.james.modules.mailbox.BlobStoreAPIModule; import org.apache.james.modules.mailbox.CassandraMailboxModule; import org.apache.james.modules.mailbox.CassandraObjectStoreModule; import org.apache.james.modules.mailbox.CassandraQuotaMailingModule; @@ -95,6 +96,7 @@ public class CassandraJamesServerMain { new CassandraEventStoreModule(), new CassandraMailRepositoryModule(), new CassandraMetricsModule(), + new BlobStoreAPIModule(), new CassandraObjectStoreModule(), new CassandraRecipientRewriteTableModule(), new CassandraSessionModule(), http://git-wip-us.apache.org/repos/asf/james-project/blob/53eeb3fb/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java index 671b86e..558a713 100644 --- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java +++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/CassandraObjectStoreModule.java @@ -20,9 +20,7 @@ package org.apache.james.modules.mailbox; import org.apache.james.backends.cassandra.components.CassandraModule; -import org.apache.james.blob.api.BlobId; import org.apache.james.blob.api.BlobStore; -import org.apache.james.blob.api.HashBlobId; import org.apache.james.blob.cassandra.CassandraBlobModule; import org.apache.james.blob.cassandra.CassandraBlobsDAO; @@ -34,10 +32,8 @@ public class CassandraObjectStoreModule extends AbstractModule { @Override protected void configure() { bind(CassandraBlobsDAO.class).in(Scopes.SINGLETON); - bind(HashBlobId.Factory.class).in(Scopes.SINGLETON); bind(BlobStore.class).to(CassandraBlobsDAO.class); - bind(BlobId.Factory.class).to(HashBlobId.Factory.class); Multibinder<CassandraModule> cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class); cassandraDataDefinitions.addBinding().toInstance(CassandraBlobModule.MODULE); http://git-wip-us.apache.org/repos/asf/james-project/blob/53eeb3fb/server/container/guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml index d4c51f3..73a6a93 100644 --- a/server/container/guice/pom.xml +++ b/server/container/guice/pom.xml @@ -33,6 +33,7 @@ <name>Apache James :: Server :: Guice</name> <modules> + <module>blob-api-guice</module> <module>cassandra-guice</module> <module>cassandra-ldap-guice</module> <module>configuration</module> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
