Package org.forgerock.json.resource
Class AbstractAsynchronousConnection
- java.lang.Object
-
- org.forgerock.json.resource.AbstractAsynchronousConnection
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Connection
public abstract class AbstractAsynchronousConnection extends Object implements Connection
An abstract connection whose synchronous methods are implemented in terms of asynchronous methods.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAsynchronousConnection()Creates a new abstract asynchronous connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ActionResponseaction(Context context, ActionRequest request)Performs an action against a specific resource, or set of resources.ResourceResponsecreate(Context context, CreateRequest request)Adds a new JSON resource.ResourceResponsedelete(Context context, DeleteRequest request)Deletes a JSON resource.ResourceResponsepatch(Context context, PatchRequest request)Updates a JSON resource by applying a set of changes to its existing content.QueryResponsequery(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.QueryResponsequery(Context context, QueryRequest request, QueryResourceHandler handler)Searches for all JSON resources matching a user specified set of criteria, and returns aPromisethat will be completed with the results of the search.ResourceResponseread(Context context, ReadRequest request)Reads a JSON resource.ResourceResponseupdate(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
-
-
-
-
Method Detail
-
action
public ActionResponse action(Context context, ActionRequest request) throws ResourceException
Description copied from interface:ConnectionPerforms an action against a specific resource, or set of resources. Bulk updates are an example of an action request.- Specified by:
actionin 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(Context context, CreateRequest request) throws ResourceException
Description copied from interface:ConnectionAdds a new JSON resource.- Specified by:
createin 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(Context context, DeleteRequest request) throws ResourceException
Description copied from interface:ConnectionDeletes a JSON resource.- Specified by:
deletein 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(Context context, PatchRequest request) throws ResourceException
Description copied from interface:ConnectionUpdates a JSON resource by applying a set of changes to its existing content.- Specified by:
patchin 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(Context context, QueryRequest request, QueryResourceHandler handler) throws ResourceException
Description copied from interface:ConnectionSearches for all JSON resources matching a user specified set of criteria, and returns aPromisethat will be completed with the results of the search.Result processing happens-before this method returns to the caller.
- Specified by:
queryin 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(Context context, QueryRequest request, Collection<? super ResourceResponse> results) throws ResourceException
Description copied from interface:ConnectionSearches for all JSON resources matching a user specified set of criteria, and places the results in the provided collection.- Specified by:
queryin 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(Context context, ReadRequest request) throws ResourceException
Description copied from interface:ConnectionReads a JSON resource.- Specified by:
readin 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(Context context, UpdateRequest request) throws ResourceException
Description copied from interface:ConnectionUpdates a JSON resource by replacing its existing content with new content.- Specified by:
updatein 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.
-
-