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

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).

Since:
2.2.0
Version:
CVS $Revision: 382410 $ $Date: 2006-03-02 15:27:24 +0000 (gio, 02 mar 2006) $

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-2007 The Apache Software Foundation. All Rights Reserved.