org.esupportail.cas.server.handlers.database
Class QueryDatabaseHandler

java.lang.Object
  extended by org.esupportail.cas.server.util.log.Debug
      extended by org.esupportail.cas.server.util.BasicHandler
          extended by org.esupportail.cas.server.util.RedundantHandler
              extended by org.esupportail.cas.server.handlers.database.DatabaseHandler
                  extended by org.esupportail.cas.server.handlers.database.QueryDatabaseHandler
Direct Known Subclasses:
SearchDatabaseHandler

public class QueryDatabaseHandler
extends DatabaseHandler

This class implements a query database handler class.

Author:
Pascal Aubry , Arunas Stockus

Field Summary
private  java.lang.String bindPassword
          the password to use to bind to the database.
private  java.lang.String bindUsername
          the username to use to bind to the database.
private  java.lang.String encryption
          the encryption used for stored passwords.
(package private) static java.lang.String SQL_LOGIN_TOKEN
          This token is replaced by the users' login when executing queries on the database.
private  java.lang.String sqlQuery
          the string used to query the database.
 
Fields inherited from class org.esupportail.cas.server.util.BasicHandler
FAILED_CONTINUE, FAILED_STOP, SUCCEEDED
 
Constructor Summary
QueryDatabaseHandler(org.dom4j.Element handlerElement, java.lang.Boolean configDebug)
          Constructor.
 
Method Summary
(package private)  java.lang.String getBindPassword()
          Retrieve the password to use to bind to the database.
(package private)  java.lang.String getBindUsername()
          Retrieve the username to use to bind to the database.
(package private)  java.lang.String getEncryption()
          Retrieve the encryption used to store passwords.
(package private)  java.lang.String getUserSqlQuery(java.lang.String username)
          Returns the SQL expression that must be executed to retrieve the password of the user with the given name.
protected  java.lang.String readSqlQueryFromConfig()
          Read the SQL query from the configuration.
 
Methods inherited from class org.esupportail.cas.server.util.RedundantHandler
addServers, authenticate, getServers
 
Methods inherited from class org.esupportail.cas.server.util.BasicHandler
checkConfigElement, getConfigElement, getConfigSubElementContent, hasConfigSubElement
 
Methods inherited from class org.esupportail.cas.server.util.log.Debug
checkClass, elementDebugValue, isDebug, setDebug, trace, trace, traceBegin, traceEnd, traceEnd, traceEnd, traceThrow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bindPassword

private java.lang.String bindPassword
the password to use to bind to the database.


bindUsername

private java.lang.String bindUsername
the username to use to bind to the database.


encryption

private java.lang.String encryption
the encryption used for stored passwords.


SQL_LOGIN_TOKEN

static final java.lang.String SQL_LOGIN_TOKEN
This token is replaced by the users' login when executing queries on the database.

See Also:
Constant Field Values

sqlQuery

private java.lang.String sqlQuery
the string used to query the database. This query is supposed to return a single VARCHAR column.

Constructor Detail

QueryDatabaseHandler

public QueryDatabaseHandler(org.dom4j.Element handlerElement,
                            java.lang.Boolean configDebug)
                     throws java.lang.Exception
Constructor.

Parameters:
handlerElement - the XML element that declares the handler in the configuration file
configDebug - debugging mode of the global configuration
Throws:
java.lang.Exception - Exception
Method Detail

getBindPassword

final java.lang.String getBindPassword()
Retrieve the password to use to bind to the database.

Returns:
a String Object.

getBindUsername

final java.lang.String getBindUsername()
Retrieve the username to use to bind to the database.

Returns:
a String Object.

getEncryption

final java.lang.String getEncryption()
Retrieve the encryption used to store passwords.

Returns:
a String Object.

getUserSqlQuery

final java.lang.String getUserSqlQuery(java.lang.String username)
Returns the SQL expression that must be executed to retrieve the password of the user with the given name.

Parameters:
username - the user's id
Returns:
a String.

readSqlQueryFromConfig

protected java.lang.String readSqlQueryFromConfig()
                                           throws java.lang.Exception
Read the SQL query from the configuration.

Returns:
a String.
Throws:
java.lang.Exception - Exception