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

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

      • getOriginalStream

        java.io.InputStream getOriginalStream​(Asset asset,
                                              boolean needFile)
                                       throws java.io.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:
        java.io.IOException - if original rendition was not found
      • getRenditionStream

        java.io.InputStream getRenditionStream​(Asset asset,
                                               java.lang.String name,
                                               boolean needFile)
                                        throws java.io.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:
        java.io.IOException - if original rendition was not found
      • getStream

        java.io.InputStream getStream​(Rendition rendition,
                                      boolean needFile)
                               throws java.io.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:
        java.io.IOException - if original rendition was not found
      • getFile

        java.io.File getFile​(Rendition rendition)
                      throws java.io.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:
        java.io.IOException - if original rendition was not found
      • getByteSource

        ByteSource getByteSource​(Rendition rendition,
                                 boolean needFile)
                          throws java.io.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:
        java.io.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.