public abstract class AbstractDatabaseHistory extends Object implements DatabaseHistory
| Modifier and Type | Field and Description |
|---|---|
private HistoryRecordComparator |
comparator |
protected Configuration |
config |
private Function<String,Optional<Pattern>> |
ddlFilter |
private DatabaseHistoryListener |
listener |
protected org.slf4j.Logger |
logger |
private boolean |
skipUnparseableDDL |
private TableChanges.TableChangesSerializer<Array> |
tableChangesSerializer |
private boolean |
useCatalogBeforeSchema |
CONFIGURATION_FIELD_PREFIX_STRING, DDL_FILTER, NAME, SKIP_UNPARSEABLE_DDL_STATEMENTS, STORE_ONLY_MONITORED_TABLES_DDL| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDatabaseHistory() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Configuration config,
HistoryRecordComparator comparator,
DatabaseHistoryListener listener,
boolean useCatalogBeforeSchema)
Configure this instance.
|
void |
initializeStorage()
Called to initialize permanent storage of the history.
|
void |
record(Map<String,?> source,
Map<String,?> position,
String databaseName,
String ddl)
Record a change to the schema of the named database, and store it in the schema storage.
|
void |
record(Map<String,?> source,
Map<String,?> position,
String databaseName,
String schemaName,
String ddl,
TableChanges changes) |
void |
recover(Map<String,?> source,
Map<String,?> position,
Tables schema,
DdlParser ddlParser)
Recover the
database schema to a known point in its history. |
protected abstract void |
recoverRecords(Consumer<HistoryRecord> records) |
void |
start()
Start the history.
|
void |
stop()
Stop recording history and release any resources acquired since
#configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener). |
protected abstract void |
storeRecord(HistoryRecord record) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexists, storageExistsprotected final org.slf4j.Logger logger
protected Configuration config
private HistoryRecordComparator comparator
private boolean skipUnparseableDDL
private DatabaseHistoryListener listener
private boolean useCatalogBeforeSchema
private TableChanges.TableChangesSerializer<Array> tableChangesSerializer
public void configure(Configuration config, HistoryRecordComparator comparator, DatabaseHistoryListener listener, boolean useCatalogBeforeSchema)
DatabaseHistoryconfigure in interface DatabaseHistoryconfig - the configuration for this history storecomparator - the function that should be used to compare history records during
recovery; may be null if the
default comparator is to be usedlistener - TODOuseCatalogBeforeSchema - true if the parsed string for a table contains only 2 items and the first should be used as
the catalog and the second as the table name, or false if the first should be used as the schema and the
second as the table namepublic void start()
DatabaseHistorystart in interface DatabaseHistorypublic final void record(Map<String,?> source, Map<String,?> position, String databaseName, String ddl) throws DatabaseHistoryException
DatabaseHistoryrecord in interface DatabaseHistorysource - the information about the source database; may not be nullposition - the point in history where these DDL changes were made, which may be used when
recovering the schema to some point in history; may not be
nulldatabaseName - the name of the database whose schema is being changed; may be nullddl - the DDL statements that describe the changes to the database schema; may not be nullDatabaseHistoryException - if the record could not be writtenpublic final void record(Map<String,?> source, Map<String,?> position, String databaseName, String schemaName, String ddl, TableChanges changes) throws DatabaseHistoryException
record in interface DatabaseHistoryDatabaseHistoryExceptionpublic final void recover(Map<String,?> source, Map<String,?> position, Tables schema, DdlParser ddlParser)
DatabaseHistorydatabase schema to a known point in its history. Note that it is possible to recover the
database schema to a point in history that is earlier than what has been recorded. Likewise, when recovering to a point in history later than what was recorded, the database schema will
reflect the latest state known to the history.recover in interface DatabaseHistorysource - the information about the source database; may not be nullposition - the point in history at which the database schema should be recovered; may not be nullschema - the table definitions that should be changed to reflect the database schema at the desired point in history;
may not be nullddlParser - the DDL parser that can be used to apply DDL statements to the given schema; may not be nullprotected abstract void storeRecord(HistoryRecord record) throws DatabaseHistoryException
DatabaseHistoryExceptionprotected abstract void recoverRecords(Consumer<HistoryRecord> records)
public void stop()
DatabaseHistory#configure(Configuration, HistoryRecordComparator, DatabaseHistoryListener).stop in interface DatabaseHistorypublic void initializeStorage()
DatabaseHistoryinitializeStorage in interface DatabaseHistoryCopyright © 2021 JBoss by Red Hat. All rights reserved.