|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mailet.GenericMatcher
org.apache.james.transport.matchers.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. |
Collection |
match(Mail mail)
Standard matcher entrypoint. |
protected long |
parseQuota(String amount)
Utility method that parses an amount string. |
Methods inherited from class org.apache.mailet.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 Collection match(Mail mail) throws 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 Matcher
match
in class GenericMatcher
mail
- - the Mail object that contains the MimeMessage and
routing information
MessagingException
- if either isSenderChecked
or isRecipientChecked throw an exceptionprotected 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 MessagingException
super.isSenderChecked
to its check.
sender
- the sender to check
MessagingException
protected boolean isRecipientChecked(MailAddress recipient) throws MessagingException
super.isRecipientChecked
to its check.
recipient
- the recipient to check
MessagingException
protected abstract long getQuota(MailAddress address, Mail mail) throws MessagingException
address
- the address holding the quota if applicablemail
- the mail involved if needed
MessagingException
protected abstract long getUsed(MailAddress address, Mail mail) throws MessagingException
address
- the address involvedmail
- the mail involved if needed
MessagingException
protected long parseQuota(String amount) throws MessagingException
amount
- the amount string to parse
MessagingException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |