Package com.atlassian.bamboo.utils.db
Enum DatabaseType
- java.lang.Object
-
- java.lang.Enum<DatabaseType>
-
- com.atlassian.bamboo.utils.db.DatabaseType
-
- All Implemented Interfaces:
Serializable
,Comparable<DatabaseType>
public enum DatabaseType extends Enum<DatabaseType>
Inspired by BitbucketServer's DbType class
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static DatabaseType
fromDialect(@NotNull String hibernateDialect)
@NotNull String
generateUrl(@NotNull String hostName, @NotNull String database)
Produces a JDBC URL incorporating the given host name, database name and default port.abstract @NotNull String
generateUrl(@NotNull String hostName, @NotNull String database, int port)
Produces a JDBC URL incorporating the given host name, database name and port.int
getDefaultPort()
String
getDriverClassName()
String
getI18nKey()
String
getKey()
String
getProtocol()
boolean
isEmbedded()
static DatabaseType
valueOf(String name)
Returns the enum constant of this type with the specified name.static DatabaseType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
HSQL
@Deprecated public static final DatabaseType HSQL
Deprecated.since 6.3 HSQL database is no longer supported (H2 is the new in-memory database)
-
MSSQL
public static final DatabaseType MSSQL
-
MYSQL
public static final DatabaseType MYSQL
-
ORACLE
public static final DatabaseType ORACLE
-
POSTGRESQL
public static final DatabaseType POSTGRESQL
-
H2
public static final DatabaseType H2
-
-
Method Detail
-
values
public static DatabaseType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DatabaseType c : DatabaseType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DatabaseType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
fromDialect
public static DatabaseType fromDialect(@NotNull @NotNull String hibernateDialect)
-
getKey
public String getKey()
-
getI18nKey
public String getI18nKey()
- Since:
- 6.3
-
getProtocol
public String getProtocol()
-
getDriverClassName
public String getDriverClassName()
-
getDefaultPort
public int getDefaultPort()
-
isEmbedded
public boolean isEmbedded()
- Since:
- 6.3
-
generateUrl
@NotNull public @NotNull String generateUrl(@NotNull @NotNull String hostName, @NotNull @NotNull String database)
Produces a JDBC URL incorporating the given host name, database name and default port.- Parameters:
hostName
- the host name of the machine on which the database is runningdatabase
- the name of the database, or alternatively its service identifier- Returns:
- a new string that can be used as a JDBC URL when accessing databases of this type
-
generateUrl
@NotNull public abstract @NotNull String generateUrl(@NotNull @NotNull String hostName, @NotNull @NotNull String database, int port)
Produces a JDBC URL incorporating the given host name, database name and port.- Parameters:
hostName
- the host name of the machine on which the database is runningdatabase
- the name of the database, or alternatively its service identifierport
- the port on which the database can be accessed at thehostName
- Returns:
- a new string that can be used as a JDBC URL when accessing databases of this type
-
-