|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.axonframework.eventstore.jdbc.GenericEventSqlSchema<T>
T
- The type used when storing serialized datapublic class GenericEventSqlSchema<T>
Field Summary | |
---|---|
protected SchemaConfiguration |
schemaConfiguration
|
Constructor Summary | |
---|---|
GenericEventSqlSchema()
Initialize a GenericEventSqlSchema using default settings. |
|
GenericEventSqlSchema(Class<T> dataType)
Initialize a GenericEventSqlSchema. |
|
GenericEventSqlSchema(Class<T> dataType,
SchemaConfiguration schemaConfiguration)
Initialize a GenericEventSqlSchema. |
Method Summary | |
---|---|
SerializedDomainEventData<T> |
createSerializedDomainEventData(ResultSet resultSet)
Reads the current entry of the ResultSet into a SerializedDomainEventData. |
protected PreparedStatement |
doInsertEventEntry(String tableName,
Connection connection,
String eventIdentifier,
String aggregateIdentifier,
long sequenceNumber,
org.joda.time.DateTime timestamp,
String eventType,
String eventRevision,
T eventPayload,
T eventMetaData,
String aggregateType)
Creates a statement to insert an entry with given attributes in the given tableName . |
Class<T> |
getDataType()
Returns the type used to store serialized payloads. |
protected T |
readPayload(ResultSet resultSet,
int columnIndex)
Reads a serialized object from the given resultSet at given columnIndex . |
protected Object |
readTimeStamp(ResultSet resultSet,
int columnIndex)
Reads a timestamp from the given resultSet at given columnIndex . |
void |
setForceUtc(boolean forceUtc)
Control if date time in the SQL scheme should use UTC time zone or system local time zone. |
PreparedStatement |
sql_createDomainEventEntryTable(Connection connection)
Creates a PreparedStatement that allows for the creation of the table to store Event entries. |
PreparedStatement |
sql_createSnapshotEventEntryTable(Connection connection)
Creates a PreparedStatement that allows for the creation of the table to store Snapshots. |
String |
sql_dateTime(org.joda.time.DateTime input)
Converts a DateTime to a data value suitable for the database scheme. |
PreparedStatement |
sql_fetchFromSequenceNumber(Connection connection,
String type,
Object aggregateIdentifier,
long firstSequenceNumber)
Creates a PreparedStatement that fetches event data for an aggregate with given type and
identifier , starting at the given firstSequenceNumber . |
PreparedStatement |
sql_findSnapshotSequenceNumbers(Connection connection,
String type,
Object aggregateIdentifier)
Creates a PreparedStatement that returns the sequence numbers of snapshots for an aggregate of given type and aggregateIdentifier . |
PreparedStatement |
sql_getFetchAll(Connection connection,
String whereClause,
Object[] params)
Creates a PreparedStatement that fetches all event messages matching the given whereClause . |
PreparedStatement |
sql_insertDomainEventEntry(Connection conn,
String eventIdentifier,
String aggregateIdentifier,
long sequenceNumber,
org.joda.time.DateTime timestamp,
String eventType,
String eventRevision,
T eventPayload,
T eventMetaData,
String aggregateType)
Creates the PreparedStatement for inserting a DomainEvent in the Event Store, using given attributes. |
PreparedStatement |
sql_insertSnapshotEventEntry(Connection conn,
String eventIdentifier,
String aggregateIdentifier,
long sequenceNumber,
org.joda.time.DateTime timestamp,
String eventType,
String eventRevision,
T eventPayload,
T eventMetaData,
String aggregateType)
Creates the PreparedStatement for inserting a Snapshot Event in the Event Store, using given attributes. |
PreparedStatement |
sql_loadLastSnapshot(Connection connection,
Object identifier,
String aggregateType)
Creates the PreparedStatement for loading the last snapshot event for an aggregate with given identifier and of given aggregateType . |
PreparedStatement |
sql_pruneSnapshots(Connection connection,
String type,
Object aggregateIdentifier,
long sequenceOfFirstSnapshotToPrune)
Creates a PreparedStatement that deletes all snapshots with a sequence identifier equal or lower to the given sequenceOfFirstSnapshotToPrune , for an aggregate of given type and
aggregateIdentifier . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SchemaConfiguration schemaConfiguration
Constructor Detail |
---|
public GenericEventSqlSchema()
public GenericEventSqlSchema(Class<T> dataType)
dataType
. Data is stored in a default SchemaConfiguration.
dataType
- The type to use when storing serialized datapublic GenericEventSqlSchema(Class<T> dataType, SchemaConfiguration schemaConfiguration)
dataType
. Data is stored according to the given SchemaConfiguration.
dataType
- schemaConfiguration
- Method Detail |
---|
public void setForceUtc(boolean forceUtc)
Default is to use system local time zone.
You should not change this after going into production, since it would affect the batching iterator when fetching events.
forceUtc
- set true to force all date times to use UTC time zonepublic PreparedStatement sql_loadLastSnapshot(Connection connection, Object identifier, String aggregateType) throws SQLException
EventSqlSchema
identifier
and of given aggregateType
.
sql_loadLastSnapshot
in interface EventSqlSchema<T>
connection
- The connection to create the PreparedStatement foridentifier
- The identifier of the aggregate to find the snapshot foraggregateType
- The type identifier of the aggregate
SQLException
- when an exception occurs while creating the prepared statementpublic PreparedStatement sql_insertDomainEventEntry(Connection conn, String eventIdentifier, String aggregateIdentifier, long sequenceNumber, org.joda.time.DateTime timestamp, String eventType, String eventRevision, T eventPayload, T eventMetaData, String aggregateType) throws SQLException
EventSqlSchema
sql_insertDomainEventEntry
in interface EventSqlSchema<T>
conn
- The connection to create the PreparedStatement foreventIdentifier
- The unique identifier of the eventaggregateIdentifier
- The identifier of the aggregate that generated the eventsequenceNumber
- The sequence number of the eventtimestamp
- The time at which the Event Message was generatedeventType
- The type identifier of the serialized eventeventRevision
- The revision of the serialized eventeventPayload
- The serialized payload of the EventeventMetaData
- The serialized meta data of the eventaggregateType
- The type identifier of the aggregate the event belongs to
SQLException
- when an exception occurs while creating the prepared statementpublic PreparedStatement sql_insertSnapshotEventEntry(Connection conn, String eventIdentifier, String aggregateIdentifier, long sequenceNumber, org.joda.time.DateTime timestamp, String eventType, String eventRevision, T eventPayload, T eventMetaData, String aggregateType) throws SQLException
EventSqlSchema
sql_insertSnapshotEventEntry
in interface EventSqlSchema<T>
conn
- The connection to create the PreparedStatement foreventIdentifier
- The unique identifier of the eventaggregateIdentifier
- The identifier of the aggregate that generated the eventsequenceNumber
- The sequence number of the eventtimestamp
- The time at which the Event Message was generatedeventType
- The type identifier of the serialized eventeventRevision
- The revision of the serialized eventeventPayload
- The serialized payload of the EventeventMetaData
- The serialized meta data of the eventaggregateType
- The type identifier of the aggregate the event belongs to
SQLException
- when an exception occurs while creating the prepared statementprotected PreparedStatement doInsertEventEntry(String tableName, Connection connection, String eventIdentifier, String aggregateIdentifier, long sequenceNumber, org.joda.time.DateTime timestamp, String eventType, String eventRevision, T eventPayload, T eventMetaData, String aggregateType) throws SQLException
tableName
. This method
is used by sql_insertDomainEventEntry(java.sql.Connection, String, String, long, org.joda.time.DateTime,
String, String, Object, Object, String)
and sql_insertSnapshotEventEntry(java.sql.Connection, String,
String, long, org.joda.time.DateTime, String, String, Object, Object, String)
, and provides an easier way to
change to types of columns used.
tableName
- The name of the table to insert the entry intoconnection
- The connection to create the statement foreventIdentifier
- The unique identifier of the eventaggregateIdentifier
- The identifier of the aggregate that generated the eventsequenceNumber
- The sequence number of the eventtimestamp
- The time at which the Event Message was generatedeventType
- The type identifier of the serialized eventeventRevision
- The revision of the serialized eventeventPayload
- The serialized payload of the EventeventMetaData
- The serialized meta data of the eventaggregateType
- The type identifier of the aggregate the event belongs to
SQLException
- when an exception occurs creating the PreparedStatementpublic PreparedStatement sql_pruneSnapshots(Connection connection, String type, Object aggregateIdentifier, long sequenceOfFirstSnapshotToPrune) throws SQLException
EventSqlSchema
sequenceOfFirstSnapshotToPrune
, for an aggregate of given type
and
aggregateIdentifier
.
sql_pruneSnapshots
in interface EventSqlSchema<T>
connection
- The connection to create the PreparedStatement fortype
- The type identifier of the aggregateaggregateIdentifier
- The identifier of the aggregatesequenceOfFirstSnapshotToPrune
- The sequence number of the most recent snapshot to prune
SQLException
- when an exception occurs while creating the prepared statementpublic PreparedStatement sql_findSnapshotSequenceNumbers(Connection connection, String type, Object aggregateIdentifier) throws SQLException
EventSqlSchema
type
and aggregateIdentifier
.
sql_findSnapshotSequenceNumbers
in interface EventSqlSchema<T>
connection
- The connection to create the PreparedStatement fortype
- The type identifier of the aggregateaggregateIdentifier
- The identifier of the aggregate
SQLException
- when an exception occurs while creating the prepared statementpublic PreparedStatement sql_fetchFromSequenceNumber(Connection connection, String type, Object aggregateIdentifier, long firstSequenceNumber) throws SQLException
EventSqlSchema
type
and
identifier
, starting at the given firstSequenceNumber
.
sql_fetchFromSequenceNumber
in interface EventSqlSchema<T>
connection
- The connection to create the PreparedStatement fortype
- The type identifier of the aggregateaggregateIdentifier
- The identifier of the aggregatefirstSequenceNumber
- The sequence number of the first event to return
EventSqlSchema.createSerializedDomainEventData(java.sql.ResultSet)
SQLException
- when an exception occurs while creating the prepared statementpublic PreparedStatement sql_getFetchAll(Connection connection, String whereClause, Object[] params) throws SQLException
EventSqlSchema
whereClause
. The
given parameters
provide the parameters used in the where clause, in the order of declaration.
sql_getFetchAll
in interface EventSqlSchema<T>
connection
- The connection to create the PreparedStatement forwhereClause
- The SQL snippet to use after the WHERE directive. May be null
or an empty String
to indicate that no filter is to be appliedparams
- The parameters to set in the WHERE clause
EventSqlSchema.createSerializedDomainEventData(java.sql.ResultSet)
SQLException
- when an exception occurs while creating the prepared statementprotected Object readTimeStamp(ResultSet resultSet, int columnIndex) throws SQLException
resultSet
at given columnIndex
. The resultSet is
positioned in the row that contains the data. This method must not change the row in the result set.
resultSet
- The resultSet containing the stored datacolumnIndex
- The column containing the timestamp
SQLException
- when an exception occurs reading from the resultSet.protected T readPayload(ResultSet resultSet, int columnIndex) throws SQLException
resultSet
at given columnIndex
. The resultSet
is positioned in the row that contains the data. This method must not change the row in the result set.
resultSet
- The resultSet containing the stored datacolumnIndex
- The column containing the timestamp
SQLException
- when an exception occurs reading from the resultSet.public PreparedStatement sql_createSnapshotEventEntryTable(Connection connection) throws SQLException
EventSqlSchema
sql_createSnapshotEventEntryTable
in interface EventSqlSchema<T>
connection
- The connection to create the PreparedStatement for
SQLException
- when an exception occurs while creating the prepared statementpublic PreparedStatement sql_createDomainEventEntryTable(Connection connection) throws SQLException
EventSqlSchema
sql_createDomainEventEntryTable
in interface EventSqlSchema<T>
connection
- The connection to create the PreparedStatement for
SQLException
- when an exception occurs while creating the prepared statementpublic SerializedDomainEventData<T> createSerializedDomainEventData(ResultSet resultSet) throws SQLException
EventSqlSchema
createSerializedDomainEventData
in interface EventSqlSchema<T>
resultSet
- The result set returned from executing one of the Prepared Statements declared on this
interface
SQLException
- when an exception occurs while creating the prepared statementSimpleSerializedDomainEventData
public String sql_dateTime(org.joda.time.DateTime input)
EventSqlSchema
DateTime
to a data value suitable for the database scheme.
sql_dateTime
in interface EventSqlSchema<T>
input
- DateTime
to convert
public Class<T> getDataType()
EventSqlSchema
getDataType
in interface EventSqlSchema<T>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |