Class MessageChecker
java.lang.Object
org.silverpeas.components.mailinglist.service.job.MessageChecker
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessageListener(MessageListener listener) Adds a new listener to the list of listeners.voidcheckNewMessages(Date date) Gets the new messages on the Mail Server and processes them.booleangetAllRecipients(jakarta.mail.internet.MimeMessage mail) Extracts all the recipients of an email.getLogin()jakarta.mail.SessionintgetPort()protected Set<MessageListener> getRecipientMailingLists(Collection<String> recipients, Map<String, MessageListener> listenersByEmail) Finds all the mailing lists recipients for an email.inthashCode()protected booleanisImap()booleanPrepare a map of subscribed email addresses and their corresponding listeners.protected voidprocessEmail(jakarta.mail.internet.MimeMessage mail, Map<MessageListener, MessageEvent> eventsMap, Map<String, MessageListener> listenersByEmail) Process an email, building the events to be send when all email have been processed.voidremoveListener(String componentId) Removes a listener from the list of listeners.voidschedule(org.silverpeas.core.scheduler.trigger.JobTrigger trigger) voidsetPort(int port) voidsetProtocol(String protocol) void
-
Field Details
-
IMAP_PROTOCOL
- See Also:
-
IMAP_SSL_PROTOCOL
- See Also:
-
POP3_PROTOCOL
- See Also:
-
-
Constructor Details
-
MessageChecker
public MessageChecker()Default constructor
-
-
Method Details
-
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
-
getPassword
-
getMailServer
-
isLeaveOnServer
public boolean isLeaveOnServer() -
getPort
public int getPort() -
setPort
public void setPort(int port) -
getProtocol
-
setProtocol
-
addMessageListener
Adds a new listener to the list of listeners.- Parameters:
listener- the listener to be added.
-
checkNewMessages
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, throws jakarta.mail.MessagingException, IOExceptionMessageListener> listenersByEmail) Process an email, building the events to be send when all email have been processed.- Parameters:
mail- the mail to be processedeventsMap- the map of MessageEventslistenersByEmail- the map of MessageListners with their emil address as key- Throws:
jakarta.mail.MessagingExceptionIOException
-
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:
-
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
Prepare a map of subscribed email addresses and their corresponding listeners.- Returns:
- a map of subscribed email addresses and their corresponding listeners.
-
removeListener
Removes a listener from the list of listeners.- Parameters:
componentId- the unique id of the component.
-
getMailProcessor
-
hashCode
public int hashCode() -
equals
-
isImap
protected boolean isImap()
-