com.atlassian.jira.config.database
Class JdbcDatasource

java.lang.Object
  extended by com.atlassian.jira.config.database.JdbcDatasource
All Implemented Interfaces:
Datasource

public final class JdbcDatasource
extends Object
implements Datasource

A JDBC datasource


Constructor Summary
JdbcDatasource(DatabaseType databaseType, String hostname, String port, String instance, String username, String password, Integer poolSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)
           
JdbcDatasource(String jdbcUrl, String driverClassName, String username, String password, int poolSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)
           
JdbcDatasource(String jdbcUrl, String driverClassName, String username, String password, Properties connectionProperties, int poolSize, String validationQuery, Long minEvictableTimeMillis, Long timeBetweenEvictionRunsMillis)
           
 
Method Summary
 Connection getConnection(com.atlassian.config.bootstrap.AtlassianBootstrapManager bootstrapManager)
          Uses the given link AtlassianBootstrapManager to acquire a Connection to the database defined by this Datasource.
 Properties getConnectionProperties()
           
 org.ofbiz.core.entity.config.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
 Long getMinEvictableTimeMillis()
           
 String getPassword()
          The password for the database connection
 int getPoolSize()
          The size of the database connection pool
 Long getTimeBetweenEvictionRunsMillis()
           
 String getUsername()
          The username for the database connection
 String getValidationQuery()
           
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcDatasource

public JdbcDatasource(String jdbcUrl,
                      String driverClassName,
                      String username,
                      String password,
                      int poolSize,
                      String validationQuery,
                      Long minEvictableTimeMillis,
                      Long timeBetweenEvictionRunsMillis)

JdbcDatasource

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

JdbcDatasource

public JdbcDatasource(DatabaseType databaseType,
                      String hostname,
                      String port,
                      String instance,
                      String username,
                      String password,
                      Integer poolSize,
                      String validationQuery,
                      Long minEvictableTimeMillis,
                      Long timeBetweenEvictionRunsMillis)
Method Detail

setRegisterDriverOnConstruct

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.

getConnection

public Connection getConnection(com.atlassian.config.bootstrap.AtlassianBootstrapManager bootstrapManager)
                         throws com.atlassian.config.bootstrap.BootstrapException
Description copied from interface: Datasource
Uses the given link AtlassianBootstrapManager to acquire a Connection to the database defined by this Datasource.

Specified by:
getConnection in interface Datasource
Parameters:
bootstrapManager - the bootstrapManager to use to get the connection.
Returns:
the connection.
Throws:
com.atlassian.config.bootstrap.BootstrapException - if the connection cannot be established.

getDatasource

public org.ofbiz.core.entity.config.DatasourceInfo getDatasource(String datasourceName,
                                                                 String databaseType,
                                                                 String schemaName)
Description copied from interface: Datasource
Get the equivalent Ofbiz DatasourceInfo config class for this Datasource. This effectively translates between this datasource and the ofbiz entityengine.xml of yore.

Specified by:
getDatasource in interface Datasource
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.

getDescriptorValue

public String getDescriptorValue(String databaseType)
Description copied from interface: Datasource
Provides a text description suitable for an administrator that identifies the datasource.

Specified by:
getDescriptorValue in interface Datasource
Parameters:
databaseType - the field-type for the datasource as defined in ofbiz field-types.xml
Returns:
the description.

getDescriptorLabel

public String getDescriptorLabel()
Description copied from interface: Datasource
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.

Specified by:
getDescriptorLabel in interface Datasource
Returns:
the label.

getJdbcUrl

public String getJdbcUrl()
The JDBC URL

Returns:
The JDBC URL

getDriverClassName

public String getDriverClassName()
The class name for the driver

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

getUsername

public String getUsername()
The username for the database connection

Returns:
The username

getPassword

public String getPassword()
The password for the database connection

Returns:
The password

getConnectionProperties

public Properties getConnectionProperties()

getPoolSize

public int getPoolSize()
The size of the database connection pool

Returns:
The database connection pool size

getValidationQuery

public String getValidationQuery()

getMinEvictableTimeMillis

public Long getMinEvictableTimeMillis()

getTimeBetweenEvictionRunsMillis

public Long getTimeBetweenEvictionRunsMillis()


Copyright © 2002-2012 Atlassian. All Rights Reserved.