Class AbstractDatabaseWriter
java.lang.Object
org.jumpmind.symmetric.io.data.writer.AbstractDatabaseWriter
- All Implemented Interfaces:
IDataResource,IDataWriter
- Direct Known Subclasses:
AbstractDatabaseWriterTest.StubAbstractDatabaseWriter,DefaultDatabaseWriter,HbaseDatabaseWriter
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Batchstatic final Stringstatic final Stringprotected IDatabaseWriterConflictResolverprotected DataContextprotected booleanprotected booleanprotected CsvDataprotected booleanprotected Tableprotected Map<Batch,Statistics> protected Map<String,TableColumnSourceReferences> protected Tablestatic final Stringprotected longprotected DatabaseWriterSettings -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDatabaseWriter(DatabaseWriterSettings settings) AbstractDatabaseWriter(IDatabaseWriterConflictResolver conflictResolver, DatabaseWriterSettings settings) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidallowInsertIntoAutoIncrementColumns(boolean value, Table table) protected voidbindVariables(Map<String, Object> variables) protected TableColumnSourceReferencesBuilds new column mappings and saves it to the cache.protected voidprotected voidClears column mapping cache.voidclose()protected voidcommit(boolean earlyCommit) protected abstract booleanprotected abstract AbstractDatabaseWriter.LoadStatusvoidvoidprotected voidfilterAfter(CsvData data) protected booleanfilterBefore(CsvData data) protected booleanfilterError(CsvData data, Exception ex) getBatch()getLookupDataMap(CsvData data, Conflict conflict) protected StringgetPkDataFor(CsvData data, Column column) protected String[]getRowData(CsvData data, String dataType) Parses source data and returns string array with values in same positions as target columns.protected TableColumnSourceReferencesLooks up column mappings in the cache (or generates them).protected booleanprotected abstract AbstractDatabaseWriter.LoadStatusprotected abstract voidlogFailureDetails(Throwable e, CsvData data, boolean logLastDmlDetails) protected abstract voidlogFailureDetails(Throwable e, CsvData data, boolean logLastDmlDetails, Object[] values) protected TablelookupTableAtTarget(Table sourceTable) protected voidprotected voidprotected voidprotected voidvoidopen(DataContext context) protected voidVerifies that column mapping cache is up-to date.protected voidrollback()protected booleanvoidsetConflictResolver(IDatabaseWriterConflictResolver conflictResolver) protected abstract booleanbooleanvoidprotected voidtargetTableWasChangedByFilter(Table oldTargetTable) protected abstract AbstractDatabaseWriter.LoadStatusvoid
-
Field Details
-
CONFLICT_ERROR
- See Also:
-
TRANSACTION_ABORTED
- See Also:
-
CONFLICT_IGNORE
- See Also:
-
lastUseConflictDetection
protected boolean lastUseConflictDetection -
lastApplyChangesOnly
protected boolean lastApplyChangesOnly -
isRequiresSavePointsInTransaction
protected boolean isRequiresSavePointsInTransaction -
sourceTable
-
targetTable
-
targetTables
-
lastData
-
batch
-
context
-
uncommittedCount
protected long uncommittedCount -
writerSettings
-
statistics
-
conflictResolver
-
missingTables
-
targetColumnSourceReferencesMap
-
-
Constructor Details
-
AbstractDatabaseWriter
public AbstractDatabaseWriter() -
AbstractDatabaseWriter
-
AbstractDatabaseWriter
public AbstractDatabaseWriter(IDatabaseWriterConflictResolver conflictResolver, DatabaseWriterSettings settings)
-
-
Method Details
-
open
- Specified by:
openin interfaceIDataResource
-
start
- Specified by:
startin interfaceIDataWriter
-
start
- Specified by:
startin interfaceIDataWriter
-
write
- Specified by:
writein interfaceIDataWriter
-
checkForEarlyCommit
protected void checkForEarlyCommit() -
commit
protected void commit(boolean earlyCommit) -
rollback
protected void rollback() -
filterError
-
filterBefore
-
targetTableWasChangedByFilter
-
notifyFiltersEarlyCommit
protected void notifyFiltersEarlyCommit() -
notifyFiltersBatchComplete
protected void notifyFiltersBatchComplete() -
notifyFiltersBatchCommitted
protected void notifyFiltersBatchCommitted() -
notifyFiltersBatchRolledback
protected void notifyFiltersBatchRolledback() -
filterAfter
-
insert
-
delete
protected abstract AbstractDatabaseWriter.LoadStatus delete(CsvData data, boolean useConflictDetection) -
update
protected abstract AbstractDatabaseWriter.LoadStatus update(CsvData data, boolean applyChangesOnly, boolean useConflictDetection) -
create
-
sql
-
logFailureDetails
-
logFailureDetails
-
getRowData
Parses source data and returns string array with values in same positions as target columns.- Parameters:
data- CsvData from the sourcedataType- CsvData type constant. Example: CsvData.ROW_DATA, CsvData.OLD_DATA- Returns:
- Values for target columns (as strings)
-
getTargetColumnReferencesMap
Looks up column mappings in the cache (or generates them). Used to quickly copy data from source columns into target columns. -
buildTargetColumnReferencesMap
Builds new column mappings and saves it to the cache. -
refreshTargetColumnReferencesMap
protected void refreshTargetColumnReferencesMap()Verifies that column mapping cache is up-to date. Rebuilds column mappings, if mismatch is detected. -
clearTargetColumnReferencesMap
protected void clearTargetColumnReferencesMap()Clears column mapping cache. Used when DDL changes impact column definitions. -
bindVariables
-
script
-
getLookupDataMap
-
getPkDataFor
-
end
- Specified by:
endin interfaceIDataWriter
-
end
- Specified by:
endin interfaceIDataWriter
-
close
public void close()- Specified by:
closein interfaceIDataResource
-
hasFilterThatHandlesMissingTable
-
allowInsertIntoAutoIncrementColumns
-
lookupTableAtTarget
-
getBatch
-
getContext
-
getConflictResolver
-
setConflictResolver
-
getTargetTable
-
getSourceTable
-
getStatistics
- Specified by:
getStatisticsin interfaceIDataResource
-
getWriterSettings
-