Package org.forgerock.json.resource
Class AbstractAsynchronousConnection
java.lang.Object
org.forgerock.json.resource.AbstractAsynchronousConnection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Connection
An abstract connection whose synchronous methods are implemented in terms of
asynchronous methods.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a new abstract asynchronous connection. -
Method Summary
Modifier and TypeMethodDescriptionaction
(org.forgerock.services.context.Context context, ActionRequest request) Performs an action against a specific resource, or set of resources.create
(org.forgerock.services.context.Context context, CreateRequest request) Adds a new JSON resource.delete
(org.forgerock.services.context.Context context, DeleteRequest request) Deletes a JSON resource.patch
(org.forgerock.services.context.Context context, PatchRequest request) Updates a JSON resource by applying a set of changes to its existing content.query
(org.forgerock.services.context.Context context, QueryRequest request, Collection<? super ResourceResponse> results) Searches for all JSON resources matching a user specified set of criteria, and places the results in the provided collection.query
(org.forgerock.services.context.Context context, QueryRequest request, QueryResourceHandler handler) Searches for all JSON resources matching a user specified set of criteria, and returns aPromise
that will be completed with the results of the search.read
(org.forgerock.services.context.Context context, ReadRequest request) Reads a JSON resource.update
(org.forgerock.services.context.Context context, UpdateRequest request) Updates a JSON resource by replacing its existing content with new content.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.forgerock.json.resource.Connection
actionAsync, close, createAsync, deleteAsync, isClosed, isValid, patchAsync, queryAsync, readAsync, updateAsync
-
Constructor Details
-
AbstractAsynchronousConnection
protected AbstractAsynchronousConnection()Creates a new abstract asynchronous connection.
-
-
Method Details
-
action
public ActionResponse action(org.forgerock.services.context.Context context, ActionRequest request) throws ResourceException Description copied from interface:Connection
Performs an action against a specific resource, or set of resources. Bulk updates are an example of an action request.- Specified by:
action
in interfaceConnection
- Parameters:
context
- The request context, such as associated principal.request
- The action request.- Returns:
- A JSON object containing the result of the action, the content of which is specified by the action.
- Throws:
ResourceException
- If the action could not be performed.
-
create
public ResourceResponse create(org.forgerock.services.context.Context context, CreateRequest request) throws ResourceException Description copied from interface:Connection
Adds a new JSON resource.- Specified by:
create
in interfaceConnection
- Parameters:
context
- The request context, such as associated principal.request
- The create request.- Returns:
- The newly created JSON resource.
- Throws:
ResourceException
- If the JSON resource could not be created.
-
delete
public ResourceResponse delete(org.forgerock.services.context.Context context, DeleteRequest request) throws ResourceException Description copied from interface:Connection
Deletes a JSON resource.- Specified by:
delete
in interfaceConnection
- Parameters:
context
- The request context, such as associated principal.request
- The delete request.- Returns:
- The deleted JSON resource.
- Throws:
ResourceException
- If the JSON resource could not be deleted.
-
patch
public ResourceResponse patch(org.forgerock.services.context.Context context, PatchRequest request) throws ResourceException Description copied from interface:Connection
Updates a JSON resource by applying a set of changes to its existing content.- Specified by:
patch
in interfaceConnection
- Parameters:
context
- The request context, such as associated principal.request
- The update request.- Returns:
- The updated JSON resource.
- Throws:
ResourceException
- If the JSON resource could not be updated.
-
query
public QueryResponse query(org.forgerock.services.context.Context context, QueryRequest request, QueryResourceHandler handler) throws ResourceException Description copied from interface:Connection
Searches for all JSON resources matching a user specified set of criteria, and returns aPromise
that will be completed with the results of the search.Result processing happens-before this method returns to the caller.
- Specified by:
query
in interfaceConnection
- Parameters:
context
- The request context, such as associated principal.request
- The query request.handler
- A query resource handler which can be used to process matching resources as they are received.- Returns:
- The query result.
- Throws:
ResourceException
- If the query could not be performed.
-
query
public QueryResponse query(org.forgerock.services.context.Context context, QueryRequest request, Collection<? super ResourceResponse> results) throws ResourceException Description copied from interface:Connection
Searches for all JSON resources matching a user specified set of criteria, and places the results in the provided collection.- Specified by:
query
in interfaceConnection
- Parameters:
context
- The request context, such as associated principal.request
- The query request.results
- A collection into which matching resources will be added as they are received.- Returns:
- The query result.
- Throws:
ResourceException
- If the query could not be performed.
-
read
public ResourceResponse read(org.forgerock.services.context.Context context, ReadRequest request) throws ResourceException Description copied from interface:Connection
Reads a JSON resource.- Specified by:
read
in interfaceConnection
- Parameters:
context
- The request context, such as associated principal.request
- The read request.- Returns:
- The JSON resource.
- Throws:
ResourceException
- If the JSON resource could not be read.
-
update
public ResourceResponse update(org.forgerock.services.context.Context context, UpdateRequest request) throws ResourceException Description copied from interface:Connection
Updates a JSON resource by replacing its existing content with new content.- Specified by:
update
in interfaceConnection
- Parameters:
context
- The request context, such as associated principal.request
- The update request.- Returns:
- The updated JSON resource.
- Throws:
ResourceException
- If the JSON resource could not be updated.
-