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.
|
| Modifier and Type | Method and Description |
|---|---|
org.forgerock.util.promise.Promise<ActionResponse,ResourceException> |
actionCollection(org.forgerock.services.context.Context context,
ActionRequest request)
Performs the provided
action
against the resource collection. |
org.forgerock.util.promise.Promise<ActionResponse,ResourceException> |
actionInstance(org.forgerock.services.context.Context context,
String id,
ActionRequest request)
Performs the provided
action against a resource within the collection. |
org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> |
createInstance(org.forgerock.services.context.Context context,
CreateRequest request)
Adds a new resource instance to the collection. |
org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> |
deleteInstance(org.forgerock.services.context.Context context,
String id,
DeleteRequest request)
Removes a resource instance from the collection. |
org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> |
patchInstance(org.forgerock.services.context.Context context,
String id,
PatchRequest request)
Patches an existing resource within the collection. |
org.forgerock.util.promise.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. |
org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> |
readInstance(org.forgerock.services.context.Context context,
String id,
ReadRequest request)
Reads an existing resource within the collection. |
org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> |
updateInstance(org.forgerock.services.context.Context context,
String id,
UpdateRequest request)
Updates an existing resource within the collection. |
public MemoryBackend()
public org.forgerock.util.promise.Promise<ActionResponse,ResourceException> actionCollection(org.forgerock.services.context.Context context, ActionRequest request)
action
against the resource collection.actionCollection in interface CollectionResourceProvidercontext - The request server context.request - The action request.Promise containing the result of the operation.RequestHandler.handleAction(Context, ActionRequest)public org.forgerock.util.promise.Promise<ActionResponse,ResourceException> actionInstance(org.forgerock.services.context.Context context, String id, ActionRequest request)
action against a resource within the collection.actionInstance in interface CollectionResourceProvidercontext - 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 org.forgerock.util.promise.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().
createInstance in interface CollectionResourceProvidercontext - The request server context.request - The create request.Promise containing the result of the operation.RequestHandler.handleCreate(Context, CreateRequest),
CreateRequest.getNewResourceId()public org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> deleteInstance(org.forgerock.services.context.Context context, String id, DeleteRequest request)
Removes a resource instance from the collection.deleteInstance in interface CollectionResourceProvidercontext - 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 org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> patchInstance(org.forgerock.services.context.Context context, String id, PatchRequest request)
Patches an existing resource within the collection.patchInstance in interface CollectionResourceProvidercontext - 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 org.forgerock.util.promise.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 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 CollectionResourceProvidercontext - 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 org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> readInstance(org.forgerock.services.context.Context context, String id, ReadRequest request)
Reads an existing resource within the collection.readInstance in interface CollectionResourceProvidercontext - 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 org.forgerock.util.promise.Promise<ResourceResponse,ResourceException> updateInstance(org.forgerock.services.context.Context context, String id, UpdateRequest request)
Updates an existing resource within the collection.updateInstance in interface CollectionResourceProvidercontext - 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 © 2021 Open Identity Platform Community. All rights reserved.