com.uwyn.rife.authentication.sessionmanagers
Class DatabaseSessions

java.lang.Object
  extended by com.uwyn.rife.database.DbQueryManager
      extended by com.uwyn.rife.authentication.sessionmanagers.DatabaseSessions
All Implemented Interfaces:
SessionManager, Cloneable

public abstract class DatabaseSessions
extends DbQueryManager
implements SessionManager


Constructor Summary
protected DatabaseSessions(Datasource datasource)
           
 
Method Summary
 boolean _continueSession(Update continueSession, String authId)
           
protected  long _countSessions(Select countSessions)
           
protected  void _eraseAllSessions(Delete eraseAllSessions)
           
protected  boolean _eraseSession(Delete eraseSession, String authId)
           
protected  boolean _eraseUserSessions(Delete eraseUserSessions, long userId)
           
protected  long _getSessionUserId(Select getSessionUserId, String authId)
           
protected  boolean _install(CreateTable createAuthentication, String createAuthenticationSessStartIndex)
           
protected  boolean _isSessionValid(Select sessionValidity, Select sessionValidityRestrictHostIp, String authId, String hostIp)
           
protected  boolean _listSessions(Select listSessions, ListSessions processor)
           
protected  void _purgeSessions(Delete purgeSession)
           
protected  boolean _remove(DropTable removeAuthentication, String removeAuthenticationSessStartIndex)
           
protected  String _startSession(Insert startSession, long userId, String hostIp, boolean remembered)
           
protected  boolean _wasRemembered(Select wasRemembered, String authId)
           
abstract  long countSessions()
          Counts the number of active sessions.
 boolean getRestrictHostIp()
          Obtains the restriction policy of the authentication ID with regards to the user's host IP.
 long getSessionDuration()
          Obtains the maximum time that a user can stay inactive before an active session becomes invalid.
abstract  boolean install()
           
abstract  boolean remove()
           
 void setRestrictHostIp(boolean flag)
          Sets the restriction policy of the authentication ID with regards to the user's host IP.
 void setSessionDuration(long milliseconds)
          Sets the maximum time that a user can stay inactive before an active session becomes invalid.
 
Methods inherited from class com.uwyn.rife.database.DbQueryManager
clone, executeFetchAll, executeFetchAll, executeFetchAllBeans, executeFetchAllBeans, executeFetchFirst, executeFetchFirst, executeFetchFirstBean, executeFetchFirstBean, executeGetFirstBoolean, executeGetFirstBoolean, executeGetFirstByte, executeGetFirstByte, executeGetFirstBytes, executeGetFirstBytes, executeGetFirstDate, executeGetFirstDate, executeGetFirstDate, executeGetFirstDate, executeGetFirstDouble, executeGetFirstDouble, executeGetFirstFloat, executeGetFirstFloat, executeGetFirstInt, executeGetFirstInt, executeGetFirstLong, executeGetFirstLong, executeGetFirstShort, executeGetFirstShort, executeGetFirstString, executeGetFirstString, executeGetFirstTime, executeGetFirstTime, executeGetFirstTime, executeGetFirstTime, executeGetFirstTimestamp, executeGetFirstTimestamp, executeGetFirstTimestamp, executeGetFirstTimestamp, executeHasResultRows, executeHasResultRows, executeQuery, executeQuery, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUseFirstAsciiStream, executeUseFirstAsciiStream, executeUseFirstBinaryStream, executeUseFirstBinaryStream, executeUseFirstCharacterStream, executeUseFirstCharacterStream, fetch, fetch, fetchAll, getConnection, getDatasource, inTransaction, reserveConnection
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.uwyn.rife.authentication.SessionManager
continueSession, eraseAllSessions, eraseSession, eraseUserSessions, getSessionUserId, isSessionValid, listSessions, purgeSessions, startSession, wasRemembered
 

Constructor Detail

DatabaseSessions

protected DatabaseSessions(Datasource datasource)
Method Detail

