public final class MemoryBackend extends Object implements CollectionResourceProvider
Map
to
store resources. This resource provider is intended for testing purposes only
and there are no performance guarantees.Constructor and Description |
---|
MemoryBackend()
Creates a new in-memory collection containing no resources.
|
public MemoryBackend()
public Promise<ActionResponse,ResourceException> actionCollection(Context context, ActionRequest request)
action
against the resource collection.actionCollection
in interface CollectionResourceProvider
context
- The request server context.request
- The action request.Promise
containing the result of the operation.RequestHandler.handleAction(Context, ActionRequest)
public Promise<ActionResponse,ResourceException> actionInstance(Context context, String id, ActionRequest request)
action
against a resource within the collection.actionInstance
in interface CollectionResourceProvider
context
- The request server context.id
- The ID of the targeted resource within the collection.request
- The action request.Promise
containing the result of the operation.RequestHandler.handleAction(Context, ActionRequest)
public Promise<ResourceResponse,ResourceException> createInstance(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()
.
createInstance
in interface CollectionResourceProvider
context
- The request server context.request
- The create request.Promise
containing the result of the operation.RequestHandler.handleCreate(Context, CreateRequest)
,
CreateRequest.getNewResourceId()
public Promise<ResourceResponse,ResourceException> deleteInstance(Context context, String id, DeleteRequest request)
Removes
a resource instance from the collection.deleteInstance
in interface CollectionResourceProvider
context
- The request server context.id
- The ID of the targeted resource within the collection.request
- The delete request.Promise
containing the result of the operation.RequestHandler.handleDelete(Context, DeleteRequest)
public Promise<ResourceResponse,ResourceException> patchInstance(Context context, String id, PatchRequest request)
Patches
an existing resource within the collection.patchInstance
in interface CollectionResourceProvider
context
- The request server context.id
- The ID of the targeted resource within the collection.request
- The patch request.Promise
containing the result of the operation.RequestHandler.handlePatch(Context, PatchRequest)
public Promise<QueryResponse,ResourceException> queryCollection(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 a
QueryResponse
if the query has completed successfully, or
ResourceException
if the query did not complete successfully
(even if some matching resources were returned).
queryCollection
in interface CollectionResourceProvider
context
- The request server context.request
- The query request.handler
- The query resource handler to be notified for each matching
resource.Promise
containing the result of the operation.RequestHandler.handleQuery(Context, QueryRequest, QueryResourceHandler)
public Promise<ResourceResponse,ResourceException> readInstance(Context context, String id, ReadRequest request)
Reads
an existing resource within the collection.readInstance
in interface CollectionResourceProvider
context
- The request server context.id
- The ID of the targeted resource within the collection.request
- The read request.Promise
containing the result of the operation.RequestHandler.handleRead(Context, ReadRequest)
public Promise<ResourceResponse,ResourceException> updateInstance(Context context, String id, UpdateRequest request)
Updates
an existing resource within the collection.updateInstance
in interface CollectionResourceProvider
context
- The request server context.id
- The ID of the targeted resource within the collection.request
- The update request.Promise
containing the result of the operation.RequestHandler.handleUpdate(Context, UpdateRequest)
Copyright © 2010-2018, ForgeRock All Rights Reserved.