|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.rdbms.table.AbstractTable
org.datanucleus.store.rdbms.table.TableImpl
public abstract class TableImpl
Class representing a table in a datastore (RDBMS). Provides a series of methods for validating the aspects of the table, namely
| Field Summary |
|---|
| Fields inherited from class org.datanucleus.store.rdbms.table.AbstractTable |
|---|
columns, columnsByName, dba, existsInDatastore, identifier, LOCALISER, state, storeMgr, TABLE_STATE_INITIALIZED, TABLE_STATE_INITIALIZED_MODIFIED, TABLE_STATE_NEW, TABLE_STATE_PK_INITIALIZED, TABLE_STATE_VALIDATED |
| Constructor Summary | |
|---|---|
TableImpl(org.datanucleus.store.mapped.DatastoreIdentifier name,
RDBMSStoreManager storeMgr)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
createConstraints(Connection conn,
Collection autoCreateErrors,
org.datanucleus.ClassLoaderResolver clr)
Method used to create all constraints for a brand new table. |
void |
dropConstraints(Connection conn)
Method to drop the constraints for the table from the datastore. |
protected List |
getExpectedCandidateKeys()
Accessor for the expected candidate keys for this table in the datastore. |
List<ForeignKey> |
getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
Accessor for the expected foreign keys for this table in the datastore. |
protected Set |
getExpectedIndices(org.datanucleus.ClassLoaderResolver clr)
Accessor for the indices for this table in the datastore. |
PrimaryKey |
getPrimaryKey()
Accessor for the primary key for this table. |
protected Map |
getSQLAddCandidateKeyStatements(Map actualCandidateKeysByName)
Get SQL statements to add expected Candidate Keys that are not yet on the table. |
protected Map |
getSQLAddFKStatements(Map actualForeignKeysByName,
org.datanucleus.ClassLoaderResolver clr)
Get SQL statements to add expected Foreign Keys that are not yet at the table. |
protected Map |
getSQLCreateIndexStatements(Map actualIndicesByName,
org.datanucleus.ClassLoaderResolver clr)
Accessor for the CREATE INDEX statements for this table. |
protected List |
getSQLCreateStatements(Properties props)
Accessor for the SQL CREATE statements for this table. |
protected List |
getSQLDropStatements()
Accessor for the DROP statements for this table. |
void |
initializeColumnInfoForPrimaryKeyColumns(Connection conn)
Utility to load the structure/metadata of primary key columns of the table. |
void |
initializeColumnInfoFromDatastore(Connection conn)
Initialize the default value for columns if null using the values from the datastore. |
void |
postInitialize(org.datanucleus.ClassLoaderResolver clr)
Post initilize. |
void |
preInitialize(org.datanucleus.ClassLoaderResolver clr)
Pre-initilize. |
boolean |
validate(Connection conn,
boolean validateColumnStructure,
boolean autoCreate,
Collection autoCreateErrors)
Method to validate the table in the datastore. |
boolean |
validateColumns(Connection conn,
boolean validateColumnStructure,
boolean autoCreate,
Collection autoCreateErrors)
Utility to validate the columns of the table. |
boolean |
validateConstraints(Connection conn,
boolean autoCreate,
Collection autoCreateErrors,
org.datanucleus.ClassLoaderResolver clr)
Method to validate any constraints, and auto create them if required. |
protected boolean |
validatePrimaryKey(Connection conn)
Utility method to validate the primary key of the table. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.datanucleus.store.rdbms.table.Table |
|---|
initialize |
| Methods inherited from interface org.datanucleus.store.mapped.DatastoreContainerObject |
|---|
getIdMapping, getMemberMapping |
| Constructor Detail |
|---|
public TableImpl(org.datanucleus.store.mapped.DatastoreIdentifier name,
RDBMSStoreManager storeMgr)
name - The name of the table (in SQL).storeMgr - The StoreManager for this table.| Method Detail |
|---|
public void preInitialize(org.datanucleus.ClassLoaderResolver clr)
clr - the ClassLoaderResolverpublic void postInitialize(org.datanucleus.ClassLoaderResolver clr)
clr - the ClassLoaderResolverpublic PrimaryKey getPrimaryKey()
public boolean validate(Connection conn,
boolean validateColumnStructure,
boolean autoCreate,
Collection autoCreateErrors)
throws SQLException
conn - The JDBC ConnectionvalidateColumnStructure - Whether to validate the column structure, or just the column existenceautoCreate - Whether to update the table to fix any validation errors. Only applies to missing columns.autoCreateErrors - Exceptions found in the "auto-create" process
SQLException - Thrown when an error occurs in the JDBC calls
public boolean validateColumns(Connection conn,
boolean validateColumnStructure,
boolean autoCreate,
Collection autoCreateErrors)
throws SQLException
conn - Connection to use for validationvalidateColumnStructure - Whether to validate down to the structure of the columns, or just their existenceautoCreate - Whether to auto create any missing columnsautoCreateErrors - Exceptions found in the "auto-create" process
SQLException - Thrown if an error occurs in the validation process
public void initializeColumnInfoForPrimaryKeyColumns(Connection conn)
throws SQLException
conn - Connection to use for validation
SQLException - Thrown if an error occurs in the initialization process
public void initializeColumnInfoFromDatastore(Connection conn)
throws SQLException
conn - The JDBC Connection
SQLException - Thrown if an error occurs in the default initialisation.
protected boolean validatePrimaryKey(Connection conn)
throws SQLException
conn - Connection to use
SQLException - When an error occurs in the valdiation
public boolean validateConstraints(Connection conn,
boolean autoCreate,
Collection autoCreateErrors,
org.datanucleus.ClassLoaderResolver clr)
throws SQLException
conn - The JDBC ConnectionautoCreate - Whether to auto create the constraints if not existingautoCreateErrors - Errors found in the "auto-create" processclr - The ClassLoaderResolver
SQLException - Thrown when an error occurs in the JDBC calls
public boolean createConstraints(Connection conn,
Collection autoCreateErrors,
org.datanucleus.ClassLoaderResolver clr)
throws SQLException
conn - The JDBC ConnectionautoCreateErrors - Errors found in the "auto-create" processclr - The ClassLoaderResolver
SQLException - Thrown when an error occurs in the JDBC calls
public void dropConstraints(Connection conn)
throws SQLException
conn - The JDBC Connection
SQLException - Thrown when an error occurs in the JDBC call.public List<ForeignKey> getExpectedForeignKeys(org.datanucleus.ClassLoaderResolver clr)
clr - The ClassLoaderResolver
protected List getExpectedCandidateKeys()
protected Set getExpectedIndices(org.datanucleus.ClassLoaderResolver clr)
clr - The ClassLoaderResolver
protected List getSQLCreateStatements(Properties props)
getSQLCreateStatements in class AbstractTableprops - Properties for controlling the table creation
protected Map getSQLAddFKStatements(Map actualForeignKeysByName,
org.datanucleus.ClassLoaderResolver clr)
actualForeignKeysByName - Actual Map of foreign keysclr - The ClassLoaderResolver
protected Map getSQLAddCandidateKeyStatements(Map actualCandidateKeysByName)
actualCandidateKeysByName - Actual Map of candidate keys
protected Map getSQLCreateIndexStatements(Map actualIndicesByName,
org.datanucleus.ClassLoaderResolver clr)
actualIndicesByName - Map of actual indexesclr - The ClassLoaderResolver
protected List getSQLDropStatements()
getSQLDropStatements in class AbstractTable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||