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.
-
StoreManager(String)
- Constructs a new
StoreManager
with a given path
where to store objects.
-
clear()
- Removes all saved objects and clears the index table.
-
getObject(Object)
- Retrieves the object corresponding to the given
key
.
-
insertObject(Object, Object)
- Stores
obj
and add an entry to the index table.
-
keys()
- Returns an enumeration of the keys in the index table.
-
loadTable()
- Loads the index table saved in a previous session.
-
removeObject(Object)
- Removes a stored object and the corresponding table entry.
-
saveTable()
- Saves the index table in stable storage, so it is possible
to retrieve it in a different session.
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.
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.
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.
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.
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.
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.
keys
public Enumeration keys()
- Returns an enumeration of the keys in the index table.
- Returns:
- an enumeration of the keys in the index table.
clear
public synchronized void clear()
- Removes all saved objects and clears the index table.
All Packages Class Hierarchy This Package Previous Next Index