View Javadoc
1   package com.atlassian.activeobjects.spi;
2   
3   import javax.annotation.Nullable;
4   import 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   */
11  public 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  }