i3mclient.email
Class EmailReceive

java.lang.Object
  |
  +--i3mclient.email.EmailReceive
All Implemented Interfaces:
Runnable

public class EmailReceive
extends Object
implements Runnable

This class worked for EmailReceiveManager. It starts a new own thread which received emails from one account in periodic time spans. These emails will be repacked for the EmailReceiveManager and send to it. The sleep time is devidet into two parts. 5 min means sleeping for 60x5sec., so the reaction time at closing of the class is only 5 sec. and not 5 min.

Author:
Gunther Wuerz
See Also:
EmailReceiveManager

Field Summary
static String PROVIDER_IMAP
           
static String PROVIDER_POP3
           
 
Constructor Summary
EmailReceive(String setHost, int setPort, String setUser, String setPasswd, String setProvider, Date setTime)
          Constructor.
 
Method Summary
 void addEmailNotificationListener(EmailListener listener)
          Adds a new listener for new email receive into a internal list.
 void addErrorListener(ErrorListener listener)
          Adds a new listener for any kind of errors into a internal list.
 Date getTime()
          Returns the date of the youngest eMail
 void removeEmailNotificationListener(EmailListener listener)
          Remove a new listener for new email receive into a internal list.
 void removeErrorListener(ErrorListener listener)
          Remove a new listener for any kind of errors from a internal list.
 void run()
           
 void start()
          Start the thread.
 void stop()
          Stop the thread by event flag.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROVIDER_POP3

public static final String PROVIDER_POP3
See Also:
Constant Field Values

PROVIDER_IMAP

public static final String PROVIDER_IMAP
See Also:
Constant Field Values
Constructor Detail

EmailReceive

public EmailReceive(String setHost,
                    int setPort,
                    String setUser,
                    String setPasswd,
                    String setProvider,
                    Date setTime)
Constructor.

Parameters:
setHost - The email server
setPort - The port of the email server
setUser - The name of the user
setPasswd - The password of the user
setProvider - The provider (pop3 or imap)
setTime - The time of last email receiving
Method Detail

getTime

public Date getTime()
Returns the date of the youngest eMail

Returns:
The time last emails received

start

public void start()
Start the thread.


stop

public void stop()
Stop the thread by event flag.


run

public void run()
Specified by:
run in interface Runnable

addEmailNotificationListener

public void addEmailNotificationListener(EmailListener listener)
Adds a new listener for new email receive into a internal list.

Parameters:
listener - The listener which will be informed about new mails

addErrorListener

public void addErrorListener(ErrorListener listener)
Adds a new listener for any kind of errors into a internal list.

Parameters:
listener - The listener which will be informed about errors

removeEmailNotificationListener

public void removeEmailNotificationListener(EmailListener listener)
Remove a new listener for new email receive into a internal list.

Parameters:
listener - The listener which will be no longer informed about new mails

removeErrorListener

public void removeErrorListener(ErrorListener listener)
Remove a new listener for any kind of errors from a internal list.

Parameters:
listener - The listener which will be no longer informed about errors