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 2015/09/22 12:26:19 UTC

svn commit: r1704543 - in /james/mailbox/trunk: cassandra/src/main/resources/META-INF/spring/ hbase/src/main/resources/META-INF/spring/ jcr/src/main/resources/META-INF/spring/ jpa/src/main/resources/META-INF/spring/ maildir/src/main/resources/META-INF/...

Author: btellier
Date: Tue Sep 22 10:26:15 2015
New Revision: 1704543

URL: http://svn.apache.org/viewvc?rev=1704543&view=rev
Log:
MAILBOX-64 Spring integration for quotas

Added:
    james/mailbox/trunk/spring/src/main/resources/META-INF/spring/quota.xml
    james/mailbox/trunk/spring/src/test/resources/META-INF/spring/
    james/mailbox/trunk/spring/src/test/resources/META-INF/spring/quota-alias.xml
Modified:
    james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
    james/mailbox/trunk/hbase/src/main/resources/META-INF/spring/mailbox-hbase.xml
    james/mailbox/trunk/jcr/src/main/resources/META-INF/spring/mailbox-jcr.xml
    james/mailbox/trunk/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
    james/mailbox/trunk/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml
    james/mailbox/trunk/memory/src/main/resources/META-INF/spring/mailbox-memory.xml
    james/mailbox/trunk/spring/src/main/java/org/apache/james/mailbox/spring/SpringMailbox.java

Modified: james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml?rev=1704543&r1=1704542&r2=1704543&view=diff
==============================================================================
--- james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml (original)
+++ james/mailbox/trunk/cassandra/src/main/resources/META-INF/spring/mailbox-cassandra.xml Tue Sep 22 10:26:15 2015
@@ -31,6 +31,9 @@
         <constructor-arg index="1" ref="authenticator"/>
         <constructor-arg index="2" ref="cassandra-locker"/>
         <property name="messageSearchIndex" ref="elasticsearch-listener"/>
+        <property name="quotaManager" ref="quotaManager"/>
+        <property name="quotaRootResolver" ref="quotaRootResolver"/>
+        <property name="quotaUpdater" ref="quotaUpdater"/>
     </bean>
 
     <bean id ="cassandra-subscriptionManager" class="org.apache.james.mailbox.cassandra.CassandraSubscriptionManager">
@@ -54,6 +57,14 @@
 
     <alias name="no-locker" alias="cassandra-locker"/>
 
+    <bean name="cassandraMaxQuotaManager" class="org.apache.james.mailbox.cassandra.quota.CassandraPerUserMaxQuotaManager">
+        <constructor-arg index="0" ref="cassandra-session"/>
+    </bean>
+
+    <bean name="cassandraCurrentQuotaManager" class="org.apache.james.mailbox.cassandra.quota.CassandraCurrentQuotaManager">
+        <constructor-arg index="0" ref="cassandra-session"/>
+    </bean>
+
     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
         <property name="ignoreUnresolvablePlaceholders" value="true"/>
         <property name ="location" value="classpath:cassandra.properties"/>

Modified: james/mailbox/trunk/hbase/src/main/resources/META-INF/spring/mailbox-hbase.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/hbase/src/main/resources/META-INF/spring/mailbox-hbase.xml?rev=1704543&r1=1704542&r2=1704543&view=diff
==============================================================================
--- james/mailbox/trunk/hbase/src/main/resources/META-INF/spring/mailbox-hbase.xml (original)
+++ james/mailbox/trunk/hbase/src/main/resources/META-INF/spring/mailbox-hbase.xml Tue Sep 22 10:26:15 2015
@@ -43,6 +43,9 @@
         <constructor-arg index="2" ref="hbase-locker"/>
         <constructor-arg index="3" ref="aclResolver"/>
         <constructor-arg index="4" ref="groupMembershipResolver"/>
+        <property name="quotaManager" ref="quotaManager"/>
+        <property name="maxQuotaManager" ref="maxQuotaManager"/>
+        <property name="quotaRootResolver" ref="quotaRootResolver"/>
     </bean>
 
     <bean id="hbase-sessionMapperFactory" class="org.apache.james.mailbox.hbase.HBaseMailboxSessionMapperFactory">

