Package org.fcrepo.kernel.api.observer
Interface EventAccumulator
-
- All Known Implementing Classes:
EventAccumulatorImpl
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clearEvents(Transaction transaction)
Removes all of a transaction's accumulated events without emitting them.void
emitEvents(Transaction transaction, String baseUrl, String userAgent)
Emits all of the events that were accumulated within the transaction.void
recordEventForOperation(Transaction transaction, FedoraId fedoraId, ResourceOperation operation)
Registers a new event to a transaction.
-
-
-
Method Detail
-
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
void emitEvents(Transaction transaction, String baseUrl, String userAgent)
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
void clearEvents(Transaction transaction)
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
-
-