Interface CollectionResourceProvider
-
- All Known Implementing Classes:
DropwizardMetricsCollectionResourceProvider
,MemoryBackend
public interface CollectionResourceProvider
An implementation interface for resource providers which exposes a collection of resource instances. The resource collection supports the following operations:- action
- create - with an optional client provided resource ID as part of the request itself
- query
- action
- delete
- patch
- read
- update
NOTE: field filtering alters the structure of a JSON resource and MUST only be performed once while processing a request. It is therefore the responsibility of front-end implementations (e.g. HTTP listeners, Servlets, etc) to perform field filtering. Request handler and resource provider implementations SHOULD NOT filter fields, but MAY choose to optimise their processing in order to return a resource containing only the fields targeted by the field filters.
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default Promise<ActionResponse,ResourceException>
actionCollection(org.forgerock.services.context.Context context, ActionRequest request)
Performs the providedaction
against the resource collection.default Promise<ActionResponse,ResourceException>
actionInstance(org.forgerock.services.context.Context context, String resourceId, ActionRequest request)
Performs the providedaction
against a resource within the collection.default Promise<ResourceResponse,ResourceException>
createInstance(org.forgerock.services.context.Context context, CreateRequest request)
Adds
a new resource instance to the collection.default Promise<ResourceResponse,ResourceException>
deleteInstance(org.forgerock.services.context.Context context, String resourceId, DeleteRequest request)
Removes
a resource instance from the collection.default Promise<ResourceResponse,ResourceException>
patchInstance(org.forgerock.services.context.Context context, String resourceId, PatchRequest request)
Patches
an existing resource within the collection.default Promise<QueryResponse,ResourceException>
queryCollection(org.forgerock.services.context.Context context, QueryRequest request, QueryResourceHandler handler)
Searches
the collection for all resources which match the query request criteria.default Promise<ResourceResponse,ResourceException>
readInstance(org.forgerock.services.context.Context context, String resourceId, ReadRequest request)
Reads
an existing resource within the collection.default Promise<ResourceResponse,ResourceException>
updateInstance(org.forgerock.services.context.Context context, String resourceId, UpdateRequest request)
Updates
an existing resource within the collection.
-
-
-
Method Detail
-
actionCollection
default Promise<ActionResponse,ResourceException> actionCollection(org.forgerock.services.context.Context context, ActionRequest request)
Performs the providedaction
against the resource collection.- Parameters:
context
- The request server context.request
- The action request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
RequestHandler.handleAction(Context, ActionRequest)
-
actionInstance
default Promise<ActionResponse,ResourceException> actionInstance(org.forgerock.services.context.Context context, String resourceId, ActionRequest request)
Performs the providedaction
against a resource within the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The action request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
RequestHandler.handleAction(Context, ActionRequest)
-
createInstance
default Promise<ResourceResponse,ResourceException> createInstance(org.forgerock.services.context.Context context, CreateRequest request)
Adds
a new resource instance to the collection.Create requests are targeted at the collection itself and may include a user-provided resource ID for the new resource as part of the request itself. The user-provider resource ID may be accessed using the method
CreateRequest.getNewResourceId()
.- Parameters:
context
- The request server context.request
- The create request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
RequestHandler.handleCreate(Context, CreateRequest)
,CreateRequest.getNewResourceId()
-
deleteInstance
default Promise<ResourceResponse,ResourceException> deleteInstance(org.forgerock.services.context.Context context, String resourceId, DeleteRequest request)
Removes
a resource instance from the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The delete request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
RequestHandler.handleDelete(Context, DeleteRequest)
-
patchInstance
default Promise<ResourceResponse,ResourceException> patchInstance(org.forgerock.services.context.Context context, String resourceId, PatchRequest request)
Patches
an existing resource within the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The patch request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
RequestHandler.handlePatch(Context, PatchRequest)
-
queryCollection
default Promise<QueryResponse,ResourceException> queryCollection(org.forgerock.services.context.Context context, QueryRequest request, QueryResourceHandler handler)
Searches
the collection for all resources which match the query request criteria.Implementations must invoke
QueryResourceHandler.handleResource(ResourceResponse)
for each resource which matches the query criteria. Once all matching resources have been returned implementations are required to return either aQueryResponse
if the query has completed successfully, orResourceException
if the query did not complete successfully (even if some matching resources were returned).- Parameters:
context
- The request server context.request
- The query request.handler
- The query resource handler to be notified for each matching resource.- Returns:
- A
Promise
containing the result of the operation. - See Also:
RequestHandler.handleQuery(Context, QueryRequest, QueryResourceHandler)
-
readInstance
default Promise<ResourceResponse,ResourceException> readInstance(org.forgerock.services.context.Context context, String resourceId, ReadRequest request)
Reads
an existing resource within the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The read request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
RequestHandler.handleRead(Context, ReadRequest)
-
updateInstance
default Promise<ResourceResponse,ResourceException> updateInstance(org.forgerock.services.context.Context context, String resourceId, UpdateRequest request)
Updates
an existing resource within the collection.- Parameters:
context
- The request server context.resourceId
- The ID of the targeted resource within the collection.request
- The update request.- Returns:
- A
Promise
containing the result of the operation. - See Also:
RequestHandler.handleUpdate(Context, UpdateRequest)
-
-