Class MetaDataAccessorSingleModelImpl<M>

java.lang.Object
com.sap.cds.services.utils.lib.mtx.impl.MetaDataAccessorSingleModelImpl<M>
All Implemented Interfaces:
MetaDataAccessor<M>

public class MetaDataAccessorSingleModelImpl<M> extends Object implements MetaDataAccessor<M>
Class that provides access to CDS and Edmx models read from java resource folders
  • Constructor Details

    • MetaDataAccessorSingleModelImpl

      public MetaDataAccessorSingleModelImpl(String cdsModelPath, String edmxFolder, MetaDataAccessorImpl.EdmxModelCreator<M> edmxstrAndServiceToEdmxModel) throws IOException
      Parameters:
      cdsModelPath - Path to the csn-file,including file name
      edmxFolder - Path of edmx folder, null and empty are allowed
      edmxstrAndServiceToEdmxModel - Function that converts edmx model read as string into generic type M
      Throws:
      IOException
  • Method Details

    • getEdmx

      public M getEdmx(ModelId id, int maxAgeSeconds) throws com.sap.cds.CdsException
      Specified by:
      getEdmx in interface MetaDataAccessor<M>
      Parameters:
      id - model identifier
      maxAgeSeconds - maximum acceptable age of resource
      Returns:
      EDMX model
      Throws:
      com.sap.cds.CdsException
    • getI18n

      public MetaDataAccessor.I18n getI18n(ModelId modelId, int maxAgeSeconds)
      Specified by:
      getI18n in interface MetaDataAccessor<M>
      Parameters:
      modelId - model identifier
      maxAgeSeconds - maximum acceptable age of resource
      Returns:
      model related i18n resources
    • getCdsModel

      public com.sap.cds.reflect.CdsModel getCdsModel(ModelId modelId, int maxAgeSeconds) throws com.sap.cds.CdsException
      Specified by:
      getCdsModel in interface MetaDataAccessor<M>
      Parameters:
      modelId - model identifier
      maxAgeSeconds - maximum acceptable age of resource
      Returns:
      CDS model
      Throws:
      com.sap.cds.CdsException
    • refresh

      public void refresh(String tenantId, int maxAgeSeconds)
      Description copied from interface: MetaDataAccessor
      TODO sync Rereads CDS and EDMX models for the specified tenant if they have changed
      Specified by:
      refresh in interface MetaDataAccessor<M>
      Parameters:
      tenantId - tenant identifier
      maxAgeSeconds - maximum acceptable age of resource
    • evict

      public void evict(String tenantId)
      Description copied from interface: MetaDataAccessor
      evicts CDS and EDMX models for the specified tenant
      Specified by:
      evict in interface MetaDataAccessor<M>
      Parameters:
      tenantId - tenant identifier