org.axiondb.engine
Class BaseDatabase

java.lang.Object
  extended by org.axiondb.engine.BaseDatabase
All Implemented Interfaces:
Database
Direct Known Subclasses:
DiskDatabase, MemoryDatabase

public abstract class BaseDatabase
extends Object
implements Database

Abstract base Databaseimplementation.

Version:
$Revision: 1.97 $ $Date: 2007/11/13 19:04:02 $

Field Summary
static String SYSTABLE_DB_LINKS
           
static String SYSTABLE_INDEX_INFO
           
 
Fields inherited from interface org.axiondb.Database
COMMIT_SIZE
 
Constructor Summary
BaseDatabase(String name)
           
 
Method Summary
 void addDatabaseModificationListener(DatabaseModificationListener l)
          Adds a listener to receive events on this database
 void addIndex(Index index, Table table)
          Add the given Indexto this database, associated with the given table.
 void addIndex(Index index, Table table, boolean doPopulate)
          Add the given Indexto this database, associating it with the given table and (optionally) populating it.
 void addTable(Table t)
          Add the given Tableto this database.
 void checkpoint()
          Make sure any modified state or data has been written to disk.
 void createDatabaseLink(DatabaseLink dblink)
           
protected  void createMetaDataTables()
          Should get called by subclasses in constructors
 void createSequence(Sequence seq)
          Create a numeric sequence
protected abstract  Table createSystemTable(String name)
           
 void dropDatabaseLink(String name)
           
 void dropDependentExternalDBTable(List tables)
           
 void dropDependentViews(List views)
           
 void dropIndex(String name)
          Drop the given Indexfrom this database.
 void dropSequence(String name)
          Drop the specified Sequencefrom this database.
 void dropTable(String name)
          Drop the specified Tablefrom this database.
protected static Properties getBaseProperties()
          Callers should treat the returned Properties as immutable.
 DatabaseLink getDatabaseLink(String name)
           
 List getDatabaseModificationListeners()
          Returns all listeners set to receive events on this database
 DataType getDataType(String name)
          Get the DataTypecurrently registered for the given name, or null.
 List getDependentExternalDBTable(String name)
           
 List getDependentViews(String tableName)
           
 ConcreteFunction getFunction(String name)
           
 Object getGlobalVariable(String key)
           
 IndexFactory getIndexFactory(String name)
          Get the IndexFactorycurrently registered for the given name, or null.
 String getName()
          Returns the name of this Database.
 Sequence getSequence(String name)
          Get the specified Sequence, or null if no such sequence can be found.
protected  int getSequenceCount()
           
protected  Iterator<Sequence> getSequences()
           
 Table getTable(String name)
          Get the specified Table, or null if no such table can be found.
 Table getTable(TableIdentifier table)
          Get the specified Table, or null if no such table can be found.
 TableFactory getTableFactory(String name)
          Get the TableFactorycurrently registered for the given name, or null.
protected  Iterator<Table> getTables()
           
 TransactionManager getTransactionManager()
          Get the TransactionManagerfor this database.
 boolean hasDatabaseLink(String name)
           
 boolean hasIndex(String name)
          Returns true iff the given Indexexists.
 boolean hasSequence(String name)
           
 boolean hasTable(String name)
           
 boolean hasTable(TableIdentifier id)
           
 boolean isReadOnly()
          Is this database read-only?
protected  void loadProperties(Properties props)
           
 void migrate(int version)
          Migrate from older version to newer version for this database
 void remount(File newdir)
          Notify this database that its root directory has been moved to the given location.
 void removeDatabaseModificationListener(DatabaseModificationListener l)
           
 void renameTable(String oldName, String newName)
           
 Selectable resolveSelectSelectable(SubSelectCommand select, TableIdentifier[] tables)
           
 void shutdown()
          Close this database and free any resources associated with it.
 void tableAltered(Table t)
          Update metadata tables since this table has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axiondb.Database
getDBDirectory
 

Field Detail

SYSTABLE_DB_LINKS

public static final String SYSTABLE_DB_LINKS
See Also:
Constant Field Values

