public class GenericSagaSqlSchema extends Object implements SagaSqlSchema
Modifier and Type | Field and Description |
---|---|
protected SagaSchema |
sagaSchema |
Constructor and Description |
---|
GenericSagaSqlSchema()
Initialize a GenericSagaSqlSchema using default settings.
|
GenericSagaSqlSchema(SagaSchema sagaSchema)
Initialize a GenericSagaSqlSchema.
|
Modifier and Type | Method and Description |
---|---|
Set<AssociationValue> |
readAssociationValues(ResultSet resultSet)
Reads a Set of AssociationValues from the given
resultSet , which has been returned by executing the
Statement returned from SagaSqlSchema.sql_findAssociations(Connection, String, String) . |
SerializedObject<byte[]> |
readSerializedSaga(ResultSet resultSet)
Reads a SerializedObject from the given
resultSet , which has been returned by executing the
Statement returned from SagaSqlSchema.sql_loadSaga(java.sql.Connection, String)
Note: The implementation must not change the resultSet's cursor position |
String |
readToken(ResultSet resultSet)
Reads a token from the given
resultSet . |
SagaSchema |
sagaSchema()
Returns the
SagaSchema used to configure this sql saga schema. |
PreparedStatement |
sql_createTableAssocValueEntry(Connection conn)
Creates a PreparedStatement that creates the table for storing Association Values for Sagas.
|
PreparedStatement |
sql_createTableSagaEntry(Connection conn)
Creates a PreparedStatement that creates the table for storing Sagas.
|
PreparedStatement |
sql_deleteAssociationEntries(Connection connection,
String sagaIdentifier)
Creates a PreparedStatement that deletes all association entries for a Saga with given
sagaIdentifier . |
PreparedStatement |
sql_deleteSagaEntry(Connection connection,
String sagaIdentifier)
Creates a PreparedStatement that deletes a Saga with given
sagaIdentifier . |
PreparedStatement |
sql_findAssociations(Connection connection,
String sagaIdentifier,
String sagaType)
Creates a PreparedStatement that finds the associations of a Saga of given
sagaType and given sagaIdentifier . |
PreparedStatement |
sql_findAssocSagaIdentifiers(Connection connection,
String key,
String value,
String sagaType)
Creates a PreparedStatement that finds identifiers of Sagas of given
sagaType associated with the
given association key and value . |
PreparedStatement |
sql_loadSaga(Connection connection,
String sagaId)
Creates a PreparedStatement that loads a single Saga, with given
sagaId . |
PreparedStatement |
sql_removeAssocValue(Connection connection,
String key,
String value,
String sagaType,
String sagaIdentifier)
Creates a PreparedStatement that removes an association value for given
sagaIdentifier , where the
association is identified with given key and value . |
PreparedStatement |
sql_storeAssocValue(Connection connection,
String key,
String value,
String sagaType,
String sagaIdentifier)
Creates a PreparedStatement that stores an association with given
key and value , for a
Saga of given type and identifier . |
PreparedStatement |
sql_storeSaga(Connection connection,
String sagaIdentifier,
String revision,
String sagaType,
byte[] serializedSaga)
Creates a PreparedStatement that inserts a Saga entry, of given
sagaType and with given
sagaIdentifier . |
PreparedStatement |
sql_updateSaga(Connection connection,
String sagaIdentifier,
byte[] serializedSaga,
String sagaType,
String revision)
Creates a PreparedStatement that updates the serialized form of an existing Saga entry, of given
sagaType and with given sagaIdentifier . |
protected final SagaSchema sagaSchema
public GenericSagaSqlSchema()
public GenericSagaSqlSchema(SagaSchema sagaSchema)
sagaSchema
.sagaSchema
- The configuration to use for the initialization of the schemapublic PreparedStatement sql_loadSaga(Connection connection, String sagaId) throws SQLException
SagaSqlSchema
sagaId
.sql_loadSaga
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forsagaId
- The identifier of the Saga to returnSagaSqlSchema.readSerializedSaga(java.sql.ResultSet)
,
when executedSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_removeAssocValue(Connection connection, String key, String value, String sagaType, String sagaIdentifier) throws SQLException
SagaSqlSchema
sagaIdentifier
, where the
association is identified with given key
and value
.sql_removeAssocValue
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forkey
- The key of the association to removevalue
- The value of the association to removesagaType
- The type of saga to remove the association forsagaIdentifier
- The identifier of the Saga to remove the association forSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_storeAssocValue(Connection connection, String key, String value, String sagaType, String sagaIdentifier) throws SQLException
SagaSqlSchema
key
and value
, for a
Saga of given type
and identifier
.sql_storeAssocValue
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forkey
- The key of the association to storevalue
- The value of the association to storesagaType
- The type of saga to create the association forsagaIdentifier
- The identifier of the Saga to create the association forSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_findAssocSagaIdentifiers(Connection connection, String key, String value, String sagaType) throws SQLException
SagaSqlSchema
sagaType
associated with the
given association key
and value
.sql_findAssocSagaIdentifiers
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forkey
- The key of the associationvalue
- The value of the associationsagaType
- The type of saga to find associations forSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_findAssociations(Connection connection, String sagaIdentifier, String sagaType) throws SQLException
SagaSqlSchema
sagaType
and given sagaIdentifier
.sql_findAssociations
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forsagaIdentifier
- The identifier of the SagasagaType
- The type of saga to find associations forSQLException
- when an error occurs while creating the PreparedStatementpublic String readToken(ResultSet resultSet)
SagaSqlSchema
resultSet
.readToken
in interface SagaSqlSchema
resultSet
- The result set to read data from.public Set<AssociationValue> readAssociationValues(ResultSet resultSet) throws SQLException
SagaSqlSchema
resultSet
, which has been returned by executing the
Statement returned from SagaSqlSchema.sql_findAssociations(Connection, String, String)
.readAssociationValues
in interface SagaSqlSchema
resultSet
- The result set to read data from.SQLException
- when an exception occurs reading from the resultSetpublic PreparedStatement sql_deleteSagaEntry(Connection connection, String sagaIdentifier) throws SQLException
SagaSqlSchema
sagaIdentifier
.sql_deleteSagaEntry
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forsagaIdentifier
- The identifier of the Saga to removeSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_deleteAssociationEntries(Connection connection, String sagaIdentifier) throws SQLException
SagaSqlSchema
sagaIdentifier
.sql_deleteAssociationEntries
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forsagaIdentifier
- The identifier of the Saga to remove associations forSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_updateSaga(Connection connection, String sagaIdentifier, byte[] serializedSaga, String sagaType, String revision) throws SQLException
SagaSqlSchema
sagaType
and with given sagaIdentifier
.sql_updateSaga
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forsagaIdentifier
- The identifier of the Saga to updateserializedSaga
- The serialized form of the saga to updatesagaType
- The serialized type of the sagarevision
- The revision identifier of the serialized formSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_storeSaga(Connection connection, String sagaIdentifier, String revision, String sagaType, byte[] serializedSaga) throws SQLException
SagaSqlSchema
sagaType
and with given
sagaIdentifier
.sql_storeSaga
in interface SagaSqlSchema
connection
- The connection to create the PreparedStatement forsagaIdentifier
- The identifier of the Saga to insertrevision
- The revision identifier of the serialized formsagaType
- The serialized type of the sagaserializedSaga
- The serialized form of the saga to insertSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_createTableAssocValueEntry(Connection conn) throws SQLException
SagaSqlSchema
sql_createTableAssocValueEntry
in interface SagaSqlSchema
conn
- The connection to create the PreparedStatement forSQLException
- when an error occurs creating the PreparedStatementpublic PreparedStatement sql_createTableSagaEntry(Connection conn) throws SQLException
SagaSqlSchema
sql_createTableSagaEntry
in interface SagaSqlSchema
conn
- The connection to create the PreparedStatement forSQLException
- when an error occurs creating the PreparedStatementpublic SerializedObject<byte[]> readSerializedSaga(ResultSet resultSet) throws SQLException
SagaSqlSchema
resultSet
, which has been returned by executing the
Statement returned from SagaSqlSchema.sql_loadSaga(java.sql.Connection, String)
Note: The implementation must not change the resultSet's cursor positionreadSerializedSaga
in interface SagaSqlSchema
resultSet
- The result set to read data from.SQLException
- when an exception occurs reading from the resultSetpublic SagaSchema sagaSchema()
SagaSchema
used to configure this sql saga schema.Copyright © 2010–2024. All rights reserved.