Class AbstractTenantAwareDatasourceService
- java.lang.Object
-
- org.pentaho.platform.engine.services.connection.datasource.dbcp.BaseDatasourceService
-
- org.pentaho.platform.engine.services.connection.datasource.dbcp.NonPooledOrJndiDatasourceService
-
- org.pentaho.platform.engine.services.connection.datasource.dbcp.PooledOrJndiDatasourceService
-
- org.pentaho.platform.engine.services.connection.datasource.dbcp.tenantaware.AbstractTenantAwareDatasourceService
-
- All Implemented Interfaces:
org.pentaho.platform.api.data.IDBDatasourceService
,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
TenantAwareLoginParsingDatasourceService
,TenantAwareSessionVariableDatasourceService
public abstract class AbstractTenantAwareDatasourceService extends PooledOrJndiDatasourceService implements org.springframework.beans.factory.InitializingBean
This class provides the foundation for combining a users' tenant ID with the datasource name being requested at runtime. The concept is this - - - a- Build against a datasource like "Customers" or "Products" b- At runtime, the users' tenant ID is substituted in a pattern to retrieve the Datasource with the Tenant ID For example: User=admin, Tenant=ABC_COMPANY Requested Datasource: Customers Actual Returned Datasource: ABC_COMPANY-Datasource When admin runs a report that uses the datasource Customers, subclassers will use the tenant-ID and the datasource name to fulfill the request -- Author:
- mbatchelor
-
-
Field Summary
-
Fields inherited from interface org.pentaho.platform.api.data.IDBDatasourceService
ACCESS_TO_UNDERLYING_CONNECTION_ALLOWED, DEFAULT_AUTO_COMMIT, DEFAULT_CATALOG, DEFAULT_READ_ONLY, DEFAULT_TRANSACTION_ISOLATION, IDBDATASOURCE_SERVICE, INITIAL_SIZE, JDBC_DATASOURCE, JDBC_POOL, LOG_ABANDONED, MAX_ACTIVE_KEY, MAX_IDLE_KEY, MAX_OPEN_PREPARED_STATEMENTS, MAX_WAIT_KEY, MIN_IDLE_KEY, POOL_PREPARED_STATEMENTS, QUERY_KEY, REMOVE_ABANDONED, REMOVE_ABANDONED_TIMEOUT, TEST_ON_BORROW, TEST_ON_RETURN, TEST_WHILE_IDLE, TIME_BETWEEN_EVICTION_RUNS_MILLIS, TRANSACTION_ISOLATION_NONE_VALUE
-
-
Constructor Summary
Constructors Constructor Description AbstractTenantAwareDatasourceService()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
DataSource
getDataSource(String dsName)
String
getDatasourceNameFormat()
abstract String
getTenantId()
This abstract method must be implemented by subclasses - this should return a string containing the tenant's ID.boolean
isRequireTenantId()
void
setDatasourceNameFormat(String value)
Getters and Settersvoid
setRequireTenantId(boolean value)
-
Methods inherited from class org.pentaho.platform.engine.services.connection.datasource.dbcp.PooledOrJndiDatasourceService
resolveDatabaseConnection
-
Methods inherited from class org.pentaho.platform.engine.services.connection.datasource.dbcp.NonPooledOrJndiDatasourceService
retrieve
-
Methods inherited from class org.pentaho.platform.engine.services.connection.datasource.dbcp.BaseDatasourceService
clearCache, clearDataSource, getCacheManager, getDatasourceMgmtService, getDSBoundName, getDSUnboundName, getJndiDataSource
-
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
getDataSource
public DataSource getDataSource(String dsName) throws org.pentaho.platform.api.data.DBDatasourceServiceException
- Specified by:
getDataSource
in interfaceorg.pentaho.platform.api.data.IDBDatasourceService
- Overrides:
getDataSource
in classBaseDatasourceService
- Throws:
org.pentaho.platform.api.data.DBDatasourceServiceException
-
getTenantId
public abstract String getTenantId()
This abstract method must be implemented by subclasses - this should return a string containing the tenant's ID.- Returns:
- String ID of the Tenant
-
setDatasourceNameFormat
public void setDatasourceNameFormat(String value)
Getters and Setters
-
getDatasourceNameFormat
public String getDatasourceNameFormat()
-
setRequireTenantId
public void setRequireTenantId(boolean value)
-
isRequireTenantId
public boolean isRequireTenantId()
-
-