Class AbstractDatabaseWriter

java.lang.Object
org.jumpmind.symmetric.io.data.writer.AbstractDatabaseWriter
All Implemented Interfaces:
IDataResource, IDataWriter
Direct Known Subclasses:
AbstractDatabaseWriterTest.StubAbstractDatabaseWriter, DefaultDatabaseWriter, HbaseDatabaseWriter

public abstract class AbstractDatabaseWriter extends Object implements IDataWriter
  • Field Details

  • Constructor Details

  • Method Details

    • open

      public void open(DataContext context)
      Specified by:
      open in interface IDataResource
    • start

      public void start(Batch batch)
      Specified by:
      start in interface IDataWriter
    • start

      public boolean start(Table table)
      Specified by:
      start in interface IDataWriter
    • write

      public void write(CsvData data)
      Specified by:
      write in interface IDataWriter
    • checkForEarlyCommit

      protected void checkForEarlyCommit()
    • commit

      protected void commit(boolean earlyCommit)
    • rollback

      protected void rollback()
    • filterError

      protected boolean filterError(CsvData data, Exception ex)
    • filterBefore

      protected boolean filterBefore(CsvData data)
    • targetTableWasChangedByFilter

      protected void targetTableWasChangedByFilter(Table oldTargetTable)
    • notifyFiltersEarlyCommit

      protected void notifyFiltersEarlyCommit()
    • notifyFiltersBatchComplete

      protected void notifyFiltersBatchComplete()
    • notifyFiltersBatchCommitted

      protected void notifyFiltersBatchCommitted()
    • notifyFiltersBatchRolledback

      protected void notifyFiltersBatchRolledback()
    • filterAfter

      protected void filterAfter(CsvData data)
    • insert

      protected abstract AbstractDatabaseWriter.LoadStatus insert(CsvData data)
    • delete

      protected abstract AbstractDatabaseWriter.LoadStatus delete(CsvData data, boolean useConflictDetection)
    • update

      protected abstract AbstractDatabaseWriter.LoadStatus update(CsvData data, boolean applyChangesOnly, boolean useConflictDetection)
    • create

      protected abstract boolean create(CsvData data)
    • sql

      protected abstract boolean sql(CsvData data)
    • logFailureDetails

      protected abstract void logFailureDetails(Throwable e, CsvData data, boolean logLastDmlDetails)
    • logFailureDetails

      protected abstract void logFailureDetails(Throwable e, CsvData data, boolean logLastDmlDetails, Object[] values)
    • getRowData

      protected String[] getRowData(CsvData data, String dataType)
      Parses source data and returns string array with values in same positions as target columns.
      Parameters:
      data - CsvData from the source
      dataType - CsvData type constant. Example: CsvData.ROW_DATA, CsvData.OLD_DATA
      Returns:
      Values for target columns (as strings)
    • getTargetColumnReferencesMap

      protected TableColumnSourceReferences getTargetColumnReferencesMap()
      Looks up column mappings in the cache (or generates them). Used to quickly copy data from source columns into target columns.
    • buildTargetColumnReferencesMap

      protected TableColumnSourceReferences buildTargetColumnReferencesMap(String key)
      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

      protected void bindVariables(Map<String,Object> variables)
    • script

      protected boolean script(CsvData data)
    • getLookupDataMap

      protected Map<String,String> getLookupDataMap(CsvData data, Conflict conflict)
    • getPkDataFor

      protected String getPkDataFor(CsvData data, Column column)
    • end

      public void end(Table table)
      Specified by:
      end in interface IDataWriter
    • end

      public void end(Batch batch, boolean inError)
      Specified by:
      end in interface IDataWriter
    • close

      public void close()
      Specified by:
      close in interface IDataResource
    • hasFilterThatHandlesMissingTable

      protected boolean hasFilterThatHandlesMissingTable(Table table)
    • allowInsertIntoAutoIncrementColumns

      protected void allowInsertIntoAutoIncrementColumns(boolean value, Table table)
    • lookupTableAtTarget

      protected Table lookupTableAtTarget(Table sourceTable)
    • getBatch

      public Batch getBatch()
    • getContext

      public DataContext getContext()
    • getConflictResolver

      public IDatabaseWriterConflictResolver getConflictResolver()
    • setConflictResolver

      public void setConflictResolver(IDatabaseWriterConflictResolver conflictResolver)
    • getTargetTable

      public Table getTargetTable()
    • getSourceTable

      public Table getSourceTable()
    • getStatistics

      public Map<Batch,Statistics> getStatistics()
      Specified by:
      getStatistics in interface IDataResource
    • getWriterSettings

      public DatabaseWriterSettings getWriterSettings()