KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgroups > persistence > PersistenceManager


1 package org.jgroups.persistence;
2
3 /**
4  * @author Mandar Shinde
5  * This interface defines the interface that needs to be implemented to
6  * persist any Map(Serializable) object. Primary usage would be users who
7  * need to store the state of a given NV for fault tolerance.
8  */

9
10
11 import java.io.Serializable JavaDoc;
12 import java.util.Map JavaDoc;
13
14
15 public interface PersistenceManager
16 {
17
18     /**
19      * Save new NV pair as serializable objects or if already exist; store
20      * new state
21      * @param key
22      * @param val
23      * @exception CannotPersistException;
24      */

25     void save(Serializable JavaDoc key, Serializable JavaDoc val) throws CannotPersistException;
26
27     /**
28      * Remove existing NV from being persisted
29      * @param key value
30      * @return Serializable; gives back the value
31      * @exception CannotRemoveException;
32      */

33     Serializable JavaDoc remove(Serializable JavaDoc key) throws CannotRemoveException;
34
35
36     /**
37      * Use to store a complete map into persistent state
38      * @param map
39      * @exception CannotPersistException;
40      */

41     void saveAll(Map JavaDoc map) throws CannotPersistException;
42
43     
44     /**
45      * Gives back the Map in last known state
46      * @return Map;
47      * @exception CannotRetrieveException;
48      */

49     Map JavaDoc retrieveAll() throws CannotRetrieveException;
50
51
52     /**
53      * Clears the complete NV state from the DB
54      * @exception CannotRemoveException;
55      */

56     void clear() throws CannotRemoveException;
57
58
59     /**
60      * Used to handle shutdown call the PersistenceManager implementation.
61      * Persistent engines can leave this implementation empty.
62      */

63     void shutDown();
64
65 }
66
Popular Tags