|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--net.rim.device.api.system.RuntimeStore
Provides a central location for applications to share information.
Note that the store is not persistent; if the device resets, then information stored in the store will be lost.
You can control read and write access to any object you place in the
store by wrapping it in a ControlledAccess object. Use
code similar to this example:
long MY_DATA_ID = 0x33abf322367f9018L;
Hashtable myHashtable = new Hashtable();
// Get the code signing key associated with "ACME"
CodeSignKey codeSigningKey = CodeSigningKey.get( moduleHandle, "ACME" );
// Store myHashtable in the RuntimeStore but protect
// it with the "ACME" code signing key
RuntimeStore.put( MY_DATA_ID, new ControlledAccess( myHashtable, codeSigningKey ) );
Now, only code files signed with the ACME key can read or replace the myHashtable object.
To retrieve something from the RuntimeStore, use code similar to this example:
Hashtable myHashtable = (Hashtable) RuntimeStore.get( MY_DATA_ID ); // Note: no need to unwrap ControlledAccess
Or, to check if your data is protected with a particular code signing key, use code similar to this:
Hashtable myHashtable = (Hashtable) RuntimeStore.get( MY_DATA_ID, codeSigningKey ); // Note: no need to unwrap ControlledAccess
| Method Summary | ||
|
Object |
get(long id)
Retrieves object in the store by ID. |
|
Object |
get(long id,
CodeSigningKey readAndReplaceKey)
Retrieves object in the store by ID, verifying permissions with provided key. |
|
Object |
get(long id,
CodeSigningKey readKey,
CodeSigningKey replaceKey)
Retrieves object in the store by ID, verifying permissions with provided keys. |
|
ControlledAccess |
getControlledAccess(long id)
Retrieves controlled access object associated with ID. |
|
static RuntimeStore |
getRuntimeStore()
Retrieves the system-wide RuntimeStore instance. |
|
void |
put(long id,
Object value)
Adds the given object to the store. |
|
Object |
remove(long id)
Removes an object from the store |
|
Object |
remove(long id,
CodeSigningKey readAndReplaceKey)
Removes object in the store by ID, verifying permissions with provided key. |
|
Object |
remove(long id,
CodeSigningKey readKey,
CodeSigningKey replaceKey)
Removes object in the store by ID, verifying permissions with provided keys. |
|
Object |
replace(long id,
Object value)
Adds the given object to the store. |
|
Object |
waitFor(long id)
Retrieves object in the store by ID. |
|
Object |
waitFor(long id,
CodeSigningKey readAndReplaceKey)
Retrieves object in the store by ID. |
|
Object |
waitFor(long id,
CodeSigningKey readKey,
CodeSigningKey replaceKey)
Retrieves object in the store by ID. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public Object get(long id)
ControlledAccess objects are automatically unwrapped.
id - Identifier of the object to retrieve.ControlledAccessException - If the caller does not have read
permission.public Object get(long id, CodeSigningKey readAndReplaceKey)
Use this method to retrieve an object by ID, and check that read and replace permisions are protected with the given key.
ControlledAccess objects are automatically unwrapped.
id - Identifier of the object to retrieve.readAndReplaceKey - Key to match for read and replace
permission. May be null, if caller doesn't care what keys are in force.ControlledAccessException - If the caller does not have read
permission, or the existing keys do not match the given key.public Object get(long id, CodeSigningKey readKey, CodeSigningKey replaceKey)
Use this method to retrieve an object ID, and check that read and replace permissions are protected with the given (separate) keys.
ControlledAccess objects are automatically unwrapped.
id - Identifier of the object to retrieve.readKey - Key to match for read permission. May be null if caller
doesn't care what read key is in force.replaceKey - Key to match for replace permission. May be null if
caller doesn't care what replace key is in force.ControlledAccessException - If the caller does not have read
permission, or the existing keys do not match the given keys.public ControlledAccess getControlledAccess(long id)
id - Identifier of object to check.public static RuntimeStore getRuntimeStore()
public void put(long id,
Object value)
id - Identifier to associate with the stored object.value - Object to store.ControlledAccessException - If the caller does not have
authorization to replace the existing object.public Object remove(long id)
id - the unique key identifying the objectid or null if no such object existspublic Object remove(long id, CodeSigningKey readAndReplaceKey)
Use this method to remove an object by ID, and check that read and replace permisions are protected with the given key.
ControlledAccess objects are automatically unwrapped.
id - Identifier of the object to retrieve.readAndReplaceKey - Key to match for read and replace
permission. May be null, if caller doesn't care what keys are in force.ControlledAccessException - If the caller does not have read
permission, or the existing keys do not match the given key.public Object remove(long id, CodeSigningKey readKey, CodeSigningKey replaceKey)
Use this method to remove an object ID, and check that read and replace permissions are protected with the given (separate) keys.
ControlledAccess objects are automatically unwrapped.
id - Identifier of the object to retrieve.readKey - Key to match for read permission. May be null if caller
doesn't care what read key is in force.replaceKey - Key to match for replace permission. May be null if
caller doesn't care what replace key is in force.ControlledAccessException - If the caller does not have read
permission, or the existing keys do not match the given keys.public Object replace(long id, Object value)
id - Identifier to associate with the stored object.value - Object to store.ControlledAccessException - If the caller does not have
authorization to replace the existing object.public Object waitFor(long id)
ControlledAccess objects are automatically unwrapped.
id - Identifier of the object to retrieve.ControlledAccessException - If the caller does not have read
permission.public Object waitFor(long id, CodeSigningKey readAndReplaceKey)
ControlledAccess objects are automatically unwrapped.
id - Identifier of the object to retrieve.readAndReplaceKey - Key to match for read and replace
permission. May be null, if caller doesn't care what keys are in force.ControlledAccessException - If the caller does not have read
permission.public Object waitFor(long id, CodeSigningKey readKey, CodeSigningKey replaceKey)
ControlledAccess objects are automatically unwrapped.
id - Identifier of the object to retrieve.readKey - Key to match for read permission. May be null if caller
doesn't care what read key is in force.replaceKey - Key to match for replace permission. May be null if
caller doesn't care what replace key is in force.ControlledAccessException - If the caller does not have read
permission.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2007 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.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.