[Home | FAQ | Big Picture | Architecture]

Mailpuccino Architecture


The Mailpuccino class

The Mailpuccino class, besides having the "public static void main(String[])" application entry method, is also a utility class of sorts. It contains many static methods that are called by many other classes, like methods to centralize a window on the screen, return the active user's Preferences object, return the root Preferences object, load image-icons, etc.

State information (Preferences)

In Mailpuccino, all state information (I call it Preferences) is stored in the file "mailpuccino.prefs". The other file "default.prefs" is used when "mailpuccino.prefs" is corrupted for some reason, and also used to upgrade "mailpuccino.prefs" to the latest version when a updated version of Mailpuccino is installed and run. The class that deals with preferences is Preferences.

All information is stored in a hierarchical (tree) fashion, in key-value pairs. Look at the class's code for implementation details. One other point of interest is that although the current version (v0.9 as I write this document) supports a single-user only, the design of the preferences tree actually allows for multi-user operation. i.e. each user's preferences are stored in it's own subtree. So, multi-user operation can be added without much messiness in future version of Mailpuccino.

Folders

The primary folder classes in Mailpucino are LocalFolder, POP3Folder and IMAPFolder. All these classes inherit from Folder. Individual Email Messages are represented by EmailID. In fact, for each type of folder, there is a corresponding class that represents each message in the folder - all of which inherit from EmailID. These classes are LocalEmailID and IMAPEmailID. The reason why there is no POP3EmailID is because POP3Folder actually inherits from LocalFolder - after all, a POP3 folder is simply a Local (Disk-based) folder that downloads email from the POP3 server.

There is also the FolderListener. Objects wanting to receive Folder events just add a FolderListener to the target folder.

All folders are "managed" by the FolderManager class. This class stores the entire folder tree, keeps track of the open folders, and does other book-keeping tasks. Look at the class for implementation details. One important thing to note is that Folders should be opened/close via the FolderManager's open and close methods, not the folder object's own open and close method.