|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.saga.repository.AbstractSagaRepository org.axonframework.saga.repository.jdbc.JdbcSagaRepository
public class JdbcSagaRepository
Jdbc implementation of the Saga Repository.
Constructor Summary | |
---|---|
JdbcSagaRepository(ConnectionProvider connectionProvider)
Initializes a Saga Repository, using given connectionProvider to obtain connections to the
database, using a Generic SQL Schema. |
|
JdbcSagaRepository(ConnectionProvider connectionProvider,
SagaSqlSchema sqldef)
Initializes a Saga Repository, using given connectionProvider to obtain connections to the
database, and given sqldef to execute SQL statements. |
|
JdbcSagaRepository(ConnectionProvider connectionProvider,
SagaSqlSchema sqldef,
Serializer serializer)
Initializes a Saga Repository, using given connectionProvider to obtain connections to the
database, and given sqldef to execute SQL statements and serializer to serialize
Sagas. |
|
JdbcSagaRepository(DataSource dataSource,
SagaSqlSchema sqldef)
Initializes a Saga Repository, using given dataSource to obtain connections to the database, and
given sqldef to execute SQL statements. |
Method Summary | |
---|---|
void |
createSchema()
Creates the SQL Schema required to store Sagas and their associations,. |
protected void |
deleteSaga(Saga saga)
Remove the given saga as well as all known association values pointing to it from the repository. |
protected Set<String> |
findAssociatedSagaIdentifiers(Class<? extends Saga> type,
AssociationValue associationValue)
Finds the identifiers of the sagas of given type associated with the given
associationValue . |
Saga |
load(String sagaId)
Loads a known Saga instance by its unique identifier. |
protected void |
removeAssociationValue(AssociationValue associationValue,
String sagaType,
String sagaIdentifier)
Removes the association value that has been associated with Saga, identified with the given sagaIdentifier . |
void |
setResourceInjector(ResourceInjector resourceInjector)
Sets the ResourceInjector to use to inject Saga instances with any (temporary) resources they might need. |
void |
setSerializer(Serializer serializer)
Sets the Serializer instance to serialize Sagas with. |
protected void |
storeAssociationValue(AssociationValue associationValue,
String sagaType,
String sagaIdentifier)
Store the given associationValue , which has been associated with given sagaIdentifier . |
protected void |
storeSaga(Saga saga)
Stores a newly created Saga instance. |
protected String |
typeOf(Class<? extends Saga> sagaClass)
Returns the type identifier to use for the given sagaClass . |
protected void |
updateSaga(Saga saga)
Update a stored Saga, by replacing it with the given saga instance. |
Methods inherited from class org.axonframework.saga.repository.AbstractSagaRepository |
---|
add, commit, find |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JdbcSagaRepository(ConnectionProvider connectionProvider)
connectionProvider
to obtain connections to the
database, using a Generic SQL Schema.
connectionProvider
- The data source to obtain connections frompublic JdbcSagaRepository(DataSource dataSource, SagaSqlSchema sqldef)
dataSource
to obtain connections to the database, and
given sqldef
to execute SQL statements.
dataSource
- The data source to obtain connections fromsqldef
- The definition of SQL operations to executepublic JdbcSagaRepository(ConnectionProvider connectionProvider, SagaSqlSchema sqldef)
connectionProvider
to obtain connections to the
database, and given sqldef
to execute SQL statements.
connectionProvider
- The provider to obtain connections fromsqldef
- The definition of SQL operations to executepublic JdbcSagaRepository(ConnectionProvider connectionProvider, SagaSqlSchema sqldef, Serializer serializer)
connectionProvider
to obtain connections to the
database, and given sqldef
to execute SQL statements and serializer
to serialize
Sagas.
connectionProvider
- The provider to obtain connections fromsqldef
- The definition of SQL operations to executeserializer
- The serializer to serialize and deserialize Saga instances withMethod Detail |
---|
public Saga load(String sagaId)
SagaRepository
committed
after processing.
Due to the concurrent nature of Sagas, it is not unlikely for a Saga to have ceased to exist after it has been
found based on associations. Therefore, a repository should return null
in case a Saga doesn't
exists, as opposed to throwing an exception.
sagaId
- The unique identifier of the Saga to load
null
if no such saga existsprotected void removeAssociationValue(AssociationValue associationValue, String sagaType, String sagaIdentifier)
AbstractSagaRepository
sagaIdentifier
.
removeAssociationValue
in class AbstractSagaRepository
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 fromprotected String typeOf(Class<? extends Saga> sagaClass)
AbstractSagaRepository
sagaClass
. This information is typically provided
by the Serializer, if the repository stores serialized instances.
typeOf
in class AbstractSagaRepository
sagaClass
- The type of saga to get the type identifier for.
protected void storeAssociationValue(AssociationValue associationValue, String sagaType, String sagaIdentifier)
AbstractSagaRepository
associationValue
, which has been associated with given sagaIdentifier
.
storeAssociationValue
in class AbstractSagaRepository
associationValue
- The association value to storesagaType
- Type type of saga the association value belongs tosagaIdentifier
- The saga related to the association valueprotected Set<String> findAssociatedSagaIdentifiers(Class<? extends Saga> type, AssociationValue associationValue)
AbstractSagaRepository
type
associated with the given
associationValue
.
findAssociatedSagaIdentifiers
in class AbstractSagaRepository
type
- The type of saga to find identifiers forassociationValue
- The value the saga must be associated with
associationValue
protected void deleteSaga(Saga saga)
AbstractSagaRepository
deleteSaga
in class AbstractSagaRepository
saga
- The saga instance to remove from the repositoryprotected void updateSaga(Saga saga)
AbstractSagaRepository
saga
instance.
updateSaga
in class AbstractSagaRepository
saga
- The saga that has been modified and needs to be updated in the storageprotected void storeSaga(Saga saga)
AbstractSagaRepository
storeSaga
in class AbstractSagaRepository
saga
- The newly created Saga instance to store.public void setResourceInjector(ResourceInjector resourceInjector)
resourceInjector
- The resource injectorpublic void setSerializer(Serializer serializer)
serializer
- the Serializer instance to serialize Sagas withpublic void createSchema() throws SQLException
SQLException
- When an error occurs preparing of executing the required statements
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |