com.stratelia.silverpeas.peasCore
Class SessionManager

java.lang.Object
  extended by com.stratelia.silverpeas.peasCore.SessionManager
All Implemented Interfaces:
SchedulerEventListener, SessionManagement

@Named(value="sessionManagement")
public class SessionManager
extends Object
implements SchedulerEventListener, SessionManagement

Class declaration This object is a singleton used by SilverpeasSessionOpenener : when the user log in, ComponentRequestRouter : when the user access a component. It provides functions to manage the sessions, to write a log journal and getFactory informations about the logged users.

Author:
Nicolas Eysseric

Method Summary
 void closeSession(String sessionId)
           
 void doSessionManagement(Date currentDate)
          This method is called every scheduledSessionManagementTimeStamp minute by the scheduler, it notify the user when timeout has expired and then invalidates the session if the user has not accessed the server.
 Collection<SessionInfo> getConnectedUsersList()
          Gets all the connected users and the duration of their session.
 Collection<SessionInfo> getDistinctConnectedUsersList(UserDetail user)
          Gets all the connected users and the duration of their session.
 int getNbConnectedUsersList(UserDetail user)
          Gets number of connected users
 long getNextSessionTimeOut(String sessionKey)
           
 SessionInfo getSessionInfo(String sessionId)
           
 void initSessionManager()
          Init attributes
 boolean isUserConnected(UserDetail user)
           
 void jobFailed(SchedulerEvent anEvent)
           
 void jobSucceeded(SchedulerEvent anEvent)
           
 SessionInfo openAnonymousSession(javax.servlet.http.HttpServletRequest request)
           
 SessionInfo openSession(UserDetail user)
          This method is dedicated to the authentication for only accessing the WEB services published in Silverpeas.
 SessionInfo openSession(UserDetail user, javax.servlet.http.HttpServletRequest request)
          This method is dedicated to the authentication of users behind a WEB browser.
 void removeSession(String sessionId)
          Remove a session and log session's data.
 void shutdown()
          This method remove and invalidates all sessions.
 void triggerFired(SchedulerEvent anEvent)
           
 SessionInfo validateSession(SessionValidationContext context)
           
 SessionInfo validateSession(String sessionKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

initSessionManager

@PostConstruct
public void initSessionManager()
Init attributes


validateSession

public SessionInfo validateSession(String sessionKey)
Specified by:
validateSession in interface SessionManagement

validateSession

public SessionInfo validateSession(SessionValidationContext context)
Specified by:
validateSession in interface SessionManagement

removeSession

public void removeSession(String sessionId)
Remove a session and log session's data.

Parameters:
sessionId - identifier
See Also:
LogoutServlet

closeSession

public void closeSession(String sessionId)
Specified by:
closeSession in interface SessionManagement

getSessionInfo

public SessionInfo getSessionInfo(String sessionId)
Specified by:
getSessionInfo in interface SessionManagement

getConnectedUsersList

public Collection<SessionInfo> getConnectedUsersList()
Gets all the connected users and the duration of their session.

Specified by:
getConnectedUsersList in interface SessionManagement
Returns:

getDistinctConnectedUsersList

public Collection<SessionInfo> getDistinctConnectedUsersList(UserDetail user)
Gets all the connected users and the duration of their session.

Specified by:
getDistinctConnectedUsersList in interface SessionManagement
Returns:
Collection of HTTPSessionInfo

getNbConnectedUsersList

public int getNbConnectedUsersList(UserDetail user)
Gets number of connected users

Specified by:
getNbConnectedUsersList in interface SessionManagement
Parameters:
user -
Returns:
nb of connected users

doSessionManagement

public void doSessionManagement(Date currentDate)
This method is called every scheduledSessionManagementTimeStamp minute by the scheduler, it notify the user when timeout has expired and then invalidates the session if the user has not accessed the server. The maximum minutes duration of session before invalidation is userSessionTimeout + scheduledSessionManagementTimeStamp.

Parameters:
currentDate - the date when the method is called by the scheduler
See Also:
for parameters, addSession, setLastAccess

shutdown

public void shutdown()
This method remove and invalidates all sessions. The unique instance of the SessionManager will be destroyed.


triggerFired

public void triggerFired(SchedulerEvent anEvent)
                  throws Exception
Specified by:
triggerFired in interface SchedulerEventListener
Throws:
Exception

jobSucceeded

public void jobSucceeded(SchedulerEvent anEvent)
Specified by:
jobSucceeded in interface SchedulerEventListener

jobFailed

public void jobFailed(SchedulerEvent anEvent)
Specified by:
jobFailed in interface SchedulerEventListener

openSession

public SessionInfo openSession(UserDetail user)
This method is dedicated to the authentication for only accessing the WEB services published in Silverpeas. To openSession a user using a WEB browser to access Silverpeas, please prefers the below openSession method.

Specified by:
openSession in interface SessionManagement
Parameters:
user - the user for which the session has to be opened
Returns:
a SessionInfo instance representing the opened session.

openSession

public SessionInfo openSession(UserDetail user,
                               javax.servlet.http.HttpServletRequest request)
This method is dedicated to the authentication of users behind a WEB browser.

Specified by:
openSession in interface SessionManagement
Parameters:
user - the user for which the session has to be opened
request - the HTTP servlet request in which the authentication is performed.
Returns:
a SessionInfo instance representing the opened session.

openAnonymousSession

public SessionInfo openAnonymousSession(javax.servlet.http.HttpServletRequest request)
Specified by:
openAnonymousSession in interface SessionManagement

isUserConnected

public boolean isUserConnected(UserDetail user)
Specified by:
isUserConnected in interface SessionManagement

getNextSessionTimeOut

public long getNextSessionTimeOut(String sessionKey)
Specified by:
getNextSessionTimeOut in interface SessionManagement


Copyright © 2016 Silverpeas. All Rights Reserved.