org.datanucleus.store.rdbms.table
Class SchemaTable

java.lang.Object
  extended by org.datanucleus.store.rdbms.table.AbstractTable
      extended by org.datanucleus.store.rdbms.table.TableImpl
          extended by org.datanucleus.store.rdbms.table.SchemaTable
All Implemented Interfaces:
org.datanucleus.store.mapped.DatastoreContainerObject, Table

public class SchemaTable
extends TableImpl

Class defining DataNucleus schema definition tables. Represents a table in the datastore storing the class and table mappings. This table is used when restarting a DataNucleus system so that it is 'aware' of what classes were supported the previous time this datastore was used. It uses this information to pre-populate the RDBMSManager with the classes stored in this table. The table names are not used as such, other than as a record of what table a class maps to - because it goes off and finds the MetaData for the class which, with the DataNucleus naming scheme, defines the table name anyway.


Field Summary
 
Fields inherited from class org.datanucleus.store.rdbms.table.AbstractTable
columns, columnsByName, dba, existsInDatastore, identifier, LOCALISER, state, storeMgr
 
Constructor Summary
SchemaTable(RDBMSManager storeMgr, java.lang.String tableName)
          Constructor.
 
Method Summary
 void addClass(org.datanucleus.store.mapped.MappedStoreData data, org.datanucleus.ManagedConnection conn)
          Method to insert a row in the SchemaTable.
 void deleteAllClasses(org.datanucleus.ManagedConnection conn)
          Method to delete all classes from the SchemaTable.
 void deleteClass(java.lang.String class_name, org.datanucleus.ManagedConnection conn)
          Method to delete a class from the SchemaTable.
 java.util.HashSet getAllClasses(org.datanucleus.ManagedConnection conn)
          Accessor for the classes already supported by this Schema Table.
 org.datanucleus.store.mapped.mapping.JavaTypeMapping getIDMapping()
          Accessor for a mapping for the ID (PersistenceCapable) for this table.
 org.datanucleus.store.mapped.mapping.JavaTypeMapping getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
          Accessor the for the mapping for a field/property stored in this table.
 void initialize(org.datanucleus.ClassLoaderResolver clr)
          Method to initialise the table.
 
Methods inherited from class org.datanucleus.store.rdbms.table.TableImpl
createConstraints, dropConstraints, getExpectedCandidateKeys, getExpectedForeignKeys, getExpectedIndices, getPrimaryKey, getSQLAddCandidateKeyStatements, getSQLAddFKStatements, getSQLCreateIndexStatements, getSQLCreateStatements, getSQLDropStatements, initializeColumnInfoForPrimaryKeyColumns, initializeColumnInfoFromDatastore, postInitialize, preInitialize, validate, validateColumns, validateConstraints, validatePrimaryKey
 
Methods inherited from class org.datanucleus.store.rdbms.table.AbstractTable
addColumnInternal, addDatastoreField, allowDDLOutput, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getDatastoreField, getDatastoreFields, getDatastoreIdentifierFullyQualified, getDiscriminatorMapping, getDiscriminatorMetaData, getIdentifier, getSchemaName, getStoreManager, getVersionMapping, getVersionMetaData, hasColumnName, hasDatastoreField, hashCode, isInitialized, isInitializedModified, isPKInitialized, isValidated, tableExistsInDatastore, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SchemaTable

public SchemaTable(RDBMSManager storeMgr,
                   java.lang.String tableName)
Constructor.

Parameters:
storeMgr - The RDBMSManager for this datastore
tableName - Name of the starter table (optional, uses NUCLEUS_TABLES when this is null)
Method Detail

initialize

public void initialize(org.datanucleus.ClassLoaderResolver clr)
Method to initialise the table.

Parameters:
clr - The ClassLoaderResolver

getIDMapping

public org.datanucleus.store.mapped.mapping.JavaTypeMapping getIDMapping()
Accessor for a mapping for the ID (PersistenceCapable) for this table.

Returns:
The (PersistenceCapable) ID mapping.

getAllClasses

public java.util.HashSet getAllClasses(org.datanucleus.ManagedConnection conn)
                                throws java.sql.SQLException
Accessor for the classes already supported by this Schema Table.

Parameters:
conn - Connection for this datastore.
Returns:
The HashSet of class names (StoreData)
Throws:
java.sql.SQLException - Thrown when an error occurs in the process.

addClass

public void addClass(org.datanucleus.store.mapped.MappedStoreData data,
                     org.datanucleus.ManagedConnection conn)
              throws java.sql.SQLException
Method to insert a row in the SchemaTable. This is called when DataNucleus is now supporting a new class (and hence DB table).

Parameters:
data - Data for the class
conn - Connection to the datastore
Throws:
java.sql.SQLException - Thrown when an error occurs inserting the schema.

deleteClass

public void deleteClass(java.lang.String class_name,
                        org.datanucleus.ManagedConnection conn)
                 throws java.sql.SQLException
Method to delete a class from the SchemaTable. This is called when DataNucleus is required to clean out support for a particular class.

Parameters:
class_name - Name of class to delete
conn - Connection to the datastore
Throws:
java.sql.SQLException - Thrown when an error occurs deleting the schema.

deleteAllClasses

public void deleteAllClasses(org.datanucleus.ManagedConnection conn)
                      throws java.sql.SQLException
Method to delete all classes from the SchemaTable. This is called when DataNucleus is required to clean out its supported classes (and hence DB table).

Parameters:
conn - Connection to the datastore
Throws:
java.sql.SQLException - Thrown when an error occurs deleting the schema.

getMemberMapping

public org.datanucleus.store.mapped.mapping.JavaTypeMapping getMemberMapping(org.datanucleus.metadata.AbstractMemberMetaData mmd)
Accessor the for the mapping for a field/property stored in this table.

Parameters:
mmd - MetaData for the field whose mapping we want
Returns:
The mapping


Copyright © 2009. All Rights Reserved.