Package com.adobe.granite.rest
Interface ResourceManager
-
@ConsumerType public interface ResourceManager
TheResourceManager
defines the API which might be asked to find, copy, move and delete specificresources
.Implementors should ensure that a ResourceManager can be retrieved adapting a
SlingHttpServletRequest
by implementing anAdapterFactory
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
copy(Resource resource, java.lang.String destUri, int depth)
Copies all properties and resources of the implementor to thedestUri
.java.util.List<Resource>
find(Resource resource, java.lang.String query)
Returns the query result from the providedquery
statement as aList
.boolean
move(Resource resource, java.lang.String destUri)
Moves all properties and resources of the implementor to thedestUri
.
-
-
-
Method Detail
-
copy
boolean copy(Resource resource, java.lang.String destUri, int depth) throws java.lang.UnsupportedOperationException, RequestException, RestException
Copies all properties and resources of the implementor to thedestUri
. The method expects thedestUri
to be a non-remote URI, absolute, normalized and within the same name space as theresource
.The method should throw a
RequestException
with a HTTP status 403 if the destination is not part of the resources ResourceProvider name space. If the parent resource of the destination does not exist the method should throw aRequestException
with the HTTP status code 412. In case an error occurs while copying one of the resources child elements aRequestException
with HTTP status code 207 pointing to the failing resource should be thrown.- Parameters:
resource
- Resource to copydestUri
- Destination URI to copy resource todepth
- Depth value indicating the depth of the copy. A value of -1 is equal to infinite, a value of 0 indicates that only the resource itself and its properties should be copied but no children.- Returns:
true
if destination has been created,false
if it has been overwritten.- Throws:
java.lang.UnsupportedOperationException
- If the operation is not supported for theresource
RequestException
- if a precondition for the operation is not metRestException
- if an error occurs during the operation
-
move
boolean move(Resource resource, java.lang.String destUri) throws java.lang.UnsupportedOperationException, RequestException, RestException
Moves all properties and resources of the implementor to thedestUri
. The method expects thedestUri
to be a non-remote URI, absolute, normalized and within the same name space as theresource
. The method should throw aRequestException
with a HTTP status 403 if the destination is not part of the resources ResourceProvider name space. If the parent resource of the destination does not exist the method should throw aRequestException
with the HTTP status code 412. In case an error occurs while copying one of the resources child elements aRequestException
with HTTP status code 207 pointing to the failing resource should be thrown.- Parameters:
resource
- Resource to movedestUri
- Destination URI to move resource to- Returns:
true
if destination has been created,false
if it has been overwritten.- Throws:
java.lang.UnsupportedOperationException
- If the operation is not supported for theresource
RequestException
- if a precondition for the operation is not metRestException
- if an error occurs during the operation
-
find
java.util.List<Resource> find(Resource resource, java.lang.String query) throws java.lang.UnsupportedOperationException, RequestException, RestException
Returns the query result from the providedquery
statement as aList
.- Parameters:
resource
- Base resource. Is used as a starting point in the tree to search from.query
- Query statement- Returns:
- A
List
ofresources
found matching the query - Throws:
java.lang.UnsupportedOperationException
- If the operation is not supported for theresource
RequestException
- if a precondition for the operation is not metRestException
- if an error occurs during the search
-
-