talx x1.0.5

talx.model.filters
Class RemoteSender

java.lang.Object
  extended bytalx.model.filters.RemoteSender
All Implemented Interfaces:
DelayedFeature, java.util.EventListener, java.lang.Runnable, SenderFilter, SenderFilterListener, TALFeature

public class RemoteSender
extends java.lang.Object
implements java.lang.Runnable, SenderFilter, DelayedFeature

Sends messages from the outgoing filter stack to an SMTPServer.


Field Summary
protected  boolean done
          Whether the sender thread should stop because the email system is being shut down.
protected  SenderFilterListener[] listeners
          Holds all the classes listening to events from this class.
protected  java.util.List messages
          Contains outgoing messages that need to be sent.
protected  java.lang.Thread sender
          The thread responsible for sending messages from the queue.
 
Constructor Summary
RemoteSender(TransportToolkit tm, Settings settings, java.lang.String param)
          Constructs new SMTP sender.
 
Method Summary
 void addFilterListener(SenderFilterListener l)
           
 void filterActivated(TALMailEvent ev)
          This method is called when we have filtered/dropped a message.
 void initialize()
          Called to initialize the feature.
 void release()
          blocks until the sender thread has sent all messages.
 boolean reload()
          Reloads the queue with unsent messages from the mailbox.
 void run()
          Periodically checks for outgoing mail from the messages vector and sends out the outgoing mail through JavaMail Transport object.
 void sendingMail(TALMailEvent ev)
          This method is used by other components to let us know that a message in needs to be sent.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listeners

protected SenderFilterListener[] listeners
Holds all the classes listening to events from this class.


messages

protected java.util.List messages
Contains outgoing messages that need to be sent.


sender

protected java.lang.Thread sender
The thread responsible for sending messages from the queue.


done

protected boolean done
Whether the sender thread should stop because the email system is being shut down.

Constructor Detail

RemoteSender

public RemoteSender(TransportToolkit tm,
                    Settings settings,
                    java.lang.String param)
Constructs new SMTP sender. The parameter string consist of the following space-delimited name=value pairs:
namevalue
service"smtp"
hostThe computer hosting the SMTP service.
userThe username for the SMTP account.
passwordThe password for the SMTP account

Method Detail

initialize

public void initialize()
Description copied from interface: DelayedFeature
Called to initialize the feature. See the Email class for details of the load sequence.

Specified by:
initialize in interface DelayedFeature

sendingMail

public void sendingMail(TALMailEvent ev)
This method is used by other components to let us know that a message in needs to be sent. So we prepare the message for delivery, and then pass it on to the SenderThread for delivery.

Specified by:
sendingMail in interface SenderFilterListener
Parameters:
ev - The event object containing message to be sent.

filterActivated

public void filterActivated(TALMailEvent ev)
Description copied from interface: SenderFilterListener
This method is called when we have filtered/dropped a message.

Specified by:
filterActivated in interface SenderFilterListener

addFilterListener

public void addFilterListener(SenderFilterListener l)
Specified by:
addFilterListener in interface SenderFilter

reload

public boolean reload()
Reloads the queue with unsent messages from the mailbox.

Returns:
true if unsent messages were found, false otherwise.

run

public void run()
Periodically checks for outgoing mail from the messages vector and sends out the outgoing mail through JavaMail Transport object.

Specified by:
run in interface java.lang.Runnable

release

public void release()
blocks until the sender thread has sent all messages.

Specified by:
release in interface TALFeature

toString

public java.lang.String toString()

talx x1.0.5

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