com.triactive.jdo.store.sql
Class BaseTable

java.lang.Object
  extended bycom.triactive.jdo.store.sql.AbstractTable
      extended bycom.triactive.jdo.store.sql.BaseTable
All Implemented Interfaces:
Table
Direct Known Subclasses:
ClassBaseTable, com.triactive.jdo.store.sql.FieldTable, ProbeTable, SchemaTable

public class BaseTable
extends com.triactive.jdo.store.sql.AbstractTable


Field Summary
protected  java.util.Map columnsByName
           
protected  DatabaseAdapter dba
           
protected  TableName name
           
protected  int state
           
protected static int TABLE_STATE_CONSTRAINTS_FROZEN
           
protected static int TABLE_STATE_CONSTRAINTS_INITIALIZED
           
protected static int TABLE_STATE_INITIALIZED
           
protected static int TABLE_STATE_NEW
           
protected static int TABLE_STATE_VALIDATED
           
 
Fields inherited from interface com.triactive.jdo.store.sql.Table
TABLE_TYPE_BASE_TABLE, TABLE_TYPE_MISSING, TABLE_TYPE_UNKNOWN, TABLE_TYPE_VIEW
 
Constructor Summary
BaseTable(TableName name, DatabaseAdapter dba)
           
 
Method Summary
 boolean addCandidateKey(CandidateKey ck)
           
 void addColumn(Column col)
           
 boolean addForeignKey(ForeignKey fk)
           
 boolean addIndex(Index idx)
           
protected  void assertConstraintsInitialized()
           
protected  void assertConstraintsNotFrozen()
           
protected  void assertConstraintsUninitialized()
           
protected  void assertIsInitialized()
           
protected  void assertIsUninitialized()
           
protected  void assertIsValidated()
           
 boolean constraintsFrozen()
           
 boolean constraintsInitialized()
           
 void create(StoreManager.MgmtTransaction mtx)
           
 void drop(StoreManager.MgmtTransaction mtx)
           
 void dropConstraints(StoreManager.MgmtTransaction mtx)
           
 boolean equals(java.lang.Object obj)
           
 boolean exists(StoreManager.MgmtTransaction mtx)
          Tests if the database table exists.
 DatabaseAdapter getDatabaseAdapter()
           
 TableName getName()
           
protected  java.util.Map getSqlAddFKStatements(java.util.Map actualForeignKeysByName)
           
protected  java.util.Map getSqlCreateIndexStatements(java.util.Map actualIndicesByName)
           
protected  java.util.List getSqlCreateStatements(StoreManager.MgmtTransaction mtx)
           
protected  java.util.List getSqlDropStatements(StoreManager.MgmtTransaction mtx)
           
protected  boolean hasColumnName(ColumnName colName)
           
 int hashCode()
           
 void initialize(StoreManager.MgmtTransaction mtx)
           
 void initializeConstraints(StoreManager.MgmtTransaction mtx)
           
 Table intern()
          Returns a canonical representation for the table object.
 boolean isInitialized()
           
 boolean isValidated()
           
 Column newColumn(java.lang.Class type, ColumnName baseColName, Role role)
           
 Column newColumn(java.lang.Class type, java.lang.String javaName)
           
 void setPrimaryKey(PrimaryKey pk)
           
 java.lang.String toString()
           
 boolean validate(StoreManager.MgmtTransaction mtx)
           
 boolean validateConstraints(StoreManager.MgmtTransaction mtx)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TABLE_STATE_CONSTRAINTS_INITIALIZED

protected static final int TABLE_STATE_CONSTRAINTS_INITIALIZED
See Also:
Constant Field Values

TABLE_STATE_CONSTRAINTS_FROZEN

protected static final int TABLE_STATE_CONSTRAINTS_FROZEN
See Also:
Constant Field Values

TABLE_STATE_NEW

protected static final int TABLE_STATE_NEW
See Also:
Constant Field Values

TABLE_STATE_INITIALIZED

protected static final int TABLE_STATE_INITIALIZED
See Also:
Constant Field Values

