|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.dlese.dpc.schemedit.SessionRegistry
public class SessionRegistry
Maintains a registry of sessions and also manages record locking.
As ServletContextListener, receives "contextInitialized" event, and sets servletContext attribute.
As HttpSessionListener, receives "sessionCreated" and "sessionDestroyed" events. SessionBean
s are created when the session is created, and destroyed when the
session is destroyed.
Constructor Summary | |
---|---|
SessionRegistry()
Constructor for the SessionRegistry object. |
Method Summary | |
---|---|
void |
contextDestroyed(ServletContextEvent event)
Method called when a context is destroyed. |
void |
contextInitialized(ServletContextEvent event)
Called when context is initialized, sets ServletContext as class attribute. |
void |
destroy()
Release locked records |
boolean |
getLock(String recId,
String sessionId)
Gets the lock attribute of the SessionRegistry object. |
Map |
getLockedRecords()
Gets the lockedRecords attribute of the SessionRegistry object, which stores all locked records and the sessions that owns the lock. |
HttpSession |
getSession(String id)
Returns active session corresponding to given Id. |
SessionBean |
getSessionBean(HttpServletRequest request)
Return the SessionBean associated with the HttpSession for the provided request. |
List |
getSessionBeans()
Returns a list of all active SessionBean instances. |
boolean |
getUniqueLock(String recId,
String sessionId)
A version of getLock that only allows a single record to be locked by a single session at a time |
List |
getUserSessionBeans(User user)
|
boolean |
isLocked(String recId)
Returns true if there is a lock for the given record. |
List |
myLockedRecords(String sessionId)
Find records locked by a given session. |
boolean |
ownsLock(String recId,
String sessionId)
Is a record locked by the given session? |
void |
registerSessionBean(SessionBean sessionBean)
Register a sessionBean by putting it into the sessionBeanMap. |
void |
releaseAllLocks()
Release all locked records. |
void |
releaseAllLocks(String sessionId)
Release all the locks owned by a particluar session. |
boolean |
releaseLock(String recId)
Releases the lock for given record, regardless of what session owns the lock. |
boolean |
releaseLock(String recId,
String sessionId)
Release lock held by specified sesssion |
void |
sessionCreated(HttpSessionEvent se)
Called when a session is created with sole effect of putting the created session into the activeSessions map. |
void |
sessionDestroyed(HttpSessionEvent se)
Notified when a session is about to be destroyed - removes the session from the activeSessions map and unregisteres sessionBean. |
void |
unregisterSessionBean(String sessionId)
Unregister a sessionBean by calling its destroy
method (releasing all held locks), and removing its entry from the sessionBeanMap. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SessionRegistry()
activeSessionsMap map maintains the set of ALL active sessions, and is only modified by sessionCreated(HttpSessionEvent)
and sessionDestroyed(HttpSessionEvent)
listeners.
sessionBeanMap maintains the set of sessionBean instances, which are created only for interactive sessions - which excludes sessions created by webservice requests.
Method Detail |
---|
public void contextDestroyed(ServletContextEvent event)
contextDestroyed
in interface ServletContextListener
event
- Description of the ParameterunregisterSessionBean(String)
public void contextInitialized(ServletContextEvent event)
contextInitialized
in interface ServletContextListener
event
- Description of the Parameterpublic Map getLockedRecords()
public void sessionCreated(HttpSessionEvent se)
sessionCreated
in interface HttpSessionListener
se
- notification eventpublic void sessionDestroyed(HttpSessionEvent se)
sessionDestroyed
in interface HttpSessionListener
se
- notification eventunregisterSessionBean(String)
public boolean isLocked(String recId)
recId
- Description of the Parameter
public boolean ownsLock(String recId, String sessionId)
recId
- Description of the ParametersessionId
- Id of given session
public List myLockedRecords(String sessionId)
sessionId
- Description of the Parameter
public void releaseAllLocks()
public void releaseAllLocks(String sessionId)
sessionId
- Id of session that is releasing records.public boolean getLock(String recId, String sessionId)
recId
- Description of the ParametersessionId
- Description of the Parameter
public boolean getUniqueLock(String recId, String sessionId)
recId
- Description of the ParametersessionId
- Description of the Parameter
public boolean releaseLock(String recId)
recId
- Description of the Parameter
public boolean releaseLock(String recId, String sessionId)
recId
- Description of the ParametersessionId
- Description of the Parameter
public void registerSessionBean(SessionBean sessionBean)
sessionBean
- Description of the Parameterpublic void unregisterSessionBean(String sessionId)
destroy
method (releasing all held locks), and removing its entry from the sessionBeanMap.
sessionId
- Description of the Parameterpublic HttpSession getSession(String id)
id
- session id
public SessionBean getSessionBean(HttpServletRequest request)
If a sessionBean does not yet exist for a valid session, then it is created and bound to the session context. This method is the standard way of obtaining of obtaining a sessionBean from within a Controller or FormBean.
request
- A request instance that is associated with a session
public List getUserSessionBeans(User user)
public List getSessionBeans()
Unregisters sessionBeans corresponding to sessions that have been invalidated.
SessionBean
public void destroy()
|
DLESE Tools v1.6.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |