Chapter 19. A Mail-Based Filesystem

“Every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.” (See the on-line hacker Jargon File, version 4.3.1, 29 JUN 2001: Zawinski’s Law ('s-Law.html).) The NetBeans IDE is no exception. Probably it will not replace your existing mail reader any time soon, but we can showcase how mail messages, including attachments, can be displayed inside the IDE. This chapter will show how to display an IMAP (Internet Message Access Protocol) mail server as a NetBeans filesystem.

Building a Mail Reader in the NetBeans Paradigm

To form the basic bones of our NetBeans mail reader, we start at the lowest level in the Open APIs hierarchy—the Filesystems API. All communication of the module with the mail server will happen via a filesystem that we define.

Why do our long examples start with the Filesystems API? This API is relatively self-contained (it can, in fact, be used independently of the rest of the NetBeans application) and so can be understood in its essentials within one chapter. Nonetheless, it provides a good summary of the basic programming style that characterizes the NetBeans APIs.

In Chapter 17 we touched on the importance of this API to the IDE and gave some examples of why the abstraction of filesystems could be used to advantage within the application. In the mail reader module, we will show how other subsystems of the ...

Get NetBeans: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.