Class 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
    • Constructor Detail

      • AbstractTenantAwareDatasourceService

        public AbstractTenantAwareDatasourceService()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws Exception
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Throws:
        Exception
      • getDataSource

        public DataSource getDataSource​(String dsName)
                                 throws org.pentaho.platform.api.data.DBDatasourceServiceException
        Specified by:
        getDataSource in interface org.pentaho.platform.api.data.IDBDatasourceService
        Overrides:
        getDataSource in class BaseDatasourceService
        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()