/activeobjects-spi/src/main/java/com/atlassian/activeobjects/spi/DataSourceProvider.java
Java | 38 lines | 9 code | 5 blank | 24 comment | 0 complexity | 9e8bead342d888332d37a29930342e11 MD5 | raw file
Possible License(s): Apache-2.0
1package com.atlassian.activeobjects.spi;
2
3import javax.annotation.Nullable;
4import javax.sql.DataSource;
5
6/**
7 * Gives access to the host application data source.
8 *
9 * Products that are tenanted should instead implement {@link TenantAwareDataSourceProvider}.
10 */
11public interface DataSourceProvider {
12
13 /**
14 * Returns the host application's SQL data source.
15 *
16 * @return see above
17 */
18 DataSource getDataSource();
19
20 /**
21 * <p>Returns the database type.</p>
22 * <p>Note: if {@link com.atlassian.activeobjects.spi.DatabaseType#UNKNOWN} is returned, it is up to the
23 * calling code to 'guess' the type of the database. It is strongly advised to implement this method so
24 * that it never returns {@link com.atlassian.activeobjects.spi.DatabaseType#UNKNOWN}.</p>
25 *
26 * @return a valid database type
27 */
28 DatabaseType getDatabaseType();
29
30 /**
31 * <p>Returns the name of the schema used with this database.</p>
32 * <p>This is especially important for SQL Server, Postgres, and HSQLDB.</p>
33 *
34 * @return the name of the schema to use, {@code null} if no schema is required.
35 */
36 @Nullable
37 String getSchema();
38}