SYSTABLE_INDEX_INFO

public static final String SYSTABLE_INDEX_INFO
See Also:
Constant Field Values
Constructor Detail

BaseDatabase

public BaseDatabase(String name)
Method Detail

addDatabaseModificationListener

public void addDatabaseModificationListener(DatabaseModificationListener l)
Description copied from interface: Database
Adds a listener to receive events on this database

Specified by:
addDatabaseModificationListener in interface Database

addIndex

public void addIndex(Index index,
                     Table table)
              throws AxionException
Description copied from interface: Database
Add the given Indexto this database, associated with the given table.

Specified by:
addIndex in interface Database
Throws:
AxionException

addIndex

public void addIndex(Index index,
                     Table table,
                     boolean doPopulate)
              throws AxionException
Description copied from interface: Database
Add the given Indexto this database, associating it with the given table and (optionally) populating it.

Specified by:
addIndex in interface Database
Parameters:
index - Index to be added and (optionally) populated
table - Table to be indexed
doPopulate - true if index should be populated by the appropriate column in table; false if index should be left as-is.
Throws:
AxionException - if error occurs during addition and/or population of index

addTable

public void addTable(Table t)
              throws AxionException
Description copied from interface: Database
Add the given Tableto this database.

Specified by:
addTable in interface Database
Throws:
AxionException

checkpoint

public void checkpoint()
                throws AxionException
Description copied from interface: Database
Make sure any modified state or data has been written to disk.

Specified by:
checkpoint in interface Database
Throws:
AxionException

createDatabaseLink

public void createDatabaseLink(DatabaseLink dblink)
                        throws AxionException
Specified by:
createDatabaseLink in interface Database
Throws:
AxionException

createSequence

public void createSequence(Sequence seq)
                    throws AxionException
Description copied from interface: Database
Create a numeric sequence

Specified by:
createSequence in interface Database
Throws:
AxionException

dropDatabaseLink

public void dropDatabaseLink(String name)
                      throws AxionException
Specified by:
dropDatabaseLink in interface Database
Throws:
AxionException

dropDependentExternalDBTable

public void dropDependentExternalDBTable(List tables)
                                  throws AxionException
Specified by:
dropDependentExternalDBTable in interface Database
Throws:
AxionException

dropDependentViews

public void dropDependentViews(List views)
                        throws AxionException
Specified by:
dropDependentViews in interface Database
Throws:
AxionException

dropIndex

public void dropIndex(String name)
               throws AxionException
Description copied from interface: Database
Drop the given Indexfrom this database.

Specified by:
dropIndex in interface Database
Throws:
AxionException

dropSequence

public void dropSequence(String name)
                  throws AxionException
Description copied from interface: Database
Drop the specified Sequencefrom this database.

Sequence name matching is case-insensitive.

Specified by:
dropSequence in interface Database
Throws:
AxionException

dropTable

public void dropTable(String name)
               throws AxionException
Description copied from interface: Database
Drop the specified Tablefrom this database.

Table name matching is case-insensitive.

Specified by:
dropTable in interface Database
Throws:
AxionException

getDatabaseLink

public DatabaseLink getDatabaseLink(String name)
Specified by:
getDatabaseLink in interface Database

getDatabaseModificationListeners

public List getDatabaseModificationListeners()
Description copied from interface: Database
Returns all listeners set to receive events on this database

Specified by:
getDatabaseModificationListeners in interface Database

getDataType

public DataType getDataType(String name)
Description copied from interface: Database
Get the DataTypecurrently registered for the given name, or null.

Specified by:
getDataType in interface Database

getDependentExternalDBTable

public List getDependentExternalDBTable(String name)
Specified by:
getDependentExternalDBTable in interface Database

getDependentViews

public List getDependentViews(String tableName)
Specified by:
getDependentViews in interface Database

getFunction

public ConcreteFunction getFunction(String name)
Specified by:
getFunction in interface Database

getGlobalVariable

public Object getGlobalVariable(String key)
Specified by:
getGlobalVariable in interface Database

getIndexFactory

