|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.funambol.mail.RMSStore
public class RMSStore
Implements the Store
interface using J2ME RecordStore. Each
Folder
is mapped to a RecordStore with name equal to the full
path of the Folder
. The records of each RecordStore can contain
any kind of data, including:
AccountFolder
items;Folder
items;Message
items.
Field Summary | |
---|---|
static int |
DEFAULT_MAX_MESSAGE_NUMBER
Max number of messages that can be stored |
Fields inherited from interface com.funambol.mail.Store |
---|
LATEST_VERSION, VERSION_101, VERSION_102, VERSION_103, VERSION_104, VERSION_105 |
Method Summary | |
---|---|
int |
addChild(java.lang.String path,
RmsRecordItem child)
This method add a new child to a Folder . |
Folder |
addFolder(Folder folder)
Add a new Folder to the Store . |
int |
countChilds(java.lang.String path)
This method returns the count of childs in a Folder . |
int |
countChilds(java.lang.String path,
char prefix)
This method returns the count of childs in a Folder . |
protected ObjectStore |
createObjectStore()
|
protected ObjectStore |
createObjectStore(java.lang.String name)
|
Folder[] |
findFolders(java.lang.String path)
Retrieves a Folder in this Store that matches the provided
substring. |
java.lang.String[] |
getChildIDs(java.lang.String path)
This method returns the array of the childs IDs contained in a Folder . |
ChildrenEnumeration |
getChildren(java.lang.String path)
Get the ChildrenEnumeration related to the given path. |
Folder |
getFolder(java.lang.String path)
Retrieves a Folder object by path. |
Folder |
getFolder(java.lang.String path,
boolean lightFolder)
Retrieves a Folder object by path. |
int |
getVersion()
This method gets the version of the Store which is currently being used on the device. |
void |
init(boolean reset)
Initialize the store. |
Folder[] |
list()
Retrieves the list of all the folders directly under this Store. |
Folder[] |
list(java.lang.String path)
Returns the list of the subfolders contained under the specified Folder . |
RmsRecordItem |
readChild(java.lang.String path,
java.lang.String childId)
This method reads a Folder from the Store, using the child
id. |
java.io.DataInputStream |
readChildBytes(java.lang.String path,
java.lang.String childId)
This method returns the InputStream of a Folder child. |
void |
removeChild(java.lang.String path,
java.lang.String childId)
This method removes a Folder child from the Store. |
boolean |
removeFolder(Folder folder,
boolean recursive)
Removes a Folder RecordStore, its parent reference and the
subfolders. |
void |
removeFolder(java.lang.String folderPath)
Recursively removes a Folder given the Folder
name |
java.lang.String |
retrieveSubfolderID(java.lang.String subfolderPath,
java.lang.String parentPath)
Retrieve a subfolder from a folder record store and return its record id. |
void |
setVersion(int version)
This method sets the version of the Store which is currently being used on the device. |
void |
updateChild(java.lang.String path,
RmsRecordItem child)
This method updates an existing Folder child in the Store. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_MESSAGE_NUMBER
Method Detail |
---|
public void init(boolean reset) throws MailException
Store
init
in interface Store
reset
- If true, erase and re-create all the store.
MailException
Store.init(boolean)
public Folder[] list()
Store
list
in interface Store
null
if the store is empty.Store.list()
public Folder[] list(java.lang.String path) throws MailException
Store
Folder
.
list
in interface Store
path
- The path of the parent Folder
.
null
if path
has no subfolders.
MailException
- If the path is not valid.Store.list(java.lang.String)
public Folder addFolder(Folder folder) throws MailException
Store
Folder
to the Store
.
addFolder
in interface Store
folder
- The Folder
item to be stored.
Folder
reference
MailException
- If an error occurs on the store (e.g. no space
left).Store.addFolder(com.funambol.mail.Folder)
public boolean removeFolder(Folder folder, boolean recursive) throws MailException
Folder
RecordStore, its parent reference and the
subfolders.
removeFolder
in interface Store
folder
- The Folder
to be removed. Use
getFolder
to retrieve the Folder
from its path.recursive
- Perform a recursive removal.
true
if the Folder
has been actually
deleted, false
if the Folder
did not
exist.
MailException
- If an error occurs on the store.Store.removeFolder(com.funambol.mail.Folder, boolean)
public void removeFolder(java.lang.String folderPath) throws MailException
Store
Folder
given the Folder
name
removeFolder
in interface Store
folderPath
- the path of the Folder
to be removed
MailException
- if a storage error occursStore.removeFolder(String)
public Folder getFolder(java.lang.String path) throws MailException
Store
Folder
object by path.
getFolder
in interface Store
path
- The path to the Folder in the device's file system
Folder
object.
MailException
- If an error occurs accessing the Store.Store.getFolder(java.lang.String)
public Folder getFolder(java.lang.String path, boolean lightFolder) throws MailException
Store
Folder
object by path.
getFolder
in interface Store
path
- The path to the Folder in the device's file systemlightFolder
- If true return the Folder
item without
reading its properties (e.g. role, creation date). It doesn't check
if it really exists in the Store.
Folder
object.
MailException
- If an error occurs accessing the Store.Store.getFolder(java.lang.String, boolean)
public Folder[] findFolders(java.lang.String path)
Store
Folder
in this Store that matches the provided
substring.
findFolders
in interface Store
path
- The partial path in the device's file system to the searched
Folder
.
Folder
objects whose path matches the
provided substring, or null
if there are no matches.Store.findFolders(java.lang.String)
public java.lang.String retrieveSubfolderID(java.lang.String subfolderPath, java.lang.String parentPath)
Store
retrieveSubfolderID
in interface Store
subfolderPath
- The path to the subfolderparentPath
- The path to the parent folder
null
if it's not foundStore.retrieveSubfolderID(java.lang.String, java.lang.String)
public java.lang.String[] getChildIDs(java.lang.String path) throws MailException
Store
Folder
.
getChildIDs
in interface Store
path
- The complete path of the Folder
.
null
if
the Folder
is empty.
MailException
- If an error occurs accessing the Store.Store.getChildIDs(java.lang.String)
public RmsRecordItem readChild(java.lang.String path, java.lang.String childId) throws MailException
Store
Folder
from the Store, using the child
id.
readChild
in interface Store
path
- The complete path of the Folder
containing the
child.childId
- The child unique ID.
RmsRecordItem
object corresponding to the
childId.
MailException
- If an error occurs accessing the Store.Store.readChild(java.lang.String, java.lang.String)
public java.io.DataInputStream readChildBytes(java.lang.String path, java.lang.String childId) throws MailException
Store
Folder
child.
readChildBytes
in interface Store
path
- The complete path of the Folder
containing the
child.childId
- The child unique ID.
DataInputStream
corresponding to the childId.
MailException
- If an error occurs accessing the Store.Store.readChildBytes(java.lang.String, java.lang.String)
public ChildrenEnumeration getChildren(java.lang.String path) throws MailException
Store
ChildrenEnumeration
related to the given path.
getChildren
in interface Store
path
- The path for which the ChildrenEnumeration
shall
be returned.
ChildrenEnumeration
.
MailException
- If an error occurs accessing the Store.com.funambol.mail.Store#getChildrenEnumeration(java.lang.String)
public int addChild(java.lang.String path, RmsRecordItem child) throws MailException
Store
Folder
.
addChild
in interface Store
path
- The complete path of the Folder
.child
- The RmsRecordItem
child to save.
MailException
- If an error occurs accessing the Store.com.funambol.mail.Store#addChild(java.lang.String, com.funambol.storage.RmsRecordItem)
public void updateChild(java.lang.String path, RmsRecordItem child) throws MailException
Store
Folder
child in the Store.
updateChild
in interface Store
path
- The complete path of the Folder
containing the
child.child
- The RmsRecordItem
child to save.
MailException
- If an error occurs accessing the Store.com.funambol.mail.Store#updateChild(java.lang.String, com.funambol.storage.RmsRecordItem)
public void removeChild(java.lang.String path, java.lang.String childId) throws MailException
Store
Folder
child from the Store.
removeChild
in interface Store
path
- The complete path of the Folder
containing the
child.childId
- A string representing the unique child ID.
MailException
- If an error occurs accessing the Store.Store.removeChild(java.lang.String, java.lang.String)
public int countChilds(java.lang.String path) throws MailException
Store
Folder
.
countChilds
in interface Store
path
- The complete path of the Folder
.
MailException
- If an error occurs accessing the Store.Store.countChilds(java.lang.String)
public int countChilds(java.lang.String path, char prefix) throws MailException
Store
Folder
. Only
childs with the specified prefix will be counted.
countChilds
in interface Store
path
- The complete path of the Folder
.prefix
- The childs type to be counted.
MailException
- If an error occurs accessing the Store.Store.countChilds(java.lang.String, char)
public void setVersion(int version)
setVersion
in interface Store
version
- is the store versionpublic int getVersion()
getVersion
in interface Store
protected ObjectStore createObjectStore()
protected ObjectStore createObjectStore(java.lang.String name)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |