Interface IDatabaseLoginPrincipal
-
- All Known Implementing Classes:
DatabaseLoginPrincipal
public interface IDatabaseLoginPrincipalEvery implementer of this interface must create a connection pool and query the required data from the database.
-
-
Method Summary
Modifier and Type Method Description java.sql.ConnectiongetConnection()Call the Tomcat's DataSource getConnection() method to retrieve a currently idle connection from the pool.java.lang.StringgetDBUser()java.lang.StringgetDBVersion()java.lang.StringgetDriver()java.lang.StringgetDriverVersion()java.util.Optional<java.lang.String>getLoginWarnings()java.lang.String[]getRoles()java.lang.StringgetSchema()voidlogout()
-
-
-
Method Detail
-
getConnection
java.sql.Connection getConnection() throws java.sql.SQLExceptionCall the Tomcat's DataSource getConnection() method to retrieve a currently idle connection from the pool.- Returns:
- a JDBC connection from the pool for temporary use
- Throws:
java.sql.SQLException- in case the connection cannot be established
-
getDriver
java.lang.String getDriver()
- Returns:
- the FQN class name used
-
getDBVersion
java.lang.String getDBVersion()
- Returns:
- the version string of the connected database as retrieved at login
-
getDriverVersion
java.lang.String getDriverVersion()
- Returns:
- the JDBC driver version being used
-
getDBUser
java.lang.String getDBUser()
- Returns:
- the exact user, e.g. the login might have been user1 but the actual database user name is "USER1"
-
getSchema
java.lang.String getSchema()
- Returns:
- the user's default schema
-
getRoles
java.lang.String[] getRoles()
- Returns:
- a list of all database roles the user is associated with
-
getLoginWarnings
java.util.Optional<java.lang.String> getLoginWarnings()
- Returns:
- a text to be rendered as information for the end user like password is about to expire, must change password
-
logout
void logout() throws java.lang.Exception- Throws:
java.lang.Exception
-
-