Class AbstractTenantAwareDatasourceService

  • All Implemented Interfaces:, 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 -
    • Constructor Detail

      • AbstractTenantAwareDatasourceService

        public AbstractTenantAwareDatasourceService()
    • Method Detail

      • afterPropertiesSet

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

        public DataSource getDataSource​(String dsName)
        Specified by:
        getDataSource in interface
        getDataSource in class BaseDatasourceService
      • getTenantId

        public abstract String getTenantId()
        This abstract method must be implemented by subclasses - this should return a string containing the tenant's ID.
        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()