com.sibvisions.rad.server
Class DefaultSessionManager

java.lang.Object
  extended by javax.rad.server.AbstractSessionManager
      extended by com.sibvisions.rad.server.DefaultSessionManager

public class DefaultSessionManager
extends AbstractSessionManager

The DefaultSessionManager handles the access to all sessions created through client connections.


Constructor Summary
protected DefaultSessionManager(Server pServer)
          Creates an instance of DefaultSessionManager for a special communication server.
 
Method Summary
 void addSessionListener(ISessionListener pListener)
          Adds an ISessionListener session listener to the list of known listeners.
protected  ISecurityManager createSecurityManager(ISession pSession)
          Creates a new security manager instance for the given session.
 Object createSession(IRequest pRequest, ISerializer pSerializer, ChangedHashtable<String,Object> pProperties)
          Creates an authenticated session for an application.
 Object createSubSession(IRequest pRequest, AbstractSession pSession, ChangedHashtable<String,Object> pProperties)
          Creates a new SubSession for an already authenticated main session.
 void destroy(Object pSessionId)
          Destroyes a session and dependent sub sessions.
 AbstractSession get(Object pSessionId)
          Gets an existing session.
 ISessionListener[] getSessionListeners()
          Gets the list of known listeners.
 boolean isAvailable(ISession pSession)
          Gets whether a session is known from this session manager.
protected  void postCreateSession(ISession pSession)
          Configures a session after it is created.
protected  void postCreateSubSession(ISession pMaster, ISession pSession)
          Configures a sub session after it is created.
 void removeSessionListener(ISessionListener pListener)
          Removes an ISessionListener from the list of known listeners.
 
Methods inherited from class javax.rad.server.AbstractSessionManager
getServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSessionManager

protected DefaultSessionManager(Server pServer)
Creates an instance of DefaultSessionManager for a special communication server.

Parameters:
pServer - communication server
Method Detail

get

public final AbstractSession get(Object pSessionId)
Gets an existing session.

Specified by:
get in class AbstractSessionManager
Parameters:
pSessionId - session identifier
Returns:
session object, guaranteed not null

addSessionListener

public final void addSessionListener(ISessionListener pListener)
Adds an ISessionListener session listener to the list of known listeners.

Specified by:
addSessionListener in class AbstractSessionManager
Parameters:
pListener - te session listener to add

removeSessionListener

public final void removeSessionListener(ISessionListener pListener)
Removes an ISessionListener from the list of known listeners.

Specified by:
removeSessionListener in class AbstractSessionManager
Parameters:
pListener - the session listener to remove

getSessionListeners

public final ISessionListener[] getSessionListeners()
Gets the list of known listeners.

Specified by:
getSessionListeners in class AbstractSessionManager
Returns:
a list of ISessionListener or an empty list

createSession

public final Object createSession(IRequest pRequest,
                                  ISerializer pSerializer,
                                  ChangedHashtable<String,Object> pProperties)
                           throws Throwable
Creates an authenticated session for an application.

Parameters:
pRequest - the request which creates the session
pSerializer - the serializer for the session
pProperties - the initial session properties
Returns:
session identifier of newly created Session
Throws:
Throwable - if the security manager detects a problem or the session properties can not be set

createSubSession

public final Object createSubSession(IRequest pRequest,
                                     AbstractSession pSession,
                                     ChangedHashtable<String,Object> pProperties)
                              throws Throwable
Creates a new SubSession for an already authenticated main session. This method doesn't check if the session is valid.

Parameters:
pRequest - the request which creates the sub session
pSession - a valid session
pProperties - the initial session properties
Returns:
the new SubSession
Throws:
Throwable - the session properties can not be set

destroy

public final void destroy(Object pSessionId)
Destroyes a session and dependent sub sessions.

Parameters:
pSessionId - session identifier
Throws:
SecurityException - if the session identifier is unknown

createSecurityManager

protected ISecurityManager createSecurityManager(ISession pSession)
                                          throws Exception
Creates a new security manager instance for the given session.

Parameters:
pSession - the session which needs a security manager
Returns:
the security manager
Throws:
Exception - if the class or default constructor was not found

postCreateSession

protected void postCreateSession(ISession pSession)
Configures a session after it is created.

Parameters:
pSession - the session

postCreateSubSession

protected void postCreateSubSession(ISession pMaster,
                                    ISession pSession)
Configures a sub session after it is created.

Parameters:
pMaster - the master session
pSession - the session

isAvailable

public boolean isAvailable(ISession pSession)
Gets whether a session is known from this session manager. This means whether the session is in the list of currently opened sessions.

Parameters:
pSession - the session to check
Returns:
true if the session is available, false otherwise


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.