com.triactive.jdo.store
Class ProbeTable

java.lang.Object
  extended bycom.triactive.jdo.store.AbstractTable
      extended bycom.triactive.jdo.store.BaseTable
          extended bycom.triactive.jdo.store.ProbeTable
All Implemented Interfaces:
Table

class ProbeTable
extends BaseTable


Field Summary
static int AUTO_CREATE
          Bit flag passed to validate() to indicate that the table should be created if it is missing.
protected  java.util.ArrayList columns
           
protected  java.util.HashMap columnsByName
           
protected  DatabaseAdapter dba
           
protected  SQLIdentifier name
           
protected  int state
           
protected  StoreManager storeMgr
           
protected static int TABLE_STATE_INITIALIZED
           
protected static int TABLE_STATE_NEW
           
protected static int TABLE_STATE_VALIDATED
           
static int TABLE_TYPE_BASE_TABLE
          Returned by StoreManager.getTableType() if the table is a base table.
static int TABLE_TYPE_MISSING
          Returned by StoreManager.getTableType() if the table does not exist.
static int TABLE_TYPE_UNKNOWN
          Returned by StoreManager.getTableType() if the table type is not recognized.
static int TABLE_TYPE_VIEW
          Returned by StoreManager.getTableType() if the table is a view.
static int VALIDATE
          Bit flag passed to validate() to indicate that the table structure should be validated using JDBC metadata.
 
Constructor Summary
ProbeTable(StoreManager storeMgr)
           
 
Method Summary
 void addColumn(Column col)
           
protected  void assertIsInitialized()
           
protected  void assertIsUninitialized()
           
protected  void assertIsValidated()
           
 void create(java.sql.Connection conn)
           
 void drop(java.sql.Connection conn)
           
 void dropConstraints(java.sql.Connection conn)
           
 boolean equals(java.lang.Object obj)
           
protected  void executeStatementList(java.util.List stmts, java.sql.Connection conn)
           
 boolean exists(java.sql.Connection conn)
          Tests if the database table exists.
 java.lang.String findSchemaName(java.sql.Connection conn)
           
protected  java.util.List getExpectedForeignKeys()
           
protected  java.util.Set getExpectedIndices()
           
 PrimaryKey getExpectedPrimaryKey()
           
 SQLIdentifier getName()
           
 java.lang.String getSchemaName()
           
protected  java.util.Map getSQLAddFKStatements(java.util.Map actualForeignKeysByName)
           
protected  java.util.Map getSQLCreateIndexStatements(java.util.Map actualIndicesByName)
           
protected  java.util.List getSQLCreateStatements()
           
protected  java.util.List getSQLDropStatements()
           
 StoreManager getStoreManager()
           
protected  boolean hasColumnName(SQLIdentifier colName)
           
 int hashCode()
           
 void initialize()
           
 boolean isInitialized()
           
 boolean isValidated()
           
 Column newColumn(java.lang.Class type, SQLIdentifier name, Role role)
           
 Column newColumn(java.lang.Class type, java.lang.String javaName)
           
 java.lang.String toString()
           
 boolean validate(int flags, java.sql.Connection conn)
           
 boolean validateConstraints(int flags, java.sql.Connection conn)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

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

storeMgr

protected final StoreManager storeMgr

dba

protected final DatabaseAdapter dba

name

protected SQLIdentifier name

state

protected int state

columns

protected java.util.ArrayList columns

columnsByName

protected java.util.HashMap columnsByName

TABLE_TYPE_MISSING

public static final int TABLE_TYPE_MISSING
Returned by StoreManager.getTableType() if the table does not exist.

See Also:
Constant Field Values

TABLE_TYPE_UNKNOWN

public static final int TABLE_TYPE_UNKNOWN
Returned by StoreManager.getTableType() if the table type is not recognized.

See Also:
Constant Field Values

TABLE_TYPE_BASE_TABLE

public static final int TABLE_TYPE_BASE_TABLE
Returned by StoreManager.getTableType() if the table is a base table.

See Also:
Constant Field Values

TABLE_TYPE_VIEW

public static final int TABLE_TYPE_VIEW
Returned by StoreManager.getTableType() if the table is a view.

See Also:
Constant Field Values

VALIDATE

public static final int VALIDATE
Bit flag passed to validate() to indicate that the table structure should be validated using JDBC metadata.

See Also:
Constant Field Values

AUTO_CREATE

public static final int AUTO_CREATE
Bit flag passed to validate() to indicate that the table should be created if it is missing.

See Also:
Constant Field Values
Constructor Detail

ProbeTable

public ProbeTable(StoreManager storeMgr)
Method Detail

initialize

public void initialize()

findSchemaName

public java.lang.String findSchemaName(java.sql.Connection conn)
                                throws java.sql.SQLException
Throws:
java.sql.SQLException

getExpectedPrimaryKey

public PrimaryKey getExpectedPrimaryKey()

create

public void create(java.sql.Connection conn)
            throws java.sql.SQLException
Specified by:
create in interface Table
Overrides:
create in class AbstractTable
Throws:
java.sql.SQLException

validate

public boolean validate(int flags,
                        java.sql.Connection conn)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

validateConstraints

public boolean validateConstraints(int flags,
                                   java.sql.Connection conn)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

drop

public void drop(java.sql.Connection conn)
          throws java.sql.SQLException
Specified by:
drop in interface Table
Overrides:
drop in class AbstractTable
Throws:
java.sql.SQLException

dropConstraints

public void dropConstraints(java.sql.Connection conn)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

getExpectedForeignKeys

protected java.util.List getExpectedForeignKeys()

getExpectedIndices

protected java.util.Set getExpectedIndices()

getSQLCreateStatements

protected java.util.List getSQLCreateStatements()
Specified by:
getSQLCreateStatements in class AbstractTable

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()
Specified by:
getSQLDropStatements in class AbstractTable

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()

getName

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

getStoreManager

public StoreManager getStoreManager()
Specified by:
getStoreManager in interface Table

getSchemaName

public java.lang.String getSchemaName()
Specified by:
getSchemaName in interface Table

addColumn

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

hasColumnName

protected boolean hasColumnName(SQLIdentifier 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,
                        SQLIdentifier name,
                        Role role)
Specified by:
newColumn in interface Table

executeStatementList

protected void executeStatementList(java.util.List stmts,
                                    java.sql.Connection conn)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

exists

public boolean exists(java.sql.Connection conn)
               throws java.sql.SQLException
Tests if the database table exists.

Specified by:
exists in interface Table
Parameters:
conn - a JDBC connection to the database.
Returns:
true if the table exists in the database, false otherwise.
Throws:
java.sql.SQLException

equals

public final boolean equals(java.lang.Object obj)

hashCode

public final int hashCode()

toString

public final java.lang.String toString()


Copyright © 2001 TriActive, Inc. All Rights Reserved.