Package com.day.cq.dam.api.handler
Interface AssetHandler
-
- All Known Implementing Classes:
AbstractAssetHandler
,StandardImageHandler
@Deprecated public interface AssetHandler
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.TheAssetHandler
inteface specifies the handling of assets, specifically during importing or updating the binary of an asset.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
canHandleSubAssets()
Deprecated.Indicates if the handler supports processing ofsub assets
void
createThumbnails(Asset asset)
Deprecated.Creates thumbnails for this asset.void
createThumbnails(Asset asset, Rendition rendition, java.util.Collection<ThumbnailConfig> configs)
Deprecated.void
createThumbnails(Asset asset, java.util.Collection<ThumbnailConfig> configs)
Deprecated.Thumbnails of an asset are created during import/update of an asset and it's original binary.void
exportAsset(Asset asset, java.io.OutputStream stream)
Deprecated.This method exports the asset into the givenOutputStream
.ExtractedMetadata
extractMetadata(Asset asset)
Deprecated.This method is used by theExtractMetadataProcess
as part of the DAM Update Asset workflow during import or update of an asset.java.awt.image.BufferedImage
getImage(Rendition rendition)
Deprecated.java.awt.image.BufferedImage
getImage(Rendition rendition, java.awt.Dimension maxDimension)
Deprecated.java.lang.String[]
getMimeTypes()
Deprecated.This method returns the mime types a particularAssetHandler
supports.java.util.Iterator<? extends AssetRelation>
processRelated(Asset asset)
Deprecated.extracts and stores the links to the assets related with provided asset.java.util.List<java.lang.String>
processSubAssets(Asset asset)
Deprecated.Handler implementations may choose to support sub asset creation for the file types it handles.
-
-
-
Method Detail
-
canHandleSubAssets
boolean canHandleSubAssets()
Deprecated.Indicates if the handler supports processing ofsub assets
- Returns:
true
if handler is able to process sub assets
-
createThumbnails
void createThumbnails(Asset asset, java.util.Collection<ThumbnailConfig> configs) throws java.io.IOException
Deprecated.Thumbnails of an asset are created during import/update of an asset and it's original binary. Currently this method is used by theCreateThumbnailProcess
and theCommandLineProcess
as part of the DAM Update Asset workflow. Implementations may choose to create asset thumbnails for every entry in thethumbnailConfigs
list argument, to not create any thumbnails at all, or to create a generic thumbnail independent of the given config. Thumbnails themselves are renditions of an asset and must be persisted as such (seeAsset.addRendition(String, java.io.InputStream, String)
).The thumbnail renditions are created depending on the given configuration list:
Sample:{ height:h1, width: w1, doCenter: true (or false) }, { ... }
... final ArrayList<Map<String, Object>> config = new ArrayList<Map<String, Object>>(); config.add(new HashMap<String, Object>() {{ put("width", 140); put("height", 100); put("doCenter", true); }}); config.add(new HashMap<String, Object>() {{ put("width", 80); put("height", 80); put("doCenter", true); }}); handler.createThumbnailsExt( getTiff(), asset.adaptTo(Node.class).getNode("jcr:content/renditions"), session, config); ...
- Parameters:
asset
- the asset/file for which the thumbnails are generatedconfigs
- thumbnail configurations- Throws:
java.io.IOException
- is thrown in case while an error occurred while fetching the image- Since:
- 5.4.0
- See Also:
Asset.addRendition(String, java.io.InputStream, String)
,Asset.getRenditions()
,)
,Asset.getRendition(com.day.cq.dam.api.RenditionPicker)
-
createThumbnails
void createThumbnails(Asset asset) throws java.io.IOException
Deprecated.Creates thumbnails for this asset. Which thumbnails are created is automatically derived from the existing thumbnails (renditions with the cq5dam.thumbnail prefix). This essentially amounts to re-creating existing thumbnails.- Parameters:
asset
- The asset for which to create thumbnails.- Throws:
java.io.IOException
- If an error occurred while extracting the image.
-
createThumbnails
void createThumbnails(Asset asset, Rendition rendition, java.util.Collection<ThumbnailConfig> configs) throws java.io.IOException
Deprecated.- Parameters:
asset
- The asset for which to created thumbnails.rendition
- The rendition serving as the thumbnail basis.configs
- The thumbnail configurations.- Throws:
java.io.IOException
- If an error occurred extracting an image from the rendition.
-
exportAsset
void exportAsset(Asset asset, java.io.OutputStream stream) throws AssetHandlerException
Deprecated.This method exports the asset into the givenOutputStream
. TheAsset
s original binary is served.- Parameters:
asset
- The asset to export.stream
- The output stream to export into.- Throws:
AssetHandlerException
- If an error occurred during export.- Since:
- 5.4.0
-
extractMetadata
ExtractedMetadata extractMetadata(Asset asset)
Deprecated.This method is used by theExtractMetadataProcess
as part of the DAM Update Asset workflow during import or update of an asset. Implementations must return anExtractedMetadata
object, which may be empty if no metadata is extracted, or contains the metadata values extracted from the binary being imported/updated at the time. TheExtractMetadataProcess
will later save the metadata contained inExtractedMetadata
to the asset's metadata node (e.g. /content/dam/geometrixx/banners/banner-mono.png/jcr:content/metadata). Implementations are free to decide which and how many metadata values are extracted.The method argument represents the
Node
of type nt:file holding the binary content or the DAM Asset node (type dam:Asset), for which its original rendition would be retrieved.- Parameters:
asset
- TheAsset
, from whose original binary metadata will extracted.- Returns:
- The extracted metadata.
- Since:
- 5.4.0
-
getImage
java.awt.image.BufferedImage getImage(Rendition rendition) throws java.io.IOException
Deprecated.This method retrieves the graphical representation of anAsset
s givenRendition
. For images theBufferedImage
of the original image is returned, for other formats the first page is retrieved asBufferedImage
- Parameters:
rendition
- The rendition for which to retrieve its graphical representation.- Returns:
BufferedImage
if a graphical representation exists, otherwisenull
- Throws:
java.io.IOException
- in case an error is thrown while fetching the buffered image- Since:
- 5.4.0
-
getImage
java.awt.image.BufferedImage getImage(Rendition rendition, java.awt.Dimension maxDimension) throws java.io.IOException
Deprecated.This method retrieves the graphical representation of anAsset
s givenRendition
. For images theBufferedImage
of the original image is returned, for other formats the first page is retrieved asBufferedImage
.If
maxDimension
is given, the handler should return an image where no dimension extends the given value. This can be used to reduce the memory footprint of large buffered images if the full resolution is not needed.- Parameters:
rendition
- The rendition for which to retrieve its graphical representation.maxDimension
- optional constraint for the maximal dimension of the image.- Returns:
BufferedImage
if a graphical representation exists, otherwisenull
- Throws:
java.io.IOException
- in case an error is thrown while fetching the buffered image- Since:
- 5.4.0
-
getMimeTypes
java.lang.String[] getMimeTypes()
Deprecated.This method returns the mime types a particularAssetHandler
supports.- Returns:
- mime type, e.g. image/jpg
-
processSubAssets
java.util.List<java.lang.String> processSubAssets(Asset asset)
Deprecated.Handler implementations may choose to support sub asset creation for the file types it handles. The method is called by theCreateSubAssetsProcess
during import/update of an asset and its binary, as part of the DAM Update Asset workflow. Sub assets represent fragments of the original asset, for example every page of a multi-page PDF document are sub assets. Sub assets are stored as assets themselves under the parent asset. Sub assets are stored in the subassets folder of the main asset, e.g. at /content/dam/geometrixx/documents/ECM Artikel.pdf/subassets.The
asset
argument represents theNode
of type nt:file holding the binary content or the DAM Asset node (type dam:Asset), for which its original rendition would be retrieved.- Parameters:
asset
- asset to extract sub assets- Returns:
- List constaining all paths to the newly created assets
- See Also:
canHandleSubAssets()
,Asset.isSubAsset()
-
processRelated
java.util.Iterator<? extends AssetRelation> processRelated(Asset asset)
Deprecated.extracts and stores the links to the assets related with provided asset.- Parameters:
asset
- asset to process- Returns:
- Iterator of
AssetRelation
or an empty iterator if no related assets are available
-
-