org.axiondb
Interface Table

All Superinterfaces:
RowSource
All Known Subinterfaces:
ExternalTable, TransactableTable
All Known Implementing Classes:
BaseDiskTable, BaseFlatfileTable, BaseTable, DelimitedFlatfileTable, DiskTable, ExternalDatabaseTable, MemoryTable, TableView, TransactableTableImpl

public interface Table
extends RowSource

A database table.

Version:
$Revision: 1.53 $ $Date: 2004/08/31 02:34:40 $

Field Summary
static String REGULAR_TABLE_TYPE
           
static String SYSTEM_TABLE_TYPE
           
 
Method Summary
 void addColumn(Column col)
          Add the given Columnto this table.
 void addConstraint(Constraint constraint)
           
 void addIndex(Index index)
          Add an index, associating it with a Column, and adding it as a org.axiondb.TableModificationListenerto the table.
 void addRow(Row row)
          Insert the given Row.
 void addTableModificationListener(TableModificationListener listener)
          Adds a listener to receive events on this table
 void applyDeletes(org.apache.commons.collections.primitives.IntCollection rowids)
          Remove the specified rows from this table and any associated indices.
 void applyInserts(Collection rows)
          Insert the given rows into this table and any associated indices.
 void applyUpdates(Collection rows)
          Update the given rows in this table and any associated indices.
 void drop()
          Drop this table from the database.
 void freeRowId(int id)
          Un-reserve a row id.
 Column getColumn(int index)
          Return the Columncorresponding to the given zero-based index .
 Column getColumn(String name)
          Return the Columnfor the given name .
 int getColumnCount()
          Return the number of Columns I contain.
 Iterator getColumnIdentifiers()
          Return an Iteratorover the ColumnIdentifiersfor my Columns.
 int getColumnIndex(String name)
          Return the zero-based index of the Columnwith the given name .
 Iterator getConstraints()
           
 RowIterator getIndexedRows(Selectable where, boolean readOnly)
           
 Index getIndexForColumn(Column column)
          Return the first Indexthat pertains to the given Column, or null if no such Indexexists.
 Iterator getIndices()
          Obtain an Iteratorover my indices.
 RowIterator getMatchingRows(List selectables, List values)
          Obtain an iteratorover my Rows where each Selectablein the selectable list evaluatesto the corresponding value in the value list.
 String getName()
          Get the name of this table.
 int getNextRowId()
          Reserve a row id.
 int getRowCount()
          Return the number of Rows I contain.
 RowIterator getRowIterator(boolean readOnly)
          Obtain an iteratorover my Rows.
 String getType()
          Get the type of this table.
 boolean hasColumn(ColumnIdentifier id)
          Indicate whether the ColumnIdentifierreferences a column in this table
 boolean hasIndex(String name)
           
 boolean isColumnIndexed(Column column)
          Check to see if an Indexexists for the given Column
 boolean isPrimaryKeyConstraintExists(String columnName)
          check if primary constraint exists on a column
 boolean isUniqueConstraintExists(String columnName)
          check if unique constraint exists on a column
 RowDecorator makeRowDecorator()
           
 TransactableTable makeTransactableTable()
          Create a TransactableTablefor this table.
 void populateIndex(Index index)
          Populate an Index, adding my current rows to it.
 void remount(File dir, boolean dataOnly)
          Notify this table that its disk-location has moved.
 void removeConstraint(String name)
           
 void removeIndex(Index index)
          Remove an index, both from the indices and as a TableModificationListener
 void removeTableModificationListener(TableModificationListener listener)
          Removes a listener so that it stops receiving events on this table
 void rename(String oldName, String newName)
           
 void shutdown()
          The database is shutting down, shutdown this table also.
 void truncate()
          Unconditionally delete all rows in this table.
 void updateRow(Row oldrow, Row newrow)
          Update the given Row.
 
Methods inherited from interface org.axiondb.RowSource
getRow
 

Field Detail

REGULAR_TABLE_TYPE

public static final String REGULAR_TABLE_TYPE
See Also:
Constant Field Values

SYSTEM_TABLE_TYPE

public static final String SYSTEM_TABLE_TYPE
See Also:
Constant Field Values
Method Detail

addColumn

public void addColumn(Column col)
               throws AxionException
Add the given Columnto this table.

Throws:
AxionException

addConstraint

public void addConstraint(Constraint constraint)
                   throws AxionException
Throws:
AxionException

addIndex

public void addIndex(Index index)
              throws AxionException
Add an index, associating it with a Column, and adding it as a org.axiondb.TableModificationListenerto the table.

Parameters:
index -
Throws:
AxionException
See Also:
addIndex(org.axiondb.Index), addTableModificationListener(org.axiondb.event.TableModificationListener), getIndexForColumn(org.axiondb.Column), isColumnIndexed(org.axiondb.Column), populateIndex(org.axiondb.Index)

addRow

public void addRow(Row row)
            throws AxionException
Insert the given Row.

Throws:
AxionException

addTableModificationListener

public void addTableModificationListener(TableModificationListener listener)
Adds a listener to receive events on this table


applyDeletes

public void applyDeletes(org.apache.commons.collections.primitives.IntCollection rowids)
                  throws AxionException
Remove the specified rows from this table and any associated indices. This process is allowed to be destructive, the table my delete values from the given list.