Modified: james/mailbox/trunk/jcr/src/main/resources/META-INF/spring/mailbox-jcr.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/jcr/src/main/resources/META-INF/spring/mailbox-jcr.xml?rev=1704543&r1=1704542&r2=1704543&view=diff
==============================================================================
--- james/mailbox/trunk/jcr/src/main/resources/META-INF/spring/mailbox-jcr.xml (original)
+++ james/mailbox/trunk/jcr/src/main/resources/META-INF/spring/mailbox-jcr.xml Tue Sep 22 10:26:15 2015
@@ -33,6 +33,9 @@
         <constructor-arg index="2" ref="jcr-locker"/>
         <constructor-arg index="3" ref="aclResolver"/>
         <constructor-arg index="4" ref="groupMembershipResolver"/>
+        <property name="quotaManager" ref="quotaManager"/>
+        <property name="quotaRootResolver" ref="quotaRootResolver"/>
+        <property name="quotaUpdater" ref="quotaUpdater"/>
     </bean>
     <bean id ="jcr-subscriptionManager" class="org.apache.james.mailbox.jcr.JCRSubscriptionManager">
         <constructor-arg index="0" ref="jcr-sessionMapperFactory"/>

Modified: james/mailbox/trunk/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml?rev=1704543&r1=1704542&r2=1704543&view=diff
==============================================================================
--- james/mailbox/trunk/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml (original)
+++ james/mailbox/trunk/jpa/src/main/resources/META-INF/spring/mailbox-jpa.xml Tue Sep 22 10:26:15 2015
@@ -36,6 +36,9 @@
         <constructor-arg index="3" type="boolean" value="false"/>
         <constructor-arg index="4" ref="aclResolver"/>
         <constructor-arg index="5" ref="groupMembershipResolver"/>
+        <property name="quotaManager" ref="quotaManager"/>
+        <property name="quotaRootResolver" ref="quotaRootResolver"/>
+        <property name="quotaUpdater" ref="quotaUpdater"/>
     </bean>
     <bean id ="jpa-subscriptionManager" class="org.apache.james.mailbox.jpa.JPASubscriptionManager">
         <constructor-arg index="0" ref="jpa-sessionMapperFactory"/>

Modified: james/mailbox/trunk/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml?rev=1704543&r1=1704542&r2=1704543&view=diff
==============================================================================
--- james/mailbox/trunk/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml (original)
+++ james/mailbox/trunk/maildir/src/main/resources/META-INF/spring/mailbox-maildir.xml Tue Sep 22 10:26:15 2015
@@ -40,6 +40,9 @@
         <constructor-arg index="3" ref="aclResolver"/>
         <constructor-arg index="4" ref="groupMembershipResolver"/>
 <!--         <property name="messageSearchIndex" ref="lazyIndex"/> -->
+        <property name="quotaManager" ref="quotaManager"/>
+        <property name="quotaRootResolver" ref="quotaRootResolver"/>
+        <property name="quotaUpdater" ref="quotaUpdater"/>
     </bean>
     <bean id ="maildir-subscriptionManager" class="org.apache.james.mailbox.store.StoreSubscriptionManager">
         <constructor-arg index="0" ref="maildir-sessionMapperFactory"/>

Modified: james/mailbox/trunk/memory/src/main/resources/META-INF/spring/mailbox-memory.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/memory/src/main/resources/META-INF/spring/mailbox-memory.xml?rev=1704543&r1=1704542&r2=1704543&view=diff
==============================================================================
--- james/mailbox/trunk/memory/src/main/resources/META-INF/spring/mailbox-memory.xml (original)
+++ james/mailbox/trunk/memory/src/main/resources/META-INF/spring/mailbox-memory.xml Tue Sep 22 10:26:15 2015
@@ -36,6 +36,9 @@
         <constructor-arg index="3" ref="aclResolver"/>
         <constructor-arg index="4" ref="groupMembershipResolver"/>
 <!--         <property name="messageSearchIndex" ref="lazyIndex"/> -->
+        <property name="quotaManager" ref="quotaManager"/>
+        <property name="quotaRootResolver" ref="quotaRootResolver"/>
+        <property name="quotaUpdater" ref="quotaUpdater"/>
     </bean>
 
     <bean id ="memory-subscriptionManager" class="org.apache.james.mailbox.store.StoreSubscriptionManager">

