Package com.adobe.granite.rest
Interface ApiResourceProvider
Interface for providers of API resources which are instantiated by
ApiResourceProviderFactory.-
Method Summary
Modifier and TypeMethodDescriptionCreate a new resource at the given path.voiddelete(ResourceResolver resolver, String path) Delete the resource at the given path.getResource(ResourceResolver resourceResolver, String path) Returns a resource from this resource provider ornullif the resource provider cannot find it.listChildren(Resource parent)
-
Method Details
-
getResource
Returns a resource from this resource provider ornullif the resource provider cannot find it. The path does not come with any prefix.- Parameters:
resourceResolver- TheResourceResolverto which the returnedResourceis attached.path- The resource path.- Returns:
nullIf this provider does not have a resource for the path.
-
listChildren
Returns anjava.util.IteratorofResourceobjects loaded from the children of the givenResource. The returnedResourceinstances are attached to the sameResourceResolveras the givenparentresource.The returned iterator may in turn contain resources which do not actually exist but are required to traverse the resource tree. Such resources SHOULD be
SyntheticResourceobjects whose resource type MUST be set toResourceProvider.RESOURCE_TYPE_SYNTHETIC.- Parameters:
parent- TheResourcewhose children are requested.- Returns:
- An
IteratorofResourceobjects ornullif the resource provider has no children for the given resource. - Throws:
NullPointerException- Ifparentisnull.
-
create
Resource create(ResourceResolver resolver, String path, Map<String, Object> properties) throws PersistenceExceptionCreate a new resource at the given path. The new resource is put into the transient space of the bound resource provider until itsResourceResolver.commit()is called.- Parameters:
resolver- The current resource resolver.path- The resource path.properties- Optional properties- Returns:
- The new resource.
- Throws:
PersistenceException- If anything fails
-
delete
Delete the resource at the given path. This change is kept in the transient space of the bound resource provider until itsResourceResolver.commit()is called.- Parameters:
resolver- The current resource resolver.path- The resource path.- Throws:
PersistenceException- If anything fails
-