All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class macondo.mak.StoreManager

macondo.mak.StoreManager

public class StoreManager
StoreManager is a simple persistent store engine. It allows to store regular Java objects that implement the java.io.Serializable interface. An index table is used to speed up access to stored objects. The table can also be saved and restored in a different session. Each object is identified by a key object, that can be the object application specific name but also any other object.


Constructor Index

 o StoreManager(String)
Constructs a new StoreManager with a given path where to store objects.

Method Index

 o clear()
Removes all saved objects and clears the index table.
 o getObject(Object)
Retrieves the object corresponding to the given key.
 o insertObject(Object, Object)
Stores obj and add an entry to the index table.
 o keys()
Returns an enumeration of the keys in the index table.
 o loadTable()
Loads the index table saved in a previous session.
 o removeObject(Object)
Removes a stored object and the corresponding table entry.
 o saveTable()
Saves the index table in stable storage, so it is possible to retrieve it in a different session.

Constructors

 o StoreManager
 public StoreManager(String path)
Constructs a new StoreManager with a given path where to store objects.

Parameters:
path - the file system path where to store objects.

Methods

 o insertObject
 public synchronized void insertObject(Object key,
                                       Object obj) throws IOException
Stores obj and add an entry to the index table.

Parameters:
key - the key corresponding to the object.
obj - the object to store.
Throws: IOException
if an I/O error occurs writing the object.
 o getObject
 public synchronized Object getObject(Object key) throws IOException, ClassNotFoundException
Retrieves the object corresponding to the given key.

Parameters:
key - the key used to retrieve the object.
Returns:
the object corresponding to the key.
Throws: IOException
if an I/O error occurs reading the object.
Throws: ClassNotFoundException
if the class of the object read is not found.
 o removeObject
 public synchronized void removeObject(Object key) throws IOException
Removes a stored object and the corresponding table entry.

Parameters:
key - the key used to retrieve the object.
Throws: IOException
if some I/O error occurs.
 o saveTable
 public synchronized void saveTable() throws IOException
Saves the index table in stable storage, so it is possible to retrieve it in a different session.

Throws: IOException
if an I/O error occurs.
 o loadTable
 public synchronized void loadTable() throws IOException, ClassNotFoundException
Loads the index table saved in a previous session.

Throws: IOException
if an I/O error occurs.
Throws: ClassNotFoundException
if a class needed to restore the table is not found.
 o keys
 public Enumeration keys()
Returns an enumeration of the keys in the index table.

Returns:
an enumeration of the keys in the index table.
 o clear
 public synchronized void clear()
Removes all saved objects and clears the index table.


All Packages  Class Hierarchy  This Package  Previous  Next  Index