Class 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 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 interface AlarmListener
        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)
      • removeIncomingMailPattern

        public void removeIncomingMailPattern​(java.lang.String pattern)
      • 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