public class MaildirStore extends Object implements UidProvider<Integer>, ModSeqProvider<Integer>
Modifier and Type | Field and Description |
---|---|
static String |
maildirDelimiter |
static String |
PATH_DOMAIN |
static String |
PATH_FULLUSER |
static String |
PATH_USER |
static String |
WILDCARD |
Constructor and Description |
---|
MaildirStore(String maildirLocation) |
MaildirStore(String maildirLocation,
MailboxPathLocker locker)
Construct a MaildirStore with a location.
|
Modifier and Type | Method and Description |
---|---|
MaildirFolder |
createMaildirFolder(Mailbox<Integer> mailbox)
Create a
MaildirFolder for a mailbox |
String |
getFolderName(Mailbox<Integer> mailbox)
Get the absolute name of the folder for a specific mailbox
|
String |
getFolderName(MailboxPath mailboxPath)
Get the absolute name of the folder for a specific mailbox
|
String |
getFolderName(String namespace,
String user,
String name)
Get the absolute name of the folder for a specific mailbox
|
String |
getMailboxNameFromFolderName(String folderName)
Transforms a folder name into a mailbox name
|
File |
getMailboxRootForUser(String user)
The main maildir folder containing all mailboxes for one user
|
String |
getMaildirLocation() |
File |
getMaildirRoot()
Return a File which is the root of all Maidirs.
|
long |
highestModSeq(MailboxSession session,
Mailbox<Integer> mailbox)
Return the highest mod-sequence which were used for the
Mailbox |
long |
lastUid(MailboxSession session,
Mailbox<Integer> mailbox)
Return the last uid which were used for storing a Message in the
Mailbox |
Mailbox<Integer> |
loadMailbox(MailboxSession session,
File root,
String namespace,
String user,
String folderName)
Creates a Mailbox object with data loaded from the file system
|
Mailbox<Integer> |
loadMailbox(MailboxSession session,
MailboxPath mailboxPath)
Creates a Mailbox object with data loaded from the file system
|
long |
nextModSeq(MailboxSession session,
Mailbox<Integer> mailbox)
Return the next mod-sequence which can be used for the
Mailbox . |
long |
nextUid(MailboxSession session,
Mailbox<Integer> mailbox)
Return the next uid which can be used while append a Message to the
Mailbox . |
String |
userRoot(String user)
Inserts the user name parts in the general maildir location String
|
public static final String PATH_USER
public static final String PATH_DOMAIN
public static final String PATH_FULLUSER
public static final String WILDCARD
public static final String maildirDelimiter
public MaildirStore(String maildirLocation, MailboxPathLocker locker)
maildirLocation
- A String with variableslocker
- public MaildirStore(String maildirLocation)
public String getMaildirLocation()
public MaildirFolder createMaildirFolder(Mailbox<Integer> mailbox)
MaildirFolder
for a mailboxmailbox
- public Mailbox<Integer> loadMailbox(MailboxSession session, File root, String namespace, String user, String folderName) throws MailboxException
root
- The main maildir folder containing the mailbox to loadnamespace
- The namespace to useuser
- The owner of this mailboxfolderName
- The name of the mailbox folderMailboxException
- If the mailbox folder doesn't exist or can't be readpublic Mailbox<Integer> loadMailbox(MailboxSession session, MailboxPath mailboxPath) throws MailboxNotFoundException, MailboxException
mailboxPath
- The path of the mailboxMailboxNotFoundException
- If the mailbox folder doesn't existMailboxException
- If the mailbox folder can't be readpublic String userRoot(String user)
user
- The user to get the root for.public File getMailboxRootForUser(String user) throws MailboxException
user
- The user name of a mailboxMailboxException
- If the folder does not exist or is no directorypublic File getMaildirRoot()
public String getMailboxNameFromFolderName(String folderName)
folderName
- The name of the mailbox folderpublic String getFolderName(String namespace, String user, String name)
namespace
- The namespace of the mailboxuser
- The user of the mailboxname
- The name of the mailboxpublic String getFolderName(Mailbox<Integer> mailbox)
mailbox
- The mailboxpublic String getFolderName(MailboxPath mailboxPath)
mailboxPath
- The MailboxPathpublic long nextUid(MailboxSession session, Mailbox<Integer> mailbox) throws MailboxException
UidProvider
Mailbox
.
Its important that the returned uid is higher then the last used and that the next call of this method does return a higher
onenextUid
in interface UidProvider<Integer>
MailboxException
UidProvider.nextUid(org.apache.james.mailbox.MailboxSession, org.apache.james.mailbox.store.mail.model.Mailbox)
public long nextModSeq(MailboxSession session, Mailbox<Integer> mailbox) throws MailboxException
ModSeqProvider
Mailbox
.
Its important that the returned mod-sequence is higher then the last used and that the next call of this method does return a higher
one.
The first mod-seq must be >= 1nextModSeq
in interface ModSeqProvider<Integer>
MailboxException
public long highestModSeq(MailboxSession session, Mailbox<Integer> mailbox) throws MailboxException
ModSeqProvider
Mailbox
highestModSeq
in interface ModSeqProvider<Integer>
MailboxException
public long lastUid(MailboxSession session, Mailbox<Integer> mailbox) throws MailboxException
UidProvider
Mailbox
lastUid
in interface UidProvider<Integer>
MailboxException
Copyright © 2010-2012 The Apache Software Foundation. All Rights Reserved.