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 2019/10/14 03:29:18 UTC

[james-project] 03/04: JAMES-2915 Remove no longer maintained (and failing!) cassandra backend support for Spring

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit d4b5109a6dae0131a0e05bd70a2670c04ef7bb65
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Oct 9 13:57:42 2019 +0700

    JAMES-2915 Remove no longer maintained (and failing!) cassandra backend support for Spring
---
 .../james/mailbox/store/event/MailboxAnnotationListener.java     | 2 +-
 server/app/src/main/resources/quota.xml                          | 8 --------
 .../java/org/apache/james/app/spring/JamesSpringContextTest.java | 3 ++-
 .../MailboxConfigurationBeanFactoryPostProcessor.java            | 9 +--------
 .../bean/factorypostprocessor/QuotaBeanFactoryPostProcessor.java | 7 +------
 src/site/xdoc/server/config-mailbox.xml                          | 3 +--
 src/site/xdoc/server/config-quota.xml                            | 9 ++++-----
 7 files changed, 10 insertions(+), 31 deletions(-)

diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxAnnotationListener.java b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxAnnotationListener.java
index e469601..bbc5302 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxAnnotationListener.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/event/MailboxAnnotationListener.java
@@ -38,7 +38,7 @@ public class MailboxAnnotationListener implements MailboxListener.GroupMailboxLi
 
     }
 
-    private static final Group GROUP = new MailboxAnnotationListenerGroup();
+    public static final Group GROUP = new MailboxAnnotationListenerGroup();
 
     private final MailboxSessionMapperFactory mailboxSessionMapperFactory;
     private final SessionProvider sessionProvider;
diff --git a/server/app/src/main/resources/quota.xml b/server/app/src/main/resources/quota.xml
index 9c8c63e..1d7a90d 100644
--- a/server/app/src/main/resources/quota.xml
+++ b/server/app/src/main/resources/quota.xml
@@ -59,16 +59,11 @@
         Possible value for provider:
          - none: when you use fake as a value for quotaManager's provider
          - inmemory
-         - cassandra
          - jpa
 
         The inmemory implementation:
          - Does not work in a distributed context
         Note that quota need to be (lazy) re-calculated after each starts
-
-        Cassandra implementation.
-        Non existing quota are considered as null. No cache. It needs to be always enabled, or you might get some
-        quota synchronisation issues.
          -->
         <provider>none</provider>
     </currentQuotaManager>
@@ -81,9 +76,6 @@
          - fixed: all QUOTA ROOT get the same upper bound for their quotas.
          - inmemory: allows you to define QUOTA ROOT specific limits, backed with a fixed policy. It does not
          work in a distributed context.
-         - cassandra: Same thing than inmemory but backed on cassandra. Works on a distributed context. Note that using
-         the default* configuration options and the CLI to set default options is dangerous as server startup might override
-         CLI values.
          - jpa: Same thing than inmemory but backed on jpa. Works on a distributed context. Note that using
          the default* configuration options and the CLI to set default options is dangerous as server startup might override
          CLI values.
diff --git a/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java b/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java
index b5ab749..72bd11e 100644
--- a/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java
+++ b/server/app/src/test/java/org/apache/james/app/spring/JamesSpringContextTest.java
@@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import org.apache.james.container.spring.context.JamesServerApplicationContext;
 import org.apache.james.mailbox.events.InVMEventBus;
 import org.apache.james.mailbox.lucene.search.LuceneMessageSearchIndex;
+import org.apache.james.mailbox.store.event.MailboxAnnotationListener;
 import org.apache.james.mailbox.store.quota.ListeningCurrentQuotaUpdater;
 import org.junit.After;
 import org.junit.Before;
@@ -50,6 +51,6 @@ public class JamesSpringContextTest {
         InVMEventBus eventBus = context.getBean(InVMEventBus.class);
 
         assertThat(eventBus.registeredGroups())
-            .containsExactlyInAnyOrder(ListeningCurrentQuotaUpdater.GROUP, LuceneMessageSearchIndex.GROUP);
+            .containsExactlyInAnyOrder(MailboxAnnotationListener.GROUP, LuceneMessageSearchIndex.GROUP, ListeningCurrentQuotaUpdater.GROUP);
     }
 }
diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java
index 9e814d5..b3b2e89 100644
--- a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java
+++ b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/MailboxConfigurationBeanFactoryPostProcessor.java
@@ -43,9 +43,8 @@ public class MailboxConfigurationBeanFactoryPostProcessor implements BeanFactory
     private static final String JPA_MAILBOXMANAGER = "jpa-mailboxmanager";
     private static final String MEMORY_MAILBOX_MANAGER = "memory-mailboxManager";
     private static final String MAILDIR_MAILBOXMANAGER = "maildir-mailboxmanager";
-    private static final String CASSANDRA_MAILBOXMANAGER = "cassandra-mailboxmanager";
     private static final ImmutableSet<String> MAILBOX_MANAGER_IDS = ImmutableSet.of(JPA_MAILBOXMANAGER, MEMORY_MAILBOX_MANAGER,
-            MAILDIR_MAILBOXMANAGER, CASSANDRA_MAILBOXMANAGER);
+            MAILDIR_MAILBOXMANAGER);
 
     @Override
     public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
@@ -78,12 +77,6 @@ public class MailboxConfigurationBeanFactoryPostProcessor implements BeanFactory
                 messageMapperFactory = "maildir-sessionMapperFactory";
                 mailboxIdDeserializer = "maildir-mailbox-id-deserializer";
                 mailboxIdFactory = "maildir-mailboxIdFactory";
