JAMES-2393 Guice bindings for event stores

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/8683586c
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/8683586c
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/8683586c

Branch: refs/heads/master
Commit: 8683586c6e9c04af1903710653863c50a5caedee
Parents: cb9ccb5
Author: benwa <[email protected]>
Authored: Thu May 10 12:10:43 2018 +0700
Committer: Matthieu Baechler <[email protected]>
Committed: Fri May 18 19:43:49 2018 +0200

----------------------------------------------------------------------
 server/container/guice/cassandra-guice/pom.xml  |  4 ++
 .../apache/james/CassandraJamesServerMain.java  |  2 +
 .../eventstore/CassandraEventStoreModule.java   | 44 ++++++++++++++++++++
 server/container/guice/memory-guice/pom.xml     |  4 ++
 .../org/apache/james/MemoryJamesServerMain.java |  2 +
 .../eventstore/MemoryEventStoreModule.java      | 34 +++++++++++++++
 6 files changed, 90 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/8683586c/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 3f0a07f..3c8d691 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -98,6 +98,10 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>event-sourcing-event-store-cassandra</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>james-server-data-cassandra</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/8683586c/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 b51bef7..fe75ebc 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
@@ -26,6 +26,7 @@ import 
org.apache.james.modules.data.CassandraMailRepositoryModule;
 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.CassandraMailboxModule;
 import org.apache.james.modules.mailbox.CassandraSessionModule;
 import org.apache.james.modules.mailbox.ElasticSearchMailboxModule;
@@ -78,6 +79,7 @@ public class CassandraJamesServerMain {
     public static final Module CASSANDRA_SERVER_MODULE = Modules.combine(
         new ActiveMQQueueModule(),
         new CassandraDomainListModule(),
+        new CassandraEventStoreModule(),
         new CassandraJmapModule(),
         new CassandraMailboxModule(),
         new CassandraMailRepositoryModule(),

http://git-wip-us.apache.org/repos/asf/james-project/blob/8683586c/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/eventstore/CassandraEventStoreModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/eventstore/CassandraEventStoreModule.java
 
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/eventstore/CassandraEventStoreModule.java
new file mode 100644
index 0000000..6707c12
--- /dev/null
+++ 
b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/eventstore/CassandraEventStoreModule.java
@@ -0,0 +1,44 @@
+/****************************************************************
+ * 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.eventstore;
+
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.eventsourcing.eventstore.EventStore;
+import org.apache.james.eventsourcing.eventstore.cassandra.CassandraEventStore;
+import org.apache.james.eventsourcing.eventstore.cassandra.dto.EventDTOModule;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
+import com.google.inject.multibindings.Multibinder;
+
+public class CassandraEventStoreModule extends AbstractModule {
+
+    @Override
+    protected void configure() {
+        bind(CassandraEventStore.class).in(Scopes.SINGLETON);
+        bind(EventStore.class).to(CassandraEventStore.class);
+
+        Multibinder.newSetBinder(binder(), CassandraModule.class)
+            .addBinding()
+            
.to(org.apache.james.eventsourcing.eventstore.cassandra.CassandraEventStoreModule.class);
+
+        Multibinder.newSetBinder(binder(), EventDTOModule.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/8683586c/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 b839cfb..26a0322 100644
--- a/server/container/guice/memory-guice/pom.xml
+++ b/server/container/guice/memory-guice/pom.xml
@@ -52,6 +52,10 @@
         </dependency>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>event-sourcing-event-store-memory</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>james-server-data-memory</artifactId>
         </dependency>
         <dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/8683586c/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 7754663..99783fd 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
@@ -23,6 +23,7 @@ import 
org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.james.modules.MailboxModule;
 import org.apache.james.modules.data.MemoryDataJmapModule;
 import org.apache.james.modules.data.MemoryDataModule;
+import org.apache.james.modules.eventstore.MemoryEventStoreModule;
 import org.apache.james.modules.mailbox.MemoryMailboxModule;
 import org.apache.james.modules.protocols.IMAPServerModule;
 import org.apache.james.modules.protocols.JMAPServerModule;
@@ -72,6 +73,7 @@ public class MemoryJamesServerMain {
 
     public static final Module IN_MEMORY_SERVER_MODULE = Modules.combine(
         new MemoryDataModule(),
+        new MemoryEventStoreModule(),
         new MemoryMailboxModule(),
         new MemoryMailQueueModule(),
         new MailboxModule());

http://git-wip-us.apache.org/repos/asf/james-project/blob/8683586c/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/eventstore/MemoryEventStoreModule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/eventstore/MemoryEventStoreModule.java
 
b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/eventstore/MemoryEventStoreModule.java
new file mode 100644
index 0000000..8a1b9cd
--- /dev/null
+++ 
b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/eventstore/MemoryEventStoreModule.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.eventstore;
+
+import org.apache.james.eventsourcing.eventstore.EventStore;
+import org.apache.james.eventsourcing.eventstore.memory.InMemoryEventStore;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
+
+public class MemoryEventStoreModule extends AbstractModule {
+    @Override
+    protected void configure() {
+        bind(InMemoryEventStore.class).in(Scopes.SINGLETON);
+        bind(EventStore.class).to(InMemoryEventStore.class);
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to