FileDocCategorySizeDatePackage
SessionManagerImpl.javaAPI DocExample5178Tue May 29 16:56:46 BST 2007com.sun.xml.ws.runtime.util

SessionManagerImpl

public class SessionManagerImpl extends SessionManager
In memory implementation of SessionManager
author
Mike Grogan

Fields Summary
private Hashtable
sessionMap
Map of session id --> session
Constructors Summary
public SessionManagerImpl()
Creates a new instance of SessionManagerImpl

    
    
           
      
        
    
Methods Summary
public SessioncreateSession(java.lang.String key, java.lang.Class clasz)
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.

param
key The Session key to be used.
returns
The new Session.. null if the given class cannot be instantiated.

        Session sess;
        try {
            sess = new Session(this, key, clasz.newInstance());
        } catch (InstantiationException e) {
            return null;
        } catch (IllegalAccessException ee) {
            return null;
        }
        
        sessionMap.put(key, sess);
        return sess;
        
    
public SessioncreateSession(java.lang.String key, java.lang.Object obj)
Creates a Session with the given key, using the specified Object as a holder for user-defined data.

param
key The Session key to be used.
param
obj The object to use as a holder for user data in the session.
returns
The new Session.

        
        Session sess = new Session(this, key, obj);
        sessionMap.put(key, sess);
        return sess;
    
public SessioncreateSession(java.lang.String key)
Creates a Session with the given key, using an instance of java.util.Hashtable asa holder for user-defined data.

param
key The Session key to be used.
returns
The new Session.

   
       return createSession(key, new java.util.Hashtable<String, String>());
    
public java.util.SetgetKeys()
Returns the Set of valid Session keys.

returns
The Set of keys.

        return sessionMap.keySet();
    
public SessiongetSession(java.lang.String key)
Returns an existing session identified by the Key else null

param
key The Session key.
returns
The Session with the given key. null if none exists.

        return sessionMap.get(key);
    
public voidsaveSession(java.lang.String key)
Does nothing in this implementation.

param
key The key of the session to be saved

        
    
public voidterminateSession(java.lang.String key)
Removed the Session with the given key.

param
key The key of the Session to be removed.

        sessionMap.remove(key);