|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.saga.repository.AbstractSagaRepository
public abstract class AbstractSagaRepository
Abstract implementation for saga repositories. This (partial) implementation will take care of the uniqueness of saga instances in the JVM. That means it will prevent multiple instances of the same conceptual Saga (i.e. with same identifier) to exist within the JVM.
Constructor Summary | |
---|---|
AbstractSagaRepository()
|
Method Summary | |
---|---|
void |
add(Saga saga)
Registers a newly created Saga with the Repository. |
void |
commit(Saga saga)
Commits the changes made to the Saga instance. |
protected abstract void |
deleteSaga(Saga saga)
Remove the given saga as well as all known association values pointing to it from the repository. |
Set<String> |
find(Class<? extends Saga> type,
AssociationValue associationValue)
Find saga instances of the given type that have been associated with the given
associationValue . |
protected abstract Set<String> |
findAssociatedSagaIdentifiers(Class<? extends Saga> type,
AssociationValue associationValue)
Finds the identifiers of the sagas of given type associated with the given
associationValue . |
protected abstract void |
removeAssociationValue(AssociationValue associationValue,
String sagaType,
String sagaIdentifier)
Removes the association value that has been associated with Saga, identified with the given sagaIdentifier . |
protected abstract void |
storeAssociationValue(AssociationValue associationValue,
String sagaType,
String sagaIdentifier)
Store the given associationValue , which has been associated with given sagaIdentifier . |
protected abstract void |
storeSaga(Saga saga)
Stores a newly created Saga instance. |
protected abstract String |
typeOf(Class<? extends Saga> sagaClass)
Returns the type identifier to use for the given sagaClass . |
protected abstract void |
updateSaga(Saga saga)
Update a stored Saga, by replacing it with the given saga instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.axonframework.saga.SagaRepository |
---|
load |
Constructor Detail |
---|
public AbstractSagaRepository()
Method Detail |
---|
public Set<String> find(Class<? extends Saga> type, AssociationValue associationValue)
SagaRepository
type
that have been associated with the given
associationValue
.
Returned Sagas must be committed
after processing.
find
in interface SagaRepository
type
- The type of Saga to returnassociationValue
- The value that the returned Sagas must be associated with
null
.public void add(Saga saga)
SagaRepository
Saga.isActive()
returns
false
), it is not stored.
add
in interface SagaRepository
saga
- The Saga instances to add.public void commit(Saga saga)
SagaRepository
Saga.isActive()
returns
false
), the repository should delete the saga from underlying storage and remove all stored association
values associated with that Saga.
Implementations *may* (temporarily) return a cached version of the Saga, which is marked inactive.
commit
in interface SagaRepository
saga
- The Saga instance to commitprotected abstract Set<String> findAssociatedSagaIdentifiers(Class<? extends Saga> type, AssociationValue associationValue)
type
associated with the given
associationValue
.
type
- The type of saga to find identifiers forassociationValue
- The value the saga must be associated with
associationValue
protected abstract String typeOf(Class<? extends Saga> sagaClass)
sagaClass
. This information is typically provided
by the Serializer, if the repository stores serialized instances.
sagaClass
- The type of saga to get the type identifier for.
protected abstract void deleteSaga(Saga saga)
saga
- The saga instance to remove from the repositoryprotected abstract void updateSaga(Saga saga)
saga
instance.
saga
- The saga that has been modified and needs to be updated in the storageprotected abstract void storeSaga(Saga saga)
saga
- The newly created Saga instance to store.protected abstract void storeAssociationValue(AssociationValue associationValue, String sagaType, String sagaIdentifier)
associationValue
, which has been associated with given sagaIdentifier
.
associationValue
- The association value to storesagaType
- Type type of saga the association value belongs tosagaIdentifier
- The saga related to the association valueprotected abstract void removeAssociationValue(AssociationValue associationValue, String sagaType, String sagaIdentifier)
sagaIdentifier
.
associationValue
- The value to remove as association value for the given sagasagaType
- The type of the Saga to remove the association fromsagaIdentifier
- The identifier of the Saga to remove the association from
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |