public class MaildirFolder extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
ACL_FILE |
static String |
CUR |
static String |
NEW |
static String |
TMP |
static String |
UIDLIST_FILE |
static String |
VALIDITY_FILE |
| Constructor and Description |
|---|
MaildirFolder(String absPath,
org.apache.james.mailbox.model.MailboxPath path,
org.apache.james.mailbox.MailboxPathLocker locker)
Representation of a maildir folder containing the message folders
and some special files
|
| Modifier and Type | Method and Description |
|---|---|
long |
appendMessage(org.apache.james.mailbox.MailboxSession session,
String name)
Appends a message to the uidlist and returns its uid.
|
MaildirMessageName |
delete(org.apache.james.mailbox.MailboxSession session,
long uid)
Retrieves the file belonging to the given uid, deletes it and updates
the uid list.
|
boolean |
exists()
Tests whether the directory belonging to this
MaildirFolder exists |
org.apache.james.mailbox.model.MailboxACL |
getACL(org.apache.james.mailbox.MailboxSession session) |
File |
getCurFolder()
Returns the .
|
long |
getHighestModSeq() |
long |
getLastUid(org.apache.james.mailbox.MailboxSession session)
Returns the last uid used in this mailbox
|
MaildirMessageName |
getMessageNameByUid(org.apache.james.mailbox.MailboxSession session,
Long uid)
Searches the uid list for a certain uid and returns the according
MaildirMessageName |
File |
getNewFolder()
Returns the .
|
SortedMap<Long,MaildirMessageName> |
getRecentMessages(org.apache.james.mailbox.MailboxSession session)
Creates a map of recent messages.
|
File |
getRootFile()
Returns the
File of this Maildir folder. |
File |
getTmpFolder()
Returns the .
|
SortedMap<Long,MaildirMessageName> |
getUidMap(org.apache.james.mailbox.MailboxSession session,
FilenameFilter filter,
int limit)
Reads all uids from the uid list file which match the given filter
and returns as many of them as a sorted map as the limit specifies.
|
SortedMap<Long,MaildirMessageName> |
getUidMap(org.apache.james.mailbox.MailboxSession session,
FilenameFilter filter,
long from,
long to) |
SortedMap<Long,MaildirMessageName> |
getUidMap(org.apache.james.mailbox.MailboxSession session,
long from,
long to)
Reads all uids between the two boundaries from the folder and returns them as
a sorted map together with their corresponding
MaildirMessageNames. |
long |
getUidValidity()
Returns the uidValidity of this mailbox
|
boolean |
isMessageNameStrictParse()
Returns whether the names of message files in this folder are parsed in
a strict manner (
true), which means a size field and flags are
expected. |
void |
setACL(org.apache.james.mailbox.MailboxSession session,
org.apache.james.mailbox.model.MailboxACL acl) |
void |
setMessageNameStrictParse(boolean messageNameStrictParse)
Specifies whether the names of message files in this folder are parsed in
a strict manner (
true), which means a size field and flags are
expected. |
void |
setUidValidity(long uidValidity)
Sets the uidValidity for this mailbox and writes it to the file system
|
static String |
stripMetaFromName(String fileName)
Takes the name of a message file and returns only the base name.
|
String |
toString()
The absolute path of this folder.
|
void |
update(org.apache.james.mailbox.MailboxSession session,
long uid,
String messageName)
Updates an entry in the uid list.
|
public static final String VALIDITY_FILE
public static final String UIDLIST_FILE
public static final String ACL_FILE
public static final String CUR
public static final String NEW
public static final String TMP
public MaildirFolder(String absPath, org.apache.james.mailbox.model.MailboxPath path, org.apache.james.mailbox.MailboxPathLocker locker)
absPath - The absolute path of the mailbox folderpublic boolean isMessageNameStrictParse()
true), which means a size field and flags are
expected.public void setMessageNameStrictParse(boolean messageNameStrictParse)
true), which means a size field and flags are
expected.messageNameStrictParse - public File getRootFile()
File of this Maildir folder.public boolean exists()
MaildirFolder existsMaildirFolder exists ; false otherwisepublic File getCurFolder()
./cur folderpublic File getNewFolder()
./new folderpublic File getTmpFolder()
./tmp folderpublic long getLastUid(org.apache.james.mailbox.MailboxSession session) throws org.apache.james.mailbox.exception.MailboxException
session - org.apache.james.mailbox.exception.MailboxExceptionpublic long getHighestModSeq() throws IOException
IOExceptionpublic long getUidValidity() throws IOException
IOExceptionpublic void setUidValidity(long uidValidity) throws IOException
uidValidity - IOExceptionpublic MaildirMessageName getMessageNameByUid(org.apache.james.mailbox.MailboxSession session, Long uid) throws org.apache.james.mailbox.exception.MailboxException
MaildirMessageNamesession - uid - The uid to search forMaildirMessageName that belongs to the uidIOException - If the uidlist file cannot be found or readorg.apache.james.mailbox.exception.MailboxExceptionpublic SortedMap<Long,MaildirMessageName> getUidMap(org.apache.james.mailbox.MailboxSession session, long from, long to) throws org.apache.james.mailbox.exception.MailboxException
MaildirMessageNames.session - from - The lower uid limitto - The upper uid limit. -1 disables the upper limitMap whith all uids in the given range and associated MaildirMessageNamesorg.apache.james.mailbox.exception.MailboxException - if there is a problem with the uid list filepublic SortedMap<Long,MaildirMessageName> getUidMap(org.apache.james.mailbox.MailboxSession session, FilenameFilter filter, long from, long to) throws org.apache.james.mailbox.exception.MailboxException
org.apache.james.mailbox.exception.MailboxExceptionpublic SortedMap<Long,MaildirMessageName> getUidMap(org.apache.james.mailbox.MailboxSession session, FilenameFilter filter, int limit) throws org.apache.james.mailbox.exception.MailboxException
session - filter - The file names of all returned items match the filter.
The dir argument to FilenameFilter.accept(dir, name) will always be null.limit - The number of items; a limit smaller then 1 disables the limitMap with all uids and associated MaildirMessageNamesorg.apache.james.mailbox.exception.MailboxException - if there is a problem with the uid list filepublic SortedMap<Long,MaildirMessageName> getRecentMessages(org.apache.james.mailbox.MailboxSession session) throws org.apache.james.mailbox.exception.MailboxException
session - Map with all uids and associated MaildirMessageNames of recent messagesorg.apache.james.mailbox.exception.MailboxException - If there is a problem with the uid list filepublic static String stripMetaFromName(String fileName)
fileName - The name of the message filepublic long appendMessage(org.apache.james.mailbox.MailboxSession session, String name) throws org.apache.james.mailbox.exception.MailboxException
session - name - The name of the message's fileIOExceptionorg.apache.james.mailbox.exception.MailboxExceptionpublic void update(org.apache.james.mailbox.MailboxSession session, long uid, String messageName) throws org.apache.james.mailbox.exception.MailboxException
session - uid - messageName - org.apache.james.mailbox.exception.MailboxExceptionpublic MaildirMessageName delete(org.apache.james.mailbox.MailboxSession session, long uid) throws org.apache.james.mailbox.exception.MailboxException
uid - The uid of the message to deleteMaildirMessageName of the deleted messageorg.apache.james.mailbox.exception.MailboxException - If the file cannot be deleted of there is a problem with the uid listpublic org.apache.james.mailbox.model.MailboxACL getACL(org.apache.james.mailbox.MailboxSession session) throws org.apache.james.mailbox.exception.MailboxException
org.apache.james.mailbox.exception.MailboxExceptionpublic void setACL(org.apache.james.mailbox.MailboxSession session, org.apache.james.mailbox.model.MailboxACL acl) throws org.apache.james.mailbox.exception.MailboxException
org.apache.james.mailbox.exception.MailboxExceptionCopyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.