net.rim.device.api.util
Class ContentProtectedHashtable

java.lang.Object
  extended by java.util.Hashtable
      extended by net.rim.device.api.util.ContentProtectedHashtable
All Implemented Interfaces:
PersistentContentListener, Persistable

public class ContentProtectedHashtable
extends Hashtable
implements Persistable, PersistentContentListener

This class provides a hashtable that will employ content protection on the values stored in the hashtable. Note that it does NOT protect the keys in the hashtable.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0, 4.0

Field Summary
 
Fields inherited from interface net.rim.device.api.system.PersistentContentListener
PERSISTENT_CONTENT_LOCKED_INSECURE, PERSISTENT_CONTENT_LOCKED_SECURE, PERSISTENT_CONTENT_LOCKING, PERSISTENT_CONTENT_UNLOCKED
 
Constructor Summary
Category: Signed ContentProtectedHashtable()
          Creates a new, empty ContentProtectedHashtable using the default capacity and automatically protects the values in the hashtable.
Category: Signed ContentProtectedHashtable(boolean protect)
          Creates a new, empty ContentProtectedHashtable using the default capacity.
Category: Signed ContentProtectedHashtable(int initialCapacity)
          Creates a new, empty ContentProtectedHashtable using the initial capacity and automatically protects the values in the hashtable.
Category: Signed ContentProtectedHashtable(int initialCapacity, boolean protect)
          Creates a new, empty ContentProtectedHashtable.
Category: Signed ContentProtectedHashtable(Hashtable hashtable, boolean protect)
          Creates a new ContentProtectedHashtable with the contents currently found in the Hashtable passed into this method.
 
Method Summary
Category: Signed  boolean checkCrypt()
          This method will return a boolean indicating if the protection setting of this hashtable matches that of the user's content protection settings.
Category: Signed  boolean contains(Object value)
          Determines if some key maps into the specified value in this hashtable.
Category: Signed  Enumeration elements()
          Retrieves an enumeration of the values in this hashtable.
Category: Signed  Object get(Object key)
          Retrieves value by key.
Category: Signed  boolean isProtected()
          This method will return a boolean indicating if the values in this hashtable are currently being protected by content protection.
Category: Signed  void persistentContentModeChanged(int generation)
          Invoked when the persistent content mode changes.
Category: Signed  void persistentContentStateChanged(int state)
          Does nothing in this implementation.
Category: Signed  Object put(Object key, Object value)
          Maps value to key in this hashtable.
Category: Signed  void reCrypt()
          This method will enable protection and cause all the current contents to be encrypted according to the user's content protection settings.
 
Methods inherited from class java.util.Hashtable
clear, containsKey, isEmpty, keys, rehash, remove, size, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 



Constructor Detail

ContentProtectedHashtable

public ContentProtectedHashtable(boolean protect)
Creates a new, empty ContentProtectedHashtable using the default capacity.

Parameters:
protect - a boolean indicating whether or not the values to be stored in the hashtable should be encrypted when placed in the hashtable or only when it is deemed necessary via the reCrypt call.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

ContentProtectedHashtable

public ContentProtectedHashtable()
Creates a new, empty ContentProtectedHashtable using the default capacity and automatically protects the values in the hashtable.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

ContentProtectedHashtable

public ContentProtectedHashtable(int initialCapacity)
Creates a new, empty ContentProtectedHashtable using the initial capacity and automatically protects the values in the hashtable.

Parameters:
initialCapacity - the initial capacity of the hashtable.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

ContentProtectedHashtable

public ContentProtectedHashtable(int initialCapacity,
                                 boolean protect)
Creates a new, empty ContentProtectedHashtable.

Parameters:
initialCapacity - the initial capacity of the hashtable.
protect - a boolean indicating whether or not the values to be stored in the hashtable should be encrypted when placed in the hashtable or only when it is deemed necessary via the reCrypt call.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

ContentProtectedHashtable

public ContentProtectedHashtable(Hashtable hashtable,
                                 boolean protect)
Creates a new ContentProtectedHashtable with the contents currently found in the Hashtable passed into this method.

Parameters:
hashtable - the hashtable to use for populating the ContentProtectedHashtable.
protect - a boolean indicating whether or not to encrypt the values of the hashtable.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0


Method Detail

contains

public boolean contains(Object value)
Determines if some key maps into the specified value in this hashtable. Note if protection is enabled and value is a byte array, then contains() will return false.

This operation is more expensive than Hashtable.containsKey(java.lang.Object).

Overrides:
contains in class Hashtable
Parameters:
value - Value to search for.
Returns:
True if some key maps to the provided value in this hashtable; otherwise, false.
Throws:
NullPointerException - If null value provided.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

elements

public Enumeration elements()
Retrieves an enumeration of the values in this hashtable.

Use the Enumeration methods on the returned object to fetch the elements sequentially.

Overrides:
elements in class Hashtable
Returns:
Enumeration of the values in this hashtable.
See Also:
Enumeration, Hashtable.keys()
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

get

public Object get(Object key)
Retrieves value by key.

Overrides:
get in class Hashtable
Parameters:
key - Key in this hashtable.
Returns:
Object value associated with provided key, or null if no object associated with the key.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

put

public Object put(Object key,
                  Object value)
Maps value to key in this hashtable.

The value can be retrieved by invoking ContentProtectedHashtable.get(java.lang.Object) with a key that is equal to the original key (as determined by Object.equals(java.lang.Object).

Overrides:
put in class Hashtable
Parameters:
key - Key to associate with the value.
value - Value to put into table.
Returns:
Previous value associated with key, or null if key had no previous associated value.
Throws:
NullPointerException - If null key or null value.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

isProtected

public boolean isProtected()
This method will return a boolean indicating if the values in this hashtable are currently being protected by content protection.

Returns:
true if the values are being protected and false otherwise.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

checkCrypt

public boolean checkCrypt()
This method will return a boolean indicating if the protection setting of this hashtable matches that of the user's content protection settings.

Returns:
true if the values are being protected according to the user's settings and false otherwise.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

reCrypt

public void reCrypt()
This method will enable protection and cause all the current contents to be encrypted according to the user's content protection settings.

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

persistentContentModeChanged

public void persistentContentModeChanged(int generation)
Invoked when the persistent content mode changes.

If this hashtable is protected, this method invokes ContentProtectedHashtable.reCrypt() on the hashtable.

Specified by:
persistentContentModeChanged in interface PersistentContentListener
Parameters:
generation - Ignored in this implementation.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0

persistentContentStateChanged

public void persistentContentStateChanged(int state)
Does nothing in this implementation.

Specified by:
persistentContentStateChanged in interface PersistentContentListener
Parameters:
state - Ignored in this implementation.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.0.0





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.