Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.forum.mail
Class EmailMonitor

java.lang.Object
  extended by com.jivesoftware.forum.mail.EmailMonitor

public class EmailMonitor
extends java.lang.Object

EmailMonitor is the main class of the forums email integration feature which allows users to post forum messages by replying to watch notification emails. EmailMonitor periodically checks the configured email account for messages and uses their contents to post replies to forum threads. Replies are posted as the user who sent the email - a special token returned with the subject line is used to authenticate the user and route the message.

The singleton instance of this class is obtained by calling the getInstance() method. To begin the periodic checks for new email, call the start() method. To stop them, call stop(). Multiple calls to start() will not result in multiple email checking tasks, and only one account can be monitored at a time.

See Also:
EmailTokenManager, EmailAction, EmailParser

Field Summary
static java.lang.String SSL_FACTORY
          Constant holding the class name of the ssl socket factory to install when using ssl.
 
Method Summary
static EmailMonitor getInstance()
          Returns the singleton instance.
 java.util.regex.Pattern getTokenPattern()
          Returns a Pattern which can be used to detect the presence of email tokens.
 boolean isEnabled()
          Returns true if forums is configured to check for incoming mail.
 void processMessages()
          Checks the email account specified by constructor parameters, reads messages and takes appropriate action based on message content.
 void restart()
          Stops, then starts email monitoring task.
 void sendRejectionMail(EmailMonitorException exception)
          Sends rejection mail using supplied EmailMonitorException and property string.
 void start()
          Starts periodic checking of the mail account.
 void start(long delay, long period)
          Starts periodic checking of the mail account.
 void stop()
          Stops periodic checking of the mail account.
 boolean testConnection()
          Attempts to connect to the mail server with the currently configured parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSL_FACTORY

public static final java.lang.String SSL_FACTORY
Constant holding the class name of the ssl socket factory to install when using ssl.

See Also:
Constant Field Values
Method Detail

getInstance

public static EmailMonitor getInstance()
Returns the singleton instance.

Returns:
the singleton instance.

start

public void start()
Starts periodic checking of the mail account. The frequency will be the value (in seconds) found in the jive property checkmail.frequency. If that value is not set, a default of thirty seconds is used.


start

public void start(long delay,
                  long period)
Starts periodic checking of the mail account.

Parameters:
delay - the number of milliseconds to delay before first check.
period - the number of milliseconds to delay between checks.

stop

public void stop()
Stops periodic checking of the mail account.


restart

public void restart()
Stops, then starts email monitoring task. Call this after changing configuration properties which affect the email monitoring behavior (such as those System - Email Settings in the admin console).


testConnection

public boolean testConnection()
Attempts to connect to the mail server with the currently configured parameters. Returns true if connection was successful, false otherwise.

Returns:
true if the connection attempt was successful, false otherwise.

processMessages

public void processMessages()
Checks the email account specified by constructor parameters, reads messages and takes appropriate action based on message content.


sendRejectionMail

public void sendRejectionMail(EmailMonitorException exception)
Sends rejection mail using supplied EmailMonitorException and property string. Throws no exceptions, so it is safe to use inside a catch block.

Parameters:
exception - the EmailMonitorException to use for user and address properties.

getTokenPattern

public java.util.regex.Pattern getTokenPattern()
Returns a Pattern which can be used to detect the presence of email tokens.

Returns:
a Pattern which can be used to detect the presence of email tokens.

isEnabled

public boolean isEnabled()
Returns true if forums is configured to check for incoming mail.

Returns:
true if forums is configured to check for incoming mail.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.