org.axiondb.engine.tables
Class BaseFlatfileTable

java.lang.Object
  extended by org.axiondb.event.BaseTableModificationPublisher
      extended by org.axiondb.engine.tables.BaseTable
          extended by org.axiondb.engine.tables.BaseDiskTable
              extended by org.axiondb.engine.tables.BaseFlatfileTable
All Implemented Interfaces:
ExternalTable, RowSource, Table
Direct Known Subclasses:
DelimitedFlatfileTable, FixedWidthFlatfileTable, TaggedEBCDICTable

public abstract class BaseFlatfileTable
extends BaseDiskTable
implements ExternalTable

Base Flatfile Table


Nested Class Summary
protected  class BaseFlatfileTable.BaseFlatfileTableOrganizationContext
           
 
Field Summary
protected  long _faultCount
           
protected  String _fileName
           
protected  boolean _isFirstLineHeader
           
protected  String _lineSep
           
protected  long _maxFaults
           
protected  int _rowsToSkip
           
protected  TableOrganizationContext context
           
protected static char CR
           
protected static int EOF
           
protected static char FILLER
           
protected static char NL
           
static String PROP_FILENAME
           
protected static String PROP_ISFIRSTLINEHEADER
           
protected static String PROP_MAXFAULTS
           
protected static String PROP_RECORDDELIMITER
           
protected static String PROP_ROWSTOSKIP
           
 
Fields inherited from class org.axiondb.engine.tables.BaseDiskTable
_dataFile, _dbdir, _freeIds, _freeIdsFileName, _modCount, _pidx, _pidxFileName, _rowCount, INVALID_OFFSET
 
Fields inherited from interface org.axiondb.ExternalTable
DELIMITED_TABLE_TYPE, EXTERNAL_DB_TABLE_TYPE, FW_TABLE_TYPE, PROP_LOADTYPE, TAGGED_EBCDIC_TABLE_TYPE
 
Fields inherited from interface org.axiondb.Table
REGULAR_TABLE_TYPE, SYSTEM_TABLE_TYPE
 
Constructor Summary
BaseFlatfileTable(String name, Database db, TableFactory factory)
           
 
Method Summary
 void addColumn(Column col, boolean metaUpdateNeeded)
           
static String addEscapeSequence(String srcString)
           
protected  void applyInserts(Iterator rows)
           
protected  void applyUpdates(Iterator rows)
           
protected  void createOrLoadDataFile()
           
static String fixEscapeSequence(String srcString)
           
protected  File getDataFile()
           
protected  String getDefaultDataFileExtension()
           
protected  File getLobDir()
           
protected abstract  Row getRowByOffset(int idToAssign, long ptr)
           
protected  RowIterator getRowIterator()
           
protected  long ignoreRowsToSkip()
           
protected  void initializeTable()
           
protected  boolean isCarriageReturn(int nextChar)
           
protected abstract  boolean isEndOfRecord(int recLength, int nextChar, RandomAccessFile data)
           
protected  boolean isEOF(int nextChar)
           
protected  boolean isNewLine(int nextChar)
           
protected  boolean isNullString(String str)
           
protected  int nextLineLength(long fileOffset)
           
protected  void reloadDataFile()
           
 void remount()
           
protected  void renameTableFiles(String oldName, String name)
           
 boolean setTableProperties(Properties props)
          Sets the properties for the given text table this is only called once by create command get executed
protected  Row trySettingColumn(int idToAssign, Row row, int i, String colValue)
           
protected abstract  void writeHeader(RandomAccessFile data2)
           
protected abstract  void writeRow(CharArrayWriter buffer, Row row)
           
 
Methods inherited from class org.axiondb.engine.tables.BaseDiskTable
addColumn, addConstraint, appendLongFile, appendLongFile, applyDeletes, applyInserts, applyUpdates, clearDataFileReference, clearMetaFileReference, closeFiles, createOrLoadFreeIdsFile, createOrLoadMetaFile, createOrLoadPidxFile, deleteFile, drop, freeRowId, getCanonicalPath, getMetaFile, getNextRowId, getReadFile, getRootDir, getRow, getRowCount, getTableFile, getWriteFile, initFiles, initializeRowCount, openFile, parseIntFile, parseMetaFile, parseTableProperties, populateIndex, remount, removeIndex, rename, renameFile, saveIndices, saveIndicesAfterTruncate, setPidx, shutdown, truncate, tryToRemove, updateLongFile, writeFridFile, writeIntFile, writeLongFile, writeMetaFile, writeNameToFile, writePidxFile, writeTableProperties
 
Methods inherited from class org.axiondb.engine.tables.BaseTable
addIndex, addRow, applyDeletesToIndices, applyInsertsToIndices, applyUpdatesToIndices, checkConstraints, checkConstraints, deleteRow, getColumn, getColumn, getColumnCount, getColumnIdentifiers, getColumnIndex, getConstraints, getIndexedRows, getIndexForColumn, getIndices, getMatchingRows, getName, getRowIterator, getType, hasColumn, hasDeferredConstraint, hasIndex, isColumnIndexed, isPrimaryKeyConstraintExists, isUniqueConstraintExists, makeRowDecorator, makeTransactableTable, notifyColumnsOfNewLobDir, readColumns, readConstraints, removeConstraint, setName, setType, toString, truncateIndices, updateRow, writeColumns, writeConstraints
 
Methods inherited from class org.axiondb.event.BaseTableModificationPublisher
addTableModificationListener, getTableModificationListeners, publishEvent, removeTableModificationListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.axiondb.ExternalTable
getTableProperties
 
