Interface RenditionHandler


  • @ConsumerType
    public interface RenditionHandler
    The RenditionHandler interface defines the API for rendition handlers. Each RenditionHandler must be identifiable via a unique ID 'rendition.handler.id'.

    RenditionHandler is used by the Asset API to delegate Access, Creation & Deletion of Rendition.

    Implementations of this interface must be registered as OSGi services.

    • Field Detail

      • PROPERTY_ID

        static final java.lang.String PROPERTY_ID
        PROPERTY_ID must be set by the implementation class as an OSGi service property This is used by the Asset API to identify RenditionHandler
        See Also:
        Constant Field Values
      • PROPERTY_RENDITION_MIME_TYPE

        static final java.lang.String PROPERTY_RENDITION_MIME_TYPE
        This property constant defines a property key for the mime type. This can be used by the RenditionHandler or the API clients to define the mime type of the Rendition
            For example, if the rendition handler requires mime type:
              final Map<String, Object> map = new HashMap<String, Object>();
              map.put(RenditionHandler.PROPERTY_RENDITION_MIME_TYPE, "image/gif");
              ....
              asset.setRendition("image.gif", InputStream, map);
        
         
        See Also:
        Constant Field Values
    • Method Detail

      • getRendition

        Rendition getRendition​(Resource resource)
        Get Rendition. Implementations are expected to type the given Resource to Rendition.
        Parameters:
        resource - Rendition resource
        Returns:
        Rendition object of the given resource
      • setRendition

        Rendition setRendition​(Resource resource,
                               java.io.InputStream is,
                               java.util.Map<java.lang.String,​java.lang.Object> map)
        Set Rendition. Implementations are free to define Resource data structure.
        Parameters:
        resource - Rendition resource
        is - InputStream to create the rendition binary or null
        map - containing values needed by this handler.
        Returns:
        newly created or updated rendition
        Throws:
        AssetException - if Rendition cannot be set
      • deleteRendition

        void deleteRendition​(Resource resource)
        Delete the rendition resource. Implementations are free to decide the semantics of deletion.
        Parameters:
        resource - To be deleted
        Throws:
        AssetException - if Rendition cannot be deleted