You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2016/04/07 05:10:18 UTC

[8/9] james-project git commit: JAMES-1617 Cassandra Guice project should use CassandraSieveRepository

JAMES-1617 Cassandra Guice project should use CassandraSieveRepository


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

Branch: refs/heads/master
Commit: a37c0c3466568ee8e0b64b2780b709168f09c5c6
Parents: a081bfd
Author: Benoit Tellier <bt...@apache.org>
Authored: Wed Feb 17 14:21:52 2016 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Thu Apr 7 09:13:35 2016 +0700

----------------------------------------------------------------------
 .../data/CassandraSieveRepositoryModule.java    | 36 +++++++++++++++++++
 .../apache/james/CassandraJamesServerMain.java  |  2 ++
 .../data/CassandraSieveRepositoryModule.java    | 38 ++++++++++++++++++++
 .../james/modules/server/SieveModule.java       |  1 -
 .../james/modules/data/MemoryDataModule.java    |  6 ++++
 5 files changed, 82 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a37c0c34/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraSieveRepositoryModule.java
----------------------------------------------------------------------
diff --git a/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraSieveRepositoryModule.java b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraSieveRepositoryModule.java
new file mode 100644
index 0000000..ffce858
--- /dev/null
+++ b/server/container/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraSieveRepositoryModule.java
@@ -0,0 +1,36 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+package org.apache.james.modules.data;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.sieve.cassandra.CassandraSieveRepository;
+import org.apache.james.sieverepository.api.SieveRepository;
+
+public class CassandraSieveRepositoryModule extends AbstractModule {
+    
+    @Override
+    public void configure() {
+        bind(SieveRepository.class).to(CassandraSieveRepository.class);
+        Multibinder<CassandraModule> cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class);
+        cassandraDataDefinitions.addBinding().to(org.apache.james.sieve.cassandra.CassandraSieveRepositoryModule.class);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a37c0c34/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 7057e7c..e5f3bd2 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
@@ -22,6 +22,7 @@ package org.apache.james;
 import org.apache.james.mailbox.cassandra.CassandraId;
 import org.apache.james.modules.data.CassandraDomainListModule;
 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.mailbox.CassandraMailboxModule;
 import org.apache.james.modules.mailbox.CassandraSessionModule;
@@ -41,6 +42,7 @@ public class CassandraJamesServerMain {
         new CassandraUsersRepositoryModule(),
         new CassandraDomainListModule(),
         new CassandraRecipientRewriteTableModule(),
+        new CassandraSieveRepositoryModule(),
         new CassandraMailboxModule(),
         new CassandraSessionModule(),
         new ElasticSearchMailboxModule(),

http://git-wip-us.apache.org/repos/asf/james-project/blob/a37c0c34/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraSieveRepositoryModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraSieveRepositoryModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraSieveRepositoryModule.java
new file mode 100644
index 0000000..036aa99
--- /dev/null
+++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/data/CassandraSieveRepositoryModule.java
@@ -0,0 +1,38 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.modules.data;
+
+import org.apache.james.backends.cassandra.components.CassandraModule;
+import org.apache.james.sieve.cassandra.CassandraSieveRepository;
+import org.apache.james.sieverepository.api.SieveRepository;
+
+import com.google.inject.AbstractModule;
+import com.google.inject.multibindings.Multibinder;
+
+public class CassandraSieveRepositoryModule extends AbstractModule {
+
+    @Override
+    protected void configure() {
+        bind(SieveRepository.class).to(CassandraSieveRepository.class);
+
+        Multibinder<CassandraModule> cassandraDataDefinitions = Multibinder.newSetBinder(binder(), CassandraModule.class);
+        cassandraDataDefinitions.addBinding().to(org.apache.james.sieve.cassandra.CassandraSieveRepositoryModule.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/a37c0c34/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/SieveModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/SieveModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/SieveModule.java
index 229b479..8777a25 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/SieveModule.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/SieveModule.java
@@ -31,7 +31,6 @@ public class SieveModule extends AbstractModule {
     @Override
     protected void configure() {
         bind(SieveParser.class).to(Parser.class);
-        bind(SieveRepository.class).to(SieveFileRepository.class);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a37c0c34/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java
index ca11b1f..9663255 100644
--- a/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java
+++ b/server/container/guice/memory-guice/src/main/java/org/apache/james/modules/data/MemoryDataModule.java
@@ -23,6 +23,8 @@ import org.apache.james.domainlist.api.DomainList;
 import org.apache.james.domainlist.memory.MemoryDomainList;
 import org.apache.james.rrt.api.RecipientRewriteTable;
 import org.apache.james.rrt.memory.MemoryRecipientRewriteTable;
+import org.apache.james.sieverepository.api.SieveRepository;
+import org.apache.james.sieverepository.file.SieveFileRepository;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.memory.MemoryUsersRepository;
 import org.apache.james.utils.ConfigurationPerformer;
@@ -50,6 +52,10 @@ public class MemoryDataModule extends AbstractModule {
 
         bind(MemoryUsersRepository.class).toInstance(MemoryUsersRepository.withVirtualHosting());
         bind(UsersRepository.class).to(MemoryUsersRepository.class);
+
+        bind(SieveFileRepository.class).in(Scopes.SINGLETON);
+        bind(SieveRepository.class).to(SieveFileRepository.class);
+
         Multibinder.newSetBinder(binder(), ConfigurationPerformer.class).addBinding().to(MemoryDataConfigurationPerformer.class);
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org