Class NoOpAuditService

    • Constructor Detail

      • NoOpAuditService

        public NoOpAuditService()
    • Method Detail

      • handleRead

        public Promise<ResourceResponse,​ResourceException> handleRead​(Context context,
                                                                            ReadRequest readRequest)
        Description copied from interface: AuditService
        Gets an object from the audit logs by identifier. The returned object is not validated against the current schema and may need processing to conform to an updated schema.

        The object will contain metadata properties, including object identifier _id, and object version _rev to enable optimistic concurrency

        If this AuditService has been closed, the returned promise will resolve to a ServiceUnavailableException.

        Reads a JSON resource, returning a Promise that will be completed when the resource has been read.

        Read expects failure exceptions as follows:

        • ForbiddenException if access to the resource is forbidden.
        • NotSupportedException if the requested functionality is not implemented/supported
        • BadRequestException if the passed identifier or filter is invalid
        • NotFoundException if the specified resource could not be found.
        Specified by:
        handleRead in interface AuditService
        Specified by:
        handleRead in interface RequestHandler
        Parameters:
        context - The request server context, such as associated principal.
        readRequest - The read request.
        Returns:
        A Promise containing the result of the operation.
      • handleCreate

        public Promise<ResourceResponse,​ResourceException> handleCreate​(Context context,
                                                                              CreateRequest createRequest)
        Description copied from interface: AuditService
        Propagates the audit event to the AuditEventHandler objects that have been registered for the audit event topic.

        This method sets the _id property to the assigned identifier for the object, and the _rev property to the revised object version (For optimistic concurrency).

        If this AuditService has been closed, the returned promise will resolve to a ServiceUnavailableException.

        Adds a new JSON resource, returning a Promise that will be completed when the resource has been added.

        Create expects failure exceptions as follows:

        • CreateNotSupportedException if create is not implemented or supported by the RequestHandler.
        • ForbiddenException if access to the resource is forbidden.
        • NotSupportedException if the requested functionality is not implemented/supported
        • PreconditionFailedException if a resource with the same ID already exists
        • BadRequestException if the passed identifier or value is invalid
        • NotFoundException if the specified id could not be resolved, for example when an intermediate resource in the hierarchy does not exist.
        Specified by:
        handleCreate in interface AuditService
        Specified by:
        handleCreate in interface RequestHandler
        Parameters:
        context - The request server context, such as associated principal.
        createRequest - The create request.
        Returns:
        A Promise containing the result of the operation.
      • handleQuery

        public Promise<QueryResponse,​ResourceException> handleQuery​(Context context,
                                                                          QueryRequest queryRequest,
                                                                          QueryResourceHandler queryResourceHandler)
        Description copied from interface: AuditService
        Performs the query on the specified object and returns the associated results.

        Queries are parametric; a set of named parameters is provided as the query criteria. The query result is a JSON object structure composed of basic Java types.

        The returned map is structured as follow:
        • The top level map contains meta-data about the query, plus an entry with the actual result records.
        • The QueryConstants defines the map keys, including the result records (QUERY_RESULT)

        If this AuditService has been closed, the returned promise will resolve to a ServiceUnavailableException.

        Searches for all JSON resources matching a user specified set of criteria, returning a Promise that 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 a QueryResponse if the query has completed successfully, or ResourceException if the query did not complete successfully (even if some matching resources were returned).

        Query expects failure exceptions as follows:

        • ForbiddenException if access to the resource is forbidden
        • NotSupportedException if the requested functionality is not implemented/supported
        • BadRequestException if the passed identifier, parameters or filter is invalid
        • NotFoundException if the specified resource could not be found
        Specified by:
        handleQuery in interface AuditService
        Specified by:
        handleQuery in interface RequestHandler
        Parameters:
        context - The request server context, such as associated principal.
        queryRequest - The query request.
        queryResourceHandler - The query resource handler to be notified for each matching resource.
        Returns:
        A Promise containing the result of the operation.
      • handleAction

        public Promise<ActionResponse,​ResourceException> handleAction​(Context context,
                                                                            ActionRequest actionRequest)
        Description copied from interface: AuditService
        Audit service may support actions on the service itself or on handlers.

        One of the following paths format is expected:

        
         [path-to-audit-service]?_action=XXX : call a global action on audit service
         [path-to-audit-service/[topic]?_action=XXX : call an action on audit service and a single topic
         [path-to-audit-service]?_action=XXX&handler=HHH : call on action on a specific handler
         [path-to-audit-service/[topic]?_action=XXX&handler=HHH : call on action on a specific handler and topic
         
        Specified by:
        handleAction in interface AuditService
        Specified by:
        handleAction in interface RequestHandler
        Parameters:
        context - The request server context, such as associated principal.
        actionRequest - The action request.
        Returns:
        A Promise containing the result of the operation.
      • isAuditing

        public boolean isAuditing​(String s)
                           throws ServiceUnavailableException
        Description copied from interface: AuditService
        Returns whether or not events of the specified topic will be handled.
        Specified by:
        isAuditing in interface AuditService
        Parameters:
        s - Identifies a category of events to which handlers may or may not be registered.
        Returns:
        whether handling of the specified topic is enabled.
        Throws:
        ServiceUnavailableException - if the AuditService has been closed.
      • shutdown

        public void shutdown()
        Description copied from interface: AuditService
        Closes this AuditService and all its AuditEventHandlers.

        This ensures that any buffered are flushed and all file handles / network connections are closed.

        Once closed, any further calls to this AuditService will throw, or return a promise that will resolve to, ServiceUnavailableException.

        Specified by:
        shutdown in interface AuditService