Class DataSourceConfig

java.lang.Object
org.conical.common.bbl.db.DataSourceConfig

public class DataSourceConfig extends Object
This class wraps the information needed to establish a connection or connection pool to a database. Objects of this class are immutable.
Author:
rdoherty
  • Field Details

  • Constructor Details

    • DataSourceConfig

      public DataSourceConfig(DatabaseType dbType, String url, String user, String password, boolean isPooled)
      Constructs object using connection URL. The URL will be checked against the dbType.
      Parameters:
      dbType - type of database
      url - connection URL
      user - user to connect as
      password - password to verify user
      isPooled - whether this connection should be pooled
    • DataSourceConfig

      public DataSourceConfig(DatabaseType dbType, String server, int port, String dbName, String user, String password, boolean isPooled)
      Constructs object using server name, port, and database name (instead of URL). A URL specific to the database type is constructed using these elements.
      Parameters:
      dbType - type of database
      server - database server
      port - port DB is served out of
      dbName - name of database (or Oracle SID)
      user - user to connect as
      password - password to verify user
      isPooled - whether this connection should be pooled
    • DataSourceConfig

      public DataSourceConfig(String bundleName)
      Constructs object given a set of parameters in a configuration bundle (i.e. properties file). See constants in this class for what values should appear in the properties file. If URL is present, server, port and dbName will be ignored. Pooling setting is not required; default is to create a connection pool.
      Parameters:
      bundleName - name of the bundle containing DB connection properties
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getDbType

      public DatabaseType getDbType()
    • getUrl

      public String getUrl()
    • getServer

      public String getServer()
    • getPort

      public int getPort()
    • getDbName

      public String getDbName()
    • getUser

      public String getUser()
    • getPassword

      public String getPassword()
    • isPooled

      public boolean isPooled()