Package org.forgerock.json.resource
Class MemoryBackend
- java.lang.Object
- 
- org.forgerock.json.resource.MemoryBackend
 
- 
- All Implemented Interfaces:
- CollectionResourceProvider
 
 public final class MemoryBackend extends Object implements CollectionResourceProvider A simple in-memory collection resource provider which uses aMapto store resources. This resource provider is intended for testing purposes only and there are no performance guarantees.
- 
- 
Constructor SummaryConstructors Constructor Description MemoryBackend()Creates a new in-memory collection containing no resources.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Promise<ActionResponse,ResourceException>actionCollection(Context context, ActionRequest request)Performs the providedactionagainst the resource collection.Promise<ActionResponse,ResourceException>actionInstance(Context context, String id, ActionRequest request)Performs the providedactionagainst a resource within the collection.Promise<ResourceResponse,ResourceException>createInstance(Context context, CreateRequest request)Addsa new resource instance to the collection.Promise<ResourceResponse,ResourceException>deleteInstance(Context context, String id, DeleteRequest request)Removesa resource instance from the collection.Promise<ResourceResponse,ResourceException>patchInstance(Context context, String id, PatchRequest request)Patchesan existing resource within the collection.Promise<QueryResponse,ResourceException>queryCollection(Context context, QueryRequest request, QueryResourceHandler handler)Searchesthe collection for all resources which match the query request criteria.Promise<ResourceResponse,ResourceException>readInstance(Context context, String id, ReadRequest request)Readsan existing resource within the collection.Promise<ResourceResponse,ResourceException>updateInstance(Context context, String id, UpdateRequest request)Updatesan existing resource within the collection.
 
- 
- 
- 
Method Detail- 
actionCollectionpublic Promise<ActionResponse,ResourceException> actionCollection(Context context, ActionRequest request) Performs the providedactionagainst the resource collection.- Specified by:
- actionCollectionin interface- CollectionResourceProvider
- Parameters:
- context- The request server context.
- request- The action request.
- Returns:
- A Promisecontaining the result of the operation.
- See Also:
- RequestHandler.handleAction(Context, ActionRequest)
 
 - 
actionInstancepublic Promise<ActionResponse,ResourceException> actionInstance(Context context, String id, ActionRequest request) Performs the providedactionagainst a resource within the collection.- Specified by:
- actionInstancein interface- CollectionResourceProvider
- Parameters:
- context- The request server context.
- id- The ID of the targeted resource within the collection.
- request- The action request.
- Returns:
- A Promisecontaining the result of the operation.
- See Also:
- RequestHandler.handleAction(Context, ActionRequest)
 
 - 
createInstancepublic Promise<ResourceResponse,ResourceException> createInstance(Context context, CreateRequest request) Addsa 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().- Specified by:
- createInstancein interface- CollectionResourceProvider
- Parameters:
- context- The request server context.
- request- The create request.
- Returns:
- A Promisecontaining the result of the operation.
- See Also:
- RequestHandler.handleCreate(Context, CreateRequest),- CreateRequest.getNewResourceId()
 
 - 
deleteInstancepublic Promise<ResourceResponse,ResourceException> deleteInstance(Context context, String id, DeleteRequest request) Removesa resource instance from the collection.- Specified by:
- deleteInstancein interface- CollectionResourceProvider
- Parameters:
- context- The request server context.
- id- The ID of the targeted resource within the collection.
- request- The delete request.
- Returns:
- A Promisecontaining the result of the operation.
- See Also:
- RequestHandler.handleDelete(Context, DeleteRequest)
 
 - 
patchInstancepublic Promise<ResourceResponse,ResourceException> patchInstance(Context context, String id, PatchRequest request) Patchesan existing resource within the collection.- Specified by:
- patchInstancein interface- CollectionResourceProvider
- Parameters:
- context- The request server context.
- id- The ID of the targeted resource within the collection.
- request- The patch request.
- Returns:
- A Promisecontaining the result of the operation.
- See Also:
- RequestHandler.handlePatch(Context, PatchRequest)
 
 - 
queryCollectionpublic Promise<QueryResponse,ResourceException> queryCollection(Context context, QueryRequest request, QueryResourceHandler handler) Searchesthe 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 aQueryResponseif the query has completed successfully, orResourceExceptionif the query did not complete successfully (even if some matching resources were returned).- Specified by:
- queryCollectionin interface- CollectionResourceProvider
- Parameters:
- context- The request server context.
- request- The query request.
- handler- The query resource handler to be notified for each matching resource.
- Returns:
- A Promisecontaining the result of the operation.
- See Also:
- RequestHandler.handleQuery(Context, QueryRequest, QueryResourceHandler)
 
 - 
readInstancepublic Promise<ResourceResponse,ResourceException> readInstance(Context context, String id, ReadRequest request) Readsan existing resource within the collection.- Specified by:
- readInstancein interface- CollectionResourceProvider
- Parameters:
- context- The request server context.
- id- The ID of the targeted resource within the collection.
- request- The read request.
- Returns:
- A Promisecontaining the result of the operation.
- See Also:
- RequestHandler.handleRead(Context, ReadRequest)
 
 - 
updateInstancepublic Promise<ResourceResponse,ResourceException> updateInstance(Context context, String id, UpdateRequest request) Updatesan existing resource within the collection.- Specified by:
- updateInstancein interface- CollectionResourceProvider
- Parameters:
- context- The request server context.
- id- The ID of the targeted resource within the collection.
- request- The update request.
- Returns:
- A Promisecontaining the result of the operation.
- See Also:
- RequestHandler.handleUpdate(Context, UpdateRequest)
 
 
- 
 
-