Package io.ebeaninternal.server.core
Class MultiTenantDbCatalogSupplier
- java.lang.Object
-
- io.ebeaninternal.server.core.MultiTenantDbCatalogSupplier
-
- All Implemented Interfaces:
DataSourceSupplier
public class MultiTenantDbCatalogSupplier extends Object implements DataSourceSupplier
DataSource supplier that changes DB catalog based on current Tenant Id.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connection
getConnection(Object tenantId)
Return a connection from the DataSource taking into account a tenantId for multi-tenant lazy loading.DataSource
getDataSource()
Return the DataSource to use for the current request.Connection
getReadOnlyConnection(Object tenantId)
Return a connection from the read only DataSource taking into account a tenantId for multi-tenant lazy loading.DataSource
getReadOnlyDataSource()
Return the read only DataSource to use for the current request.void
shutdown(boolean deregisterDriver)
Shutdown the datasource de-registering the JDBC driver if requested.
-
-
-
Method Detail
-
getDataSource
public DataSource getDataSource()
Description copied from interface:DataSourceSupplier
Return the DataSource to use for the current request.This should take into account multi-tenancy and the current tenantId.
- Specified by:
getDataSource
in interfaceDataSourceSupplier
-
getReadOnlyDataSource
public DataSource getReadOnlyDataSource()
Description copied from interface:DataSourceSupplier
Return the read only DataSource to use for the current request.This can return null meaning that no read only DataSource (with autoCommit) is available for use so normal transactions with explicit commit should be used.
- Specified by:
getReadOnlyDataSource
in interfaceDataSourceSupplier
-
getConnection
public Connection getConnection(Object tenantId) throws SQLException
Description copied from interface:DataSourceSupplier
Return a connection from the DataSource taking into account a tenantId for multi-tenant lazy loading.- Specified by:
getConnection
in interfaceDataSourceSupplier
- Parameters:
tenantId
- Most often null but well supplied indicates a multi-tenant lazy loading query- Returns:
- the connection to use
- Throws:
SQLException
-
getReadOnlyConnection
public Connection getReadOnlyConnection(Object tenantId) throws SQLException
Description copied from interface:DataSourceSupplier
Return a connection from the read only DataSource taking into account a tenantId for multi-tenant lazy loading.- Specified by:
getReadOnlyConnection
in interfaceDataSourceSupplier
- Parameters:
tenantId
- Most often null but well supplied indicates a multi-tenant lazy loading query- Returns:
- the connection to use
- Throws:
SQLException
-
shutdown
public void shutdown(boolean deregisterDriver)
Description copied from interface:DataSourceSupplier
Shutdown the datasource de-registering the JDBC driver if requested.- Specified by:
shutdown
in interfaceDataSourceSupplier
-
-