public static class

JdbcDatasource.Builder

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

Class Overview

This is a builder class for constructing a JdbcDatasource manually. Use the builder() factory to obtain an instance of this class and call the various setXyzzy methods to populate the fields. Those that are left unset or are explicitly set to null will use their default values.

Summary

Public Constructors
Builder()
Public Methods
JdbcDatasource build()
Returns a new JdbcDatasource as specified by the current state of this builder.
boolean equals(Object o)
ConnectionPoolInfo getConnectionPoolInfo()
Properties getConnectionProperties()
DatabaseType getDatabaseType()
String getDriverClassName()
String getHostname()
String getInstance()
String getJdbcUrl()
String getPassword()
String getPort()
String getUsername()
int hashCode()
JdbcDatasource.Builder setConnectionPoolInfo(ConnectionPoolInfo connectionPoolInfo)
JdbcDatasource.Builder setConnectionProperties(Properties connectionProperties)
JdbcDatasource.Builder setDatabaseType(DatabaseType databaseType)
Sets the database type.
JdbcDatasource.Builder setDriverClassName(String driverClassName)
The driver class name is required when the JDBC URL is explicitly set.
JdbcDatasource.Builder setHostname(String hostname)
Sets the hostname for the JDBC URL.
JdbcDatasource.Builder setInstance(String instance)
Sets the instance for the JDBC URL.
JdbcDatasource.Builder setJdbcUrl(String jdbcUrl)
Sets an explicit value for the JDBC URL.
JdbcDatasource.Builder setPassword(String password)
JdbcDatasource.Builder setPort(String port)
Sets the port for the JDBC URL.
JdbcDatasource.Builder setUsername(String username)
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Builder ()

Public Methods

public JdbcDatasource build ()

Returns a new JdbcDatasource as specified by the current state of this builder.

Returns
  • the new JdbcDatasource
Throws
IllegalArgumentException if the configuration is invalid, such as if the username is left unspecified or if neither the JDBC URL nor a database type is given.
InvalidDatabaseDriverException if the database driver is invalid

public boolean equals (Object o)

public ConnectionPoolInfo getConnectionPoolInfo ()

public Properties getConnectionProperties ()

public DatabaseType getDatabaseType ()

public String getDriverClassName ()

public String getHostname ()

public String getInstance ()

public String getJdbcUrl ()

public String getPassword ()

public String getPort ()

public String getUsername ()

public int hashCode ()

public JdbcDatasource.Builder setConnectionPoolInfo (ConnectionPoolInfo connectionPoolInfo)

public JdbcDatasource.Builder setConnectionProperties (Properties connectionProperties)

public JdbcDatasource.Builder setDatabaseType (DatabaseType databaseType)

Sets the database type. This value, the hostname, the port, and the instance are ignored if the JDBC URL is explicitly set. One or the other means of setting the URL is required.

Parameters
databaseType the database type for the JDBC URL
Returns
  • this builder

public JdbcDatasource.Builder setDriverClassName (String driverClassName)

The driver class name is required when the JDBC URL is explicitly set. Otherwise, it is ignored.

Parameters
driverClassName the class name of the JDBC driver to use
Returns
  • this builder

public JdbcDatasource.Builder setHostname (String hostname)

Sets the hostname for the JDBC URL.

Parameters
hostname the hostname for the JDBC URL
Returns
  • this builder

public JdbcDatasource.Builder setInstance (String instance)

Sets the instance for the JDBC URL.

Parameters
instance the instance for the JDBC URL
Returns
  • this builder

public JdbcDatasource.Builder setJdbcUrl (String jdbcUrl)

Sets an explicit value for the JDBC URL. If this value is not set, then the database type, hostname, port, and instance must be set, instead. If this is set, then those other values are ignored, and the driver class name will be required.

Parameters
jdbcUrl the complete JDBC URL to use
Returns
  • this builder

public JdbcDatasource.Builder setPassword (String password)

public JdbcDatasource.Builder setPort (String port)

Sets the port for the JDBC URL.

Parameters
port the port for the JDBC URL
Returns
  • this builder

public JdbcDatasource.Builder setUsername (String username)

public String toString ()