getSessionDuration

public long getSessionDuration()
Description copied from interface: SessionManager
Obtains the maximum time that a user can stay inactive before an active session becomes invalid.

Specified by:
getSessionDuration in interface SessionManager
Returns:
The maximum time of inactivity in milliseconds.

setSessionDuration

public void setSessionDuration(long milliseconds)
Description copied from interface: SessionManager
Sets the maximum time that a user can stay inactive before an active session becomes invalid.

Specified by:
setSessionDuration in interface SessionManager
Parameters:
milliseconds - The maximum time of inactivity in milliseconds.

getRestrictHostIp

public boolean getRestrictHostIp()
Description copied from interface: SessionManager
Obtains the restriction policy of the authentication ID with regards to the user's host IP.

The default is false, or no restriction.

Specified by:
getRestrictHostIp in interface SessionManager
Returns:
true if the authentication is restricted to one host IP; or

false if the authentication ID can be used with any host IP


setRestrictHostIp

public void setRestrictHostIp(boolean flag)
Description copied from interface: SessionManager
Sets the restriction policy of the authentication ID with regards to the user's host IP.

The default is false, or no restriction.

Specified by:
setRestrictHostIp in interface SessionManager
Parameters:
flag - true to activate the host IP restriction; or

false otherwise


install

public abstract boolean install()
                         throws SessionManagerException
Throws:
SessionManagerException

remove

public abstract boolean remove()
                        throws SessionManagerException
Throws:
SessionManagerException

countSessions

public abstract long countSessions()
                            throws SessionManagerException
Description copied from interface: SessionManager
Counts the number of active sessions.

Specified by:
countSessions in interface SessionManager
Returns:
The number of active sessions.
Throws:
SessionManagerException - An undefined number of exceptional cases or error situations can occur when a session is counted. They are all indicated by throwing an instance of SessionManagerException. It's up to the implementations of this interface to give more specific meanings to these exceptions.

_install

protected boolean _install(CreateTable createAuthentication,
                           String createAuthenticationSessStartIndex)

_remove

protected boolean _remove(DropTable removeAuthentication,
                          String removeAuthenticationSessStartIndex)

_purgeSessions

protected void _purgeSessions(Delete purgeSession)
                       throws SessionManagerException
Throws:
SessionManagerException

_startSession

protected String _startSession(Insert startSession,
                               long userId,
                               String hostIp,
                               boolean remembered)
                        throws SessionManagerException
Throws:
SessionManagerException

_isSessionValid

protected boolean _isSessionValid(Select sessionValidity,
                                  Select sessionValidityRestrictHostIp,
                                  String authId,
                                  String hostIp)
                           throws SessionManagerException
Throws:
SessionManagerException

_continueSession

public boolean _continueSession(Update continueSession,
                                String authId)
                         throws SessionManagerException
Throws:
SessionManagerException

_eraseSession

protected boolean _eraseSession(Delete eraseSession,
                                String authId)
                         throws SessionManagerException
Throws:
SessionManagerException

_wasRemembered

protected boolean _wasRemembered(Select wasRemembered,
                                 String authId)
                          throws SessionManagerException
Throws:
SessionManagerException

_eraseUserSessions

protected boolean _eraseUserSessions(Delete eraseUserSessions,
                                     long userId)
                              throws SessionManagerException
Throws:
SessionManagerException

_eraseAllSessions

protected void _eraseAllSessions(Delete eraseAllSessions)
                          throws SessionManagerException
Throws:
SessionManagerException

_countSessions

protected long _countSessions(Select countSessions)
                       throws SessionManagerException
Throws:
SessionManagerException

_getSessionUserId

protected long _getSessionUserId(Select getSessionUserId,
                                 String authId)
                          throws SessionManagerException
Throws:
SessionManagerException

_listSessions

protected boolean _listSessions(Select listSessions,
                                ListSessions processor)
                         throws SessionManagerException
Throws:
SessionManagerException


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.