Interface ResourceAccessor
- All Known Implementing Classes:
OkHttpResourceAccessor
public interface ResourceAccessor
Interface used by the shape trees core for accessing individual
InstanceResource
s.
Depending upon the context, this could be implemented by a ResourceAccessor
implementation
accessing a database or filesystem (typical of server-side processing), or by a ResourceAccessor
implementation that is working with remote resources over http (typical of client-side processing).
-
Method Summary
Modifier and TypeMethodDescriptioncreateResource
(ShapeTreeContext context, URL resourceUrl, ResourceAttributes headers, String body, String contentType) Creates a specificInstanceResource
identified by the providedresourceUrl
.deleteResource
(ShapeTreeContext context, InstanceResource deleteResource) Deletes a specificInstanceResource
identified by the providedupdatedResource
getResource
(ShapeTreeContext context, URL resourceUrl) Gets a specificInstanceResource
identified by the providedresourceUrl
.updateResource
(ShapeTreeContext context, InstanceResource updatedResource, String body) Updates a specificInstanceResource
identified by the providedupdatedResource
-
Method Details
-
getResource
Gets a specificInstanceResource
identified by the providedresourceUrl
.- Parameters:
context
-ShapeTreeContext
resourceUrl
- URL of the target resource to get- Returns:
InstanceResource
- Throws:
ShapeTreeException
-
createResource
InstanceResource createResource(ShapeTreeContext context, URL resourceUrl, ResourceAttributes headers, String body, String contentType) throws ShapeTreeException Creates a specificInstanceResource
identified by the providedresourceUrl
.- Parameters:
context
-ShapeTreeContext
resourceUrl
- URL of the resource to createheaders
- Incoming HTTP headersbody
- Body of the resource to createcontentType
- Content-type of the resource to create- Returns:
InstanceResource
- Throws:
ShapeTreeException
-
updateResource
DocumentResponse updateResource(ShapeTreeContext context, InstanceResource updatedResource, String body) throws ShapeTreeException Updates a specificInstanceResource
identified by the providedupdatedResource
- Parameters:
context
-ShapeTreeContext
updatedResource
-InstanceResource
to updatebody
- Updated body of theInstanceResource
- Returns:
- Updated
InstanceResource
- Throws:
ShapeTreeException
-
deleteResource
DocumentResponse deleteResource(ShapeTreeContext context, InstanceResource deleteResource) throws ShapeTreeException Deletes a specificInstanceResource
identified by the providedupdatedResource
- Parameters:
context
-ShapeTreeContext
deleteResource
-InstanceResource
to delete- Returns:
- Resultant
DocumentResponse
- Throws:
ShapeTreeException
-