Package com.nilhcem.fakesmtp.server
Class MailSaver
java.lang.Object
java.util.Observable
com.nilhcem.fakesmtp.server.MailSaver
Saves emails and notifies components so they can refresh their views with new data.
- Since:
- 1.0
- Author:
- Nilhcem
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes all received emails from file system.getLock()
Returns a lock object.void
saveEmailAndNotify
(String from, String to, InputStream data) Saves incoming email in file system and notifies observers.Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
Constructor Details
-
MailSaver
public MailSaver()
-
-
Method Details
-
saveEmailAndNotify
Saves incoming email in file system and notifies observers.- Parameters:
from
- the user who send the email.to
- the recipient of the email.data
- an InputStream object containing the email.- See Also:
-
deleteEmails
public void deleteEmails()Deletes all received emails from file system. -
getLock
Returns a lock object.This lock will be used to make the application thread-safe, and avoid receiving and deleting emails in the same time.
- Returns:
- a lock object (which is actually the current instance of the
MailSaver
object).
-