org.apache.james.transport.matchers
Class AbstractStorageQuota

java.lang.Object
  extended by org.apache.mailet.GenericMatcher
      extended by org.apache.james.transport.matchers.AbstractQuotaMatcher
          extended by org.apache.james.transport.matchers.AbstractStorageQuota
All Implemented Interfaces:
Matcher, MatcherConfig
Direct Known Subclasses:
RecipientIsOverFixedQuota

public abstract class AbstractStorageQuota
extends AbstractQuotaMatcher

Experimental: Abstract matcher checking whether a recipient has exceeded a maximum allowed storage quota for messages standing in his inbox.

"Storage quota" at this level is still an abstraction whose specific interpretation will be done by subclasses (e.g. could be specific for each user or common to all of them).

This matcher need to calculate the mailbox size everytime it is called. This can slow down things if there are many mails in the mailbox. Some users also report big problems with the matcher if a JDBC based mailrepository is used.

Since:
2.2.0
Version:
CVS $Revision: 494058 $ $Date: 2007-01-08 13:18:22 +0000 (Mon, 08 Jan 2007) $

Constructor Summary
AbstractStorageQuota()
           
 
Method Summary
protected  java.lang.String getPrimaryName(java.lang.String originalUsername)
          Gets the main name of a local customer, handling aliases.
protected  long getUsed(MailAddress recipient, Mail _)
          Gets the storage used in the recipient's inbox.
 void init()
          Standard matcher initialization.
protected  boolean isRecipientChecked(MailAddress recipient)
          Checks the recipient.
 
Methods inherited from class org.apache.james.transport.matchers.AbstractQuotaMatcher
getQuota, isOverQuota, isSenderChecked, match, parseQuota
 
Methods inherited from class org.apache.mailet.GenericMatcher
destroy, getCondition, getMailetContext, getMatcherConfig, getMatcherInfo, getMatcherName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractStorageQuota

public AbstractStorageQuota()
Method Detail

init

public void init()
          throws javax.mail.MessagingException
Standard matcher initialization. Overriding classes must do a super.init().

Overrides:
init in class GenericMatcher
Throws:
javax.mail.MessagingException

isRecipientChecked

protected boolean isRecipientChecked(MailAddress recipient)
                              throws javax.mail.MessagingException
Checks the recipient. Does a super.isRecipientChecked and checks that the recipient is a known user in the local server. If a subclass overrides this method it should "and" super.isRecipientChecked to its check.

Overrides:
isRecipientChecked in class AbstractQuotaMatcher
Parameters:
recipient - the recipient to check
Throws:
javax.mail.MessagingException

getUsed

protected long getUsed(MailAddress recipient,
                       Mail _)
                throws javax.mail.MessagingException
Gets the storage used in the recipient's inbox.

Specified by:
getUsed in class AbstractQuotaMatcher
Parameters:
recipient - the recipient to check
_ - the mail involved if needed
Throws:
javax.mail.MessagingException

getPrimaryName

protected java.lang.String getPrimaryName(java.lang.String originalUsername)
Gets the main name of a local customer, handling aliases.

Parameters:
originalUsername - the user name to look for; it can be already the primary name or an alias
Returns:
the primary name, or originalUsername unchanged if not found


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.