talx x1.0.5

talx.model.filters
Class OutboxCountMonitor

java.lang.Object
  extended bytalx.model.filters.ReceiverFilterAdapter
      extended bytalx.model.filters.OutboxCountMonitor
All Implemented Interfaces:
java.util.EventListener, javax.mail.event.MessageCountListener, ReceiverFilter, ReceiverFilterListener, TALFeature

public class OutboxCountMonitor
extends ReceiverFilterAdapter
implements TALFeature, javax.mail.event.MessageCountListener

Keeps the outbox at or below a given size.


Constructor Summary
OutboxCountMonitor(TransportToolkit model, java.lang.String param)
           
 
Method Summary
protected  boolean filterMessage(javax.mail.internet.MimeMessage msg)
          Always returns true.
 void messagesAdded(javax.mail.event.MessageCountEvent e)
           
 void messagesRemoved(javax.mail.event.MessageCountEvent e)
           
 void release()
          Removes this monitor from the model's outbox.
 
Methods inherited from class talx.model.filters.ReceiverFilterAdapter
addFilterListener, filterActivated, fireFilterActivated, fireNewMailEvent, newMailArrived, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OutboxCountMonitor

public OutboxCountMonitor(TransportToolkit model,
                          java.lang.String param)
Parameters:
param - a string consisting of an optional global limit followed by a whitespace delimited list of zero or more pairs of the form buddyname=messagecount where buddyname is the real name of one of the people in the inbox model and messagecount is the maximum number of messages allowed for that person. If a buddyname appears in the list more than once, the behavior of this filter is undefined for that person. If a message comes in from a person who was not listed in the parameter string, then the global limit will be used as the maximum number of messages for that person. If there is no limit for a person and the global limit was less than one, then any number of messages are allowed.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the parameter string is empty or malformed.
Method Detail

messagesRemoved

public void messagesRemoved(javax.mail.event.MessageCountEvent e)
Specified by:
messagesRemoved in interface javax.mail.event.MessageCountListener

messagesAdded

public void messagesAdded(javax.mail.event.MessageCountEvent e)
Specified by:
messagesAdded in interface javax.mail.event.MessageCountListener

release

public void release()
Removes this monitor from the model's outbox.

Specified by:
release in interface TALFeature
Overrides:
release in class ReceiverFilterAdapter

filterMessage

protected boolean filterMessage(javax.mail.internet.MimeMessage msg)
Always returns true. This class is only a filter because it needs access to the store, and non-filter features don't have that. So, it never drops any messages. It just passes them through the chain.

Specified by:
filterMessage in class ReceiverFilterAdapter
Parameters:
msg - The message to be filtered by this method.
Returns:
true if the message should be passed along, false if the message should be dropped.

talx x1.0.5

© 2001-2005 University of Oregon.
Eugene OR 97403, U.S.A. All Rights Reserved.