Package com.adobe.granite.rest
Interface ApiResourceProvider
-
@ConsumerType public interface ApiResourceProvider
Interface for providers of API resources which are instantiated byApiResourceProviderFactory.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Resourcecreate(ResourceResolver resolver, java.lang.String path, java.util.Map<java.lang.String,java.lang.Object> properties)Create a new resource at the given path.voiddelete(ResourceResolver resolver, java.lang.String path)Delete the resource at the given path.ResourcegetResource(ResourceResolver resourceResolver, java.lang.String path)Returns a resource from this resource provider ornullif the resource provider cannot find it.java.util.Iterator<Resource>listChildren(Resource parent)
-
-
-
Method Detail
-
getResource
Resource getResource(ResourceResolver resourceResolver, java.lang.String path)
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
java.util.Iterator<Resource> listChildren(Resource parent)
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.
-
create
Resource create(ResourceResolver resolver, java.lang.String path, java.util.Map<java.lang.String,java.lang.Object> properties) throws PersistenceException
Create 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
void delete(ResourceResolver resolver, java.lang.String path) throws PersistenceException
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
-
-