org.apache.james.transport.matchers
Class RecipientIsOverFixedQuota

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
              extended by org.apache.james.transport.matchers.RecipientIsOverFixedQuota
All Implemented Interfaces:
Matcher, MatcherConfig

public class RecipientIsOverFixedQuota
extends AbstractStorageQuota

Experimental: Checks whether a recipient has exceeded a maximum allowed quota for messages standing in his inbox. Such quota is the same for all users.

Will check if the total size of all his messages in the inbox are greater than a certain number of bytes. You can use 'k' and 'm' as optional postfixes. In other words, "1m" is the same as writing "1024k", which is the same as "1048576".

Here follows an example of a config.xml definition:


 <processor name="transport">
 .
 .
 .
    <mailet match=match="RecipientIsOverFixedQuota=40M" class="ToProcessor">
       <processor> error </processor>
       <notice>The recipient has exceeded maximum allowed size quota</notice>
    </mailet>
 .
 .
 .
 </processor>
 

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.

Version:
1.0.0, 2003-05-11

Constructor Summary
RecipientIsOverFixedQuota()
           
 
Method Summary
protected  long getQuota(MailAddress recipient, Mail _)
          Gets the quota to check against.
 void init()
          Standard matcher initialization.
 
Methods inherited from class org.apache.james.transport.matchers.AbstractStorageQuota
getPrimaryName, getUsed, isRecipientChecked
 
Methods inherited from class org.apache.james.transport.matchers.AbstractQuotaMatcher
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

RecipientIsOverFixedQuota

public RecipientIsOverFixedQuota()
Method Detail

init

public void init()
          throws javax.mail.MessagingException
Standard matcher initialization. Does a super.init() and parses the common storage quota amount from config.xml for later use.

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

getQuota

protected long getQuota(MailAddress recipient,
                        Mail _)
                 throws javax.mail.MessagingException
Description copied from class: AbstractQuotaMatcher
Gets the quota to check against.

Specified by:
getQuota in class AbstractQuotaMatcher
Parameters:
recipient - the address holding the quota if applicable
_ - the mail involved if needed
Throws:
javax.mail.MessagingException


Copyright © 2002-2007 The Apache Software Foundation. All Rights Reserved.