net.rim.device.api.crypto.keystore
Class AssociatedDataKeyStoreIndex

java.lang.Object
  extended by net.rim.device.api.crypto.keystore.AssociatedDataKeyStoreIndex
All Implemented Interfaces:
KeyStoreIndex

public class AssociatedDataKeyStoreIndex
extends Object
implements KeyStoreIndex

This class allows for easy use of current associated data elements to be used as an index into the keystore.

For example, if you added an email address as an AssociatedData then set that with a keystore data you will be able to use the long for the association to find all of the keystoredata records with that long.

For more information on using a keystore index, see Using the keystore index. This quick tutorial provides overview information as well as an example of using an index within a keystore.

See Also:
AssociatedData
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 3.6.0

Constructor Summary
Category: Signed AssociatedDataKeyStoreIndex(long association)
          Accepts a long which would refer to the association for an AssociatedData object.
 
Method Summary
Category: Signed  void addToIndex(KeyStoreData data, KeyStoreDataMap dataMap)
          This method adds the KeyStoreData item to the KeyStoreDataMap given the associated data that is contained within that KeyStoreData.
Category: Signed  int getHash(Object target)
          This method returns the hash or int representing a target object given the hashing method.
Category: Signed  long getID()
          Returns the long associated with this index which is the long passed into the constructor.
Category: Signed  boolean matches(KeyStoreData data, Object target)
          This method will return true if the target is the KeyStoreData object that we are attempting to find using the index.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Constructor Detail

AssociatedDataKeyStoreIndex

public AssociatedDataKeyStoreIndex(long association)
Accepts a long which would refer to the association for an AssociatedData object. Note that this long needs to be unique.

Parameters:
association - A long describing the association.
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 3.6.0


Method Detail

addToIndex

public void addToIndex(KeyStoreData data,
                       KeyStoreDataMap dataMap)
This method adds the KeyStoreData item to the KeyStoreDataMap given the associated data that is contained within that KeyStoreData. The method calculates the hashcode for each associatedData and adds it to the map according to the hashcode of the object.

Specified by:
addToIndex in interface KeyStoreIndex
Parameters:
data - the KeyStoreData object that contains the associated data items we want to add to the index.
dataMap - the map that represents the mapping between the associations and the associated data objects.
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 3.6.0

getHash

public int getHash(Object target)
This method returns the hash or int representing a target object given the hashing method. If the target is not a byte[] this method will throw an IllegalArgumentException.

Specified by:
getHash in interface KeyStoreIndex
Parameters:
target - an object that we will return the hash for.
Returns:
the hash for this object
Throws:
IllegalArgumentException - if the target is not of type byte[]
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 3.6.0

matches

public boolean matches(KeyStoreData data,
                       Object target)
This method will return true if the target is the KeyStoreData object that we are attempting to find using the index.

Specified by:
matches in interface KeyStoreIndex
Parameters:
data - the key store data we are attempting to find.
target - the information that we used to find the key store data.
Returns:
true if the key store data object equals the target.
Throws:
IllegalArgumentException - if the target object is not an instance of byte[].
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 3.6.0

getID

public long getID()
Returns the long associated with this index which is the long passed into the constructor. Note that this long needs to be unique.

Specified by:
getID in interface KeyStoreIndex
Returns:
A long that is associated with the index.
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 3.6.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.