public class InMemoryStore extends java.lang.Object implements Store, ImapConstants
Store
, used for testing
and development. Note: this implementation does not persist *anything* to disk.BAD, BYE, CAPABILITIES, HIERARCHY_DELIMITER, HIERARCHY_DELIMITER_CHAR, INBOX_NAME, NAMESPACE_PREFIX, NAMESPACE_PREFIX_CHAR, NO, OK, SP, UNTAGGED, USER_NAMESPACE, VERSION
Constructor and Description |
---|
InMemoryStore() |
Modifier and Type | Method and Description |
---|---|
MailFolder |
createMailbox(MailFolder parent,
java.lang.String mailboxName,
boolean selectable)
Creates a mailbox under the supplied parent with the given name.
|
void |
deleteMailbox(MailFolder folder)
Deletes the supplied mailbox from the store.
|
java.util.Collection |
getChildren(MailFolder parent) |
MailFolder |
getMailbox(MailFolder parent,
java.lang.String name)
Looks up a child mailbox of the supplied parent with the name given.
|
MailFolder |
getMailbox(java.lang.String absoluteMailboxName)
Retrieves a mailbox based on a fully qualified name.
|
java.util.Collection |
listMailboxes(java.lang.String searchPattern)
Lists all of the mailboxes in the store which have a name
matching the supplied search pattern.
|
void |
renameMailbox(MailFolder existingFolder,
java.lang.String newName)
Renames the mailbox with the new name.
|
MailFolder |
setSelectable(MailFolder folder,
boolean selectable)
Tells the store to make the supplied mailbox selectable or not (able to store
messages).
|
public MailFolder getMailbox(java.lang.String absoluteMailboxName)
Store
getMailbox
in interface Store
null
if not.public MailFolder getMailbox(MailFolder parent, java.lang.String name)
Store
getMailbox
in interface Store
parent
- The parent mailboxname
- The name of the child to lookupnull
if not found.public MailFolder createMailbox(MailFolder parent, java.lang.String mailboxName, boolean selectable) throws FolderException
Store
createMailbox
in interface Store
parent
- A mailbox from this store.mailboxName
- The name of the mailbox to create.selectable
- If true
, the mailbox will be created to store messages.FolderException
- If the mailbox couldn't be created.public void deleteMailbox(MailFolder folder) throws FolderException
Store
deleteMailbox
in interface Store
folder
- A mailbox from this store.FolderException
- If the mailbox couldn't be deleted.public void renameMailbox(MailFolder existingFolder, java.lang.String newName) throws FolderException
Store
renameMailbox
in interface Store
existingFolder
- A mailbox from this store.newName
- The new name for the mailbox.FolderException
- If the mailbox couldn't be renamedpublic java.util.Collection getChildren(MailFolder parent)
getChildren
in interface Store
parent
- A mailbox from this store.MailFolder
instances, which
are the children of the supplied parent.public MailFolder setSelectable(MailFolder folder, boolean selectable)
Store
setSelectable
in interface Store
folder
- The mailbox to modify.selectable
- Whether this mailbox should be able to store messages.public java.util.Collection listMailboxes(java.lang.String searchPattern) throws FolderException
Store
Valid wildcards are: '*' - matches any number of characters, including the hierarchy delimiter '%' - matches any number of characters, but not the hierarchy delimiter
listMailboxes
in interface Store
searchPattern
- The pattern to match mailboxesFolderException
- If the list operation failedStore.listMailboxes(java.lang.String)