Class CdsDataStoreLookup

java.lang.Object
com.sap.cds.services.utils.lib.mt.CdsDataStoreLookup

public class CdsDataStoreLookup extends Object
Responsible for retrieval of CdsDataStoreConnectors. For performance reasons CdsDataStore connector instances are cached per tenant. The cache is synchronized with the MetaDataAccessor's cache: cache CdsDataStore entries are automatically refreshed when a cached model changes in the MetaDataAccessor's cache. To manually refresh a CdsDataStore for a particular tenant the tenant's model must be refreshed or evicted at the MetaDataAccessor.
See Also:
  • Constructor Details

    • CdsDataStoreLookup

      public CdsDataStoreLookup(CdsDataStoreConnectorCreator cdsDataStoreConnectorCreator, BiPredicate<String,com.sap.cds.reflect.CdsModel> isModelOutDated, CacheParams cacheParams, com.google.common.base.Ticker cacheTicker)
      Parameters:
      cdsDataStoreConnectorCreator - factory that creates a CdsDataStoreConnector
      isModelOutDated - predicate that takes the tenant id and the current model as input and decides if the model is out dated
      cacheParams - Parameters that control cache lifecycle
      cacheTicker - Optional ticker used by guava cache for testing purposes, use null for productive use
  • Method Details

    • getCdsDataStoreConnector

      public com.sap.cds.CdsDataStoreConnector getCdsDataStoreConnector(String tenantId) throws com.sap.cds.CdsException
      Determine a data store connector for a tenant
      Parameters:
      tenantId - tenant identifier
      Returns:
      a CDS data store connector
      Throws:
      com.sap.cds.CdsException
    • evictIfOutDated

      public void evictIfOutDated(String tenantId)