Class Setup

All Implemented Interfaces:
Map<String,String>

public class Setup extends Preferences
Application setup: the singleton Preferences loaded from the bundle and the database, holding the connection pool.
  • Constructor Details

    • Setup

      public Setup(boolean initConfigAndPool)
      Constructor loading the configuration bundle and, optionally, the database config and pool.
      Parameters:
      initConfigAndPool - whether to init the connection pool and load the DB config
  • Method Details

    • getBundleName

      public static String getBundleName()
      Configuration bundle name, from the setup.data system property.
      Returns:
      bundle name
    • getSetup

      public static Setup getSetup()
      Use this singleton call wisely, because introducing that everywhere makes code hardly testable.
      Returns:
      the setup singleton
    • resetSetup

      public static void resetSetup(ConnectionPool pool)
      Resets the singleton, used in tests.
      Parameters:
      pool - connection pool for the next load
    • getConnectionPool

      public ConnectionPool getConnectionPool()
      Connection pool.
      Returns:
      connection pool
    • getDBConnectionFromPool

      public Connection getDBConnectionFromPool()
      Takes a master DB connection from the pool.
      Returns:
      DB connection
    • getDBSlaveConnectionFromPool

      public Connection getDBSlaveConnectionFromPool()
      Takes a slave DB connection from the pool.
      Returns:
      slave DB connection
    • getDataSource

      @Deprecated public DataSource getDataSource()
      Deprecated.
      Returns:
      data source
    • getSlaveDataSource

      @Deprecated public DataSource getSlaveDataSource()
      Deprecated.
      Returns:
      slave data source