Class 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 Detail

      • AbstractAsynchronousConnection

        protected AbstractAsynchronousConnection()
        Creates a new abstract asynchronous connection.
    • Method Detail

      • 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 interface Connection
        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 interface Connection
        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 interface Connection
        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 interface Connection
        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 a Promise that will be completed with the results of the search.

        Result processing happens-before this method returns to the caller.

        Specified by:
        query in interface Connection
        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 interface Connection
        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 interface Connection
        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 interface Connection
        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.