Package com.icegreen.greenmail.store
Interface Store
-
- All Known Implementing Classes:
InMemoryStore
public interface StoreRepresents the complete mail store for an IMAP server, providing access to and manipulation of allMailboxesstored on this server.- Version:
- $Revision: 109034 $
- Author:
- Darrell DeBoer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MailFoldercreateMailbox(MailFolder parent, String mailboxName, boolean selectable)Creates a mailbox under the supplied parent with the given name.voiddeleteMailbox(MailFolder folder)Deletes the supplied mailbox from the store.voiddeleteQuota(String qualifiedRootPrefix)Deletes the quota.Collection<MailFolder>getChildren(MailFolder parent)MailFoldergetMailbox(MailFolder parent, String mailboxName)Looks up a child mailbox of the supplied parent with the name given.MailFoldergetMailbox(String qualifiedMailboxName)Retrieves a mailbox based on a fully qualified name.jakarta.mail.Quota[]getQuota(String root, String qualifiedRootPrefix)Gets the quotas.booleanisQuotaSupported()Checks if quota capability is activated.Collection<MailFolder>listMailboxes(String searchPattern)Lists all the mailboxes in the store which have a name matching the supplied search pattern.voidrenameMailbox(MailFolder existingFolder, String newName)Renames the mailbox with the new name.voidsetQuota(jakarta.mail.Quota quota, String qualifiedRootPrefix)Sets the quota.voidsetQuotaSupported(boolean pQuotaSupported)Toggles quota capability.MailFoldersetSelectable(MailFolder folder, boolean selectable)Tells the store to make the supplied mailbox selectable or not (able to store messages).
-
-
-
Method Detail
-
getMailbox
MailFolder getMailbox(String qualifiedMailboxName)
Retrieves a mailbox based on a fully qualified name.- Parameters:
qualifiedMailboxName- the fully qualified name.- Returns:
- The mailbox if present, or
nullif not.
-
getMailbox
MailFolder getMailbox(MailFolder parent, String mailboxName)
Looks up a child mailbox of the supplied parent with the name given.- Parameters:
parent- The parent mailboxmailboxName- The name of the child to lookup- Returns:
- The child mailbox, or
nullif not found.
-
getChildren
Collection<MailFolder> getChildren(MailFolder parent)
- Parameters:
parent- A mailbox from this store.- Returns:
- A read-only collection of
MailFolderinstances, which are the children of the supplied parent.
-
createMailbox
MailFolder createMailbox(MailFolder parent, String mailboxName, boolean selectable) throws FolderException
Creates a mailbox under the supplied parent with the given name. If specified, the mailbox created will be made selectable (able to store messages).- Parameters:
parent- A mailbox from this store.mailboxName- The name of the mailbox to create.selectable- Iftrue, the mailbox will be created to store messages.- Returns:
- The created mailbox
- Throws:
FolderException- If the mailbox couldn't be created.
-
setSelectable
MailFolder setSelectable(MailFolder folder, boolean selectable)
Tells the store to make the supplied mailbox selectable or not (able to store messages). The returned mailbox may be a new instance, and the supplied mailbox may no longer be valid.- Parameters:
folder- The mailbox to modify.selectable- Whether this mailbox should be able to store messages.- Returns:
- The modified mailbox
-
deleteMailbox
void deleteMailbox(MailFolder folder) throws FolderException
Deletes the supplied mailbox from the store. To be deleted, mailboxes must be empty of messages, and not have any children.- Parameters:
folder- A mailbox from this store.- Throws:
FolderException- If the mailbox couldn't be deleted.
-
renameMailbox
void renameMailbox(MailFolder existingFolder, String newName) throws FolderException
Renames the mailbox with the new name.- Parameters:
existingFolder- A mailbox from this store.newName- The new name for the mailbox.- Throws:
FolderException- If the mailbox couldn't be renamed
-
listMailboxes
Collection<MailFolder> listMailboxes(String searchPattern) throws FolderException
Lists all the mailboxes in the store which have a name matching the supplied search pattern.Valid wildcards are: '*' - matches any number of characters, including the hierarchy delimiter '%' - matches any number of characters, but not the hierarchy delimiter- Parameters:
searchPattern- The pattern to match mailboxes- Returns:
- A read-only collection of mailboxes which match this pattern
- Throws:
FolderException- If the list operation failed
-
setQuota
void setQuota(jakarta.mail.Quota quota, String qualifiedRootPrefix)Sets the quota.
-
deleteQuota
void deleteQuota(String qualifiedRootPrefix)
Deletes the quota.- Parameters:
qualifiedRootPrefix- the user specific prefix
-
isQuotaSupported
boolean isQuotaSupported()
Checks if quota capability is activated.- Returns:
- true, if quota is supported.
-
setQuotaSupported
void setQuotaSupported(boolean pQuotaSupported)
Toggles quota capability.- Parameters:
pQuotaSupported- true, if supported.
-
-