/activeobjects-spi/src/main/java/com/atlassian/activeobjects/spi/DataSourceProvider.java

https://bitbucket.org/activeobjects/ao-plugin · Java · 38 lines · 9 code · 5 blank · 24 comment · 0 complexity · 9e8bead342d888332d37a29930342e11 MD5 · raw file

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