Interface AssetCache


@Deprecated public interface AssetCache
Deprecated.
In AEM as a Cloud Service, asset file manipulation should no longer occur directly in the JVM. Instead, we recommend using the Asset Workflow Migration Tool to to migrate workflows to Processing profiles.
Provides convenience methods for handling InputStreams from and temporary files for DAM asset renditions. A proper instance of an AssetCache can be retrieved via DamUtil.getAssetCache(). Every obtained instance needs to be release()d after use.

The AssetCache might keep temporary files around for longer and reuse them in future AssetCache instances. This is transparent to the caller.

  • Method Summary

    Modifier and Type
    Method
    Description
    getByteSource(Rendition rendition, boolean needFile)
    Deprecated.
    Get a ByteSource for the renction's content.
    getFile(Rendition rendition)
    Deprecated.
    Get an File with the content of the Asset rendition.
    getOriginalStream(Asset asset, boolean needFile)
    Deprecated.
    Get an InputStream to the content of the original Asset rendition.
    getRenditionStream(Asset asset, String name, boolean needFile)
    Deprecated.
    Get an InputStream to the content of the Asset rendition with name.
    getStream(Rendition rendition, boolean needFile)
    Deprecated.
    Get an InputStream to the content of the Asset rendition.
    void
    Deprecated.
    Notify the cache that an asset has been modified/deleted and that cached data is no longer valid
    void
    Deprecated.
    Notify the cache that an asset rendition has been modified/deleted and that cached data is no longer valid
    void
    Deprecated.
    Release this cache instance and cleanup all handed out streams and data.
  • Method Details

    • getOriginalStream

      InputStream getOriginalStream(Asset asset, boolean needFile) throws IOException
      Deprecated.
      Get an InputStream to the content of the original Asset rendition. The stream is automatically closed on release of this cache instance.
      Parameters:
      asset - the asset to get the original rendition for
      needFile - if a file based stream is preferred
      Returns:
      stream to original rendition content, closed on release
      Throws:
      IOException - if original rendition was not found
    • getRenditionStream

      InputStream getRenditionStream(Asset asset, String name, boolean needFile) throws IOException
      Deprecated.
      Get an InputStream to the content of the Asset rendition with name. The stream is automatically closed on release of this cache instance.
      Parameters:
      asset - the asset to get the original rendition for
      name - name of the rendition to get the content for
      needFile - if a file based stream is preferred
      Returns:
      stream to original rendition content, closed on release
      Throws:
      IOException - if original rendition was not found
    • getStream

      InputStream getStream(Rendition rendition, boolean needFile) throws IOException
      Deprecated.
      Get an InputStream to the content of the Asset rendition. The stream is automatically closed on release of this cache instance.
      Parameters:
      rendition - rendition to get the content for
      needFile - if a file based stream is preferred
      Returns:
      stream to original rendition content, closed on release
      Throws:
      IOException - if original rendition was not found
    • getFile

      File getFile(Rendition rendition) throws IOException
      Deprecated.
      Get an File with the content of the Asset rendition. The file is temporary and will be deleted on cache release (not necessarily the release of this cache instance).
      Parameters:
      rendition - rendition to get the content for
      Returns:
      stream to original rendition content, closed on release
      Throws:
      IOException - if original rendition was not found
    • getByteSource

      ByteSource getByteSource(Rendition rendition, boolean needFile) throws IOException
      Deprecated.
      Get a ByteSource for the renction's content. The source is automatically cleaned up on release of this cache instance.
      Parameters:
      rendition - rendition to get the content for
      needFile - if a file based stream is preferred
      Returns:
      stream to original rendition content, closed on release
      Throws:
      IOException - if original rendition was not found
    • invalidateCache

      void invalidateCache(Asset asset)
      Deprecated.
      Notify the cache that an asset has been modified/deleted and that cached data is no longer valid
      Parameters:
      asset - asset that was modified/deleted.
    • invalidateCache

      void invalidateCache(Rendition rendition)
      Deprecated.
      Notify the cache that an asset rendition has been modified/deleted and that cached data is no longer valid
      Parameters:
      rendition - rendition that was modified/deleted.
    • release

      void release()
      Deprecated.
      Release this cache instance and cleanup all handed out streams and data. Needs to be invoked at the end of cache use.