|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.system.PersistentStore
public final class PersistentStore
Store for persistent objects.
The persistent store provides a means for objects to persist across device resets. A persistent object consists of a key-value pair. When a persistent object is committed to the persistent store, that object's value is stored in flash memory via a deep copy. The value can then be retrieved at a later point in time via the key.
Here is an example of a persistent address book:
import java.util.*;
import net.rim.device.api.system.*;
public class AddressBook
{
static Vector addresses;
static PersistentObject persist;
static {
// Hash of "net.rim.sample.AddressBook".
long KEY = 0xa3b3159378f59a29L;
persist = PersistentStore.getPersistentObject( KEY );
addresses = (Vector) persist.getContents();
if( addresses == null ) {
addresses = new Vector();
persist.setContents( addresses );
persist.commit();
}
}
void add( Address a ) {
addresses.addElement( a );
persist.commit();
}
}
| Method Summary | ||
|---|---|---|
|
static void |
destroyPersistentObject(long key)
Removes persistent object from store by key. |
|
static PersistentObject |
getPersistentObject(long key)
Retrieves persistent object from store by key. |
|
static Object |
getSynchObject()
Retrieves monitor object for this persistent store. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static PersistentObject getPersistentObject(long key)
key - Key of object to retrieve.
public static void destroyPersistentObject(long key)
If the identified object is wrapped in a controlled access object, then the caller must have replace permissions on that object in order to destroy it.
key - Key of object to destroy.
ControlledAccessException - If the caller does not have replace permission.public static Object getSynchObject()
In order to perform efficient, batch commit transactions on this store, callers must synchronize on the object returned by this method.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.