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 int LATEST_VERSION
          Latest version
static java.lang.String OUTBOX
           
static java.lang.String SENT
           
static int VERSION_101
          Store available versions
static int VERSION_102
           
 
Method Summary
 void addMessage(java.lang.String path, Message msg)
          This method saves a new message in the Store
 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 readFirstMessage(java.lang.String path)
          Return the first message in the store.
 java.io.DataInputStream readMessage(Message msg)
          This method reads a record from the Store, using its record id.
 Message readMessage(java.lang.String path, java.lang.String msgid)
          This method reads a message from the Store, using the message Id.
 Message readNextMessage(java.lang.String path)
          Return the next message in the store.
 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 updates an existing message in the Store
 void setVersion(int version)
          This method sets the version of the Store which is currently being used on the device.
 

Field Detail

VERSION_101

static final int VERSION_101
Store available versions

See Also:
Constant Field Values

VERSION_102

static final int VERSION_102
See Also:
Constant Field Values

LATEST_VERSION

static final int LATEST_VERSION
Latest version

See Also:
Constant Field Values

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
Method Detail

init

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

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

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 MailException
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
MailException

createFolder

Folder createFolder(java.lang.String path)
                    throws MailException
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)
MailException

removeFolder

boolean removeFolder(java.lang.String path)
                     throws MailException
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
MailException

getFolder

Folder getFolder(java.lang.String path)
                 throws MailException
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
MailException

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 MailException
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
MailException

getMessageIDs

java.lang.String[] getMessageIDs(java.lang.String path)
                                 throws MailException
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
MailException

readMessage

Message readMessage(java.lang.String path,
                    java.lang.String msgid)
                    throws MailException
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
MailException

readFirstMessage

Message readFirstMessage(java.lang.String path)
                         throws MailException
Return the first message in the store.

Returns:
the first Message if it exists, null otherwise
Throws:
MailException - if the store cannot be accessed

readNextMessage

Message readNextMessage(java.lang.String path)
                        throws MailException
Return the next message in the store.

Returns:
the next Message if it exists, null otherwise
Throws:
MailException - if the store cannot be accessed

readMessage

java.io.DataInputStream readMessage(Message msg)
                                    throws MailException
This method reads a record from the Store, using its record id. The message must be in a folder for this method to succeed. If the record is found the method returns a DataInputStream to read its bytes.

Parameters:
msg - The message whose record must be re-read
Throws:
MailException - If an error occurs accessing the Store

addMessage

void addMessage(java.lang.String path,
                Message msg)
                throws MailException
This method saves a new 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
MailException

saveMessage

void saveMessage(java.lang.String path,
                 Message msg)
                 throws MailException
This method updates an existing 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
MailException

removeMessage

void removeMessage(java.lang.String path,
                   java.lang.String messageID)
                   throws MailException
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
MailException

countMessages

int countMessages(java.lang.String path)
                  throws MailException
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
MailException

setVersion

void setVersion(int version)
This method sets the version of the Store which is currently being used on the device. If no version is specified, the Store defaults to the latest one.

Parameters:
version - is the store version


Copyright © 2006 Funambol.