Last updated January 18, 2012 19:33, by shannon
= mbox Store =
The mbox Store supports reading messages from files in the UNIX
[ http://en.wikipedia.org/wiki/Mbox mbox ] format. The mbox Store
is included in the JavaMail source code, but is not currently distributed
with JavaMail. To use the mbox Store, you'll need to build it yourself.
=== File Locking ===
The mbox Store supports several file locking choices. To properly
interact with other native programs accessing UNIX mailboxes, native
file locking code is required. This native file locking code
has only been tested on Solaris, and requires a native
compiler to build. Native code is used to access the Solaris mailbox
locking functions in the libmail library. Unfortunately, the mailbox locking
protocol depends on creating hard links, which is not supported before JDK 7.
The mbox Store can also use Java file locking support, which will allow
coordination between multiple applications using the mbox Store, but
not with native applications accessing the same mailboxes.
Finally, the mbox Store can operate with no locking at all. This is only
appropriate if you're sure that only a single instance of your Java application
is accessing the mailbox, and no native applications are accessing the mailbox.
You'll need to coordinate access to the mailbox within your application to
ensure that each mailbox is accessed by only a single thread at a time.
The file locking options are selected by setting the mail.mbox.locktype
System property:
{|- border="1"
! Lock Type
! Description
|-
| native
| This is the default, which requires native code as described above.
|-
| java
| This uses java.nio.channels.FileLock.
|-
| none
| No file locking is done
|}
=== Mailbox Names ===
Mailbox names are of the form '''mbox:''''''''name'''''. If '''''name''''' is a relative path name,
it is normally relative to the current directory. If the System property mail.mbox.homerelative
is set to true, relative names are relative to the current user's home directory.
The mailbox name can also be of the form '''mbox:~/''''''''name''''', which is always relative
to the current user's home directory, or '''mbox:~''''''''user/name''''', which is relative to the
given user's home directory. (The latter only works on Solaris.)
The mailbox name '''mbox:INBOX''' is the current user's Inbox, .e.g, in /var/mail on Solaris.
=== Build Instructions ===
To build the mbox Store provider, assuming the "c89" compiler is in your PATH:
cd mbox
mvn
cd native
mvn
XXX - Still need to provide more information.