Throws:
AxionException

applyInserts

public void applyInserts(Collection rows)
                  throws AxionException
Insert the given rows into this table and any associated indices. This process is allowed to be destructive, the table my delete rows from the given list.

Parameters:
rows - a collection of Rows
Throws:
AxionException

applyUpdates

public void applyUpdates(Collection rows)
                  throws AxionException
Update the given rows in this table and any associated indices. This process is allowed to be destructive, the table my delete rows from the given list.

Throws:
AxionException

drop

public void drop()
          throws AxionException
Drop this table from the database.

Throws:
AxionException

freeRowId

public void freeRowId(int id)
Un-reserve a row id.


getColumn

public Column getColumn(int index)
Return the Columncorresponding to the given zero-based index .


getColumn

public Column getColumn(String name)
Return the Columnfor the given name .


getColumnCount

public int getColumnCount()
Return the number of Columns I contain.

Specified by:
getColumnCount in interface RowSource

getColumnIdentifiers

public Iterator getColumnIdentifiers()
Return an Iteratorover the ColumnIdentifiersfor my Columns.


getColumnIndex

public int getColumnIndex(String name)
                   throws AxionException
Return the zero-based index of the Columnwith the given name .

Specified by:
getColumnIndex in interface RowSource
Throws:
AxionException

getConstraints

public Iterator getConstraints()

getIndexedRows

public RowIterator getIndexedRows(Selectable where,
                                  boolean readOnly)
                           throws AxionException
Parameters:
readOnly - when true, the caller does not expect to be able to modify (i.e., call RowIterator.set(org.axiondb.Row)or RowIterator.remove()on) the returned RowIterator, the returned iterator may be unmodifiable.
Throws:
AxionException

getIndexForColumn

public Index getIndexForColumn(Column column)
Return the first Indexthat pertains to the given Column, or null if no such Indexexists.

Returns:
the pertinent Column, or null if no such Indexexists

getIndices

public Iterator getIndices()
Obtain an Iteratorover my indices.


getMatchingRows

public RowIterator getMatchingRows(List selectables,
                                   List values)
                            throws AxionException
Obtain an iteratorover my Rows where each Selectablein the selectable list evaluatesto the corresponding value in the value list.

This is functionally similiar to executing a SELECT over this table where selectable[i] = value[i] for each value of i . The return RowIterator is not modifiable.

Throws:
AxionException

getName

public String getName()
Get the name of this table.


getNextRowId

public int getNextRowId()
Reserve a row id.


getRowCount

public int getRowCount()
Return the number of Rows I contain.


getRowIterator

public RowIterator getRowIterator(boolean readOnly)
                           throws AxionException
Obtain an iteratorover my Rows.

Parameters:
readOnly - when true, the caller does not expect to be able to modify (i.e., call RowIterator.set(org.axiondb.Row)or RowIterator.remove()on) the returned RowIterator, the returned iterator may be unmodifiable.
Throws:
AxionException

getType

public String getType()
Get the type of this table.


hasColumn

public boolean hasColumn(ColumnIdentifier id)
Indicate whether the ColumnIdentifierreferences a column in this table


hasIndex

public boolean hasIndex(String name)
                 throws AxionException
Throws:
AxionException

isColumnIndexed

public boolean isColumnIndexed(Column column)
Check to see if an Indexexists for the given Column

Parameters:
column - Columnto check
Returns:
true iff there is an existing Indexfor the given Column

isPrimaryKeyConstraintExists

public boolean isPrimaryKeyConstraintExists(String columnName)
check if primary constraint exists on a column

Returns:
if PrimaryKeyConstraint exists on the column

isUniqueConstraintExists

public boolean isUniqueConstraintExists(String columnName)
check if unique constraint exists on a column

Parameters:
columnName - name of the columm
Returns:
true if uniqueConstraint exists on the column

makeRowDecorator

public RowDecorator makeRowDecorator()
Specified by:
makeRowDecorator in interface RowSource

makeTransactableTable

public TransactableTable makeTransactableTable()
Create a TransactableTablefor this table.


populateIndex

public void populateIndex(Index index)
                   throws AxionException
Populate an Index, adding my current rows to it. Does not addthe index.

Parameters:
index -
Throws:
AxionException
See Also:
addIndex(org.axiondb.Index)

remount

public void remount(File dir,
                    boolean dataOnly)
             throws AxionException
Notify this table that its disk-location has moved.

Throws:
AxionException

removeConstraint

public void removeConstraint(String name)

removeIndex

public void removeIndex(Index index)
                 throws AxionException
Remove an index, both from the indices and as a TableModificationListener

Parameters:
index -
Throws:
AxionException

removeTableModificationListener

public void removeTableModificationListener(TableModificationListener listener)
Removes a listener so that it stops receiving events on this table


rename

public void rename(String oldName,
                   String newName)
            throws AxionException
Throws:
AxionException

shutdown

public void shutdown()
              throws AxionException
The database is shutting down, shutdown this table also.

Throws:
AxionException

truncate

public void truncate()
              throws AxionException
Unconditionally delete all rows in this table.

Returns:
true if truncation succeeded; false otherwise
Throws:
AxionException

updateRow

public void updateRow(Row oldrow,
                      Row newrow)
               throws AxionException
Update the given Row.

Throws:
AxionException