ikrs.util.session
Interface SessionManager<K,V,U>

All Known Implementing Classes:
AbstractSessionManager, DefaultSessionManager, SynchronizedSessionManagerDelegation

public interface SessionManager<K,V,U>

This is a basic session handler interface. The actual handling policy is up to the individual implementation.


Method Summary
 Session<K,V,U> bind(U userID)
          This method tries to create a new session for the given user (ID).
 boolean destroy(java.util.UUID sessionID)
          This method destroys the session with the specified SID.
 Session<K,V,U> get(java.util.UUID sessionID)
          Retrieve the session with the given SID.
 SessionFactory<K,V,U> getSessionFactory()
          This method can be used to retrieve the manager's internal session factory.
 int getSessionTimeout()
          This method returns the session timeout (seconds) currently set for this manager.
 void setSessionTimeout(int seconds)
          This method sets the manager's session timeout to the new value (must be larger than 0).
 

Method Detail

getSessionFactory

SessionFactory<K,V,U> getSessionFactory()
This method can be used to retrieve the manager's internal session factory.

Returns:
The manager's internal session factory.

getSessionTimeout

int getSessionTimeout()
This method returns the session timeout (seconds) currently set for this manager.

Returns:
The session timeout (seconds) currently set for this manager.

setSessionTimeout

void setSessionTimeout(int seconds)
                       throws java.lang.IllegalArgumentException
This method sets the manager's session timeout to the new value (must be larger than 0).

Parameters:
The - number of seconds the manager's session will die after not being accessed.
Throws:
java.lang.IllegalArgumentException - If the passed timeout is less or equals zero.

get

Session<K,V,U> get(java.util.UUID sessionID)
Retrieve the session with the given SID. If the session cannot be found (does not exist or timed out) the method returns null.

Parameters:
sessionID - The desired session's unique ID.
Returns:
The session with the given ID or null if no such session can be found.

destroy

boolean destroy(java.util.UUID sessionID)
This method destroys the session with the specified SID. That means that all session data will be removed and the session itself becomes invalid. It will not be accessible or retrievable any more using on of this interface's methods.

Parameters:
sessionID - The unique ID of the session you want to destroy.
Returns:
True if the session was found (and so destroyed) or false otherwise.

bind

Session<K,V,U> bind(U userID)
This method tries to create a new session for the given user (ID). If there is already a session for the given user no new session will be created but the existing one returned.

Parameters:
userID - The user (ID) to create the new session for.