KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mountainminds > eclemma > core > ISessionManager


1 /*******************************************************************************
2  * Copyright (c) 2006 Mountainminds GmbH & Co. KG
3  * This software is provided under the terms of the Eclipse Public License v1.0
4  * See http://www.eclipse.org/legal/epl-v10.html.
5  *
6  * $Id: ISessionManager.java 76 2006-09-13 07:16:36Z mho $
7  ******************************************************************************/

8 package com.mountainminds.eclemma.core;
9
10
11 /**
12  * The session manager holds a list of currently available sessions. One of the
13  * sessions in the list may be the active session, which is the one that is used
14  * to attach coverage information to Java elements.
15  *
16  * This interface is not intended to be implemented or extended by clients.
17  *
18  * @see com.mountainminds.eclemma.core.CoverageTools#getSessionManager()
19  *
20  * @author Marc R. Hoffmann
21  * @version $Revision: 76 $
22  */

23 public interface ISessionManager {
24
25   /**
26    * Adds the given session to this session manager. If the session is already
27    * part of this session manager the method has no effect. If the key parameter
28    * is not <code>null</code> the key is internally assigned to this session
29    * for later access.
30    *
31    * @param session
32    * the new session
33    * @param activate
34    * if <code>true</code> the session will also be activated
35    * @param key
36    * key object this session will be assigned to
37    */

38   public void addSession(ICoverageSession session, boolean activate, Object JavaDoc key);
39
40   /**
41    * Removes the given session. If the session is not in included in this
42    * session manager this method has no effect. If the removed session was the
43    * active session, the most recently added session becomes active.
44    *
45    * @param session
46    * session to remove
47    */

48   public void removeSession(ICoverageSession session);
49
50   /**
51    * Removes the session that has been assigned to the given key. If there is no
52    * session for the key this method has no effect. If the removed session was
53    * the active session, the most recently added session becomes active.
54    *
55    * @see #addSession(ICoverageSession, boolean, Object)
56    * @param key
57    * key object for the session to remove
58    */

59   public void removeSession(Object JavaDoc key);
60
61   /**
62    * Removes all registered sessions.
63    */

64   public void removeAllSessions();
65
66   /**
67    * Returns all sessions that have been registered with this session manager.
68    *
69    * @see #addSession(ICoverageSession, boolean, Object)
70    * @return list of registered session
71    */

72   public ICoverageSession[] getSessions();
73
74   /**
75    * Returns the session that has been assigned to the given key. If there is no
76    * session for the key this method returns <code>null</code>.
77    *
78    * @see #addSession(ICoverageSession, boolean, Object)
79    * @param key
80    * key object for the session
81    * @return session object or <code>null</code>
82    */

83   public ICoverageSession getSession(Object JavaDoc key);
84
85   /**
86    * Activates the given session. If the session is not in included in this
87    * session manager this method has no effect.
88    *
89    * @param session
90    * session to activate
91    */

92   public void activateSession(ICoverageSession session);
93
94   /**
95    * Activates the session that has been assigned to the given key. If there is
96    * no session for the key this method has no effect.
97    *
98    * @see #addSession(ICoverageSession, boolean, Object)
99    * @param key
100    * key object for the session to activate
101    */

102   public void activateSession(Object JavaDoc key);
103
104   /**
105    * Returns the active session or <code>null</code> if there is no session.
106    *
107    * @return active session or <code>null</null>
108    */

109   public ICoverageSession getActiveSession();
110
111   /**
112    * Triggers a reload of the active session. If there is no active session
113    * this method has no effect.
114    */

115   public void refreshActiveSession();
116   
117   /**
118    * Adds the given session listener unless it has been added before.
119    *
120    * @param listener
121    * session listener to add
122    */

123   public void addSessionListener(ISessionListener listener);
124
125   /**
126    * Removes the given session listener. If the listener has not been added
127    * before this method has no effect.
128    *
129    * @param listener
130    * session listener to remove
131    */

132   public void removeSessionListener(ISessionListener listener);
133
134 }
135
Popular Tags