java.lang.Object
com.sun.xml.ws.commons.AbstractMOMRegistrationAware
com.sun.xml.ws.runtime.dev.SessionManager
- All Implemented Interfaces:
MOMRegistrationAware
- Direct Known Subclasses:
SessionManagerImpl
@ManagedObject
@Description("Session manager used by RM and SC")
@AMXMetadata(type="WSRMSCSessionManager")
public abstract class SessionManager
extends AbstractMOMRegistrationAware
The
SessionManager is used to obtain session information
This can be implemented using persistent storage mechanisms or using transient storage
Even if it is implemented using persistent storage the implementation should take care
of backing by a cache which will avoid the overhead of serialization and database
operations
Additionally the SessionManager is responsible for managing the life cycle
events for the sessions. It exposes methods to create and terminate the session
Periodically the SessionManager will check for sessions who have been inactive for
a predefined amount of time and then will terminate those sessions
- Author:
- Bhakti Mehta, Mike Grogan
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddSecurityContext(String key, IssuedTokenContext itctx) Add the SecurityContext with key in local cacheabstract SessioncreateSession(String key) Creates a Session with the given key, using an instance ofjava.util.Hashtable<String, String>asa holder for user-defined data.abstract SessioncreateSession(String key, SecurityContextTokenInfo sctInfo) abstract SessioncreateSession(String key, Class<?> clasz) Creates a Session with the given key, using a new instance of the specified Class as a holder for user-defined data.abstract SessioncreateSession(String key, Object obj) Creates a Session with the given key, using the specified Object as a holder for user-defined data.static Propertiesabstract IssuedTokenContextgetSecurityContext(String key, boolean checkExpiry) Return the valid SecurityContext for matching keyabstract SessiongetSession(String key) Returns an existing session identified by the Key else nullstatic SessionManagergetSessionManager(com.sun.xml.ws.api.server.WSEndpoint endpoint, boolean isSC, Properties props) Returns the single instance of SessionManager Use the usual services mechanism to find implementing class.static SessionManagergetSessionManager(com.sun.xml.ws.api.server.WSEndpoint endpoint, Properties props) keys()Returns the Set of valid Session keys.static voidremoveSessionManager(com.sun.xml.ws.api.server.WSEndpoint endpoint) abstract voidsaveSession(String key) Saves the state of the Session with the given key.protected abstract Collection<Session>sessions()static voidsetConfig(Properties aConfig) abstract voidterminateSession(String key) Removed the Session with the given key.Methods inherited from class com.sun.xml.ws.commons.AbstractMOMRegistrationAware
isRegisteredAtMOM, setRegisteredAtMOM
-
Field Details
-
TIMEOUT_INTERVAL
- See Also:
-
SESSION_THRESHOLD
- See Also:
-
-
Constructor Details
-
SessionManager
public SessionManager()
-
-
Method Details
-
getConfig
- Returns:
- the config
-
setConfig
- Parameters:
aConfig- the config to set
-
getSession
Returns an existing session identified by the Key else null- Parameters:
key- The Session key.- Returns:
- The Session with the given key.
nullif none exists.
-
keys
Returns the Set of valid Session keys.- Returns:
- The Set of keys.
-
sessions
@ManagedAttribute @Description("The collection of valid Sessions") protected abstract Collection<Session> sessions()- Returns:
- The Collection of valid Sessions.
-
terminateSession
Removed the Session with the given key.- Parameters:
key- The key of the Session to be removed.
-
createSession
Creates a Session with the given key, using a new instance of the specified Class as a holder for user-defined data. The specified Class must have a default ctor.- Parameters:
key- The Session key to be used.- Returns:
- The new Session..
nullif the given class cannot be instantiated.
-
createSession
Creates a Session with the given key, using the specified Object as a holder for user-defined data.- Parameters:
key- The Session key to be used.obj- The object to use as a holder for user data in the session.- Returns:
- The new Session.
-
createSession
-
createSession
Creates a Session with the given key, using an instance ofjava.util.Hashtable<String, String>asa holder for user-defined data.- Parameters:
key- The Session key to be used.- Returns:
- The new Session.
-
saveSession
Saves the state of the Session with the given key.- Parameters:
key- The key of the session to be saved
-
getSecurityContext
Return the valid SecurityContext for matching key- Parameters:
key- The key of the security context to be lookedcheckExpiry- indicates whether to check the token expiry or not, As in case of renew we don't need to check token expiry- Returns:
- IssuedTokenContext for security context key
-
addSecurityContext
Add the SecurityContext with key in local cache- Parameters:
key- The key of the security context to be storeditctx- The IssuedTokenContext to be stored
-
removeSessionManager
public static void removeSessionManager(com.sun.xml.ws.api.server.WSEndpoint endpoint) -
getSessionManager
public static SessionManager getSessionManager(com.sun.xml.ws.api.server.WSEndpoint endpoint, boolean isSC, Properties props) Returns the single instance of SessionManager Use the usual services mechanism to find implementing class. If not found, usecom.sun.xml.ws.runtime.util.SessionManagerby default.- Returns:
- The value of the
managerfield.
-
getSessionManager
public static SessionManager getSessionManager(com.sun.xml.ws.api.server.WSEndpoint endpoint, Properties props)
-