public class SessionManager extends Object
This class is fully threadsafe.
| Constructor and Description |
|---|
SessionManager()
Creates and initializes a new SessionManager instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Session session,
boolean store)
Configures a passed Session instance and optionally saves it for later access.
|
void |
clear()
Clears the configuration of this session manager and removes
all sessions from the internal lookup table.
|
void |
delete(Session session)
Removes a session from the internal list of sessions.
|
Session |
get(String name)
Returns a previously added session.
|
SessionDefaults |
getDefaults()
This method lets you specify the default property values
for new sessions which will be passed to the add method.
|
void |
loadConfiguration(Configuration config)
Loads the configuration properties of this session manager.
|
void |
update(Session session,
String to,
String from)
Updates an entry in the internal lookup table of sessions.
|
public SessionManager()
public void loadConfiguration(Configuration config)
This method loads the configuration of this session manager from the passed Configuration object. Sessions which have already been stored or will be added with add will automatically configured with the new properties if the passed Configuration object contains corresponding session entries. Moreover, this method also loads the default session properties which will be applied to all sessions which are passed to add.
Please see the SmartInspect.loadConfiguration method for details on how session entries look like.
config - The Configuration object to load the configuration frompublic void add(Session session, boolean store)
This method configures the passed session with the default session properties as specified by the defaults property. This default configuration can be overridden on a per-session basis by loading the session configuration with the loadConfiguration method.
If the 'store' parameter is true, the passed session is stored for later access and can be retrieved with the get method. To remove a stored session from the internal list, call delete.
If this method is called multiple times with the same session name, then the get method operates on the session which got added last. If the session parameter is null, this method does nothing.
session - The session to configure and to save for later access, if desiredstore - Indicates if the passed session should be stored for later accesspublic void delete(Session session)
This method removes a session which has previously been added with the add method. After this method returns, the get method returns null when called with the same session name unless a different session with the same name has been added. This method does nothing if the supplied session argument is null.
session - The session to remove from the lookup table of sessions. Not allowed to be nullpublic Session get(String name)
name - The name of the session to lookup and return. Not allowed to be nullpublic void update(Session session, String to, String from)
Once the name of a session has changed, this method is called to update the internal session lookup table. The 'to' argument specifies the new name and 'from' the old name of the session. After this method returns, the new name can be passed to the get method to lookup the supplied session.
session - The session whose name has changed and whose entry should be updatedto - The new name of the sessionfrom - The old name of the sessionpublic void clear()
public SessionDefaults getDefaults()
Copyright © 2023. All rights reserved.