public class DatabaseUtilities extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DATABASE_TYPE_ORACLE
String that identifes the database type to be Oracle.
|
static String |
DATABASE_TYPE_POSTGRES
String that identifes the database type to be Postgres.
|
static String |
DATASOURCE_CLASS_ORACLE
Oracle Datasource class.
|
static String |
DATASOURCE_CLASS_POSTGRES
Postgres Datasource class.
|
static String |
DRIVER_CLASS_ORACLE
Default Oracle JDBC driver class.
|
static String |
DRIVER_CLASS_POSTGRES
Default Postgres JDBC driver class.
|
static String |
JDBCDRIVERTYPE_OCI8
The JDBC OCI8 driver for Oracle.
|
static String |
JDBCDRIVERTYPE_THIN
The JDBC Thin driver for Oracle.
|
Modifier and Type | Method and Description |
---|---|
static DataSource |
constructDataSource(String databaseType,
String databaseUrl,
String schemaName,
String schemaPassword)
Constructs the data source.
|
static String |
deriveDatabaseType(String domainName)
Derives the effective Database type from the specified domain name.
|
static String |
getDatabaseUrl(String databaseType,
String domainName,
String jdbcDriverType)
Resolves a database type and domain name to a database URL.
|
static String |
getDatabaseUrlPrefix(String databaseType,
String jdbcDriverType)
Resolves a domain name to the prefix to use for a database URL.
|
static String |
getDatabaseUrlSuffix(String databaseType,
String domainName)
Resolves a domain name to the suffix to use for a database URL.
|
static String |
getEffectiveDatabaseType(String databaseType,
String domainName)
Returns the effective Database type.
|
static String |
getSchemaName(String domainName)
Resolves a domain name to a schema name.
|
static boolean |
isPostgres(String databaseType)
Returns true if the specified Database type indicates Postgres.
|
public static final String DATABASE_TYPE_ORACLE
public static final String DATABASE_TYPE_POSTGRES
public static final String DRIVER_CLASS_ORACLE
public static final String DRIVER_CLASS_POSTGRES
public static final String DATASOURCE_CLASS_ORACLE
public static final String DATASOURCE_CLASS_POSTGRES
public static final String JDBCDRIVERTYPE_THIN
public static final String JDBCDRIVERTYPE_OCI8
public static DataSource constructDataSource(String databaseType, String databaseUrl, String schemaName, String schemaPassword) throws IfsException
databaseType
- database type ("oracle" or "postgres");
if null, default to oracledatabaseUrl
- database urlschemaName
- name of the schemaschemaPassword
- schema passwordIfsException
- if the operation failspublic static String getDatabaseUrl(String databaseType, String domainName, String jdbcDriverType) throws IfsException
A database URL is synthesized from the specified domain name, database type ("oracle" or "postgres"), and JDBC driver type.
databaseType
- the database type ("oracle" or "postgres");
if null assume postgresdomainName
- the domain namejdbcDriverType
- the JDBC driver type for Oracle;
either "thin" or "oci8"IfsException
- (IFS-20130) if the operation failspublic static String getDatabaseUrlPrefix(String databaseType, String jdbcDriverType)
databaseType
- the database type ("oracle" or "postgres");
if null assume postgresjdbcDriverType
- the JDBC driver type for Oracle;
either "thin" or "oci8"public static String getDatabaseUrlSuffix(String databaseType, String domainName) throws IfsException
databaseType
- the database type ("oracle" or "postgres");
if null assume postgresdomainName
- the domain nameIfsException
- if the operation failspublic static String getEffectiveDatabaseType(String databaseType, String domainName)
If specified value is null, return a type indicating Oracle. Otherwise, the database type must indicate a legal value; if not, a RuntimeException is thrown.
databaseType
- the database typedomainName
- the domain name; used to create default value
for database type if it is not specifiedpublic static String deriveDatabaseType(String domainName)
domainName
- the domain name; used to create default value
for database type if it is not specifiedpublic static String getSchemaName(String domainName) throws IfsException
domainName
- the domain nameIfsException
- (IFS-20131) if the operation failspublic static boolean isPostgres(String databaseType)
Copyright © 2023. All rights reserved.