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 Resource
create(ResourceResolver resolver, java.lang.String path, java.util.Map<java.lang.String,java.lang.Object> properties)
Create a new resource at the given path.void
delete(ResourceResolver resolver, java.lang.String path)
Delete the resource at the given path.Resource
getResource(ResourceResolver resourceResolver, java.lang.String path)
Returns a resource from this resource provider ornull
if 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 ornull
if the resource provider cannot find it. The path does not come with any prefix.- Parameters:
resourceResolver
- TheResourceResolver
to which the returnedResource
is attached.path
- The resource path.- Returns:
null
If this provider does not have a resource for the path.
-
listChildren
java.util.Iterator<Resource> listChildren(Resource parent)
Returns anjava.util.Iterator
ofResource
objects loaded from the children of the givenResource
. The returnedResource
instances are attached to the sameResourceResolver
as the givenparent
resource.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
SyntheticResource
objects 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
-
-