com.niggle.data.inmemory
Class SimpleSessionManager

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.niggle.data.AbstractDataSource
                          |
                          +--com.niggle.data.AbstractMutableDataSource
                                |
                                +--com.niggle.data.inmemory.InMemoryRecordSet
                                      |
                                      +--com.niggle.data.inmemory.SimpleSessionManager
All Implemented Interfaces:
DataChangeNotifier, DataSource, MutableDataSource, java.rmi.Remote, java.io.Serializable, SessionManager

public class SimpleSessionManager
extends InMemoryRecordSet
implements SessionManager

An implementation of com.niggle.data.SessionManager built on top of our MemoryMutableDataSource

Author:
Jonathan Revusky
See Also:
Serialized Form

Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
SimpleSessionManager()
           
 
Method Summary
 boolean invalidateSession(java.lang.String sessionID)
          Invalidates the current session (the result of a logout).
 boolean isValidSession(java.lang.String sessionID, java.lang.String username)
          Checks the validity of a session.
 Session newSession(java.lang.String username)
          Creates and returns a new session.
protected  java.lang.Object nextKey()
          Returns the next available primary key, assuming that it is an integer.
 void touchSession(java.lang.String sessionID)
           
 
Methods inherited from class com.niggle.data.inmemory.InMemoryRecordSet
close, delete, forceUpdate, get, init, insert, keys, loadRecords, loadRecordsFromFlatFile, select, update
 
Methods inherited from class com.niggle.data.AbstractMutableDataSource
addDataListener, delete, fireDataEvent, freeze, getRecords, markStale, normalizeKey, removeDataListener, select, wipeCache
 
Methods inherited from class com.niggle.data.AbstractDataSource
get, getName, keys
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.niggle.data.DataSource
close, get, get, getName, getRecords, init, keys, keys
 

Constructor Detail

SimpleSessionManager

public SimpleSessionManager()
                     throws java.io.IOException
Method Detail

isValidSession

public boolean isValidSession(java.lang.String sessionID,
                              java.lang.String username)
Checks the validity of a session.
Specified by:
isValidSession in interface SessionManager
Parameters:
sessionID - the ID of the session.
username - the ID of the user to whom the session belongs.
Returns:
true if the session is valid, false otherwise.

newSession

public Session newSession(java.lang.String username)
                   throws java.io.IOException
Creates and returns a new session.
Specified by:
newSession in interface SessionManager
Parameters:
username - the ID of the user requesting the session.
require: (username != null) && (username.length() > 0)
Returns:
the new session.
ensure: result != null

invalidateSession

public boolean invalidateSession(java.lang.String sessionID)
Invalidates the current session (the result of a logout).
Specified by:
invalidateSession in interface SessionManager
Parameters:
sessionID - the ID of the session.
Returns:
success or failure of the operation.

touchSession

public void touchSession(java.lang.String sessionID)
Specified by:
touchSession in interface SessionManager

nextKey

protected java.lang.Object nextKey()
Description copied from class: InMemoryRecordSet
Returns the next available primary key, assuming that it is an integer.
Overrides:
nextKey in class InMemoryRecordSet