public final class

JdbcDatasource

extends Object
implements Datasource
java.lang.Object
   ↳ com.atlassian.jira.config.database.JdbcDatasource

Class Overview

A JDBC datasource. Note: The direct constructors for this class are all deprecated. Use the JdbcDatasource.Builder instead. Several getters are also deprecated because the same data can be obtained indirectly through getConnectionPoolInfo().

Summary

Nested Classes
class JdbcDatasource.Builder This is a builder class for constructing a JdbcDatasource manually. 
Public Constructors
@Deprecated JdbcDatasource(String jdbcUrl, String driverClassName, String username, String password, int poolMaxSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)
@Deprecated JdbcDatasource(String jdbcUrl, String driverClassName, String username, String password, Properties connectionProperties, int poolMaxSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)
@Deprecated JdbcDatasource(DatabaseType databaseType, String hostname, String port, String instance, String username, String password, Integer poolMaxSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)
JdbcDatasource(JdbcDatasourceInfo jdbc)
Public Methods
static JdbcDatasource.Builder builder()
Factory method to create a new JdbcDatasource.Builder for constructing a JdbcDatasource using a chain of named setters rather than a long list of parameters in a specific order.
boolean equals(Object o)
Connection getConnection(AtlassianBootstrapManager bootstrapManager)
Uses the given link AtlassianBootstrapManager to acquire a Connection to the database defined by this Datasource.
ConnectionPoolInfo getConnectionPoolInfo()
Properties getConnectionProperties()
DatasourceInfo getDatasource(String datasourceName, String databaseType, String schemaName)
Get the equivalent Ofbiz DatasourceInfo config class for this Datasource.
String getDescriptorLabel()
Provides the name of the datasource field that this datasource represents.
String getDescriptorValue(String databaseType)
Provides a text description suitable for an administrator that identifies the datasource.
String getDriverClassName()
The class name for the driver
String getJdbcUrl()
The JDBC URL
@Deprecated Long getMinEvictableTimeMillis()
String getPassword()
The password for the database connection
@Deprecated int getPoolSize()
@Deprecated Long getTimeBetweenEvictionRunsMillis()
String getUsername()
The username for the database connection
@Deprecated String getValidationQuery()
int hashCode()
static void registerDriver(String className)
static void setRegisterDriverOnConstruct(boolean registerDriverOnConstruct)
This setting is soley so the config tool can avoid the fatal side-effect of registering the JDBC driver in this class's constructor.
JdbcDatasource.Builder toBuilder()
String toString()
void writeTo(Element element)
Serializes this JDBC to an XML element.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.config.database.Datasource

Public Constructors

@Deprecated public JdbcDatasource (String jdbcUrl, String driverClassName, String username, String password, int poolMaxSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)

@Deprecated public JdbcDatasource (String jdbcUrl, String driverClassName, String username, String password, Properties connectionProperties, int poolMaxSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)

@Deprecated public JdbcDatasource (DatabaseType databaseType, String hostname, String port, String instance, String username, String password, Integer poolMaxSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)

public JdbcDatasource (JdbcDatasourceInfo jdbc)

Public Methods

public static JdbcDatasource.Builder builder ()

Factory method to create a new JdbcDatasource.Builder for constructing a JdbcDatasource using a chain of named setters rather than a long list of parameters in a specific order.

Returns

public boolean equals (Object o)

public Connection getConnection (AtlassianBootstrapManager bootstrapManager)

Uses the given link AtlassianBootstrapManager to acquire a Connection to the database defined by this Datasource.

Parameters
bootstrapManager the bootstrapManager to use to get the connection.
Returns
  • the connection.
Throws
BootstrapException

public ConnectionPoolInfo getConnectionPoolInfo ()

public Properties getConnectionProperties ()

public DatasourceInfo getDatasource (String datasourceName, String databaseType, String schemaName)

Get the equivalent Ofbiz DatasourceInfo config class for this Datasource. This effectively translates between this datasource and the ofbiz entityengine.xml of yore.

Parameters
datasourceName the ofbiz name of the datasource.
databaseType the field-type for the datasource as defined in ofbiz field-types.xml
schemaName the name of the schema for the database (may be empty)
Returns
  • an instance of a DatasourceInfo suitable for configuring Ofbiz.

public String getDescriptorLabel ()

Provides the name of the datasource field that this datasource represents. Effectively, it delegates the name of the datasource field when the configuration is being described to an administrator and will say "JDBC Config" or "JNDI Name" as appropriate.

Returns
  • the label.

public String getDescriptorValue (String databaseType)

Provides a text description suitable for an administrator that identifies the datasource.

Parameters
databaseType the field-type for the datasource as defined in ofbiz field-types.xml
Returns
  • the description.

public String getDriverClassName ()

The class name for the driver

Returns
  • The class name. May or may not be valid.

public String getJdbcUrl ()

The JDBC URL

Returns
  • The JDBC URL

@Deprecated public Long getMinEvictableTimeMillis ()

public String getPassword ()

The password for the database connection

Returns
  • The password

@Deprecated public int getPoolSize ()

@Deprecated public Long getTimeBetweenEvictionRunsMillis ()

public String getUsername ()

The username for the database connection

Returns
  • The username

@Deprecated public String getValidationQuery ()

public int hashCode ()

public static void registerDriver (String className)

public static void setRegisterDriverOnConstruct (boolean registerDriverOnConstruct)

This setting is soley so the config tool can avoid the fatal side-effect of registering the JDBC driver in this class's constructor.

Parameters
registerDriverOnConstruct If true we do "Class.forName(driverClassName);" in the Constructor.

public JdbcDatasource.Builder toBuilder ()

public String toString ()

public void writeTo (Element element)

Serializes this JDBC to an XML element. This creates a child element called jdbc-datasource which contains the settings.

Parameters
element the parent element within which to write the JDBC Datasource.