-            } else if (provider.equalsIgnoreCase("cassandra")) {
-                mailbox = CASSANDRA_MAILBOXMANAGER;
-                subscription = "cassandra-subscriptionManager";
-                messageMapperFactory = "cassandra-sessionMapperFactory";
-                mailboxIdDeserializer = "cassandra-mailbox-id-deserializer";
-                mailboxIdFactory = "cassandra-mailboxIdFactory";
             }
 
             if (mailbox == null) {
diff --git a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/QuotaBeanFactoryPostProcessor.java b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/QuotaBeanFactoryPostProcessor.java
index 833c119..ea805ca 100644
--- a/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/QuotaBeanFactoryPostProcessor.java
+++ b/server/container/spring/src/main/java/org/apache/james/container/spring/bean/factorypostprocessor/QuotaBeanFactoryPostProcessor.java
@@ -32,7 +32,6 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 public class QuotaBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
 
     private static final String IN_MEMORY_IMPLEMENTATION = "inmemory";
-    private static final String CASSANDRA_IMPLEMENTATION = "cassandra";
     private static final String FAKE_IMPLEMENTATION = "fake";
     private static final String MAX_QUOTA_MANAGER = "maxQuotaManager";
     private static final String JPA_IMPLEMENTATION = "jpa";
@@ -96,8 +95,6 @@ public class QuotaBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
             registry.registerAlias("noMaxQuotaManager", MAX_QUOTA_MANAGER);
         } else if (maxQuotaManager.equalsIgnoreCase(IN_MEMORY_IMPLEMENTATION)) {
             registry.registerAlias("inMemoryMaxQuotaManager", MAX_QUOTA_MANAGER);
-        } else if (maxQuotaManager.equalsIgnoreCase(CASSANDRA_IMPLEMENTATION)) {
-            registry.registerAlias("cassandraMaxQuotaManager", MAX_QUOTA_MANAGER);
         } else if (maxQuotaManager.equalsIgnoreCase(JPA_IMPLEMENTATION)) {
             registry.registerAlias("jpaMaxQuotaManager", MAX_QUOTA_MANAGER);
         } else {
@@ -108,9 +105,7 @@ public class QuotaBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
     private void registerAliasForCurrentQuotaManager(String currentQuotaManager, BeanDefinitionRegistry registry) {
         if (currentQuotaManager.equalsIgnoreCase(IN_MEMORY_IMPLEMENTATION)) {
             registry.registerAlias("inMemoryCurrentQuotaManager", CURRENT_QUOTA_MANAGER_BEAN);
-        } else if (currentQuotaManager.equalsIgnoreCase(CASSANDRA_IMPLEMENTATION)) {
-            registry.registerAlias("cassandraCurrentQuotaManager", CURRENT_QUOTA_MANAGER_BEAN);
-        }  else if (currentQuotaManager.equalsIgnoreCase(JPA_IMPLEMENTATION)) {
+        } else if (currentQuotaManager.equalsIgnoreCase(JPA_IMPLEMENTATION)) {
             registry.registerAlias("jpaCurrentQuotaManager", CURRENT_QUOTA_MANAGER_BEAN);
         } else if (! currentQuotaManager.equalsIgnoreCase("none")) {
             throw new FatalBeanException("Unreadable value for Current Quota Manager : " + currentQuotaManager);
diff --git a/src/site/xdoc/server/config-mailbox.xml b/src/site/xdoc/server/config-mailbox.xml
index 9109a2a..9c68bea 100644
--- a/src/site/xdoc/server/config-mailbox.xml
+++ b/src/site/xdoc/server/config-mailbox.xml
@@ -37,8 +37,7 @@
 
       <dl>
         <dt><strong>provider</strong></dt>
-        <dd>Supported providers are: jpa (default), maildir, memory. Be aware that maildir will only work on unix like operation systems!
-        Cassandra mailbox need to be compiled and run using java 8.</dd>
+        <dd>Supported providers are: jpa (default), maildir, memory. Be aware that maildir will only work on unix like operation systems!</dd>
       </dl>
 
       <p>See <a href="http://james.apache.org/mailbox/index.html">documentation page</a> to learn more about the different back-ends and their capabilities.</p>
diff --git a/src/site/xdoc/server/config-quota.xml b/src/site/xdoc/server/config-quota.xml
index 1198eb0..f13d3a2 100644
--- a/src/site/xdoc/server/config-quota.xml
+++ b/src/site/xdoc/server/config-quota.xml
@@ -56,11 +56,10 @@
         (depending on the implementation) update these per QUOTA ROOT maximum values. Four implementations are available for now. A NoQuotaManager implementation
         is read only and returns UNLIMITED maximum values. FixedMaxQuotaManager returns one and only one value for all user. You can configure these maximum values
           threw the configuration files. A InMemoryPerUserMaxQuotaManager allows you to configure quota for each QUOTA ROOT. Note that it needs to be done threw
-          configuration to be persistent. We provide some other implementation: A Cassandra implementation allows to store maximum quota values in Cassandra,
-          and a JPA implementation.</li>
+          configuration to be persistent. We provide some other implementation: A JPA implementation allows to store maximum quota values in a SQL database.</li>
         <li>Current Quota Manager: This component can be omitted if you are running a fake QUOTA manager. inmemory implementation is an event updated cache on
-        top of a Quota calculator (that fetches every e-mail metadata of every mailboxes belonging to the QUOTA ROOT: it is expensive). Cassandra and Jpa implementations
-        are also available.</li>
+        top of a Quota calculator (that fetches every e-mail metadata of every mailboxes belonging to the QUOTA ROOT: it is expensive). Jpa implementation
+        is also available.</li>
         <li>Quota Updater: This components allows to update current quota values. A fake implementation is available. A real, event base solution also exists.</li>
       </ul>
     </p>
@@ -87,7 +86,7 @@
       <ul>
         <li>Threw configuration file. Note that this is required to persist a change made to the inmemory or fixed Max Quota
           Manager. It needs a James reboot to take effect. Finally, using configuration file for setting maximum quota values
-          will override CLI set values. Avoid this option this persistent Max Quota Manager (for instance Cassandra)</li>
+          will override CLI set values. Avoid this option this persistent Max Quota Manager (for instance JPA)</li>
         <li>Threw the CLI: offers immediate configuration changes on quota maximum values. Note that if you are using either a
         fixed or inmemory Max QUota Manager, your changes need to be done to the XML configuration to be persisted.</li>
       </ul>


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