Package com.adobe.granite.asset.api
Interface AssetManager
-
@ProviderType public interface AssetManager
AssetManager
is a primary interface which provides methods to manageAsset
s.AssetManager is created by adapting
ResourceResolver
toAssetManager
AssetManager assetManager = resolver.adaptTo(AssetManager.class);
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
assetExists(java.lang.String assetPath)
Checks for the existence of anAsset
.void
copyAsset(java.lang.String assetPath, java.lang.String destAbsPath)
Copy Asset to the desired location.Asset
createAsset(java.lang.String path)
Creates a newAsset
at the givenpath
.Asset
getAsset(java.lang.String assetPath)
GetAsset
at the givenassetPath
.Asset
getAssetByIdentifier(java.lang.String id)
GetAsset
specified by the givenIdentifier
.void
moveAsset(java.lang.String assetPath, java.lang.String destAbsPath)
Move Asset to the desired location.void
removeAsset(java.lang.String assetPath)
RemoveAsset
if exists.
-
-
-
Method Detail
-
createAsset
Asset createAsset(java.lang.String path)
Creates a newAsset
at the givenpath
.- Parameters:
path
- Absolute path at which asset is to be created.- Returns:
- The newly created asset
- Throws:
AssetException
- If error occurs while creating an Asset or if Asset already exists
-
getAsset
Asset getAsset(java.lang.String assetPath)
GetAsset
at the givenassetPath
.- Parameters:
assetPath
- An absolute path of the Asset- Returns:
- Asset if found otherwise null
- Throws:
AssetException
- If an error occurs trying to load the Asset object
-
getAssetByIdentifier
Asset getAssetByIdentifier(java.lang.String id)
GetAsset
specified by the givenIdentifier
.- Parameters:
id
- Asset identifier- Returns:
- Asset if found otherwise null
- Throws:
AssetException
- If an error occurs trying to load the Asset object
-
assetExists
boolean assetExists(java.lang.String assetPath)
Checks for the existence of anAsset
.- Parameters:
assetPath
- Absolute path of the asset to be checked- Returns:
- true if the Asset exist at the specified path
-
removeAsset
void removeAsset(java.lang.String assetPath)
RemoveAsset
if exists.- Parameters:
assetPath
- Absolute path of the asset to be removed- Throws:
AssetException
- If asset does not exist or cant be removed
-
copyAsset
void copyAsset(java.lang.String assetPath, java.lang.String destAbsPath)
Copy Asset to the desired location.Eg: //To copy Asset from /document/somedocument.pdf to /document/legal with name document.pdf AssetManager#copy("/document/somedocument.pdf", "/document/legal/document.pdf");
- Parameters:
assetPath
- Absolute path of the asset to be copieddestAbsPath
- Absolute path at with asset is to be copied- Throws:
AssetException
- If an error occurs while copying
-
moveAsset
void moveAsset(java.lang.String assetPath, java.lang.String destAbsPath)
Move Asset to the desired location.Eg: // To move Asset from /document/somedocument.pdf to /document/legal with name document.pdf AssetManager#move("/document/somedocument.pdf", "/document/legal/document.pdf");
- Parameters:
assetPath
- Absolute path of the asset to be moveddestAbsPath
- Absolute path at with asset is to be moved- Throws:
AssetException
- If an error occurs while moving
-
-