public abstract class ListeningQuotaManager extends Object implements QuotaManager, MailboxListener
QuotaManager which will keep track of quota by listing for MailboxListener.Event's.
The whole quota is keeped in memory after it was lazy-fetched on the first access
*MailboxListener.Added, MailboxListener.Event, MailboxListener.Expunged, MailboxListener.FlagsUpdated, MailboxListener.MailboxACLUpdated, MailboxListener.MailboxAdded, MailboxListener.MailboxDeletion, MailboxListener.MailboxRenamed, MailboxListener.MessageEvent| Constructor and Description |
|---|
ListeningQuotaManager(StoreMailboxManager<?> manager) |
| Modifier and Type | Method and Description |
|---|---|
void |
event(MailboxListener.Event event)
Informs this listener about the given event.
|
protected MailboxSessionMapperFactory<?> |
getFactory() |
protected abstract long |
getMaxMessage(MailboxSession session)
Return the maximum message count which is allowed for the given
MailboxSession (in fact the user which the session is bound to) |
protected abstract long |
getMaxStorage(MailboxSession session)
Return the maximum storage which is allowed for the given
MailboxSession (in fact the user which the session is bound to)
The returned valued must be in bytes |
Quota |
getMessageQuota(MailboxSession session)
Return the message count
Quota for the given MailboxSession (which in fact is
bound to a user) |
Quota |
getStorageQuota(MailboxSession session)
Return the message storage
Quota for the given MailboxSession (which in fact is
bound to a user) |
boolean |
isClosed()
Get never closed
|
void |
setCalculateUsedWhenUnlimited(boolean calculateWhenUnlimited) |
public ListeningQuotaManager(StoreMailboxManager<?> manager) throws MailboxException
MailboxExceptionprotected MailboxSessionMapperFactory<?> getFactory()
public void setCalculateUsedWhenUnlimited(boolean calculateWhenUnlimited)
public Quota getMessageQuota(MailboxSession session) throws MailboxException
QuotaManagerQuota for the given MailboxSession (which in fact is
bound to a user)getMessageQuota in interface QuotaManagerMailboxExceptionpublic Quota getStorageQuota(MailboxSession session) throws MailboxException
QuotaManagerQuota for the given MailboxSession (which in fact is
bound to a user)getStorageQuota in interface QuotaManagerMailboxExceptionprotected abstract long getMaxStorage(MailboxSession session) throws MailboxException
MailboxSession (in fact the user which the session is bound to)
The returned valued must be in bytessession - MailboxExceptionprotected abstract long getMaxMessage(MailboxSession session) throws MailboxException
MailboxSession (in fact the user which the session is bound to)session - MailboxExceptionpublic void event(MailboxListener.Event event)
MailboxListenerevent in interface MailboxListenerevent - not nullpublic boolean isClosed()
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.