01: package org.jgroups.persistence;
02:
03: /**
04: * @author Mandar Shinde
05: * This interface defines the interface that needs to be implemented to
06: * persist any Map(Serializable) object. Primary usage would be users who
07: * need to store the state of a given NV for fault tolerance.
08: */
09:
10: import java.io.Serializable;
11: import java.util.Map;
12:
13: public interface PersistenceManager {
14:
15: /**
16: * Save new NV pair as serializable objects or if already exist; store
17: * new state
18: * @param key
19: * @param val
20: * @exception CannotPersistException;
21: */
22: void save(Serializable key, Serializable val)
23: throws CannotPersistException;
24:
25: /**
26: * Remove existing NV from being persisted
27: * @param key value
28: * @return Serializable; gives back the value
29: * @exception CannotRemoveException;
30: */
31: Serializable remove(Serializable key) throws CannotRemoveException;
32:
33: /**
34: * Use to store a complete map into persistent state
35: * @param map
36: * @exception CannotPersistException;
37: */
38: void saveAll(Map map) throws CannotPersistException;
39:
40: /**
41: * Gives back the Map in last known state
42: * @return Map;
43: * @exception CannotRetrieveException;
44: */
45: Map retrieveAll() throws CannotRetrieveException;
46:
47: /**
48: * Clears the complete NV state from the DB
49: * @exception CannotRemoveException;
50: */
51: void clear() throws CannotRemoveException;
52:
53: /**
54: * Used to handle shutdown call the PersistenceManager implementation.
55: * Persistent engines can leave this implementation empty.
56: */
57: void shutDown();
58:
59: }
|