Author: btellier
Date: Tue Sep 22 10:14:48 2015
New Revision: 1704515

URL: http://svn.apache.org/viewvc?rev=1704515&view=rev
Log:
MAILBOX-64 Modify and extends Quota APIs

Added:
    
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/QuotaRoot.java
    
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java
    
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java
    
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaRootPartitioner.java
Removed:
    
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/quota/FixedQuotaManager.java
    
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/quota/ListeningQuotaManager.java
    
james/mailbox/trunk/store/src/main/java/org/apache/james/mailbox/store/quota/PerUserQuotaManager.java
Modified:
    
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java

Added: 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/QuotaRoot.java
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/QuotaRoot.java?rev=1704515&view=auto
==============================================================================
--- 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/QuotaRoot.java
 (added)
+++ 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/model/QuotaRoot.java
 Tue Sep 22 10:14:48 2015
@@ -0,0 +1,29 @@
+/****************************************************************
+ * 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.mailbox.model;
+
+/**
+ * Represents RFC 2087 Quota root
+ */
+public interface QuotaRoot {
+
+    String getValue();
+
+}

Added: 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java?rev=1704515&view=auto
==============================================================================
--- 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java
 (added)
+++ 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/CurrentQuotaManager.java
 Tue Sep 22 10:14:48 2015
@@ -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.mailbox.quota;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.QuotaRoot;
+
+/**
+ * This interface allows us to get the current value associated to a quota 
value
+ */
+public interface CurrentQuotaManager {
+
+    long getCurrentMessageCount(QuotaRoot quotaRoot) throws MailboxException;
+
+    long getCurrentStorage(QuotaRoot quotaRoot) throws MailboxException;
+
+}

Added: 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java?rev=1704515&view=auto
==============================================================================
--- 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java
 (added)
+++ 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/MaxQuotaManager.java
 Tue Sep 22 10:14:48 2015
@@ -0,0 +1,85 @@
+/****************************************************************
+ * 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.mailbox.quota;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.QuotaRoot;
+
+/**
+ * This interface describe how to set the max quotas for users
+ * Part of RFC 2087 implementation
+ */
+public interface MaxQuotaManager {
+
+    /**
+     * Method allowing you to set the maximum storage quota for a given user
+     *
+     * @param quotaRoot Quota root argument from RFC 2087 ( correspond to the 
user owning this mailbox )
+     * @param maxStorageQuota The new storage quota ( in bytes ) for this user
+     */
+    void setMaxStorage(QuotaRoot quotaRoot, long maxStorageQuota) throws 
MailboxException;
+
+    /**
+     * Method allowing you to set the maximum message count allowed for this 
user
+     *
+     * @param quotaRoot Quota root argument from RFC 2087 ( correspond to the 
user owning this mailbox )
+     * @param maxMessageCount The new message count allowed for this user.
+     */
+    void setMaxMessage(QuotaRoot quotaRoot, long maxMessageCount) throws 
MailboxException;
+
+    /**
+     * Method allowing you to set the default maximum storage in bytes.
+     *
+     * @param defaultMaxStorage new default maximum storage
+     */
+    void setDefaultMaxStorage(long defaultMaxStorage) throws MailboxException;
+
+    /**
+     * Method allowing you to set the default maximum message count allowed
+     *
+     * @param defaultMaxMessageCount new default message count
+     */
+    void setDefaultMaxMessage(long defaultMaxMessageCount) throws 
MailboxException;
+
+    long getDefaultMaxStorage() throws MailboxException;
+
+    long getDefaultMaxMessage() throws MailboxException;
+
+    /**
+     * Return the maximum storage which is allowed for the given {@link 
QuotaRoot} (in fact the user which the session is bound to)
+     *
+     * The returned valued must be in <strong>bytes</strong>
+     *
+     * @param quotaRoot Quota root argument from RFC 2087 ( correspond to the 
user owning this mailbox )
+     * @return maxBytesThe maximum storage
+     * @throws MailboxException
+     */
+    long getMaxStorage(QuotaRoot quotaRoot) throws MailboxException;
+
+
+    /**
+     * Return the maximum message count which is allowed for the given {@link 
QuotaRoot} (in fact the user which the session is bound to)
+     *
+     * @param quotaRoot Quota root argument from RFC 2087 ( correspond to the 
user owning this mailbox )
+     * @return maximum of allowed message count
+     * @throws MailboxException
+     */
+    long getMaxMessage(QuotaRoot quotaRoot) throws MailboxException;
+}
\ No newline at end of file

Modified: 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java?rev=1704515&r1=1704514&r2=1704515&view=diff
==============================================================================
--- 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java
 (original)
+++ 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaManager.java
 Tue Sep 22 10:14:48 2015
@@ -18,36 +18,35 @@
  ****************************************************************/
 package org.apache.james.mailbox.quota;
 
-import org.apache.james.mailbox.MailboxSession;
 import org.apache.james.mailbox.exception.MailboxException;
 import org.apache.james.mailbox.model.Quota;
+import org.apache.james.mailbox.model.QuotaRoot;
 
 
 /**
- * Allows to get quotas for {@link MailboxSession} which are bound to a user.
- * 
+ * Allows to get quotas for {@link QuotaRoot} which are bound to a user.
+ * Part of RFC 2087 implementation
  */
 public interface QuotaManager {
 
     /**
-     * Return the message count {@link Quota} for the given {@link 
MailboxSession} (which in fact is 
+     * Return the message count {@link Quota} for the given {@link QuotaRoot} 
(which in fact is
      * bound to a user)
-     * 
-     * @param session
+     *
+     * @param quotaRoot Quota root argument from RFC 2087 ( correspond to the 
user owning this mailbox )
      * @return quota
      * @throws MailboxException
      */
-    public Quota getMessageQuota(MailboxSession session) throws 
MailboxException;
+    Quota getMessageQuota(QuotaRoot quotaRoot) throws MailboxException;
+
 
-    
     /**
-     * Return the message storage {@link Quota} for the given {@link 
MailboxSession} (which in fact is 
+     * Return the message storage {@link Quota} for the given {@link 
QuotaRoot} (which in fact is
      * bound to a user)
-     * 
-     * @param session
+     *
+     * @param quotaRoot Quota root argument from RFC 2087 ( correspond to the 
user owning this mailbox )
      * @return quota
      * @throws MailboxException
      */
-    public Quota getStorageQuota(MailboxSession session) throws 
MailboxException;
-    
+    Quota getStorageQuota(QuotaRoot quotaRoot) throws MailboxException;
 }

Added: 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaRootPartitioner.java
URL: 
http://svn.apache.org/viewvc/james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaRootPartitioner.java?rev=1704515&view=auto
==============================================================================
--- 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaRootPartitioner.java
 (added)
+++ 
james/mailbox/trunk/api/src/main/java/org/apache/james/mailbox/quota/QuotaRootPartitioner.java
 Tue Sep 22 10:14:48 2015
@@ -0,0 +1,35 @@
+/****************************************************************
+ * 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.mailbox.quota;
+
+import org.apache.james.mailbox.exception.MailboxException;
+import org.apache.james.mailbox.model.MailboxPath;
+import org.apache.james.mailbox.model.QuotaRoot;
+
+public interface QuotaRootPartitioner {
+    /**
+     * Return the quotaRoot associated with the given mailbox name.
+     *
+     * @param mailboxPath The name of the mailbox
+     * @return QuotaRoot ruling this mailbox ( we uses user owning this 
mailbox name )
+     * @throws MailboxException
+     */
+    QuotaRoot getQuotaRoot(MailboxPath mailboxPath) throws MailboxException;
+}



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

Reply via email to