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

java.lang.Object
  extended by org.esupportail.cas.server.util.log.Debug
      extended by org.esupportail.cas.server.util.Server
          extended by org.esupportail.cas.server.handlers.database.DatabaseServer
Direct Known Subclasses:
BindDatabaseServer, QueryDatabaseServer

abstract class DatabaseServer
extends Server

This abstract class implements a database server class, inherited by BindDatabaseServer and SearchDatabaseServer.

Author:
Pascal Aubry

Field Summary
private  java.lang.String jdbcDriver
          The name of the class used to access the database through JDBC.
private  java.lang.String jdbcUrl
          The JDBC URL of the database.
 
Fields inherited from class org.esupportail.cas.server.util.Server
AUTHENTICATE_FAILURE, AUTHENTICATE_NOAUTH, AUTHENTICATE_SUCCESS, CONNECT_FAILURE, CONNECT_NOAUTH, CONNECT_SUCCESS
 
Constructor Summary
protected DatabaseServer(java.lang.Boolean handlerDebug, RedundantHandler handler, org.dom4j.Element serverElement)
          Constructor.
 
Method Summary
protected  java.sql.Connection connect(java.lang.String bindUsername, java.lang.String bindPassword)
          Connect to a database using specified username and password.
 
Methods inherited from class org.esupportail.cas.server.util.Server
authenticate, getConnectError, getHandler, getServerSubElementContent, setConnectError
 
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

jdbcDriver

private java.lang.String jdbcDriver
The name of the class used to access the database through JDBC.


jdbcUrl

private java.lang.String jdbcUrl
The JDBC URL of the database.

Constructor Detail

DatabaseServer

protected DatabaseServer(java.lang.Boolean handlerDebug,
                         RedundantHandler handler,
                         org.dom4j.Element serverElement)
                  throws java.lang.Exception
Constructor.

Parameters:
handlerDebug - debugging mode of the handler
handler - the handler the server will be used by
serverElement - the XML element that declares the server
Throws:
java.lang.Exception - Exception
Method Detail

connect

protected final java.sql.Connection connect(java.lang.String bindUsername,
                                            java.lang.String bindPassword)
Connect to a database using specified username and password.

Parameters:
bindUsername - the username to use for the connection
bindPassword - the associated password
Returns:
a Connection object on success, null on error (in this case, the error code can be retrieved with the connectError() method).