Class HikariConnectionFactory

java.lang.Object
me.lucko.luckperms.common.storage.implementation.sql.connection.hikari.HikariConnectionFactory
All Implemented Interfaces:
ConnectionFactory
Direct Known Subclasses:
DriverBasedHikariConnectionFactory

public abstract class HikariConnectionFactory extends Object implements ConnectionFactory
Abstract ConnectionFactory using a HikariDataSource.
  • Constructor Details

    • HikariConnectionFactory

      public HikariConnectionFactory(StorageCredentials configuration)
  • Method Details

    • defaultPort

      protected abstract String defaultPort()
      Gets the default port used by the database
      Returns:
      the default port
    • configureDatabase

      protected abstract void configureDatabase(com.zaxxer.hikari.HikariConfig config, String address, String port, String databaseName, String username, String password)
      Configures the HikariConfig with the relevant database properties.

      Each driver does this slightly differently...

      Parameters:
      config - the hikari config
      address - the database address
      port - the database port
      databaseName - the database name
      username - the database username
      password - the database password
    • overrideProperties

      protected void overrideProperties(Map<String,Object> properties)
      Allows the connection factory instance to override certain properties before they are set.
      Parameters:
      properties - the current properties
    • setProperties

      protected void setProperties(com.zaxxer.hikari.HikariConfig config, Map<String,Object> properties)
      Sets the given connection properties onto the config.
      Parameters:
      config - the hikari config
      properties - the properties
    • postInitialize

      protected void postInitialize()
      Called after the Hikari pool has been initialised
    • init

      public void init(LuckPermsPlugin plugin)
      Specified by:
      init in interface ConnectionFactory
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface ConnectionFactory
    • getConnection

      public Connection getConnection() throws SQLException
      Specified by:
      getConnection in interface ConnectionFactory
      Throws:
      SQLException
    • getMeta

      public StorageMetadata getMeta()
      Specified by:
      getMeta in interface ConnectionFactory