com.funambol.mail
Interface Store

All Known Implementing Classes:
RMSStore

public interface Store

Represents a message store and its access protocol, for storing and retrieving messages on the device


Field Summary
static java.lang.String DRAFTS
           
static java.lang.String INBOX
           
static java.lang.String OUTBOX
           
static java.lang.String SENT
           
static java.lang.String TRASH
           
 
Method Summary
 int countMessages(java.lang.String path)
          This method returns the message count in this Store.
 Folder createFolder(java.lang.String path)
          Creates a Folder in this Store with the provided path
 Folder[] findFolders(java.lang.String path)
          Retrieves a Folder in this Store that matches the provided substring
 Folder getFolder(java.lang.String path)
          Retrieves a Folder by name
 java.lang.String[] getMessageIDs(java.lang.String path)
          This method returns the messageIDs of all the messages in the folder path.
 Message[] getMsgHeaders(java.lang.String path)
          This method reads the headers of all the message from a folder.
 void init(boolean reset)
          Initialize the message store, creating the main folders.
 Folder[] list()
          Retrieves a list of folders directly under this Store
 Folder[] list(java.lang.String path)
          This method returns the list of the folders whose path starts with 'path' and are direct subfolders of it.
 Message readMessage(java.lang.String path, java.lang.String msgid)
          This method reads a message from the Store, using the message Id.
 boolean removeFolder(java.lang.String path)
          Removes a folder from the record store.
 void removeMessage(java.lang.String path, java.lang.String messageID)
          This method removes a Message from the Store, using message ID as index.
 void saveMessage(java.lang.String path, Message msg)
          This method saves a message in the Store
 

Field Detail

INBOX

static final java.lang.String INBOX
See Also:
Constant Field Values

OUTBOX

static final java.lang.String OUTBOX
See Also:
Constant Field Values

DRAFTS

static final java.lang.String DRAFTS
See Also:
Constant Field Values

SENT

static final java.lang.String SENT
See Also:
Constant Field Values

TRASH

static final java.lang.String TRASH
See Also:
Constant Field Values
Method Detail

init

void init(boolean reset)
          throws StoreException
Initialize the message store, creating the main folders.

Parameters:
reset - if true, erase and re-create all the main folders.
Throws:
StoreException

list

Folder[] list()
Retrieves a list of folders directly under this Store

Returns:
an array of folders, or null if the store is empty.

list

Folder[] list(java.lang.String path)
              throws StoreException
This method returns the list of the folders whose path starts with 'path' and are direct subfolders of it.

Parameters:
path - the path of the parent folder
Returns:
an array of folders, or null if path has no subfolders.
Throws:
StoreException - If the path is not valid

createFolder

Folder createFolder(java.lang.String path)
                    throws StoreException
Creates a Folder in this Store with the provided path

Parameters:
path - the full path of the folder in the Store.
Throws:
StoreException - If an error occurs on the store (e.g. no space left)

removeFolder

boolean removeFolder(java.lang.String path)
                     throws StoreException
Removes a folder from the record store.

Parameters:
path - The full pathname in the Store
Returns:
true if the folder has been actually deleted, false if the folder did not exist.
Throws:
StoreException - if an error occurs on the store

getFolder

Folder getFolder(java.lang.String path)
                 throws StoreException
Retrieves a Folder by name

Parameters:
path - The path to the Folder in the device's file system
Returns:
The Folder object
Throws:
StoreException - If an error occurs accessing the Store

findFolders

Folder[] findFolders(java.lang.String path)
Retrieves a Folder in this Store that matches the provided substring

Parameters:
path - The partial path in the device's file system to the searched Folder
Returns:
A list of Folder objects whose path matches the provided substring, or null if there are no matches

getMsgHeaders

Message[] getMsgHeaders(java.lang.String path)
                        throws StoreException
This method reads the headers of all the message from a folder.

Parameters:
path - The complete path of the Folder containing the messages.
Returns:
An array of Message with all the headers set but without content
Throws:
StoreException - If an error occurs accessing the Store

getMessageIDs

java.lang.String[] getMessageIDs(java.lang.String path)
                                 throws StoreException
This method returns the messageIDs of all the messages in the folder path.

Parameters:
path - the complete path of the folder
Returns:
an array of String, or null if the folder is empty.
Throws:
StoreException - If an error occurs accessing the Store

readMessage

Message readMessage(java.lang.String path,
                    java.lang.String msgid)
                    throws StoreException
This method reads a message from the Store, using the message Id.

Parameters:
path - The complete path of the Folder containing the Message.
msgid - A string representing the unique message ID
Returns:
The Message corresponding to the passed path and message ID from this Store
Throws:
StoreException - If an error occurs accessing the Store

saveMessage

void saveMessage(java.lang.String path,
                 Message msg)
                 throws StoreException
This method saves a message in the Store

Parameters:
path - The complete path of the Folder containing the Message.
msg - The Message to save.
Throws:
StoreException - If an error occurs accessing the Store

removeMessage

void removeMessage(java.lang.String path,
                   java.lang.String messageID)
                   throws StoreException
This method removes a Message from the Store, using message ID as index.

Parameters:
path - The complete path of the Folder containing the Message.
messageID - A string representing the unique message ID
Throws:
StoreException - If an error occurs accessing the Store

countMessages

int countMessages(java.lang.String path)
                  throws StoreException
This method returns the message count in this Store.

Parameters:
path - The complete path of the Folder containing the Message.
Throws:
StoreException - If an error occurs accessing the Store


Copyright © 2006 Funambol.