Package org.jgroups.persistence
Class DBPersistenceManager
- java.lang.Object
-
- org.jgroups.persistence.DBPersistenceManager
-
- All Implemented Interfaces:
PersistenceManager
public class DBPersistenceManager extends java.lang.Object implements PersistenceManager
Class will be utilized
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.logging.Loglog
-
Constructor Summary
Constructors Constructor Description DBPersistenceManager(java.io.InputStream input)Duplicate constructor allowing inputstreamDBPersistenceManager(java.lang.String filename)Default construct
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the key-cache as well as all entriesprotected voidinit(java.io.InputStream in)used to intitiailize complete DB access.java.io.Serializableremove(java.io.Serializable key)Removes existing entry.java.util.MapretrieveAll()Used to retrieve the persisted map back to its last known statevoidsave(java.io.Serializable key, java.io.Serializable val)Saves NV pair as serializable object; creates if new, stores new state if already exists.voidsaveAll(java.util.Map map)Saves all row entries for the map to DB.voidshutDown()Shutting down the database cleanly
-
-
-
Constructor Detail
-
DBPersistenceManager
public DBPersistenceManager(java.lang.String filename) throws java.lang.ExceptionDefault construct- Parameters:
filename- absolute filepath- Throws:
java.lang.Exception
-
DBPersistenceManager
public DBPersistenceManager(java.io.InputStream input) throws java.lang.ExceptionDuplicate constructor allowing inputstream- Parameters:
input-- Throws:
java.lang.Exception
-
-
Method Detail
-
init
protected void init(java.io.InputStream in) throws java.lang.Exceptionused to intitiailize complete DB access. THis method will use existing database to create schema (if it doesnt exist) and get PersistenceManager in usable condition- Parameters:
in-- Throws:
java.lang.Exception
-
save
public void save(java.io.Serializable key, java.io.Serializable val) throws CannotPersistExceptionSaves NV pair as serializable object; creates if new, stores new state if already exists.- Specified by:
savein interfacePersistenceManager- Parameters:
key-val-- Throws:
CannotPersistException
-
remove
public java.io.Serializable remove(java.io.Serializable key) throws CannotRemoveExceptionRemoves existing entry.- Specified by:
removein interfacePersistenceManager- Parameters:
key-- Returns:
- Serializable; gives back the value
- Throws:
CannotRemoveException
-
saveAll
public void saveAll(java.util.Map map) throws CannotPersistExceptionSaves all row entries for the map to DB.- Specified by:
saveAllin interfacePersistenceManager- Parameters:
map-- Throws:
CannotPersistException
-
retrieveAll
public java.util.Map retrieveAll() throws CannotRetrieveExceptionUsed to retrieve the persisted map back to its last known state- Specified by:
retrieveAllin interfacePersistenceManager- Returns:
- Map;
- Throws:
CannotRetrieveException
-
clear
public void clear() throws CannotRemoveExceptionClears the key-cache as well as all entries- Specified by:
clearin interfacePersistenceManager- Throws:
CannotRemoveException
-
shutDown
public void shutDown()
Shutting down the database cleanly- Specified by:
shutDownin interfacePersistenceManager
-
-