Package com.adobe.granite.asset.api
Interface AssetManager
-
@ProviderType public interface AssetManagerAssetManageris a primary interface which provides methods to manageAssets.AssetManager is created by adapting
ResourceResolvertoAssetManagerAssetManager assetManager = resolver.adaptTo(AssetManager.class);
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanassetExists(java.lang.String assetPath)Checks for the existence of anAsset.voidcopyAsset(java.lang.String assetPath, java.lang.String destAbsPath)Copy Asset to the desired location.AssetcreateAsset(java.lang.String path)Creates a newAssetat the givenpath.AssetgetAsset(java.lang.String assetPath)GetAssetat the givenassetPath.AssetgetAssetByIdentifier(java.lang.String id)GetAssetspecified by the givenIdentifier.voidmoveAsset(java.lang.String assetPath, java.lang.String destAbsPath)Move Asset to the desired location.voidremoveAsset(java.lang.String assetPath)RemoveAssetif exists.
-
-
-
Method Detail
-
createAsset
Asset createAsset(java.lang.String path)
Creates a newAssetat 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)
GetAssetat 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)
GetAssetspecified 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)
RemoveAssetif 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
-
-