Class JOP.util.HashtableDB
All Packages  Class Hierarchy  This Package  Previous  Next  Index  Home

Class JOP.util.HashtableDB

java.lang.Object
   |
   +----JOP.util.HashtableDB

public class HashtableDB
extends Object
implements Persistable
A HashtableDB implements a subset of the functionality of a Hasthable. The HashtableDB supports the late fetching of objects, ie objects are only fetched from the database when they are referenced - hence performance is improved. The semantics of Hashtable are maintained so that HashtableDB and Hasthable can be substituted for one another in applications programs.

One of the main uses of HashtableDB is support indexed collections of persistent objects.

Like a Hashtable when a HasthableDB is saved to a database by calling streamOutObject(), the hashtable, its keys and all referenced objects will be automatically saved.

A typical application will have a 'root' HashtableDB with a well known object id (read from an environment variable etc). When this HashableDB is read it contains references to other HashtableDB's and other application objects.

If you streamOutObject() a HashtableDB to a different PersistManager than the one that was used to read the HashtableDB (or first save the HashtableDB) then the HashtableDB will be fully resolved (ie all referenced objects will be read) before the HashtableDB is written to the second PersistManager.


Constructor Index

 o HashtableDB()

Method Index

 o clear()
Remove all entries from the hashtable
 o containsKey(Object)
Test if the hashtable contains the given key and return 'true' if the key is found.
 o defineObject(PersistController)
Called by the PeristManager to define the hashtable.
 o elements()
Return an enumerator of all objects in the hashtable.
 o get(Object)
Retrieve an object from the hashtable with the given key.
 o keys()
Return an enumerator of all objects over their key values.
 o put(Object, Object)
Add a new object to the hashtable accessible by the key value.
 o remove(Object)
Remove an object with the given key from the hashtable.
 o streamIn(PersistController)
Called by the PersistManager when this object is retrieved from the persistent database.
 o streamOut(PersistController)
Called by the PersistManager when this object is saved to the persistent database.

Constructors

 o HashtableDB
  public HashtableDB()

Methods

 o clear
  public synchronized void clear()
Remove all entries from the hashtable
 o containsKey
  public boolean containsKey(Object key)
Test if the hashtable contains the given key and return 'true' if the key is found.
 o remove
  public void remove(Object key)
Remove an object with the given key from the hashtable.
 o put
  public synchronized void put(Object key,
                               Object obj)
Add a new object to the hashtable accessible by the key value.
 o get
  public synchronized Object get(Object key)
Retrieve an object from the hashtable with the given key. If the object is not currently in memory or in the JOP cache the object will be retrieved from the persistent database. Returns 'null' if the object is not in the hashtable or cannot be retrieved.

Any exceptions from the PersistManager whilst retrieving the object are caught and a strace trace is printed.

 o keys
  public Enumeration keys()
Return an enumerator of all objects over their key values. As the 'getNext()' method is called for the enumerator objects will be retrieved from the persistent database (or the JOP cache).
 o elements
  public Enumeration elements()
Return an enumerator of all objects in the hashtable. As the 'getNext()' method is called for the enumerator objects will be retrieved from the persistent database (or the JOP cache).
 o streamIn
  public synchronized void streamIn(PersistController c) throws Exception
Called by the PersistManager when this object is retrieved from the persistent database.

To retrieve a HashtableDB object call the 'streamInObject()' method or the 'streamInRoot()' method of the PersistManager.

 o streamOut
  public synchronized void streamOut(PersistController c) throws Exception
Called by the PersistManager when this object is saved to the persistent database. To save a HashtableDB call the 'streamOutObject()' or 'streamOutRoot()' methods of the PersistManager.
 o defineObject
  public void defineObject(PersistController c) throws Exception
Called by the PeristManager to define the hashtable.

All Packages  Class Hierarchy  This Package  Previous  Next  Index  Home