Package org.fcrepo.kernel.api.observer
Interface EventAccumulator
public interface EventAccumulator
Accumulates events for changes made to resources, grouped by transaction. The events are not emitted until after the
transaction has been committed. If a transaction is rolled back,
clearEvents(org.fcrepo.kernel.api.Transaction) MUST be called to release the
stored events.- Author:
- pwinckles
-
Method Summary
Modifier and TypeMethodDescriptionvoidclearEvents(Transaction transaction) Removes all of a transaction's accumulated events without emitting them.voidemitEvents(Transaction transaction, String baseUrl, String userAgent) Emits all of the events that were accumulated within the transaction.voidrecordEventForOperation(Transaction transaction, FedoraId fedoraId, ResourceOperation operation) Registers a new event to a transaction.
-
Method Details
-
recordEventForOperation
void recordEventForOperation(Transaction transaction, FedoraId fedoraId, ResourceOperation operation) Registers a new event to a transaction.- Parameters:
transaction- the transactionfedoraId- the id of the affected resourceoperation- the operation affecting the resource
-
emitEvents
Emits all of the events that were accumulated within the transaction. Multiple events affecting the same resource are combined into a single event.This method SHOULD NOT throw an exception if an event fails to be emitted. It should always attempt to emit all events accumulated within a transaction.
- Parameters:
transaction- the transactionbaseUrl- the baseUrl of the requestsuserAgent- the user-agent of the user making the requests
-
clearEvents
Removes all of a transaction's accumulated events without emitting them. This must be called when a transaction is rolled back.- Parameters:
transaction- the id of the transaction
-