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​(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.
      • patch

        public ResourceResponse patch​(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​(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​(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.
      • update

        public ResourceResponse update​(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.