|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sdm.quasar.client.core.application.AbstractSessionManager
Basic implementation of SessionManager.
Derived classes must implement SessionManager.createSession()
and SessionManager.disposeSession(com.sdm.quasar.client.core.application.SessionId) in a threadsafe manner
that allows for maximum parallelization.
Derived classes can access the registered sessions by using
registerSession(com.sdm.quasar.client.core.application.Session),
unregisterSession(com.sdm.quasar.client.core.application.SessionId),
hasRegisteredSession(com.sdm.quasar.client.core.application.SessionId),
and getRegisteredSession(com.sdm.quasar.client.core.application.SessionId).
The implementation of SessionManager.createSession()
should determine the session instance and use createSessionInstance(com.sdm.quasar.client.core.application.SessionId)
to create a new session or return an existing (if applicable).
The new session should be added to the manager using registerSession(com.sdm.quasar.client.core.application.Session).
If a new session is created, it should notify the SessionListeners
using fireSessionCreated(com.sdm.quasar.client.core.application.Session).
The implementation of SessionManager.disposeSession(com.sdm.quasar.client.core.application.SessionId)
should notify the SessionListeners using
fireSessionWillBeDisposed(com.sdm.quasar.client.core.application.Session), then dispose the session using
Session.dispose() and finally unregister it using
unregisterSession(com.sdm.quasar.client.core.application.SessionId).
| Field Summary | |
protected java.util.List |
listeners
Keeps the list of registered SessionListener objects. |
| Constructor Summary | |
AbstractSessionManager(Application application,
SessionCreator sessionCreator)
Constructor. |
|
| Method Summary | |
void |
addSessionListener(SessionListener listener)
Registers an observer that is notified when sessions are created and disposed. |
abstract Session |
createSession()
Creates and initializes a session object. |
protected Session |
createSessionInstance(SessionId sessionId)
Creates the session using a SessionCreator. |
void |
dispose()
This implementation disposes all sessions. |
abstract void |
disposeSession(SessionId sessionId)
Disposes a session. |
protected void |
fireSessionCreated(Session session)
Notifies all registered SessionListeners that a new
session has been created. |
protected void |
fireSessionWillBeDisposed(Session session)
Notifies all registered SessionListeners that a
session will be disposed. |
protected Application |
getApplication()
|
protected Session |
getRegisteredSession(SessionId sessionId)
Returns the session with the given id. |
protected int |
getRegisteredSessionCount()
Returns the number of sessions that are currently registered |
protected boolean |
hasRegisteredSession(SessionId sessionId)
Tests if a session with a given id has been registered. |
protected void |
registerSession(Session session)
Registers a session. |
void |
removeSessionListener(SessionListener listener)
Unregisters an observer. |
protected void |
unregisterSession(SessionId sessionId)
Unregisteres a session. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final java.util.List listeners
SessionListener objects.
| Constructor Detail |
public AbstractSessionManager(Application application,
SessionCreator sessionCreator)
application - the Application this session manager forks for.sessionCreator - the SessionCreator that is used for creating a Session.| Method Detail |
public void addSessionListener(SessionListener listener)
SessionManager
addSessionListener in interface SessionManagerlistener - the listener to be addedpublic void removeSessionListener(SessionListener listener)
SessionManager
removeSessionListener in interface SessionManagerlistener - the listener to be removedprotected Application getApplication()
Application this SessionManager works for.protected void registerSession(Session session)
session - the new sessionprotected boolean hasRegisteredSession(SessionId sessionId)
sessionId - the session id
protected void unregisterSession(SessionId sessionId)
sessionId - the session id of the session that should be unregisteredprotected Session getRegisteredSession(SessionId sessionId)
null will be returned.
sessionId - the session id
protected int getRegisteredSessionCount()
protected Session createSessionInstance(SessionId sessionId)
SessionCreator.
sessionId - the session id of the new session
public void dispose()
throws DisposeException
For more information see Disposable.dispose().
dispose in interface DisposableDisposeException - if there was one or more errors while
disposing the component.protected void fireSessionCreated(Session session)
SessionListeners that a new
session has been created.
session - the new sessionprotected void fireSessionWillBeDisposed(Session session)
SessionListeners that a
session will be disposed.
session - the new sessionpublic abstract Session createSession()
SessionManager
createSession in interface SessionManagerSessionManager.createSession()
public abstract void disposeSession(SessionId sessionId)
throws DisposeException
SessionManager
The implementation should call Session.dispose().
The call to this method is irrevokable. If you want to allow for user interaction or server calls before the session or its dialogs are disposed, you should do so before calling.
Note: The implementation must not return before the session is disposed. Any threads or asynchronous calls started must be completed before this method returns.
disposeSession in interface SessionManagersessionId - the id of the session to be disposed
DisposeException - if there is an error while disposing the sessionSessionManager.disposeSession(com.sdm.quasar.client.core.application.SessionId)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||