com.jalios.jcms.mail
Class MailFetcher

java.lang.Object
  extended by com.jalios.jcms.mail.MailFetcher
All Implemented Interfaces:
AlarmListener, JPropertiesListener

public class MailFetcher
extends Object
implements JPropertiesListener, AlarmListener

The MailFetcher is used for communication between JCMS, MailServer and Mail Account.

Version:
$Revision: 26594 $
Author:
Jean-Philippe Encausse

Field Summary
static String ALARM_MAIL_FETCHER
           
static String CONTEXT_MAILFETCHER
           
static String REVISION
           
 
Constructor Summary
protected MailFetcher()
           
 
Method Summary
 void addArchiveMailPattern(String pattern, ArchiveMailListener.ArchiveMailCriteria criteria)
           
 void addMailListener(MailListener ml)
           
protected  Collection<MailMessage.Part> decodeMultipart(javax.mail.Message msg)
           
 void fetch(MailAccount account)
          Fetch given MailAccount and Fire MailMessage to listeners.
protected  void fireFetchMessage(MailAccount account, MailMessage mail)
           
 ArchiveMailListener getArchiveMailListener()
           
 MailAccount getLastFetchAccount()
          Returns the latest Mail Account fetched
 Map<String,MailAccount> getMailAccountMap()
          Retrieve MailAccount list from properties
static String getMessageIdQuietly(javax.mail.Message msg)
          Returns the messageId for the given message.
 void handleAlarm(AlarmEntry entry)
          Invoked when an alarm is triggered.
 void propertiesChange(JProperties properties)
           
 void removeArchiveMailPattern(String pattern)
           
 void removeMailListener(MailListener ml)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

ALARM_MAIL_FETCHER

public static final String ALARM_MAIL_FETCHER
See Also:
Constant Field Values

CONTEXT_MAILFETCHER

public static final String CONTEXT_MAILFETCHER
See Also:
Constant Field Values
Constructor Detail

MailFetcher

protected MailFetcher()
Method Detail

handleAlarm

public void handleAlarm(AlarmEntry entry)
Description copied from interface: AlarmListener
Invoked when an alarm is triggered.

Specified by:
handleAlarm in interface AlarmListener
Parameters:
entry - the AlarmEntry which has been triggered.

propertiesChange

public void propertiesChange(JProperties properties)
Specified by:
propertiesChange in interface JPropertiesListener

getLastFetchAccount

public MailAccount getLastFetchAccount()
Returns the latest Mail Account fetched

Returns:
MailAccount the latest fetch mail account

getMailAccountMap

public Map<String,MailAccount> getMailAccountMap()
Retrieve MailAccount list from properties

Returns:
List of MailAccount

addMailListener

public void addMailListener(MailListener ml)

removeMailListener

public void removeMailListener(MailListener ml)

fireFetchMessage

protected void fireFetchMessage(MailAccount account,
                                MailMessage mail)

getArchiveMailListener

public ArchiveMailListener getArchiveMailListener()

addArchiveMailPattern

public void addArchiveMailPattern(String pattern,
                                  ArchiveMailListener.ArchiveMailCriteria criteria)

removeArchiveMailPattern

public void removeArchiveMailPattern(String pattern)

getMessageIdQuietly

public static String getMessageIdQuietly(javax.mail.Message msg)
Returns the messageId for the given message. Trying to catch and log messaging exception.

Parameters:
msg - the javax.mail.Message
Returns:
String the message Id or null

fetch

public void fetch(MailAccount account)
Fetch given MailAccount and Fire MailMessage to listeners.
  1. Retrieve Message from server
  2. Build MailMessage and download attachements
  3. Remove message from server
  4. Fire notification

Parameters:
account - the mailAccount to Fetch

decodeMultipart

protected Collection<MailMessage.Part> decodeMultipart(javax.mail.Message msg)
                                                throws javax.mail.MessagingException,
                                                       IOException
Throws:
javax.mail.MessagingException
IOException


Copyright © 2001-2010 Jalios SA. All Rights Reserved.