org.esupportail.cas.server.util
Class RedundantHandler

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
Direct Known Subclasses:
DatabaseHandler, LdapHandler, NisHandler, NtHandler

public abstract class RedundantHandler
extends BasicHandler

This abstract class implements a redundant handler, with a list of servers that will be used for redundancy.

Author:
Pascal Aubry

Field Summary
private  java.util.LinkedList servers
          the list of servers to be used for authentication.
 
Fields inherited from class org.esupportail.cas.server.util.BasicHandler
FAILED_CONTINUE, FAILED_STOP, SUCCEEDED
 
Constructor Summary
protected RedundantHandler(org.dom4j.Element handlerElement, java.lang.Boolean configDebug)
          Constructor.
 
Method Summary
protected  void addServers(boolean serverElementNeeded, java.lang.String serverClassname)
          Constructor.
 int authenticate(java.lang.String username, java.lang.String password)
          Tries to Authenticate a user by accessing all the servers.
 java.util.List getServers()
          retrieve the list of the servers.
 
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

servers

private java.util.LinkedList servers
the list of servers to be used for authentication. Modified by addServer().

Constructor Detail

RedundantHandler

protected RedundantHandler(org.dom4j.Element handlerElement,
                           java.lang.Boolean configDebug)
Constructor.

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

addServers

protected final void addServers(boolean serverElementNeeded,
                                java.lang.String serverClassname)
                         throws java.lang.Exception
Constructor.

Parameters:
serverElementNeeded - true to force the handler to have at least one server sub-element
serverClassname - the classname of the server to create for the handler
Throws:
java.lang.Exception - Exception

authenticate

public final int authenticate(java.lang.String username,
                              java.lang.String password)
Tries to Authenticate a user by accessing all the servers.

Specified by:
authenticate in class BasicHandler
Parameters:
username - the username to authenticate
password - the correspoding password
Returns:
BasicHandlerSUCCEDED on success, or BasicHandler.FAILED_CONTINUE otherwise.

getServers

public final java.util.List getServers()
retrieve the list of the servers.

Returns:
the list of the servers used for authentication.