public interface AssetHandler
AssetHandler
inteface specifies the handling of assets, specifically during importing or updating
the binary of an asset.Modifier and Type | Method and Description |
---|---|
boolean |
canHandleSubAssets()
Indicates if the handler supports processing of
sub assets |
void |
createThumbnails(Asset asset)
Creates thumbnails for this asset.
|
void |
createThumbnails(Asset asset,
Collection<ThumbnailConfig> configs)
Thumbnails of an asset are created during import/update of an asset and it's original binary.
|
void |
createThumbnails(Asset asset,
Rendition rendition,
Collection<ThumbnailConfig> configs)
|
void |
createThumbnails(Node asset,
Node renditionFolder,
Session session,
List<Integer[]> dimensions)
Deprecated.
|
void |
createThumbnailsExt(Node asset,
Node renditionFolder,
Session session,
List<Map<String,Object>> thumbnailConfigs)
Deprecated.
|
void |
exportAsset(Node asset,
OutputStream stream)
Deprecated.
Use
#exportAsset(com.day.cq.dam.api.Asset, java.io.OutputStream) instead. |
ExtractedMetadata |
extractMetadata(Node asset)
Deprecated.
Use
#extractMetadata(com.day.cq.dam.api.Asset) instead. |
BufferedImage |
getImage(Node file)
Deprecated.
Use
#getImage(Rendition) instead. |
BufferedImage |
getImage(Rendition rendition,
Dimension maxDimension)
|
String[] |
getMimeTypes()
This method returns the mime types a particular
AssetHandler supports. |
Iterator<? extends AssetRelation> |
processRelated(Asset asset)
extracts and stores the links to the assets related with provided asset.
|
List<String> |
processSubAssets(Asset asset)
Handler implementations may choose to support sub asset creation for the file types it handles.
|
List<String> |
processSubAssets(Node asset,
Session session)
Deprecated.
Use
processSubAssets(com.day.cq.dam.api.Asset) instead. |
boolean canHandleSubAssets()
sub assets
true
if handler is able to process sub assetsvoid createThumbnails(Asset asset, Collection<ThumbnailConfig> configs) throws IOException
CreateThumbnailProcess
and the CommandLineProcess
as part of the DAM Update Asset workflow. Implementations
may choose to create asset thumbnails for every entry in the thumbnailConfigs
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 (see Asset.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
asset
- the asset/file for which the thumbnails are generatedconfigs
- thumbnail configurationsIOException
- is thrown in case while an error occurred while fetching the imageAsset.addRendition(String, java.io.InputStream, String)
,
Asset.getRenditions()
,
)
,
Asset.getRendition(com.day.cq.dam.api.RenditionPicker)
void createThumbnails(Asset asset) throws IOException
asset
- The asset for which to create thumbnails.IOException
- If an error occurred while extracting the image.void createThumbnails(Asset asset, Rendition rendition, Collection<ThumbnailConfig> configs) throws IOException
asset
- The asset for which to created thumbnails.rendition
- The rendition serving as the thumbnail basis.configs
- The thumbnail configurations.IOException
- If an error occurred extracting an image from the rendition.void createThumbnails(Node asset, Node renditionFolder, Session session, List<Integer[]> dimensions)
createThumbnails(com.day.cq.dam.api.Asset, java.util.Collection)
instead.[width1,height1], [width2,height2], ...
asset
- the asset/file for which the thumbnails are generatedrenditionFolder
- the folder where the thumbnails belong tosession
- the jcr session shich is used to store the thumbnailsdimensions
- the dimensions for the "ordered" thumbnailsvoid createThumbnailsExt(Node asset, Node renditionFolder, Session session, List<Map<String,Object>> thumbnailConfigs) throws IOException
createThumbnails(com.day.cq.dam.api.Asset, java.util.Collection)
instead.CreateThumbnailProcess
and the CommandLineProcess
as part of the DAM Update Asset workflow. Implementations
may choose to create asset thumbnails for every entry in the thumbnailConfigs
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 (see Asset.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> config = new ArrayList >(); config.add(new HashMap () {{ put("width", 140); put("height", 100); put("doCenter", true); }}); config.add(new HashMap () {{ put("width", 80); put("height", 80); put("doCenter", true); }}); handler.createThumbnailsExt( getTiff(), asset.adaptTo(Node.class).getNode("jcr:content/renditions"), session, config); ...
asset
- the asset/file for which the thumbnails are generatedrenditionFolder
- the folder where thumbnails (renditions) shall be storedsession
- the jcr session shich is used to store the thumbnailsthumbnailConfigs
- thumbnail configurationsIOException
- is thrown in case while an error occured while fetching the imageAsset.addRendition(String, java.io.InputStream, String)
,
Asset.getRenditions()
,
)
,
Asset.getRendition(com.day.cq.dam.api.RenditionPicker)
void exportAsset(Node asset, OutputStream stream) throws AssetHandlerException
#exportAsset(com.day.cq.dam.api.Asset, java.io.OutputStream)
instead.asset
- the file nodestream
- the OutputStream
where the exported asset is put.AssetHandlerException
- in case the export work failed.ExtractedMetadata extractMetadata(Node asset)
#extractMetadata(com.day.cq.dam.api.Asset)
instead.ExtractMetadataProcess
as part of the DAM
Update Asset workflow during import or update of an asset. Implementations must return an ExtractedMetadata
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. The
ExtractMetadataProcess
will later save the metadata contained in ExtractedMetadata
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 javax.jcr.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.asset
- the file nodeAsset.getMetadata()
,
Asset.getMetadata(String)
,
Asset.getMetadataValue(String)
BufferedImage getImage(Node file) throws IOException
#getImage(Rendition)
instead.BufferedImage
of the original image is returned, for other formats the first page is retrieved as BufferedImage
file
- to retrieve the image representationBufferedImage
if a graphical representaion exists, otherwise null
IOException
- in case an error is thrown while fetching the buffered imageBufferedImage getImage(Rendition rendition, Dimension maxDimension) throws IOException
Asset
s given Rendition
. For images the
BufferedImage
of the original image is returned, for other formats the first page is retrieved as
BufferedImage
.
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.
rendition
- The rendition for which to retrieve its graphical representation.maxDimension
- optional constraint for the maximal dimension of the image.BufferedImage
if a graphical representation exists, otherwise null
IOException
- in case an error is thrown while fetching the buffered imageString[] getMimeTypes()
AssetHandler
supports.List<String> processSubAssets(Node asset, Session session)
processSubAssets(com.day.cq.dam.api.Asset)
instead.CreateSubAssetsProcess
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 the javax.jcr.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.asset
- asset to extract sub assetssession
- jcr sessioncanHandleSubAssets()
,
Asset.isSubAsset()
List<String> processSubAssets(Asset asset)
CreateSubAssetsProcess
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 the javax.jcr.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.asset
- asset to extract sub assetscanHandleSubAssets()
,
Asset.isSubAsset()
"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"