TABLE_STATE_VALIDATED

protected static final int TABLE_STATE_VALIDATED
See Also:
Constant Field Values

dba

protected final DatabaseAdapter dba

name

protected final TableName name

state

protected int state

columnsByName

protected java.util.Map columnsByName
Constructor Detail

BaseTable

public BaseTable(TableName name,
                 DatabaseAdapter dba)
Method Detail

constraintsInitialized

public boolean constraintsInitialized()

constraintsFrozen

public boolean constraintsFrozen()

assertConstraintsUninitialized

protected void assertConstraintsUninitialized()

assertConstraintsInitialized

protected void assertConstraintsInitialized()

assertConstraintsNotFrozen

protected void assertConstraintsNotFrozen()

initialize

public void initialize(StoreManager.MgmtTransaction mtx)

initializeConstraints

public void initializeConstraints(StoreManager.MgmtTransaction mtx)

setPrimaryKey

public void setPrimaryKey(PrimaryKey pk)

addCandidateKey

public boolean addCandidateKey(CandidateKey ck)

addForeignKey

public boolean addForeignKey(ForeignKey fk)

addIndex

public boolean addIndex(Index idx)

intern

public Table intern()
Description copied from interface: Table
Returns a canonical representation for the table object.

This method behaves much like String.intern(). A pool of tables, initially empty, is maintained privately.

When the intern method is invoked, if the pool already contains a table equal to this Table object as determined by the equals(Object) method, then the table from the pool is returned. Otherwise, this Table object is added to the pool and a reference to this Table object is returned.

It follows that for any two tables t1 and t2, t1.intern() == t2.intern() is true if and only if t1.equals(t2) is true.


create

public void create(StoreManager.MgmtTransaction mtx)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

validate

public boolean validate(StoreManager.MgmtTransaction mtx)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

validateConstraints

public boolean validateConstraints(StoreManager.MgmtTransaction mtx)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

drop

public void drop(StoreManager.MgmtTransaction mtx)
          throws java.sql.SQLException
Throws:
java.sql.SQLException

dropConstraints

public void dropConstraints(StoreManager.MgmtTransaction mtx)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

getSqlCreateStatements

protected java.util.List getSqlCreateStatements(StoreManager.MgmtTransaction mtx)

getSqlAddFKStatements

protected java.util.Map getSqlAddFKStatements(java.util.Map actualForeignKeysByName)

getSqlCreateIndexStatements

protected java.util.Map getSqlCreateIndexStatements(java.util.Map actualIndicesByName)

getSqlDropStatements

protected java.util.List getSqlDropStatements(StoreManager.MgmtTransaction mtx)

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object obj)

getName

public TableName getName()
Specified by:
getName in interface Table

getDatabaseAdapter

public DatabaseAdapter getDatabaseAdapter()
Specified by:
getDatabaseAdapter in interface Table

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface Table

isValidated

public boolean isValidated()
Specified by:
isValidated in interface Table

assertIsUninitialized

protected void assertIsUninitialized()

assertIsInitialized

protected void assertIsInitialized()

assertIsValidated

protected void assertIsValidated()

addColumn

public void addColumn(Column col)
Specified by:
addColumn in interface Table

hasColumnName

protected boolean hasColumnName(ColumnName colName)

newColumn

public Column newColumn(java.lang.Class type,
                        java.lang.String javaName)
Specified by:
newColumn in interface Table

newColumn

public Column newColumn(java.lang.Class type,
                        ColumnName baseColName,
                        Role role)
Specified by:
newColumn in interface Table

exists

public boolean exists(StoreManager.MgmtTransaction mtx)
               throws java.sql.SQLException
Description copied from interface: Table
Tests if the database table exists.

Specified by:
exists in interface Table
Parameters:
mtx - the active management transaction
Returns:
true if the table exists in the database, false otherwise.
Throws:
java.sql.SQLException

toString

public final java.lang.String toString()


Copyright 2001-2007 The TJDO Project All Rights Reserved.