Package com.jalios.jcms.mail
Class MailFetcher
- java.lang.Object
-
- com.jalios.jcms.mail.MailFetcher
-
- All Implemented Interfaces:
AlarmListener
public class MailFetcher extends java.lang.Object implements AlarmListener
The MailFetcher is used for communication between JCMS, MailServer and Mail Account.- Fetch message from MailAccount
- Fire fetching information to MailListeners
- Provides convenient methods to handle Message retrieved from MailAccount
- Author:
- Jean-Philippe Encausse
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALARM_MAIL_FETCHER
static java.lang.String
CONTEXT_MAILFETCHER
-
Constructor Summary
Constructors Modifier Constructor Description protected
MailFetcher(java.util.Map<java.lang.String,AbstractMailProvider> providerMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addIncomingMailPattern(java.lang.String pattern, IncomingMailListener.IncomingMailCriteria criteria)
void
addMailListener(MailListener ml)
void
fetch(MailAccount account)
Fetch given MailAccount and Fire MailMessage to listeners.IncomingMailListener
getIncomingMailListener()
MailAccount
getLastFetchAccount()
Returns the latest Mail Account fetchedjava.util.Map<java.lang.String,MailAccount>
getMailAccountMap()
Retrieve MailAccount listvoid
handleAlarm(AlarmEntry entry)
Invoked when an alarm is triggered.protected void
initWithProviderMap(java.util.Map<java.lang.String,AbstractMailProvider> providerMap)
void
removeIncomingMailPattern(java.lang.String pattern)
void
removeMailListener(MailListener ml)
-
-
-
Field Detail
-
ALARM_MAIL_FETCHER
public static final java.lang.String ALARM_MAIL_FETCHER
- See Also:
- Constant Field Values
-
CONTEXT_MAILFETCHER
public static final java.lang.String CONTEXT_MAILFETCHER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MailFetcher
protected MailFetcher(java.util.Map<java.lang.String,AbstractMailProvider> providerMap)
-
-
Method Detail
-
handleAlarm
public void handleAlarm(AlarmEntry entry)
Description copied from interface:AlarmListener
Invoked when an alarm is triggered.- Specified by:
handleAlarm
in interfaceAlarmListener
- Parameters:
entry
- the AlarmEntry which has been triggered.
-
initWithProviderMap
protected void initWithProviderMap(java.util.Map<java.lang.String,AbstractMailProvider> providerMap)
-
getLastFetchAccount
public MailAccount getLastFetchAccount()
Returns the latest Mail Account fetched- Returns:
- MailAccount the latest fetch mail account
-
getMailAccountMap
public java.util.Map<java.lang.String,MailAccount> getMailAccountMap()
Retrieve MailAccount list- Returns:
- List of MailAccount
-
addMailListener
public void addMailListener(MailListener ml)
-
removeMailListener
public void removeMailListener(MailListener ml)
-
getIncomingMailListener
public IncomingMailListener getIncomingMailListener()
-
addIncomingMailPattern
public void addIncomingMailPattern(java.lang.String pattern, IncomingMailListener.IncomingMailCriteria criteria)
-
removeIncomingMailPattern
public void removeIncomingMailPattern(java.lang.String pattern)
-
fetch
public void fetch(MailAccount account)
Fetch given MailAccount and Fire MailMessage to listeners.- Retrieve Message from server
- Build MailMessage and download attachements
- Remove message from server
- Fire notification
- Parameters:
account
- the mailAccount to Fetch
-
-