01: package org.esupportail.cas.server.handlers.database;
02:
03: import org.dom4j.Element;
04:
05: /**
06: * This class implements a search database handler class. It is used by
07: * GenericHandler.
08: *
09: * @author Pascal Aubry <pascal.aubry at univ-rennes1.fr>
10: */
11: public final class SearchDatabaseHandler extends QueryDatabaseHandler {
12:
13: /**
14: * Constructor.
15: *
16: * @param handlerElement the XML element that declares the handler
17: * in the configuration file
18: * @param configDebug debugging mode of the global configuration
19: * @throws Exception Exception
20: */
21: public SearchDatabaseHandler(final Element handlerElement,
22: final Boolean configDebug) throws Exception {
23: super (handlerElement, configDebug);
24: traceBegin();
25: traceEnd();
26: }
27:
28: /**
29: * Read the SQL query from the configuration (deduces it from other parameters).
30: * @return a String.
31: * @throws Exception Exception
32: */
33: protected String readSqlQueryFromConfig() throws Exception {
34: traceBegin();
35:
36: String table = getConfigSubElementContent("table", true/*needed*/);
37: trace("table = " + table);
38:
39: String loginColumn = getConfigSubElementContent("login_column",
40: true/*needed*/);
41: trace("login_column = " + loginColumn);
42:
43: String passwordColumn = getConfigSubElementContent(
44: "password_column", true/*needed*/);
45: trace("password_column = " + passwordColumn);
46:
47: String query = "SELECT " + passwordColumn + " FROM " + table
48: + " WHERE " + loginColumn + " = '"
49: + QueryDatabaseHandler.SQL_LOGIN_TOKEN + "'";
50:
51: traceEnd(query);
52: return query;
53: }
54:
55: }
|