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
`protected Log` `log`

### Constructor Summary

Constructors
Constructor and Description
`DBPersistenceManager(java.io.InputStream input)` Duplicate constructor allowing inputstream
`DBPersistenceManager(java.lang.String filename)` Default construct

### Method Summary

Methods
`void` `clear()` Clears the key-cache as well as all entries
`protected void` `init(java.io.InputStream in)` used to initialize 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 state
`void` `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

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### log

    protected final Log log

### Constructor Detail

#### DBPersistenceManager

    public DBPersistenceManager(java.lang.String filename)
                         throws java.lang.Exception

Default construct

Parameters:
  `filename` - absolute filepath
Throws:
  `Exception;`
  `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 initialize complete DB access. This method will use existing database to create schema (if it doesn't exist) and get PersistenceManager in usable condition

Parameters:
  `in` -
Throws:
  `Exception;`
  `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 interface `PersistenceManager`
Parameters:
  `key` -
  `val` -
Throws:
  `CannotPersistException;`
  `CannotPersistException`

#### remove

    public java.io.Serializable remove(java.io.Serializable key)
                                throws CannotRemoveException

Removes existing entry.

Specified by:
  `remove` in interface `PersistenceManager`
Parameters:
  `key` -
Returns:
  Serializable; gives back the value
Throws:
  `CannotRemoveException;`
  `CannotRemoveException`

#### saveAll

    public void saveAll(java.util.Map map)
                 throws CannotPersistException

Saves all row entries for the map to DB.

Specified by:
  `saveAll` in interface `PersistenceManager`
Parameters:
  `map` -
Throws:
  `CannotPersistException;`
  `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 interface `PersistenceManager`
Returns:
  Map;
Throws:
  `CannotRetrieveException;`
  `CannotRetrieveException`

#### clear

    public void clear()
               throws CannotRemoveException

Clears the key-cache as well as all entries

Specified by:
  `clear` in interface `PersistenceManager`
Throws:
  `CannotRemoveException;`
  `CannotRemoveException`

#### shutDown

    public void shutDown()

Shutting down the database cleanly

Specified by:
  `shutDown` in interface `PersistenceManager`