| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mailet.base.GenericMatcher
org.apache.james.transport.matchers.AbstractQuotaMatcher
public abstract class AbstractQuotaMatcher
Abstract matcher checking whether a recipient has exceeded a maximum allowed quota.
"Quota" at this level is an abstraction whose specific interpretation will be done by subclasses.
Although extending GenericMatcher, its logic is recipient oriented.
| Constructor Summary | |
|---|---|
AbstractQuotaMatcher()
 | 
|
| Method Summary | |
|---|---|
protected abstract  long | 
getQuota(MailAddress address,
         Mail mail)
Gets the quota to check against.  | 
protected abstract  long | 
getUsed(MailAddress address,
        Mail mail)
Gets the used amount to check against the quota.  | 
protected  boolean | 
isOverQuota(MailAddress address,
            Mail mail)
Does the quota check.  | 
protected  boolean | 
isRecipientChecked(MailAddress recipient)
Checks the recipient.  | 
protected  boolean | 
isSenderChecked(MailAddress sender)
Checks the sender.  | 
 java.util.Collection | 
match(Mail mail)
Standard matcher entrypoint.  | 
protected  long | 
parseQuota(java.lang.String amount)
Utility method that parses an amount string.  | 
| Methods inherited from class org.apache.mailet.base.GenericMatcher | 
|---|
destroy, getCondition, getMailetContext, getMatcherConfig, getMatcherInfo, getMatcherName, init, init, log, log | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public AbstractQuotaMatcher()
| Method Detail | 
|---|
public final java.util.Collection match(Mail mail)
                                 throws javax.mail.MessagingException
isSenderChecked(org.apache.mailet.MailAddress).
 Then, for each recipient checks it using isRecipientChecked(org.apache.mailet.MailAddress) and
 isOverQuota(org.apache.mailet.MailAddress, org.apache.mailet.Mail).
match in interface Matchermatch in class GenericMatcherjavax.mail.MessagingException - if either isSenderChecked or isRecipientChecked throw an exception
protected boolean isOverQuota(MailAddress address,
                              Mail mail)
getQuota(org.apache.mailet.MailAddress, org.apache.mailet.Mail) < getUsed(org.apache.mailet.MailAddress, org.apache.mailet.Mail) for a recipient.
 Catches any throwable returning false, and so should any override do.
address - the recipient addresss to checkmail - the mail involved in the check
protected boolean isSenderChecked(MailAddress sender)
                           throws javax.mail.MessagingException
super.isSenderChecked
 to its check.
sender - the sender to check
javax.mail.MessagingException
protected boolean isRecipientChecked(MailAddress recipient)
                              throws javax.mail.MessagingException
super.isRecipientChecked
 to its check.
recipient - the recipient to check
javax.mail.MessagingException
protected abstract long getQuota(MailAddress address,
                                 Mail mail)
                          throws javax.mail.MessagingException
address - the address holding the quota if applicablemail - the mail involved if needed
javax.mail.MessagingException
protected abstract long getUsed(MailAddress address,
                                Mail mail)
                         throws javax.mail.MessagingException
address - the address involvedmail - the mail involved if needed
javax.mail.MessagingException
protected long parseQuota(java.lang.String amount)
                   throws javax.mail.MessagingException
amount - the amount string to parse
javax.mail.MessagingException
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||