Modified: james/mailbox/trunk/spring/src/main/java/org/apache/james/mailbox/spring/SpringMailbox.java
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/spring/src/main/java/org/apache/james/mailbox/spring/SpringMailbox.java?rev=1704543&r1=1704542&r2=1704543&view=diff
==============================================================================
--- james/mailbox/trunk/spring/src/main/java/org/apache/james/mailbox/spring/SpringMailbox.java (original)
+++ james/mailbox/trunk/spring/src/main/java/org/apache/james/mailbox/spring/SpringMailbox.java Tue Sep 22 10:26:15 2015
@@ -27,7 +27,8 @@ public class SpringMailbox {
     
     public SpringMailbox() {
         applicationContext = new ClassPathXmlApplicationContext("META-INF/spring/spring-mailbox.xml",
-                "META-INF/spring/mailbox-authenticator-anonymous.xml");
+            "META-INF/spring/mailbox-authenticator-anonymous.xml", "META-INF/spring/quota.xml",
+            "META-INF/spring/quota-alias.xml");
     }
     
     public Object getBean(String beanName) {

Added: james/mailbox/trunk/spring/src/main/resources/META-INF/spring/quota.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/spring/src/main/resources/META-INF/spring/quota.xml?rev=1704543&view=auto
==============================================================================
--- james/mailbox/trunk/spring/src/main/resources/META-INF/spring/quota.xml (added)
+++ james/mailbox/trunk/spring/src/main/resources/META-INF/spring/quota.xml Tue Sep 22 10:26:15 2015
@@ -0,0 +1,55 @@
+<?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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="defaultQuotaRootResolver" class="org.apache.james.mailbox.store.quota.DefaultQuotaRootResolver" lazy-init="true">
+        <constructor-arg index="0" ref="messageMapperFactory"/>
+    </bean>
+
+    <bean id="currentQuotaCalculator" class="org.apache.james.mailbox.store.quota.CurrentQuotaCalculator" lazy-init="true">
+        <constructor-arg index="0" ref="messageMapperFactory"/>
+        <constructor-arg index="1" ref="quotaRootResolver"/>
+    </bean>
+
+    <bean id="inMemoryCurrentQuotaManager" class="org.apache.james.mailbox.inmemory.quota.InMemoryCurrentQuotaManager" lazy-init="true">
+        <constructor-arg index="0" ref="currentQuotaCalculator"/>
+        <constructor-arg index="1" ref="mailboxmanager"/>
+    </bean>
+
+    <bean id="noMaxQuotaManager" class="org.apache.james.mailbox.store.quota.NoMaxQuotaManager" lazy-init="true"/>
+    <bean id="fixedMaxQuotaManager" class="org.apache.james.mailbox.store.quota.FixedMaxQuotaManager" lazy-init="true"/>
+    <bean id="inMemoryMaxQuotaManager" class="org.apache.james.mailbox.inmemory.quota.InMemoryPerUserMaxQuotaManager" lazy-init="true"/>
+
+    <bean id="noQuotaManager" class="org.apache.james.mailbox.store.quota.NoQuotaManager" lazy-init="true"/>
+    <bean id="storeQuotaManager" class="org.apache.james.mailbox.store.quota.StoreQuotaManager" lazy-init="true">
+        <property name="maxQuotaManager" ref="maxQuotaManager"/>
+        <property name="currentQuotaManager" ref="currentQuotaManager"/>
+    </bean>
+
+    <bean id="noQuotaUpdater" class="org.apache.james.mailbox.store.quota.NoQuotaUpdater" lazy-init="true"/>
+    <bean id="eventQuotaUpdater" class="org.apache.james.mailbox.store.quota.ListeningCurrentQuotaUpdater" lazy-init="true">
+        <property name="quotaRootResolver" ref="quotaRootResolver"/>
+        <property name="currentQuotaManager" ref="currentQuotaManager"/>
+    </bean>
+
+</beans>
\ No newline at end of file

Added: james/mailbox/trunk/spring/src/test/resources/META-INF/spring/quota-alias.xml
URL: http://svn.apache.org/viewvc/james/mailbox/trunk/spring/src/test/resources/META-INF/spring/quota-alias.xml?rev=1704543&view=auto
==============================================================================
--- james/mailbox/trunk/spring/src/test/resources/META-INF/spring/quota-alias.xml (added)
+++ james/mailbox/trunk/spring/src/test/resources/META-INF/spring/quota-alias.xml Tue Sep 22 10:26:15 2015
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <alias name="noMaxQuotaManager" alias="maxQuotaManager"/>
+    <alias name="noQuotaManager" alias="quotaManager"/>
+    <alias name="noQuotaUpdater" alias="quotaUpdater"/>
+    <alias name="defaultQuotaRootResolver" alias="quotaRootResolver"/>
+    <alias name="jpa-sessionMapperFactory" alias="messageMapperFactory"/>
+
+</beans>
\ No newline at end of file



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