com.atlassian.jira.config.database
Class DatabaseConfig

java.lang.Object
  extended by com.atlassian.jira.config.database.DatabaseConfig

public final class DatabaseConfig
extends Object

The configuration for JIRA to connect to the database.

Since:
4.3

Field Summary
static String DEFAULT_DATASOURCE_NAME
          The name of the default JNDI datasource.
static String DEFAULT_DELEGATOR_NAME
          The name of the default delegator.
 
Constructor Summary
DatabaseConfig(String databaseType, String schemaName, Datasource datasource)
          Uses defaults for OfBiz Datasource name and Delegator name.
DatabaseConfig(String datasourceName, String delegatorName, String databaseType, String schemaName, Datasource datasource)
           
 
Method Summary
 String getDatabaseType()
          Get the database type
 Datasource getDatasource()
          Get the datasource
 org.ofbiz.core.entity.config.DatasourceInfo getDatasourceInfo()
           
 String getDatasourceName()
          Get the name of the data source.
 String getDelegatorName()
          Get the name of the delegate.
 String getDescriptorLabel()
           
 String getDescriptorValue()
           
 String getSchemaName()
          Get the schema name
 boolean isDatabaseEmpty(com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager bootstrapManager)
           
 boolean isHSql()
          Returns true if this configuration is for an HSql database
 boolean isMySql()
          Returns true if this configuration is for a MySQL database
 boolean isOracle()
          Returns true if this configuration is for an Oracle database
 boolean isPostgres()
          Returns true if this configuration is for a Postgres database
 boolean isSqlServer()
          Returns true if this configuration is for a SqlServer database
 StartupCheck testConnection(com.atlassian.config.bootstrap.AtlassianBootstrapManager bootstrapManager)
          Tests the connection using the given bootstrapManager.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DATASOURCE_NAME

public static final String DEFAULT_DATASOURCE_NAME
The name of the default JNDI datasource. This is the one true place for this constant to live in JIRA. This should not be used by plugins or considered an API.

See Also:
Constant Field Values

DEFAULT_DELEGATOR_NAME

public static final String DEFAULT_DELEGATOR_NAME
The name of the default delegator. There Is Only One. This is the one true place for this constant to live in JIRA. This should not be used by plugins or considered an API.

See Also:
Constant Field Values
Constructor Detail

DatabaseConfig

public DatabaseConfig(String databaseType,
                      String schemaName,
                      Datasource datasource)
Uses defaults for OfBiz Datasource name and Delegator name.

Parameters:
databaseType - the name that matches the field types defined in entityengine.xml
schemaName - if the database needs it, the name of the schema. e.g. "public" is common in postgres.
datasource - the definition of the jdbc or jndi details.

DatabaseConfig

public DatabaseConfig(String datasourceName,
                      String delegatorName,
                      String databaseType,
                      String schemaName,
                      Datasource datasource)
Method Detail

testConnection

public StartupCheck testConnection(com.atlassian.config.bootstrap.AtlassianBootstrapManager bootstrapManager)
                            throws com.atlassian.config.bootstrap.BootstrapException
Tests the connection using the given bootstrapManager.

Parameters:
bootstrapManager - to use for testing the connection.
Returns:
any StartupCheck that has failed this test or null if all OK.
Throws:
com.atlassian.config.bootstrap.BootstrapException - on connection failure.

isDatabaseEmpty

public boolean isDatabaseEmpty(com.atlassian.config.bootstrap.DefaultAtlassianBootstrapManager bootstrapManager)
                        throws com.atlassian.config.bootstrap.BootstrapException
Throws:
com.atlassian.config.bootstrap.BootstrapException

getDatasourceName

public String getDatasourceName()
Get the name of the data source. This is also known as the helperName in ofbiz.

Returns:
The name of the data source

getDelegatorName

public String getDelegatorName()
Get the name of the delegate.

Returns:
The name of the delegate.

getDatabaseType

public String getDatabaseType()
Get the database type

Returns:
The database type

isHSql

public boolean isHSql()
Returns true if this configuration is for an HSql database

Returns:
true if this configuration is for an HSql database

isMySql

public boolean isMySql()
Returns true if this configuration is for a MySQL database

Returns:
true if this configuration is for a MySQL database

isOracle

public boolean isOracle()
Returns true if this configuration is for an Oracle database

Returns:
true if this configuration is for an Oracle database

isPostgres

public boolean isPostgres()
Returns true if this configuration is for a Postgres database

Returns:
true if this configuration is for a Postgres database

isSqlServer

public boolean isSqlServer()
Returns true if this configuration is for a SqlServer database

Returns:
true if this configuration is for a SqlServer database

getSchemaName

public String getSchemaName()
Get the schema name

Returns:
The schema name

getDatasource

public Datasource getDatasource()
Get the datasource

Returns:
The datasource

getDatasourceInfo

public org.ofbiz.core.entity.config.DatasourceInfo getDatasourceInfo()

getDescriptorValue

public String getDescriptorValue()

getDescriptorLabel

public String getDescriptorLabel()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2012 Atlassian. All Rights Reserved.