java.lang.Object
org.silverpeas.components.mailinglist.service.job.MessageChecker

@Service public class MessageChecker extends Object
  • Field Details

  • Constructor Details

    • MessageChecker

      public MessageChecker()
      Default constructor
  • Method Details

    • getMailingListService

      public MailingListService getMailingListService()
    • getMailSession

      public jakarta.mail.Session getMailSession()
    • schedule

      public void schedule(org.silverpeas.core.scheduler.trigger.JobTrigger trigger) throws org.silverpeas.core.scheduler.SchedulerException
      Throws:
      org.silverpeas.core.scheduler.SchedulerException
    • unschedule

      public void unschedule() throws org.silverpeas.core.scheduler.SchedulerException
      Throws:
      org.silverpeas.core.scheduler.SchedulerException
    • getLogin

      public String getLogin()
    • getPassword

      public String getPassword()
    • getMailServer

      public String getMailServer()
    • isLeaveOnServer

      public boolean isLeaveOnServer()
    • getPort

      public int getPort()
    • setPort

      public void setPort(int port)
    • getProtocol

      public String getProtocol()
    • setProtocol

      public void setProtocol(String protocol)
    • addMessageListener

      public void addMessageListener(MessageListener listener)
      Adds a new listener to the list of listeners.
      Parameters:
      listener - the listener to be added.
    • checkNewMessages

      public void checkNewMessages(Date date)
      Gets the new messages on the Mail Server and processes them.
      Parameters:
      date - the date of the checking.
    • processEmail

      protected void processEmail(jakarta.mail.internet.MimeMessage mail, Map<MessageListener,MessageEvent> eventsMap, Map<String,MessageListener> listenersByEmail) throws jakarta.mail.MessagingException, IOException
      Process an email, building the events to be send when all email have been processed.
      Parameters:
      mail - the mail to be processed
      eventsMap - the map of MessageEvents
      listenersByEmail - the map of MessageListners with their emil address as key
      Throws:
      jakarta.mail.MessagingException
      IOException
    • getAllRecipients

      protected Set<String> getAllRecipients(jakarta.mail.internet.MimeMessage mail) throws jakarta.mail.MessagingException
      Extracts all the recipients of an email.
      Parameters:
      mail - the email whose recipients are extracted.
      Returns:
      a list of InternetAdress.
      Throws:
      jakarta.mail.MessagingException
      See Also:
      • InternetAddress
    • getRecipientMailingLists

      protected Set<MessageListener> getRecipientMailingLists(Collection<String> recipients, Map<String,MessageListener> listenersByEmail)
      Finds all the mailing lists recipients for an email.
      Parameters:
      recipients - the recipients of the email.
      Returns:
      the list of mailing lists (as MessageListener) for this email.
    • prepareListeners

      public Map<String,MessageListener> prepareListeners()
      Prepare a map of subscribed email addresses and their corresponding listeners.
      Returns:
      a map of subscribed email addresses and their corresponding listeners.
    • removeListener

      public void removeListener(String componentId)
      Removes a listener from the list of listeners.
      Parameters:
      componentId - the unique id of the component.
    • getMailProcessor

      public MailProcessor getMailProcessor()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isImap

      protected boolean isImap()