Interface ResourceAccessor
- All Known Implementing Classes:
OkHttpResourceAccessor
public interface ResourceAccessor
Interface used by the shape trees core for accessing individual
InstanceResources.
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 specificInstanceResourceidentified by the providedresourceUrl.deleteResource(ShapeTreeContext context, InstanceResource deleteResource) Deletes a specificInstanceResourceidentified by the providedupdatedResourcegetResource(ShapeTreeContext context, URL resourceUrl) Gets a specificInstanceResourceidentified by the providedresourceUrl.updateResource(ShapeTreeContext context, InstanceResource updatedResource, String body) Updates a specificInstanceResourceidentified by the providedupdatedResource
-
Method Details
-
getResource
Gets a specificInstanceResourceidentified by the providedresourceUrl.- Parameters:
context-ShapeTreeContextresourceUrl- 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 specificInstanceResourceidentified by the providedresourceUrl.- Parameters:
context-ShapeTreeContextresourceUrl- 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 specificInstanceResourceidentified by the providedupdatedResource- Parameters:
context-ShapeTreeContextupdatedResource-InstanceResourceto updatebody- Updated body of theInstanceResource- Returns:
- Updated
InstanceResource - Throws:
ShapeTreeException
-
deleteResource
DocumentResponse deleteResource(ShapeTreeContext context, InstanceResource deleteResource) throws ShapeTreeException Deletes a specificInstanceResourceidentified by the providedupdatedResource- Parameters:
context-ShapeTreeContextdeleteResource-InstanceResourceto delete- Returns:
- Resultant
DocumentResponse - Throws:
ShapeTreeException
-