org.hardtokenmgmt.uds.sql
Class SQLUserDataSource

java.lang.Object
  extended by org.hardtokenmgmt.uds.sql.BaseCustomUserDataSource
      extended by org.hardtokenmgmt.uds.sql.SQLUserDataSource
All Implemented Interfaces:
org.ejbca.core.model.ra.userdatasource.ICustomUserDataSource

public class SQLUserDataSource
extends BaseCustomUserDataSource

A General SQL User Data Source for use with htmf.

Version:
$Id$
Author:
Philip Vendil 16 dec 2008

Field Summary
static java.lang.String DBDRIVER
          Class path to JDBC driver to use.
static java.lang.String DBPASSWORD
          Password used to connect to database.
static java.lang.String DBURL
          DB connection URL
static java.lang.String DBUSERNAME
          Username used to connect to database.
static java.lang.String DEFAULT_SUPPORTREMOVE
           
static java.lang.String FETCHQUERY
          Complete SQL query used to fetch user data from database.
static java.lang.String NAMECOLUMNS
          Setting defining how the full name should be fetched.
static java.lang.String NAMECOLUMNS_FIRSTANDSURNAME
           
static java.lang.String NAMECOLUMNS_FIRSTMIDDLEANDSURNAME
           
static java.lang.String NAMECOLUMNS_FULLNAME
           
static java.lang.String REMOVEQUERY
          Complete SQL used in "remove" queries, the call is called after a fetch query to make sure not more than one entry matches the search string.
static java.lang.String REMOVESIZEQUERY
          Complete SQL used to get the size in "remove" queries, the call is done if by remove user call have multiple match is false.
static java.lang.String SUPPORTREMOVE
          Boolean string indicating if remove user data should be supported.
static java.lang.String TESTQUERY
          complete test query string used for making sure the database is up and running example value is "select 1" but the actual query depends on database type.
 
Fields inherited from class org.hardtokenmgmt.uds.sql.BaseCustomUserDataSource
ADDOMAIN, ADDSNTODN, ADDUIDTODN, BASEDN, DEFAULTCAID, DEFAULTCANAME, DEFAULTCERTIFICATEPROFILEID, DEFAULTCERTIFICATEPROFILENAME, DEFAULTENDENTITYPROFILEID, DEFAULTENDENTITYPROFILENAME, props
 
Constructor Summary
SQLUserDataSource()
           
 
Method Summary
 java.util.Collection<?> fetch(org.ejbca.core.model.log.Admin admin, java.lang.String searchString)
           
 boolean removeUserData(org.ejbca.core.model.log.Admin admin, java.lang.String searchString, boolean removeMultipleMatch)
           
 void testConnection(org.ejbca.core.model.log.Admin admin)
           
 
Methods inherited from class org.hardtokenmgmt.uds.sql.BaseCustomUserDataSource
getBooleanSetting, getCaId, getCertProfileId, getEndEntityProfileId, getIntSetting, getLocator, getSetting, getUserDataSourceVO, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBDRIVER

public static final java.lang.String DBDRIVER
Class path to JDBC driver to use.

See Also:
Constant Field Values

DBURL

public static final java.lang.String DBURL
DB connection URL

See Also:
Constant Field Values

DBUSERNAME

public static final java.lang.String DBUSERNAME
Username used to connect to database.

See Also:
Constant Field Values

DBPASSWORD

public static final java.lang.String DBPASSWORD
Password used to connect to database.

See Also:
Constant Field Values

TESTQUERY

public static final java.lang.String TESTQUERY
complete test query string used for making sure the database is up and running example value is "select 1" but the actual query depends on database type.

See Also:
Constant Field Values

FETCHQUERY

public static final java.lang.String FETCHQUERY
Complete SQL query used to fetch user data from database. it should return only few columns in the following order in one of following order, depending on column type.

NAMECOLUMNS

public static final java.lang.String NAMECOLUMNS
Setting defining how the full name should be fetched. can be one of fullname, firstandsurname and firstmiddleandsurname values and indicates how column 3 and up should be fetched from database.

See Also:
Constant Field Values

NAMECOLUMNS_FULLNAME

public static final java.lang.String NAMECOLUMNS_FULLNAME
See Also:
Constant Field Values

NAMECOLUMNS_FIRSTANDSURNAME

public static final java.lang.String NAMECOLUMNS_FIRSTANDSURNAME
See Also:
Constant Field Values

NAMECOLUMNS_FIRSTMIDDLEANDSURNAME

public static final java.lang.String NAMECOLUMNS_FIRSTMIDDLEANDSURNAME
See Also:
Constant Field Values

SUPPORTREMOVE

public static final java.lang.String SUPPORTREMOVE
Boolean string indicating if remove user data should be supported. Default is "FALSE"

See Also:
Constant Field Values

DEFAULT_SUPPORTREMOVE

public static final java.lang.String DEFAULT_SUPPORTREMOVE
See Also:
Constant Field Values

REMOVESIZEQUERY

public static final java.lang.String REMOVESIZEQUERY
Complete SQL used to get the size in "remove" queries, the call is done if by remove user call have multiple match is false. The query should be a count(*) query returning an integer value.

See Also:
Constant Field Values

REMOVEQUERY

public static final java.lang.String REMOVEQUERY
Complete SQL used in "remove" queries, the call is called after a fetch query to make sure not more than one entry matches the search string.

See Also:
Constant Field Values
Constructor Detail

SQLUserDataSource

public SQLUserDataSource()
Method Detail

fetch

public java.util.Collection<?> fetch(org.ejbca.core.model.log.Admin admin,
                                     java.lang.String searchString)
                              throws org.ejbca.core.model.ra.userdatasource.UserDataSourceException
Throws:
org.ejbca.core.model.ra.userdatasource.UserDataSourceException

removeUserData

public boolean removeUserData(org.ejbca.core.model.log.Admin admin,
                              java.lang.String searchString,
                              boolean removeMultipleMatch)
                       throws org.ejbca.core.model.ra.userdatasource.MultipleMatchException,
                              org.ejbca.core.model.ra.userdatasource.UserDataSourceException
Throws:
org.ejbca.core.model.ra.userdatasource.MultipleMatchException
org.ejbca.core.model.ra.userdatasource.UserDataSourceException

testConnection

public void testConnection(org.ejbca.core.model.log.Admin admin)
                    throws org.ejbca.core.model.ra.userdatasource.UserDataSourceConnectionException
Throws:
org.ejbca.core.model.ra.userdatasource.UserDataSourceConnectionException