Class AbstractAssetCache

java.lang.Object
com.atlan.cache.AbstractAssetCache
Direct Known Subclasses:
ConnectionCache, SourceTagCache

public abstract class AbstractAssetCache extends Object
Base class for reusable components that are common to all caches, where a cache is populated entry-by-entry.
  • Field Details

  • Constructor Details

    • AbstractAssetCache

      protected AbstractAssetCache(AtlanClient client)
  • Method Details

    • lookupByGuid

      public abstract void lookupByGuid(String guid) throws AtlanException
      Logic to refresh the cache for a single object from Atlan.
      Parameters:
      guid - the unique UUID of a single item to lookup
      Throws:
      AtlanException - on any error communicating with Atlan to lookup the object
    • lookupByQualifiedName

      public abstract void lookupByQualifiedName(String qualifiedName) throws AtlanException
      Logic to refresh the cache for a single object from Atlan.
      Parameters:
      qualifiedName - the identity of a single item to lookup
      Throws:
      AtlanException - on any error communicating with Atlan to lookup the object
    • lookupByName

      public abstract void lookupByName(ObjectName name) throws AtlanException
      Logic to refresh the cache for a single object from Atlan.
      Parameters:
      name - the name of a single item to lookup
      Throws:
      AtlanException - on any error communicating with Atlan to lookup the object
    • getName

      public abstract ObjectName getName(Asset asset)
      Logic to construct a unique identity for the asset.
      Parameters:
      asset - for which to construct the unique identity
      Returns:
      a unique identity for the asset, or null if there is no asset
    • cache

      protected String cache(Asset asset)
      Add an entry to the cache.
      Parameters:
      asset - to be cached
      Returns:
      the guid of the asset that was cached, or null if none was provided
    • isGuidKnown

      public boolean isGuidKnown(String guid)
      Checks whether the provided Atlan-internal UUID is known. (Note: will not refresh the cache itself to determine this.)
      Parameters:
      guid - Atlan-internal UUID of the object
      Returns:
      true if the object is known, false otherwise
    • isQualifiedNameKnown

      public boolean isQualifiedNameKnown(String qualifiedName)
      Checks whether the provided Atlan-internal ID string is known. (Note: will not refresh the cache itself to determine this.)
      Parameters:
      qualifiedName - Atlan-internal ID string of the object
      Returns:
      true if the object is known, false otherwise
    • isNameKnown

      public boolean isNameKnown(ObjectName name)
      Checks whether the provided human-readable name is known. (Note: will not refresh the cache itself to determine this.)
      Parameters:
      name - human-constructable name of the object
      Returns:
      true if the object is known, false otherwise
    • getByGuid

      public Asset getByGuid(String guid) throws AtlanException
      Retrieve an asset from the cache by its UUID, looking it up and adding it to the cache if it is not found there.
      Parameters:
      guid - UUID of the asset in Atlan
      Returns:
      the asset (if found)
      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 UUID was provided for the object to retrieve
    • getByGuid

      public Asset getByGuid(String guid, boolean allowRefresh) throws AtlanException
      Retrieve an asset from the cache by its UUID.
      Parameters:
      guid - UUID of the asset in Atlan
      allowRefresh - whether to allow a refresh of the cache (true) or not (false)
      Returns:
      the asset (if found)
      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 UUID was provided for the object to retrieve
    • getByQualifiedName

      public Asset getByQualifiedName(String qualifiedName) throws AtlanException
      Retrieve an asset from the cache by its unique Atlan-internal name, looking it up and adding it to the cache if it is not found there.
      Parameters:
      qualifiedName - unique Atlan-internal name of the asset
      Returns:
      the asset (if found)
      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 qualifiedName was provided for the object to retrieve
    • getByQualifiedName

      public Asset getByQualifiedName(String qualifiedName, boolean allowRefresh) throws AtlanException
      Retrieve an asset from the cache by its unique Atlan-internal name.
      Parameters:
      qualifiedName - unique Atlan-internal name of the asset
      allowRefresh - whether to allow a refresh of the cache (true) or not (false)
      Returns:
      the asset (if found)
      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 qualifiedName was provided for the object to retrieve
    • getByName

      public Asset getByName(ObjectName name) throws AtlanException
      Retrieve an asset from the cache by its uniquely-identifiable name, looking it up and adding it to the cache if it is not found there.
      Parameters:
      name - uniquely-identifiable name of the asset in Atlan
      Returns:
      the asset (if found)
      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
    • getByName

      public Asset getByName(ObjectName name, boolean allowRefresh) throws AtlanException
      Retrieve an asset from the cache by its uniquely-identifiable name.
      Parameters:
      name - uniquely-identifiable name of the asset in Atlan
      allowRefresh - whether to allow a refresh of the cache (true) or not (false)
      Returns:
      the asset (if found)
      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