OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

com.ibm.opencard.service
Class MFCCardObjectInfoCache

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--com.ibm.opencard.service.MFCCardObjectInfoCache

public class MFCCardObjectInfoCache
extends java.util.Dictionary

A cache for information about objects located on a smartcard. The information to be stored are instances of MFCCardObjectInfo or derived classes. Examples for objects located on a smartcard are files and keys. The information on those objects includes access information.
To store and retrieve object information from this cache, a key has to be used to specify the object to which information is related. For files, this will be the file path. For keys, it may be the path to a file in which the key is stored, or to a directory in which several files hold the key information.
This cache uses a hashtable to maintain the association between keys and information objects. The abstract methods defined in the base class Dictionary are mapped to their implementation in the hashtable. Use of these methods, especially to modify the contents of the cache, is strongly discouraged.
Some additional methods are provided that restrict the type of the objects stored in the cache from Object to MFCCardObjectInfo. These methods are cacheObjectInfo to store, lookupObjectInfo to retrieve, and removeObjectInfo to delete information in or from the cache.

Version:
$Id: MFCCardObjectInfoCache.java,v 1.1 1999/12/02 16:06:07 damke Exp $
See Also:
MFCCardObjectInfo, Dictionary, Hashtable, cacheObjectInfo(java.lang.Object, com.ibm.opencard.service.MFCCardObjectInfo), lookupObjectInfo(java.lang.Object), removeObjectInfo(java.lang.Object)

Constructor Summary
MFCCardObjectInfoCache()
           
 
Method Summary
 void cacheObjectInfo(java.lang.Object key, MFCCardObjectInfo info)
          Store some object information in the cache.
 java.util.Enumeration elements()
           
 java.lang.Object get(java.lang.Object key)
           
 boolean isEmpty()
           
 java.util.Enumeration keys()
           
 MFCCardObjectInfo lookupObjectInfo(java.lang.Object key)
          Retrieve some object information from the cache.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
 java.lang.Object remove(java.lang.Object key)
           
 void removeObjectInfo(java.lang.Object key)
          Delete some object information from the cache. if the cache contains information about the object identified by the key, this information will be removed from the cache.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MFCCardObjectInfoCache

public MFCCardObjectInfoCache()
Method Detail

size

public final int size()
Overrides:
size in class java.util.Dictionary

isEmpty

public final boolean isEmpty()
Overrides:
isEmpty in class java.util.Dictionary

keys

public final java.util.Enumeration keys()
Overrides:
keys in class java.util.Dictionary

elements

public final java.util.Enumeration elements()
Overrides:
elements in class java.util.Dictionary

get

public final java.lang.Object get(java.lang.Object key)
Overrides:
get in class java.util.Dictionary

put

public final java.lang.Object put(java.lang.Object key,
                                  java.lang.Object value)
Overrides:
put in class java.util.Dictionary

remove

public final java.lang.Object remove(java.lang.Object key)
Overrides:
remove in class java.util.Dictionary

cacheObjectInfo

public final void cacheObjectInfo(java.lang.Object key,
                                  MFCCardObjectInfo info)
Store some object information in the cache. The key passed as argument identifies an object located on the smartcard for which information is to be stored. If the cache already contains information on that object, it will be replaced by the one that is passed as an argument. The information can be retrieved by invoking lookupObjectInfo and deleted using removeObjectInfo.
The key specified has to obey the contract for the methods equals and hashCode specified in the documentation of Object. Especially, it may not change any attributes evaluated in any of these methods while it is stored in the cache. If the key's class allows such changes, make sure to pass a copy of the key which can be compared to other keys using equals, but will not be changed since it's identity is not passed to the outside world.
Parameters:
key - an identifier for the object located on the smartcard
info - the information to store in the cache
See Also:
lookupObjectInfo(java.lang.Object), removeObjectInfo(java.lang.Object), Object.equals(java.lang.Object), Object.hashCode()

lookupObjectInfo

public final MFCCardObjectInfo lookupObjectInfo(java.lang.Object key)
Retrieve some object information from the cache. If object information has been stored in the cache by a preceeding invocation of cacheObjectInfo with an equal key, and this information has not yet been removed from the cache by an invocation of removeObjectInfo, this information will be returned. Otherwise, null is returned.
The key passed as argument and the key that has been passed when the information to retrieve was stored must be equal with respect to their implementations of the equals method. Also, hashCode has to return the same value for both.
Parameters:
key - an identifier for the object located on the smartcard
Returns:
any available information on that object
See Also:
cacheObjectInfo(java.lang.Object, com.ibm.opencard.service.MFCCardObjectInfo), removeObjectInfo(java.lang.Object), Object.equals(java.lang.Object), Object.hashCode()

removeObjectInfo

public final void removeObjectInfo(java.lang.Object key)
Delete some object information from the cache. if the cache contains information about the object identified by the key, this information will be removed from the cache. Otherwise, nothing will be done. See cacheObjectInfo and lookupObjectInfo for details on keys, and how information can be stored in or retrieved from the cache.
Parameters:
key - an identifier for the object located on the smartcard
See Also:
cacheObjectInfo(java.lang.Object, com.ibm.opencard.service.MFCCardObjectInfo), removeObjectInfo(java.lang.Object)