Interface IDatabaseLoginPrincipal

  • All Known Implementing Classes:
    DatabaseLoginPrincipal

    public interface IDatabaseLoginPrincipal
    Every 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.Connection getConnection()
      Call the Tomcat's DataSource getConnection() method to retrieve a currently idle connection from the pool.
      java.lang.String getDBUser()  
      java.lang.String getDBVersion()  
      java.lang.String getDriver()  
      java.lang.String getDriverVersion()  
      java.util.Optional<java.lang.String> getLoginWarnings()  
      java.lang.String[] getRoles()  
      java.lang.String getSchema()  
      void logout()  
    • Method Detail

      • getConnection

        java.sql.Connection getConnection()
                                   throws java.sql.SQLException
        Call 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