Methods inherited from interface org.axiondb.Table
addColumn, addConstraint, addIndex, addRow, addTableModificationListener, applyDeletes, applyInserts, applyUpdates, drop, freeRowId, getColumn, getColumn, getColumnCount, getColumnIdentifiers, getColumnIndex, getConstraints, getIndexedRows, getIndexForColumn, getIndices, getMatchingRows, getName, getNextRowId, getRowCount, getRowIterator, getType, hasColumn, hasIndex, isColumnIndexed, isPrimaryKeyConstraintExists, isUniqueConstraintExists, makeRowDecorator, makeTransactableTable, populateIndex, remount, removeConstraint, removeIndex, removeTableModificationListener, rename, shutdown, truncate, updateRow
 
Methods inherited from interface org.axiondb.RowSource
getRow
 

Field Detail

CR

protected static final char CR
See Also:
Constant Field Values

EOF

protected static final int EOF
See Also:
Constant Field Values

FILLER

protected static final char FILLER
See Also:
Constant Field Values

NL

protected static final char NL
See Also:
Constant Field Values

PROP_FILENAME

public static final String PROP_FILENAME
See Also:
Constant Field Values

PROP_ISFIRSTLINEHEADER

protected static final String PROP_ISFIRSTLINEHEADER
See Also:
Constant Field Values

PROP_RECORDDELIMITER

protected static final String PROP_RECORDDELIMITER
See Also:
Constant Field Values

PROP_ROWSTOSKIP

protected static final String PROP_ROWSTOSKIP
See Also:
Constant Field Values

PROP_MAXFAULTS

protected static final String PROP_MAXFAULTS
See Also:
Constant Field Values

context

protected TableOrganizationContext context

_fileName

protected String _fileName

_isFirstLineHeader

protected boolean _isFirstLineHeader

_rowsToSkip

protected int _rowsToSkip

_maxFaults

protected long _maxFaults

_faultCount

protected long _faultCount

_lineSep

protected String _lineSep
Constructor Detail

BaseFlatfileTable

public BaseFlatfileTable(String name,
                         Database db,
                         TableFactory factory)
                  throws AxionException
Throws:
AxionException
Method Detail

addColumn

public void addColumn(Column col,
                      boolean metaUpdateNeeded)
               throws AxionException
Overrides:
addColumn in class BaseDiskTable
Throws:
AxionException

setTableProperties

public boolean setTableProperties(Properties props)
                           throws AxionException
Sets the properties for the given text table this is only called once by create command get executed

Specified by:
setTableProperties in interface ExternalTable
Parameters:
table - Table to be set
props - Properties for Table
Throws:
AxionException - thrown while setting Properties

remount

public void remount()
             throws AxionException
Specified by:
remount in interface ExternalTable
Throws:
AxionException

addEscapeSequence

public static String addEscapeSequence(String srcString)

applyInserts

protected void applyInserts(Iterator rows)
                     throws AxionException
Specified by:
applyInserts in class BaseDiskTable
Throws:
AxionException

applyUpdates

protected void applyUpdates(Iterator rows)
                     throws AxionException
Specified by:
applyUpdates in class BaseDiskTable
Throws:
AxionException

createOrLoadDataFile

protected void createOrLoadDataFile()
                             throws AxionException
Overrides:
createOrLoadDataFile in class BaseDiskTable
Throws:
AxionException

fixEscapeSequence

public static String fixEscapeSequence(String srcString)

getDataFile

protected File getDataFile()
Specified by:
getDataFile in class BaseDiskTable

renameTableFiles

protected void renameTableFiles(String oldName,
                                String name)
Overrides:
renameTableFiles in class BaseDiskTable

getLobDir

protected File getLobDir()
Specified by:
getLobDir in class BaseDiskTable

getRowByOffset

protected abstract Row getRowByOffset(int idToAssign,
                                      long ptr)
                               throws AxionException
Specified by:
getRowByOffset in class BaseDiskTable
Throws:
AxionException

getRowIterator

protected RowIterator getRowIterator()
                              throws AxionException
Specified by:
getRowIterator in class BaseTable
Throws:
AxionException

ignoreRowsToSkip

protected long ignoreRowsToSkip()
                         throws AxionException
Throws:
AxionException

initializeTable

protected void initializeTable()
                        throws AxionException
Throws:
AxionException

isCarriageReturn

protected boolean isCarriageReturn(int nextChar)

isEndOfRecord

protected abstract boolean isEndOfRecord(int recLength,
                                         int nextChar,
                                         RandomAccessFile data)
                                  throws IOException
Throws:
IOException

isEOF

protected boolean isEOF(int nextChar)

isNewLine

protected boolean isNewLine(int nextChar)

isNullString

protected boolean isNullString(String str)

getDefaultDataFileExtension

protected String getDefaultDataFileExtension()
Overrides:
getDefaultDataFileExtension in class BaseDiskTable

reloadDataFile

protected void reloadDataFile()
                       throws AxionException
Specified by:
reloadDataFile in class BaseDiskTable
Throws:
AxionException

trySettingColumn

protected Row trySettingColumn(int idToAssign,
                               Row row,
                               int i,
                               String colValue)
                        throws AxionException
Throws:
AxionException

writeHeader

protected abstract void writeHeader(RandomAccessFile data2)
                             throws AxionException
Throws:
AxionException

writeRow

protected abstract void writeRow(CharArrayWriter buffer,
                                 Row row)
                          throws AxionException
Throws:
AxionException

nextLineLength

protected int nextLineLength(long fileOffset)
                      throws AxionException
Throws:
AxionException