public class AuditEventHandlerAdapter extends Object implements AuditEventHandler
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BATCHSIZE
The default batch size to use for event selection and processing.
|
Constructor and Description |
---|
AuditEventHandlerAdapter() |
Modifier and Type | Method and Description |
---|---|
protected int |
deleteEvents(AuditEventHandlerContext context,
long maxId)
Deletes all events for this handler's AuditSpecification,
up to and including the specified maximum event ID.
|
AuditHandlerSpecification |
getAuditHandlerSpecification(LibrarySession session)
Gets the AuditHandlerSpecification.
|
AuditSpecification |
getAuditSpecification(LibrarySession session)
Gets the AuditSpecification.
|
AttributeValue |
getHandlerProperty(LibrarySession session,
String key)
Gets a handler's property using a sesson context.
|
void |
handleDispose(AuditEventHandlerContext context)
Called when the AuditEventHandler instance will no longer
be used.
|
void |
handleEventPosted(AuditEventHandlerContext context)
Called when at least one registered event is posted.
|
void |
handleInitialize(AuditEventHandlerContext context)
Initializes this handler.
|
void |
handleTimerExpired(AuditEventHandlerContext context)
Called when the timer for this AuditEventHandler expires.
|
protected void |
processEvent(AuditEventHandlerContext context,
AuditEvent event)
Process the specified event.
|
protected void |
processEvents(AuditEventHandlerContext context)
Handle events by performing the requested operations, using the default batch size.
|
protected void |
processEvents(AuditEventHandlerContext context,
int batchSize)
Handle events by performing the requested operations, using the specified batch size.
|
protected AuditEvent[] |
selectEvents(AuditEventHandlerContext context,
String[] eventTypes,
Long maxId,
int batchSize)
Selects all events for this handler's AuditSpecification, up to and
including the specified maximum event ID, filtered by the specified
event types.
|
protected AuditEvent[] |
selectEvents(AuditEventHandlerContext context,
String[] eventTypes,
Long minId,
Long maxId,
int batchSize)
Selects all events for this handler's AuditSpecification,
using an ID range specified by optional min and max values.
|
protected long |
selectMaximumEventId(AuditEventHandlerContext context)
Selects the maximum event ID in use in this handler's AuditSpecification.
|
void |
setHandlerProperty(LibrarySession session,
String key,
AttributeValue value)
Sets a handler's property using a sesson context.
|
public static final int DEFAULT_BATCHSIZE
public void handleInitialize(AuditEventHandlerContext context) throws Exception
Called immediately after construction.
handleInitialize
in interface AuditEventHandler
context
- the AuditEventHandlerContext to use for processingException
- if the operation failspublic AuditSpecification getAuditSpecification(LibrarySession session) throws IfsException
session
- The session contextIfsException
- if the operation failspublic AuditHandlerSpecification getAuditHandlerSpecification(LibrarySession session) throws IfsException
session
- The session contextIfsException
- if the operation failspublic AttributeValue getHandlerProperty(LibrarySession session, String key) throws IfsException
session
- The session contextkey
- The property keyIfsException
- if the operation failspublic void setHandlerProperty(LibrarySession session, String key, AttributeValue value) throws IfsException
session
- The session contextkey
- The property keyvalue
- The property valueIfsException
- if the operation failspublic void handleEventPosted(AuditEventHandlerContext context) throws Exception
handleEventPosted
in interface AuditEventHandler
context
- the AuditEventHandlerContext to use for processingException
- if the operation failspublic void handleTimerExpired(AuditEventHandlerContext context) throws Exception
handleTimerExpired
in interface AuditEventHandler
context
- the AuditEventHandlerContext to use for processingException
- if the operation failspublic void handleDispose(AuditEventHandlerContext context) throws Exception
The instance should release any resources it is holding that would not be automatically released as part of the object's garbage collection.
handleDispose
in interface AuditEventHandler
context
- the AuditEventHandlerContext to use for processingException
- if the operation failsprotected void processEvents(AuditEventHandlerContext context) throws IfsException
context
- the AuditEventHandlerContext to use for processingIfsException
- if the operation failsprotected void processEvents(AuditEventHandlerContext context, int batchSize) throws IfsException
context
- the AuditEventHandlerContext to use for processingbatchsize
- the batch size to use for processingIfsException
- if the operation failsprotected void processEvent(AuditEventHandlerContext context, AuditEvent event) throws IfsException
context
- the AuditEventHandlerContext to use for processingevent
- the event to processIfsException
- if the operation failsprotected long selectMaximumEventId(AuditEventHandlerContext context) throws IfsException
This event ID can be used during event or timer notification processing, so that processing occurs only the events posted up until the time the maximum event ID is determined, avoiding any race conditions with new events being posted during the processing.
context
- the AuditEventHandlerContext to use for processingIfsException
- if the operation failsprotected AuditEvent[] selectEvents(AuditEventHandlerContext context, String[] eventTypes, Long maxId, int batchSize) throws IfsException
If a null or empty array is specified for the event types, all types are selected.
The array of returned events is sorted by event ID.
context
- the AuditEventHandlerContext to use for processingeventTypes
- the event types of interestmaxId
- the maximum event ID in existence;
if null, do not use any maximum ID constraintbatchSize
- the batch sizeIfsException
- if the operation failsprotected AuditEvent[] selectEvents(AuditEventHandlerContext context, String[] eventTypes, Long minId, Long maxId, int batchSize) throws IfsException
The min and/or max ID values specified will result in a search qualification that will be inclusive for either or both values specified.
The array of returned events is sorted by event ID.
context
- the AuditEventHandlerContext to use for processingeventTypes
- the event types of interestminId
- minimum event ID to be searched for inclusively;
if null, do not use any minimum ID constraintminId
- maximum event ID to be searched for inclusively;
if null, do not use any maximum ID constraintbatchSize
- the batch sizeIfsException
- if the operation failsprotected int deleteEvents(AuditEventHandlerContext context, long maxId) throws IfsException
context
- the AuditEventHandlerContext to use for processingmaxId
- the maximum event ID in existenceIfsException
- if the operation failsCopyright © 2023. All rights reserved.