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.Log
log
-
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 void
clear()
Clears the key-cache as well as all entriesprotected void
init(java.io.InputStream in)
used to intitiailize complete DB access.java.io.Serializable
remove(java.io.Serializable key)
Removes existing entry.java.util.Map
retrieveAll()
Used to retrieve the persisted map back to its last known statevoid
save(java.io.Serializable key, java.io.Serializable val)
Saves NV pair as serializable object; creates if new, stores new state if already exists.void
saveAll(java.util.Map map)
Saves all row entries for the map to DB.void
shutDown()
Shutting down the database cleanly
-
-
-
Constructor Detail
-
DBPersistenceManager
public DBPersistenceManager(java.lang.String filename) throws java.lang.Exception
Default construct- Parameters:
filename
- absolute filepath- Throws:
java.lang.Exception
-
DBPersistenceManager
public DBPersistenceManager(java.io.InputStream input) throws java.lang.Exception
Duplicate constructor allowing inputstream- Parameters:
input
-- Throws:
java.lang.Exception
-
-
Method Detail
-
init
protected void init(java.io.InputStream in) throws java.lang.Exception
used 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 CannotPersistException
Saves NV pair as serializable object; creates if new, stores new state if already exists.- Specified by:
save
in interfacePersistenceManager
- Parameters:
key
-val
-- Throws:
CannotPersistException
-
remove
public java.io.Serializable remove(java.io.Serializable key) throws CannotRemoveException
Removes existing entry.- Specified by:
remove
in interfacePersistenceManager
- Parameters:
key
-- Returns:
- Serializable; gives back the value
- Throws:
CannotRemoveException
-
saveAll
public void saveAll(java.util.Map map) throws CannotPersistException
Saves all row entries for the map to DB.- Specified by:
saveAll
in interfacePersistenceManager
- Parameters:
map
-- Throws:
CannotPersistException
-
retrieveAll
public java.util.Map retrieveAll() throws CannotRetrieveException
Used to retrieve the persisted map back to its last known state- Specified by:
retrieveAll
in interfacePersistenceManager
- Returns:
- Map;
- Throws:
CannotRetrieveException
-
clear
public void clear() throws CannotRemoveException
Clears the key-cache as well as all entries- Specified by:
clear
in interfacePersistenceManager
- Throws:
CannotRemoveException
-
shutDown
public void shutDown()
Shutting down the database cleanly- Specified by:
shutDown
in interfacePersistenceManager
-
-