@ProviderType public interface AssetManager
AssetManager
is a primary interface which provides methods to manage Asset
s.
AssetManager is created by adapting ResourceResolver
to AssetManager
AssetManager assetManager = resolver.adaptTo(AssetManager.class);
Modifier and Type | Method and Description |
---|---|
boolean |
assetExists(java.lang.String assetPath)
Checks for the existence of an
Asset . |
void |
copyAsset(java.lang.String assetPath,
java.lang.String destAbsPath)
Copy Asset to the desired location.
|
Asset |
createAsset(java.lang.String path)
Creates a new
Asset at the given path . |
Asset |
getAsset(java.lang.String assetPath)
Get
Asset at the given assetPath . |
Asset |
getAssetByIdentifier(java.lang.String id)
Get
Asset specified by the given Identifier . |
void |
moveAsset(java.lang.String assetPath,
java.lang.String destAbsPath)
Move Asset to the desired location.
|
void |
removeAsset(java.lang.String assetPath)
Remove
Asset if exists. |
Asset createAsset(java.lang.String path)
Asset
at the given path
.path
- Absolute path at which asset is to be created.AssetException
- If error occurs while creating an Asset or if Asset already existsAsset getAsset(java.lang.String assetPath)
Asset
at the given assetPath
.assetPath
- An absolute path of the AssetAssetException
- If an error occurs trying to load the Asset objectAsset getAssetByIdentifier(java.lang.String id)
Asset
specified by the given Identifier
.id
- Asset identifierAssetException
- If an error occurs trying to load the Asset objectboolean assetExists(java.lang.String assetPath)
Asset
.assetPath
- Absolute path of the asset to be checkedvoid removeAsset(java.lang.String assetPath)
Asset
if exists.assetPath
- Absolute path of the asset to be removedAssetException
- If asset does not exist or cant be removedvoid copyAsset(java.lang.String assetPath, java.lang.String destAbsPath)
Eg:
//To copy Asset from /document/somedocument.pdf to /document/legal with name document.pdf
AssetManager#copy("/document/somedocument.pdf", "/document/legal/document.pdf");
assetPath
- Absolute path of the asset to be copieddestAbsPath
- Absolute path at with asset is to be copiedAssetException
- If an error occurs while copyingvoid moveAsset(java.lang.String assetPath, java.lang.String destAbsPath)
Eg:
// To move Asset from /document/somedocument.pdf to /document/legal with name document.pdf
AssetManager#move("/document/somedocument.pdf", "/document/legal/document.pdf");
assetPath
- Absolute path of the asset to be moveddestAbsPath
- Absolute path at with asset is to be movedAssetException
- If an error occurs while movingCopyright © 2010 - 2020 Adobe. All Rights Reserved