Merge "BUG-732 Fix netconf-connector unable to detect monitoring capability"
[controller.git] / opendaylight / samples / clustersession / src / main / java / org / opendaylight / controller / clustersession / service / ClusterSessionService.java
1 package org.opendaylight.controller.clustersession.service;
2
3 import java.util.HashMap;
4
5 import org.apache.catalina.Session;
6 import org.apache.catalina.util.SessionIdGenerator;
7 import org.opendaylight.controller.clustersession.ClusterSession;
8
9 /**
10  * A service to handle session persistence and retrieval in any data store
11  *
12  * @author harman singh
13  *
14  */
15 public interface ClusterSessionService {
16
17   /**
18    * This method performs all startup operations
19    */
20   void startInternal(SessionIdGenerator sessionIdGenerator);
21
22   /**
23    * Method to perform all clean up operations
24    */
25   void stopInternal();
26
27   /**
28    * Find Session object based on provided session id from persistance
29    * @param id
30    * @return an instance of Session
31    */
32   Session findSession(final String id);
33
34   /**
35    * Get an array of session objects available in storage
36    */
37   Session[] findSessions();
38
39   /**
40    * Remove a session object from persistence
41    * @param id of session object need to be removed
42    */
43   void removeSession(final String id);
44
45   /**
46    * Expire and remove a session object from persistence
47    * @param id of session object need to be expired
48    */
49   void expireSession(final String id);
50
51   /**
52    * Create a session object based on session id, if session is not present
53    * use random session id
54    * @param sessionId
55    * @return an instance of Session
56    */
57   Session createSession(final String sessionId);
58
59   /**
60    * Add a session object in persistence
61    * @param session an instance of ClusterSession
62    */
63   void addSession(final ClusterSession session);
64
65   /**
66    * Create an empty Session object
67    * @return session object
68    */
69   Session createEmptySession();
70
71   /**
72    * Fetch attributes of Session object fetched by supplied session id
73    * @param sessionId
74    * @return
75    */
76   HashMap<String, String> getSession(String sessionId);
77
78   /**
79    * update the session object in persistence
80    * @param session
81    */
82   void updateSession(final ClusterSession session);
83
84 }