Class DescribedSyncRequestHandlerAdapter
- java.lang.Object
-
- org.forgerock.json.resource.DescribedSyncRequestHandlerAdapter
-
- All Implemented Interfaces:
RequestHandler,org.forgerock.services.descriptor.Describable<org.forgerock.api.models.ApiDescription,Request>
public class DescribedSyncRequestHandlerAdapter extends Object implements org.forgerock.services.descriptor.Describable<org.forgerock.api.models.ApiDescription,Request>
Version ofSynchronousRequestHandlerAdapterthat exposes a described handler.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDescriptorListener(org.forgerock.services.descriptor.Describable.Listener listener)org.forgerock.api.models.ApiDescriptionapi(org.forgerock.http.ApiProducer<org.forgerock.api.models.ApiDescription> producer)Promise<ActionResponse,ResourceException>handleAction(org.forgerock.services.context.Context context, ActionRequest request)Handles performing an action on a resource, and optionally returns an associated result.org.forgerock.api.models.ApiDescriptionhandleApiRequest(org.forgerock.services.context.Context context, Request request)Promise<ResourceResponse,ResourceException>handleCreate(org.forgerock.services.context.Context context, CreateRequest request)Adds a new JSON resource, returning aPromisethat will be completed when the resource has been added.Promise<ResourceResponse,ResourceException>handleDelete(org.forgerock.services.context.Context context, DeleteRequest request)Deletes a JSON resource, returning aPromisethat will be completed when the resource has been deleted.Promise<ResourceResponse,ResourceException>handlePatch(org.forgerock.services.context.Context context, PatchRequest request)Updates a JSON resource by applying a set of changes to its existing content, returning aPromisethat will be completed when the resource has been updated.Promise<QueryResponse,ResourceException>handleQuery(org.forgerock.services.context.Context context, QueryRequest request, QueryResourceHandler handler)Searches for all JSON resources matching a user specified set of criteria, returning aPromisethat will be completed when the search has completed.Promise<ResourceResponse,ResourceException>handleRead(org.forgerock.services.context.Context context, ReadRequest request)Reads a JSON resource, returning aPromisethat will be completed when the resource has been read.Promise<ResourceResponse,ResourceException>handleUpdate(org.forgerock.services.context.Context context, UpdateRequest request)Updates a JSON resource by replacing its existing content with new content, returning aPromisethat will be completed when the resource has been updated.voidremoveDescriptorListener(org.forgerock.services.descriptor.Describable.Listener listener)
-
-
-
Method Detail
-
api
public org.forgerock.api.models.ApiDescription api(org.forgerock.http.ApiProducer<org.forgerock.api.models.ApiDescription> producer)
- Specified by:
apiin interfaceorg.forgerock.services.descriptor.Describable<org.forgerock.api.models.ApiDescription,Request>
-
handleApiRequest
public org.forgerock.api.models.ApiDescription handleApiRequest(org.forgerock.services.context.Context context, Request request)- Specified by:
handleApiRequestin interfaceorg.forgerock.services.descriptor.Describable<org.forgerock.api.models.ApiDescription,Request>
-
addDescriptorListener
public void addDescriptorListener(org.forgerock.services.descriptor.Describable.Listener listener)
- Specified by:
addDescriptorListenerin interfaceorg.forgerock.services.descriptor.Describable<org.forgerock.api.models.ApiDescription,Request>
-
removeDescriptorListener
public void removeDescriptorListener(org.forgerock.services.descriptor.Describable.Listener listener)
- Specified by:
removeDescriptorListenerin interfaceorg.forgerock.services.descriptor.Describable<org.forgerock.api.models.ApiDescription,Request>
-
handleUpdate
public Promise<ResourceResponse,ResourceException> handleUpdate(org.forgerock.services.context.Context context, UpdateRequest request)
Description copied from interface:RequestHandlerUpdates a JSON resource by replacing its existing content with new content, returning aPromisethat will be completed when the resource has been updated.Update expects failure the following failure exceptions:
ForbiddenExceptionif access to the resource is forbiddenNotSupportedExceptionif the requested functionality is not implemented/supportedPreconditionRequiredExceptionif version is required, but isnullPreconditionFailedExceptionif version did not match the existing resourceBadRequestExceptionif the passed identifier or filter is invalidNotFoundExceptionif the specified resource could not be found.
- Specified by:
handleUpdatein interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.request- The update request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleRead
public Promise<ResourceResponse,ResourceException> handleRead(org.forgerock.services.context.Context context, ReadRequest request)
Description copied from interface:RequestHandlerReads a JSON resource, returning aPromisethat will be completed when the resource has been read.Read expects failure exceptions as follows:
ForbiddenExceptionif access to the resource is forbidden.NotSupportedExceptionif the requested functionality is not implemented/supportedBadRequestExceptionif the passed identifier or filter is invalidNotFoundExceptionif the specified resource could not be found.
- Specified by:
handleReadin interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.request- The read request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleQuery
public Promise<QueryResponse,ResourceException> handleQuery(org.forgerock.services.context.Context context, QueryRequest request, QueryResourceHandler handler)
Description copied from interface:RequestHandlerSearches for all JSON resources matching a user specified set of criteria, returning aPromisethat will be completed when the search has completed.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).Query expects failure exceptions as follows:
ForbiddenExceptionif access to the resource is forbiddenNotSupportedExceptionif the requested functionality is not implemented/supportedBadRequestExceptionif the passed identifier, parameters or filter is invalidNotFoundExceptionif the specified resource could not be found
- Specified by:
handleQueryin interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.request- The query request.handler- The query resource handler to be notified for each matching resource.- Returns:
- A
Promisecontaining the result of the operation.
-
handlePatch
public Promise<ResourceResponse,ResourceException> handlePatch(org.forgerock.services.context.Context context, PatchRequest request)
Description copied from interface:RequestHandlerUpdates a JSON resource by applying a set of changes to its existing content, returning aPromisethat will be completed when the resource has been updated.Patch expects failure exceptions as follows:
ForbiddenExceptionif access to the resource is forbiddenNotSupportedExceptionif the requested functionality is not implemented/supportedPreconditionRequiredExceptionif version is required, but isnullPreconditionFailedExceptionif version did not match the existing resourceBadRequestExceptionif the passed identifier or filter is invalidNotFoundExceptionif the specified resource could not be foundConflictExceptionif patch could not be applied for the given resource state.
- Specified by:
handlePatchin interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.request- The patch request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleDelete
public Promise<ResourceResponse,ResourceException> handleDelete(org.forgerock.services.context.Context context, DeleteRequest request)
Description copied from interface:RequestHandlerDeletes a JSON resource, returning aPromisethat will be completed when the resource has been deleted.Delete expects failure exceptions as follows:
ForbiddenExceptionif access to the resource is forbiddenNotSupportedExceptionif the requested functionality is not implemented/supportedBadRequestExceptionif the passed identifier is invalidNotFoundExceptionif the specified resource could not be foundPreconditionRequiredExceptionif version is required, but isnullPreconditionFailedExceptionif version did not match the existing resource.
- Specified by:
handleDeletein interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.request- The delete request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleCreate
public Promise<ResourceResponse,ResourceException> handleCreate(org.forgerock.services.context.Context context, CreateRequest request)
Description copied from interface:RequestHandlerAdds a new JSON resource, returning aPromisethat will be completed when the resource has been added.Create expects failure exceptions as follows:
CreateNotSupportedExceptionif create is not implemented or supported by the RequestHandler.ForbiddenExceptionif access to the resource is forbidden.NotSupportedExceptionif the requested functionality is not implemented/supportedPreconditionFailedExceptionif a resource with the same ID already existsBadRequestExceptionif the passed identifier or value is invalidNotFoundExceptionif the specified id could not be resolved, for example when an intermediate resource in the hierarchy does not exist.
- Specified by:
handleCreatein interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.request- The create request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleAction
public Promise<ActionResponse,ResourceException> handleAction(org.forgerock.services.context.Context context, ActionRequest request)
Description copied from interface:RequestHandlerHandles performing an action on a resource, and optionally returns an associated result. The execution of an action is allowed to incur side effects.Actions are parametric; a set of named parameters is provided as input to the action. The action result is a JSON object structure composed of basic Java types; its overall structure is defined by a specific implementation.
On completion, the action result (or null) must be used to complete the returned
Promise. On failure, the returnedPromisemust be completed with the exception.Action expects failure exceptions as follows:
ForbiddenExceptionif access to the resource is forbidden.NotSupportedExceptionif the requested functionality is not implemented/supportedBadRequestExceptionif the passed identifier, parameters or filter is invalidNotFoundExceptionif the specified resource could not be found.- Specified by:
handleActionin interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.request- The action request.- Returns:
- A
Promisecontaining the result of the operation.
-
-