Class NoOpAuditService
- All Implemented Interfaces:
AuditService,RequestHandler
AuditService which can be overridden via config.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classCreates aNoOpAuditServicein a heap environment. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the AuditService configuration.Returns the set of event topics (schemas) that theAuditServiceunderstands.Returns the registered handler corresponding to provided name.Returns the registered handlers.handleAction(Context context, ActionRequest actionRequest) Audit service may support actions on the service itself or on handlers.handleCreate(Context context, CreateRequest createRequest) Propagates the audit event to theAuditEventHandlerobjects that have been registered for the audit event topic.handleDelete(Context context, DeleteRequest deleteRequest) Audit service does not support changing audit entries.handlePatch(Context context, PatchRequest patchRequest) Audit service does not support changing audit entries.handleQuery(Context context, QueryRequest queryRequest, QueryResourceHandler queryResourceHandler) Performs the query on the specified object and returns the associated results.handleRead(Context context, ReadRequest readRequest) Gets an object from the audit logs by identifier.handleUpdate(Context context, UpdateRequest updateRequest) Audit service does not support changing audit entries.booleanisAuditing(String s) Returns whether or not events of the specified topic will be handled.booleanReturnstrueif this object is running.voidshutdown()Closes thisAuditServiceand all itsAuditEventHandlers.voidstartup()Allows thisAuditServiceand all itsAuditEventHandlers to perform any initialization that would be unsafe to do if any other instance of theAuditServicewere still running.
-
Constructor Details
-
NoOpAuditService
public NoOpAuditService()
-
-
Method Details
-
handleRead
public Promise<ResourceResponse,ResourceException> handleRead(Context context, ReadRequest readRequest) Description copied from interface:AuditServiceGets 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_revto enable optimistic concurrencyIf this
Reads a JSON resource, returning aAuditServicehas been closed, the returned promise will resolve to aServiceUnavailableException.Promisethat 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 interfaceAuditService- Specified by:
handleReadin interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.readRequest- The read request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleCreate
public Promise<ResourceResponse,ResourceException> handleCreate(Context context, CreateRequest createRequest) Description copied from interface:AuditServicePropagates the audit event to theAuditEventHandlerobjects that have been registered for the audit event topic.This method sets the
_idproperty to the assigned identifier for the object, and the_revproperty to the revised object version (For optimistic concurrency).If this
Adds a new JSON resource, returning aAuditServicehas been closed, the returned promise will resolve to aServiceUnavailableException.Promisethat 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 interfaceAuditService- Specified by:
handleCreatein interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.createRequest- The create request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleUpdate
public Promise<ResourceResponse,ResourceException> handleUpdate(Context context, UpdateRequest updateRequest) Description copied from interface:AuditServiceAudit service does not support changing audit entries.The returned promise will resolve to a
NotSupportedException.- Specified by:
handleUpdatein interfaceAuditService- Specified by:
handleUpdatein interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.updateRequest- The update request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleDelete
public Promise<ResourceResponse,ResourceException> handleDelete(Context context, DeleteRequest deleteRequest) Description copied from interface:AuditServiceAudit service does not support changing audit entries.The returned promise will resolve to a
NotSupportedException.- Specified by:
handleDeletein interfaceAuditService- Specified by:
handleDeletein interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.deleteRequest- The delete request.- Returns:
- A
Promisecontaining the result of the operation.
-
handlePatch
public Promise<ResourceResponse,ResourceException> handlePatch(Context context, PatchRequest patchRequest) Description copied from interface:AuditServiceAudit service does not support changing audit entries.The returned promise will resolve to a
NotSupportedException.- Specified by:
handlePatchin interfaceAuditService- Specified by:
handlePatchin interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.patchRequest- The patch request.- Returns:
- A
Promisecontaining the result of the operation.
-
handleQuery
public Promise<QueryResponse,ResourceException> handleQuery(Context context, QueryRequest queryRequest, QueryResourceHandler queryResourceHandler) Description copied from interface:AuditServicePerforms 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
QueryConstantsdefines the map keys, including the result records (QUERY_RESULT)
If this
Searches for all JSON resources matching a user specified set of criteria, returning aAuditServicehas been closed, the returned promise will resolve to aServiceUnavailableException.Promisethat 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 interfaceAuditService- Specified by:
handleQueryin interfaceRequestHandler- 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
Promisecontaining the result of the operation.
-
handleAction
public Promise<ActionResponse,ResourceException> handleAction(Context context, ActionRequest actionRequest) Description copied from interface:AuditServiceAudit 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:
handleActionin interfaceAuditService- Specified by:
handleActionin interfaceRequestHandler- Parameters:
context- The request server context, such as associated principal.actionRequest- The action request.- Returns:
- A
Promisecontaining the result of the operation.
-
getConfig
Description copied from interface:AuditServiceGets the AuditService configuration.- Specified by:
getConfigin interfaceAuditService- Returns:
- the audit service config
- Throws:
ServiceUnavailableException- if the AuditService has been closed.
-
getRegisteredHandler
Description copied from interface:AuditServiceReturns the registered handler corresponding to provided name.- Specified by:
getRegisteredHandlerin interfaceAuditService- Parameters:
s- Name of the registered handler to retrieve.- Returns:
- the handler, or
nullif no handler with the provided name was registered to the service. - Throws:
ServiceUnavailableException- if the AuditService has been closed.
-
getRegisteredHandlers
Description copied from interface:AuditServiceReturns the registered handlers.- Specified by:
getRegisteredHandlersin interfaceAuditService- Returns:
- the handlers
- Throws:
ServiceUnavailableException- if the AuditService has been closed.
-
isAuditing
Description copied from interface:AuditServiceReturns whether or not events of the specified topic will be handled.- Specified by:
isAuditingin interfaceAuditService- 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.
-
getKnownTopics
Description copied from interface:AuditServiceReturns the set of event topics (schemas) that theAuditServiceunderstands.- Specified by:
getKnownTopicsin interfaceAuditService- Returns:
- The set of event topics.
- Throws:
ServiceUnavailableException- if the AuditService has been closed.
-
startup
Description copied from interface:AuditServiceAllows thisAuditServiceand all itsAuditEventHandlers to perform any initialization that would be unsafe to do if any other instance of theAuditServicewere still running.- Specified by:
startupin interfaceAuditService- Throws:
ServiceUnavailableException- if the AuditService has been closed.
-
shutdown
public void shutdown()Description copied from interface:AuditServiceCloses thisAuditServiceand all itsAuditEventHandlers.This ensures that any buffered are flushed and all file handles / network connections are closed.
Once
closed, any further calls to thisAuditServicewill throw, or return a promise that will resolve to,ServiceUnavailableException.- Specified by:
shutdownin interfaceAuditService
-
isRunning
public boolean isRunning()Description copied from interface:AuditServiceReturnstrueif this object is running.This object will be in a 'running' state if
AuditService.startup()completed successfully andAuditService.shutdown()has not yet been called.- Specified by:
isRunningin interfaceAuditService- Returns:
- true if this object is running; false otherwise.
-