Class AbstractMassTrackingCache<T extends AtlanObject>

java.lang.Object
com.atlan.cache.AbstractMassCache<T>
com.atlan.cache.AbstractMassTrackingCache<T>
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
AtlanTagCache, CustomMetadataCache

public abstract class AbstractMassTrackingCache<T extends AtlanObject> extends AbstractMassCache<T>
Base class for reusable components that are common to all caches, where a cache is populated en-masse through batch refreshing and furthermore where any cache misses are also tracked (to avoid attempting to refresh the cache unnecessarily).
  • Constructor Details

    • AbstractMassTrackingCache

      public AbstractMassTrackingCache(AtlanClient client, String name)
  • Method Details

    • refreshCache

      protected void refreshCache() throws AtlanException
      Logic to refresh a specific cache en-masse (must be implemented).
      Specified by:
      refreshCache in class AbstractMassCache<T extends AtlanObject>
      Throws:
      AtlanException - on any error communicating with Atlan to refresh the cache of objects
    • refresh

      protected void refresh(long minimumTime) throws AtlanException
      Consider whether to refresh the cache, based on when it was last refreshed.
      Parameters:
      minimumTime - epoch-based time (in milliseconds) to compare against the time the cache was last refreshed
      Throws:
      AtlanException - on any API communication problem if the cache needs to be refreshed
    • isDeletedName

      protected boolean isDeletedName(String name)
      Check whether the provided name has already been tracked as deleted.
      Parameters:
      name - to check is known to be deleted
      Returns:
      true if the name is known to be deleted
    • addDeletedName

      protected void addDeletedName(String name)
      Add the provided name for tracking as deleted.
      Parameters:
      name - to mark as known-deleted
    • isDeletedId

      protected boolean isDeletedId(String id)
      Check whether the provided ID has already been tracked as deleted.
      Parameters:
      id - to check is known to be deleted
      Returns:
      true if the ID is known to be deleted
    • addDeletedId

      protected void addDeletedId(String id)
      Add the provided ID for tracking as deleted.
      Parameters:
      id - to mark as known-deleted
    • getIdForName

      public String getIdForName(String name, long minimumTime) throws AtlanException
      Translate the provided human-readable name to its Atlan-internal ID string.
      Parameters:
      name - human-readable name of the object
      minimumTime - epoch-based time (in milliseconds) to compare against the time the cache was last refreshed
      Returns:
      unique Atlan-internal ID string for the object
      Throws:
      AtlanException - on any API communication problem if the cache needs to be refreshed
      NotFoundException - if the object cannot be found (does not exist) in Atlan
      InvalidRequestException - if no name was provided for the object to retrieve
    • getNameForId

      public String getNameForId(String id, long minimumTime) throws AtlanException
      Translate the provided Atlan-internal ID string to the human-readable name for the object.
      Parameters:
      id - Atlan-internal ID string
      minimumTime - epoch-based time (in milliseconds) to compare against the time the cache was last refreshed
      Returns:
      unique Atlan-internal ID string for the object
      Throws:
      AtlanException - on any API communication problem if the cache needs to be refreshed
      NotFoundException - if the object cannot be found (does not exist) in Atlan
      InvalidRequestException - if no name was provided for the object to retrieve
    • getSidForName

      public String getSidForName(String name, long minimumTime) throws AtlanException
      Translate the provided human-readable name to its Atlan-internal secondary ID string.
      Parameters:
      name - human-readable name of the object
      minimumTime - epoch-based time (in milliseconds) to compare against the time the cache was last refreshed
      Returns:
      unique Atlan-internal secondary ID string for the object
      Throws:
      AtlanException - on any API communication problem if the cache needs to be refreshed
      NotFoundException - if the object cannot be found (does not exist) in Atlan
      InvalidRequestException - if no name was provided for the object to retrieve
    • getNameForSid

      public String getNameForSid(String sid, long minimumTime) throws AtlanException
      Translate the provided Atlan-internal secondary ID string to the human-readable name for the object.
      Parameters:
      sid - Atlan-internal secondary ID string
      minimumTime - epoch-based time (in milliseconds) to compare against the time the cache was last refreshed
      Returns:
      human-readable name of the object
      Throws:
      AtlanException - on any API communication problem if the cache needs to be refreshed
      NotFoundException - if the object cannot be found (does not exist) in Atlan
      InvalidRequestException - if no name was provided for the object to retrieve