public IndexFactory getIndexFactory(String name)
Description copied from interface: Database
Get the IndexFactorycurrently registered for the given name, or null.

Specified by:
getIndexFactory in interface Database

getName

public String getName()
Description copied from interface: Database
Returns the name of this Database.

Specified by:
getName in interface Database

getSequence

public Sequence getSequence(String name)
Description copied from interface: Database
Get the specified Sequence, or null if no such sequence can be found.

Sequence name matching is case-insensitive.

Specified by:
getSequence in interface Database

getTable

public Table getTable(String name)
               throws AxionException
Description copied from interface: Database
Get the specified Table, or null if no such table can be found.

Table name matching is case-insensitive.

Specified by:
getTable in interface Database
Throws:
AxionException

getTable

public Table getTable(TableIdentifier table)
               throws AxionException
Description copied from interface: Database
Get the specified Table, or null if no such table can be found.

Table name matching is case-insensitive.

Specified by:
getTable in interface Database
Throws:
AxionException

getTableFactory

public TableFactory getTableFactory(String name)
Description copied from interface: Database
Get the TableFactorycurrently registered for the given name, or null.

Specified by:
getTableFactory in interface Database

getTransactionManager

public TransactionManager getTransactionManager()
Description copied from interface: Database
Get the TransactionManagerfor this database.

Specified by:
getTransactionManager in interface Database

hasDatabaseLink

public boolean hasDatabaseLink(String name)
                        throws AxionException
Specified by:
hasDatabaseLink in interface Database
Throws:
AxionException

hasIndex

public boolean hasIndex(String name)
                 throws AxionException
Description copied from interface: Database
Returns true iff the given Indexexists.

Specified by:
hasIndex in interface Database
Throws:
AxionException

hasSequence

public boolean hasSequence(String name)
                    throws AxionException
Specified by:
hasSequence in interface Database
Throws:
AxionException

hasTable

public boolean hasTable(String name)
                 throws AxionException
Specified by:
hasTable in interface Database
Throws:
AxionException

hasTable

public boolean hasTable(TableIdentifier id)
                 throws AxionException
Specified by:
hasTable in interface Database
Throws:
AxionException

isReadOnly

public boolean isReadOnly()
Description copied from interface: Database
Is this database read-only?

Specified by:
isReadOnly in interface Database

migrate

public void migrate(int version)
             throws AxionException
Migrate from older version to newer version for this database

Specified by:
migrate in interface Database
Throws:
AxionException

remount

public void remount(File newdir)
             throws AxionException
Description copied from interface: Database
Notify this database that its root directory has been moved to the given location. (E.g., the CD containing the data for a CD-resident database has changed drives.)

Specified by:
remount in interface Database
Throws:
AxionException

removeDatabaseModificationListener

public void removeDatabaseModificationListener(DatabaseModificationListener l)

renameTable

public void renameTable(String oldName,
                        String newName)
                 throws AxionException
Specified by:
renameTable in interface Database
Throws:
AxionException

resolveSelectSelectable

public Selectable resolveSelectSelectable(SubSelectCommand select,
                                          TableIdentifier[] tables)

shutdown

public void shutdown()
              throws AxionException
Description copied from interface: Database
Close this database and free any resources associated with it.

Specified by:
shutdown in interface Database
Throws:
AxionException

tableAltered

public void tableAltered(Table t)
                  throws AxionException
Description copied from interface: Database
Update metadata tables since this table has changed.

Specified by:
tableAltered in interface Database
Throws:
AxionException

createMetaDataTables

protected void createMetaDataTables()
                             throws AxionException
Should get called by subclasses in constructors

Throws:
AxionException

createSystemTable

protected abstract Table createSystemTable(String name)

getSequenceCount

protected int getSequenceCount()

getSequences

protected Iterator<Sequence> getSequences()

getTables

protected Iterator<Table> getTables()

loadProperties

protected void loadProperties(Properties props)
                       throws AxionException
Throws:
AxionException

getBaseProperties

protected static Properties getBaseProperties()
Callers should treat the returned Properties as immutable.