|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jpox.store.rdbms.table.AbstractTable
org.jpox.store.rdbms.table.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.jpox.store.rdbms.table.AbstractTable |
columns, columnsByName, dba, ddlDumpWriter, identifier, LOCALISER, state, storeMgr |
Fields inherited from interface org.jpox.store.rdbms.table.Table |
TABLE_STATE_INITIALIZED, TABLE_STATE_INITIALIZED_MODIFIED, TABLE_STATE_NEW, TABLE_STATE_PK_INITIALIZED, TABLE_STATE_VALIDATED, TABLE_TYPE_MISSING, TABLE_TYPE_TABLE, TABLE_TYPE_UNKNOWN, TABLE_TYPE_VIEW |
Constructor Summary | |
TableImpl(DatastoreIdentifier name,
RDBMSManager storeMgr)
Constructor. |
Method Summary | |
void |
dropConstraints(java.sql.Connection conn)
Method to drop the constraints for the table from the datastore. |
protected java.util.List |
getExpectedCandidateKeys()
Accessor for the expected candidate keys for this table in the datastore. |
protected java.util.List |
getExpectedForeignKeys(ClassLoaderResolver clr)
Accessor for the expected foreign keys for this table in the datastore. |
protected java.util.Set |
getExpectedIndices(ClassLoaderResolver clr)
Accessor for the indices for this table in the datastore. |
PrimaryKey |
getPrimaryKey()
Accessor for the primary key for this table. |
protected java.util.Map |
getSQLAddCandidateKeyStatements(java.util.Map actualCandidateKeysByName)
Get SQL statements to add expected Candidate Keys that are not yet on the table. |
protected java.util.Map |
getSQLAddFKStatements(java.util.Map actualForeignKeysByName,
ClassLoaderResolver clr)
Get SQL statements to add expected Foreign Keys that are not yet at the table. |
protected java.util.Map |
getSQLCreateIndexStatements(java.util.Map actualIndicesByName,
ClassLoaderResolver clr)
Accessor for the CREATE INDEX statements for this table. |
protected java.util.List |
getSQLCreateStatements(java.util.Properties props)
Accessor for the SQL CREATE statements for this table. |
protected java.util.List |
getSQLDropStatements()
Accessor for the DROP statements for this table. |
void |
initializeColumnInfoForPrimaryKeyColumns(java.sql.Connection conn)
Utility to load the structure/metadata of columns of the table. |
void |
initializeColumnInfoFromDatastore(java.sql.Connection conn)
Initialize the default value for columns if null using the values from the datastore. |
void |
postInitialize(ClassLoaderResolver clr)
Post initilize. |
void |
preInitialize(ClassLoaderResolver clr)
Pre initilize. |
boolean |
validate(java.sql.Connection conn,
boolean validateColumnStructure,
boolean autoCreate,
java.util.Collection autoCreateErrors)
Method to validate the table in the datastore. |
boolean |
validateColumns(java.sql.Connection conn,
boolean validateColumnStructure,
boolean autoCreate,
java.util.Collection autoCreateErrors)
Utility to validate the columns of the table. |
boolean |
validateConstraints(java.sql.Connection conn,
boolean autoCreate,
java.util.Collection autoCreateErrors,
ClassLoaderResolver clr)
Method to validate any constraints, and auto create them if required. |
protected boolean |
validatePrimaryKey(java.sql.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.jpox.store.rdbms.table.Table |
initialize |
Methods inherited from interface org.jpox.store.DatastoreContainerObject |
getFieldMapping, getIDMapping |
Constructor Detail |
public TableImpl(DatastoreIdentifier name, RDBMSManager storeMgr)
name
- The name of the table (in SQL).storeMgr
- The StoreManager for this table.Method Detail |
public void initializeColumnInfoFromDatastore(java.sql.Connection conn) throws java.sql.SQLException
conn
- The JDBC Connection
java.sql.SQLException
- Thrown if an error occurs in the default initialisation.public void preInitialize(ClassLoaderResolver clr)
clr
- the ClassLoaderResolverpublic void postInitialize(ClassLoaderResolver clr)
clr
- the ClassLoaderResolverpublic PrimaryKey getPrimaryKey()
public boolean validate(java.sql.Connection conn, boolean validateColumnStructure, boolean autoCreate, java.util.Collection autoCreateErrors) throws java.sql.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
java.sql.SQLException
- Thrown when an error occurs in the JDBC callspublic boolean validateColumns(java.sql.Connection conn, boolean validateColumnStructure, boolean autoCreate, java.util.Collection autoCreateErrors) throws java.sql.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
java.sql.SQLException
- Thrown if an error occurs in the validation processpublic void initializeColumnInfoForPrimaryKeyColumns(java.sql.Connection conn) throws java.sql.SQLException
conn
- Connection to use for validation
java.sql.SQLException
- Thrown if an error occurs in the initialization processprotected boolean validatePrimaryKey(java.sql.Connection conn) throws java.sql.SQLException
conn
- Connection to use
java.sql.SQLException
- When an error occurs in the valdiationpublic boolean validateConstraints(java.sql.Connection conn, boolean autoCreate, java.util.Collection autoCreateErrors, ClassLoaderResolver clr) throws java.sql.SQLException
conn
- The JDBC ConnectionautoCreate
- Whether to auto create the constraints if not existingautoCreateErrors
- Errors found in the "auto-create" processclr
- The ClassLoaderResolver
java.sql.SQLException
- Thrown when an error occurs in the JDBC callspublic void dropConstraints(java.sql.Connection conn) throws java.sql.SQLException
conn
- The JDBC Connection
java.sql.SQLException
- Thrown when an error occurs in the JDBC call.protected java.util.List getExpectedForeignKeys(ClassLoaderResolver clr)
clr
- The ClassLoaderResolver
protected java.util.List getExpectedCandidateKeys()
protected java.util.Set getExpectedIndices(ClassLoaderResolver clr)
clr
- The ClassLoaderResolver
protected java.util.List getSQLCreateStatements(java.util.Properties props)
getSQLCreateStatements
in class AbstractTable
props
- Properties for controlling the table creation
protected java.util.Map getSQLAddFKStatements(java.util.Map actualForeignKeysByName, ClassLoaderResolver clr)
actualForeignKeysByName
- Actual Map of foreign keysclr
- The ClassLoaderResolver
protected java.util.Map getSQLAddCandidateKeyStatements(java.util.Map actualCandidateKeysByName)
actualCandidateKeysByName
- Actual Map of candidate keys
protected java.util.Map getSQLCreateIndexStatements(java.util.Map actualIndicesByName, ClassLoaderResolver clr)
actualIndicesByName
- Map of actual indexesclr
- The ClassLoaderResolver
protected java.util.List getSQLDropStatements()
getSQLDropStatements
in class AbstractTable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |