|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.rdbms.table.AbstractTable
public abstract class AbstractTable
Abstract implementation of a table in the datastore. The table exists in various states. After initialisation it can be created in the datastore by calling create. At any point after initialisation it can be modified, but only by addition of columns. The table can be dropped from the datastore by calling drop.
| Field Summary | |
|---|---|
protected List<Column> |
columns
Columns for this table. |
protected HashMap<org.datanucleus.store.mapped.DatastoreIdentifier,Column> |
columnsByName
Index to the columns, keyed by name. |
protected RDBMSAdapter |
dba
Database Adapter being used. |
protected Boolean |
existsInDatastore
Cache what we learned in a call to exists() |
protected org.datanucleus.store.mapped.DatastoreIdentifier |
identifier
Identifier name for the table. |
protected static org.datanucleus.util.Localiser |
LOCALISER
Localiser for messages. |
protected int |
state
State of the table |
protected RDBMSStoreManager |
storeMgr
Manager for this table. |
protected static int |
TABLE_STATE_INITIALIZED
Table object has been initialised. |
protected static int |
TABLE_STATE_INITIALIZED_MODIFIED
Table object has been initialized but has had structural modifications since. |
protected static int |
TABLE_STATE_NEW
Table object has just been created. |
protected static int |
TABLE_STATE_PK_INITIALIZED
Table object is created and PK initialised. |
protected static int |
TABLE_STATE_VALIDATED
Table object has been validated. |
| Constructor Summary | |
|---|---|
AbstractTable(org.datanucleus.store.mapped.DatastoreIdentifier identifier,
RDBMSStoreManager storeMgr)
Constructor taking the table name and the RDBMSManager managing this table. |
|
| Method Summary | |
|---|---|
protected void |
addColumnInternal(Column col)
Utility method to add a column to the internal representation |
org.datanucleus.store.mapped.DatastoreField |
addDatastoreField(String storedJavaType,
org.datanucleus.store.mapped.DatastoreIdentifier name,
org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
org.datanucleus.metadata.ColumnMetaData colmd)
Creates a new column in the table. |
protected boolean |
allowDDLOutput()
Determine whether we or our concrete class allow DDL to be written into a file instead of sending it to the DB. |
protected void |
assertIsInitialized()
|
protected void |
assertIsInitializedModified()
|
protected void |
assertIsPKInitialized()
|
protected void |
assertIsPKUninitialized()
|
protected void |
assertIsUninitialized()
|
protected void |
assertIsValidated()
|
boolean |
create(Connection conn)
Method to create this table. |
void |
drop(Connection conn)
Method to drop this table. |
boolean |
equals(Object obj)
Equality operator. |
protected void |
executeDdlStatement(Statement stmt,
String stmtText)
Execute a single DDL SQL statement with appropriate logging. |
protected void |
executeDdlStatementList(List stmts,
Connection conn)
Method to perform the required SQL statements. |
boolean |
exists(Connection conn,
boolean auto_create)
Method to check the existence of the table/view, optionally auto creating it where required. |
String |
getCatalogName()
Accessor for the Catalog Name. |
org.datanucleus.store.mapped.DatastoreField |
getDatastoreField(org.datanucleus.store.mapped.DatastoreIdentifier identifier)
Accessor for the Datastore field with the specified identifier. |
org.datanucleus.store.mapped.DatastoreField[] |
getDatastoreFields()
Accessor for the DatastoreFields infered from the java and metadata files. |
org.datanucleus.store.mapped.DatastoreIdentifier |
getDatastoreIdentifierFullyQualified()
Method that operates like toString except it returns a fully-qualified name that will always be fully-qualified even when the user hasnt specified the catalog/schema in PMF or MetaData. |
org.datanucleus.store.mapped.mapping.JavaTypeMapping |
getDiscriminatorMapping(boolean allowSuperclasses)
Accessor for the discriminator mapping specified . |
org.datanucleus.metadata.DiscriminatorMetaData |
getDiscriminatorMetaData()
Accessor for Discriminator MetaData |
org.datanucleus.store.mapped.DatastoreIdentifier |
getIdentifier()
Accessor for the SQL identifier (the table name). |
org.datanucleus.store.mapped.mapping.JavaTypeMapping |
getMultitenancyMapping()
|
String |
getSchemaName()
Accessor for the Schema Name. |
protected abstract List |
getSQLCreateStatements(Properties props)
Accessor for the SQL create statements. |
protected abstract List |
getSQLDropStatements()
Accessor for the SQL drop statements. |
org.datanucleus.store.mapped.MappedStoreManager |
getStoreManager()
Accessor for the Store Manager. |
org.datanucleus.store.mapped.mapping.JavaTypeMapping |
getVersionMapping(boolean allowSuperclasses)
Accessor for the version mapping specified. |
org.datanucleus.metadata.VersionMetaData |
getVersionMetaData()
Accessor for Version MetaData |
protected boolean |
hasColumnName(org.datanucleus.store.mapped.DatastoreIdentifier colName)
Utility to return if a column of this name exists. |
boolean |
hasDatastoreField(org.datanucleus.store.mapped.DatastoreIdentifier identifier)
Checks if there is a DatastoreField for the identifier |
int |
hashCode()
Accessor for the hascode of this table. |
boolean |
isInitialized()
Accessor for whether the table is initialised. |
boolean |
isInitializedModified()
Accessor for whether the table has been modified since initialisation. |
boolean |
isPKInitialized()
Accessor for whether the primary key of the table is initialised. |
boolean |
isValidated()
Accessor for whether the table is validated. |
protected boolean |
tableExistsInDatastore(Connection conn)
Determine whether our table exists in the datastore (without modifying datastore). |
String |
toString()
Method to return a string version of this 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, postInitialize, preInitialize, validate |
| Methods inherited from interface org.datanucleus.store.mapped.DatastoreContainerObject |
|---|
getIdMapping, getMemberMapping |
| Field Detail |
|---|
protected static final int TABLE_STATE_NEW
protected static final int TABLE_STATE_PK_INITIALIZED
protected static final int TABLE_STATE_INITIALIZED
protected static final int TABLE_STATE_INITIALIZED_MODIFIED
protected static final int TABLE_STATE_VALIDATED
protected static final org.datanucleus.util.Localiser LOCALISER
protected final RDBMSStoreManager storeMgr
protected final RDBMSAdapter dba
protected final org.datanucleus.store.mapped.DatastoreIdentifier identifier
protected int state
protected List<Column> columns
protected HashMap<org.datanucleus.store.mapped.DatastoreIdentifier,Column> columnsByName
protected Boolean existsInDatastore
| Constructor Detail |
|---|
public AbstractTable(org.datanucleus.store.mapped.DatastoreIdentifier identifier,
RDBMSStoreManager storeMgr)
identifier - Name of the tablestoreMgr - The RDBMS Manager| Method Detail |
|---|
public boolean isInitialized()
isInitialized in interface Tablepublic boolean isPKInitialized()
public boolean isValidated()
isValidated in interface Tablepublic boolean isInitializedModified()
isInitializedModified in interface Tablepublic org.datanucleus.store.mapped.MappedStoreManager getStoreManager()
getStoreManager in interface org.datanucleus.store.mapped.DatastoreContainerObjectpublic String getCatalogName()
getCatalogName in interface Tablepublic String getSchemaName()
getSchemaName in interface Tablepublic org.datanucleus.store.mapped.DatastoreIdentifier getIdentifier()
getIdentifier in interface org.datanucleus.store.mapped.DatastoreContainerObjectpublic org.datanucleus.metadata.DiscriminatorMetaData getDiscriminatorMetaData()
getDiscriminatorMetaData in interface org.datanucleus.store.mapped.DatastoreContainerObjectpublic org.datanucleus.store.mapped.mapping.JavaTypeMapping getDiscriminatorMapping(boolean allowSuperclasses)
getDiscriminatorMapping in interface org.datanucleus.store.mapped.DatastoreContainerObjectpublic org.datanucleus.store.mapped.mapping.JavaTypeMapping getMultitenancyMapping()
getMultitenancyMapping in interface org.datanucleus.store.mapped.DatastoreContainerObjectpublic org.datanucleus.metadata.VersionMetaData getVersionMetaData()
getVersionMetaData in interface org.datanucleus.store.mapped.DatastoreContainerObjectpublic org.datanucleus.store.mapped.mapping.JavaTypeMapping getVersionMapping(boolean allowSuperclasses)
getVersionMapping in interface org.datanucleus.store.mapped.DatastoreContainerObject
public org.datanucleus.store.mapped.DatastoreField addDatastoreField(String storedJavaType,
org.datanucleus.store.mapped.DatastoreIdentifier name,
org.datanucleus.store.mapped.mapping.JavaTypeMapping mapping,
org.datanucleus.metadata.ColumnMetaData colmd)
addDatastoreField in interface org.datanucleus.store.mapped.DatastoreContainerObjectstoredJavaType - the java type of the datastore fieldname - the SQL identifier for the column to be addedmapping - the mapping for the column to be addedcolmd - ColumnMetaData for the column to be added to the table
org.datanucleus.store.mapped.exceptions.DuplicateDatastoreFieldException - if a column already exists with same name and not a supported situation.public boolean hasDatastoreField(org.datanucleus.store.mapped.DatastoreIdentifier identifier)
hasDatastoreField in interface org.datanucleus.store.mapped.DatastoreContainerObjectidentifier - the identifier of the DatastoreField
public org.datanucleus.store.mapped.DatastoreField getDatastoreField(org.datanucleus.store.mapped.DatastoreIdentifier identifier)
getDatastoreField in interface org.datanucleus.store.mapped.DatastoreContainerObjectidentifier - The name of the column
public org.datanucleus.store.mapped.DatastoreField[] getDatastoreFields()
getDatastoreFields in interface org.datanucleus.store.mapped.DatastoreContainerObject
public boolean create(Connection conn)
throws SQLException
create in interface Tableconn - Connection to the datastore.
SQLException - Thrown if an error occurs creating the table.
public void drop(Connection conn)
throws SQLException
drop in interface Tableconn - Connection to the datastore.
SQLException - Thrown if an error occurs dropping the table.
public boolean exists(Connection conn,
boolean auto_create)
throws SQLException
exists in interface Tableconn - The JDBC Connectionauto_create - Whether to auto create the table if not existing
SQLException - Thrown when an error occurs in the JDBC callspublic final boolean equals(Object obj)
equals in class Objectobj - The object to compare against
public final int hashCode()
hashCode in class Objectpublic final String toString()
toString in class Objectpublic org.datanucleus.store.mapped.DatastoreIdentifier getDatastoreIdentifierFullyQualified()
protected void addColumnInternal(Column col)
col - The columnprotected boolean hasColumnName(org.datanucleus.store.mapped.DatastoreIdentifier colName)
colName - The column name
protected abstract List getSQLCreateStatements(Properties props)
props - Properties controlling the table creation
protected abstract List getSQLDropStatements()
protected void assertIsPKUninitialized()
protected void assertIsUninitialized()
protected void assertIsInitialized()
protected void assertIsInitializedModified()
protected void assertIsPKInitialized()
protected void assertIsValidated()
protected boolean allowDDLOutput()
protected void executeDdlStatementList(List stmts,
Connection conn)
throws SQLException
stmts - A List of statementsconn - The Connection to the datastore
SQLException - Any exceptions thrown by the statements
protected void executeDdlStatement(Statement stmt,
String stmtText)
throws SQLException
stmt - The JDBC Statement object to execute onstmtText - The actual SQL statement text
SQLException - Thrown if an error occurs
protected boolean tableExistsInDatastore(Connection conn)
throws SQLException
conn - The Connection
SQLException - Thrown if an error occurs
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||