org.chorem.pollen.ui.utils
Class SendMail

java.lang.Object
  extended by java.lang.Thread
      extended by org.chorem.pollen.ui.utils.SendMail
All Implemented Interfaces:
Runnable

public class SendMail
extends Thread

Mass mail management class. This class store email to send in a csv file, and send it (one per second) in a second time. This class can restart to send mail at application restart. For a mass mail sending to start, following files must be present:

Version:
$Revision: 2927 $ Last update : $Date: 2010-03-10 19:08:53 +0100 (mer., 10 mars 2010) $ By : $Author: echatellier $
Author:
chatellier

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  Configuration configuration
          Pollen configuration.
static String EXTENSION_INDEX
           
static String EXTENSION_MAIL
           
protected  File mailStorageDirectory
          Mail storage directory.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SendMail(Configuration configuration)
           
 
Method Summary
 void prepareMails(String id, List<Map<String,String>> mailData)
          Prepare mail list.
 void run()
           
protected  void sendAllMails()
          Look for all xx.index file, and restart mail sending on non ending mass mail sending.
protected  void sleep()
           
 void wakeUp()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

EXTENSION_MAIL

public static final String EXTENSION_MAIL
See Also:
Constant Field Values

EXTENSION_INDEX

public static final String EXTENSION_INDEX
See Also:
Constant Field Values

configuration

protected Configuration configuration
Pollen configuration.


mailStorageDirectory

protected File mailStorageDirectory
Mail storage directory.

Constructor Detail

SendMail

public SendMail(Configuration configuration)
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

sleep

protected void sleep()
              throws InterruptedException
Throws:
InterruptedException

wakeUp

public void wakeUp()

sendAllMails

protected void sendAllMails()
                     throws IOException
Look for all xx.index file, and restart mail sending on non ending mass mail sending. After execution, delete mail and index file.

Throws:
IOException

prepareMails

public void prepareMails(String id,
                         List<Map<String,String>> mailData)
                  throws IOException
Prepare mail list. TODO : improve configuration reading

Parameters:
id -
mailData -
Throws:
IOException


Copyright © 2009-2010 CodeLutin. All Rights Reserved.