org.jpox.store.rdbms.table
Class AbstractClassTable

java.lang.Object
  extended by org.jpox.store.rdbms.table.AbstractTable
      extended by org.jpox.store.rdbms.table.TableImpl
          extended by org.jpox.store.rdbms.table.AbstractClassTable
All Implemented Interfaces:
org.jpox.store.mapped.DatastoreContainerObject, org.jpox.store.mapped.DatastoreObject, Table
Direct Known Subclasses:
ClassTable, SecondaryTable

public abstract class AbstractClassTable
extends TableImpl

Abstract representation of a table for a class. Abstracts out the common parts of a primary ClassTable and a SecondaryClassTable.

Mappings

A Table is built from a series of field mappings. Each Java class has a series of fields and each of these has an associated JavaTypeMapping. Each JavaTypeMapping has related DatastoreMapping(s). These are used in mapping the Java class to the table, and are used when populating the table, and when retrieving data from the table back to the object. There are several categories of mappings in this class

Version:
$Revision: 1.56 $

Field Summary
protected  org.jpox.store.mapped.mapping.JavaTypeMapping datastoreIDMapping
          Mapping for datastore identity (optional).
protected  org.jpox.store.mapped.mapping.JavaTypeMapping discriminatorMapping
          Mapping for any discriminator column.
protected  org.jpox.metadata.DiscriminatorMetaData discriminatorMetaData
          MetaData for discriminator for objects stored in this table.
protected  java.util.Map fieldMappingsMap
          Mappings for fields mapped to this table, keyed by the FieldMetaData.
protected  int highestFieldNumber
          Highest absolute field number managed by this table
protected  org.jpox.store.mapped.mapping.JavaTypeMapping idMapping
          Mapping for the id of the table.
protected  org.jpox.store.mapped.mapping.JavaTypeMapping[] pkMappings
          Mappings for application identity (optional).
protected  org.jpox.store.mapped.mapping.JavaTypeMapping versionMapping
          Mapping for any version/timestamp column.
protected  org.jpox.metadata.VersionMetaData versionMetaData
          MetaData for versioning of objects stored in this table.
 
Fields inherited from class org.jpox.store.rdbms.table.AbstractTable
columns, columnsByName, completeDdl, dba, ddlWriter, existsInDatastore, 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
AbstractClassTable(org.jpox.store.mapped.DatastoreIdentifier tableName, RDBMSManager storeMgr)
          Constructor.
 
Method Summary
protected  void addFieldMapping(org.jpox.store.mapped.mapping.JavaTypeMapping fieldMapping)
          Utility to add the mapping for a field to the managed list.
 org.jpox.store.mapped.mapping.JavaTypeMapping getDataStoreObjectIdMapping()
          Accessor for a mapping for the datastore ID (OID) for this table.
 org.jpox.store.mapped.mapping.JavaTypeMapping getDiscriminatorMapping(boolean allowSuperclasses)
          Accessor for the discriminator mapping specified .
abstract  org.jpox.metadata.IdentityType getIdentityType()
          Accessor for the identity-type.
protected  org.jpox.store.mapped.mapping.JavaTypeMapping getMappingForFieldName(java.lang.String fieldName)
          Accessor for the JavaTypeMapping that is handling the field of the specified name.
 org.jpox.store.mapped.DatastoreContainerObject getPrimaryDatastoreContainerObject()
          Convenience method to return the primary table.
 org.jpox.store.mapped.mapping.JavaTypeMapping getVersionMapping(boolean allowSuperclasses)
          Accessor for the version mapping specified .
protected abstract  void initializePK(org.jpox.ClassLoaderResolver clr)
          Method to initialise the table primary key field(s).
abstract  boolean isObjectIDDatastoreAttributed()
          Accessor for whether the table has its identity attributed by the datastore (e.g using autoincrement)
 boolean managesField(java.lang.String fieldName)
          Convenience method for whether the (fully-specified) field is managed by this table
 void provideDatastoreIdMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
          Accessor for a mapping for the datastore ID (OID) for this table.
 void provideDiscriminatorMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
          Provide the discriminator mappings
 void provideMappingsForFields(org.jpox.store.mapped.mapping.MappingConsumer consumer, org.jpox.metadata.AbstractMemberMetaData[] fieldMetaData, boolean includeSecondaryTables)
          Provide the mappings to the consumer for all absolute field Numbers in this table that are container in the fieldNumbers parameter.
 void provideNonPrimaryKeyMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
          Provide the mappings to the consumer for all non primary-key fields mapped to this table.
abstract  void providePrimaryKeyMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
          Provide the mappings to the consumer for all primary-key fields mapped to this table (for application identity).
 void provideVersionMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
          Provide the version mappings.
 
Methods inherited from class org.jpox.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.jpox.store.rdbms.table.AbstractTable
addColumnInternal, addDatastoreField, allowDDLOutput, assertIsInitialized, assertIsInitializedModified, assertIsPKInitialized, assertIsPKUninitialized, assertIsUninitialized, assertIsValidated, create, drop, equals, executeDdlStatement, executeDdlStatementList, exists, getCatalogName, getDatastoreFieldsMetaData, getDatastoreIdentifierFullyQualified, getDiscriminatorMetaData, getIdentifier, getSchemaName, getStoreManager, getVersionMetaData, hasColumnName, hasDatastoreField, hashCode, isCompleteDdl, isInitialized, isInitializedModified, isOutputtingDDL, isPKInitialized, isValidated, setCompleteDdl, setDdlWriter, tableExistsInDatastore, toString
 
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.mapped.DatastoreContainerObject
getFieldMapping, getIDMapping
 

Field Detail

fieldMappingsMap

protected java.util.Map fieldMappingsMap
Mappings for fields mapped to this table, keyed by the FieldMetaData.


datastoreIDMapping

protected org.jpox.store.mapped.mapping.JavaTypeMapping datastoreIDMapping
Mapping for datastore identity (optional).


pkMappings

protected org.jpox.store.mapped.mapping.JavaTypeMapping[] pkMappings
Mappings for application identity (optional).


idMapping

protected org.jpox.store.mapped.mapping.JavaTypeMapping idMapping
Mapping for the id of the table.


versionMapping

protected org.jpox.store.mapped.mapping.JavaTypeMapping versionMapping
Mapping for any version/timestamp column.


versionMetaData

protected org.jpox.metadata.VersionMetaData versionMetaData
MetaData for versioning of objects stored in this table.


discriminatorMetaData

protected org.jpox.metadata.DiscriminatorMetaData discriminatorMetaData
MetaData for discriminator for objects stored in this table.


discriminatorMapping

protected org.jpox.store.mapped.mapping.JavaTypeMapping discriminatorMapping
Mapping for any discriminator column.


highestFieldNumber

protected int highestFieldNumber
Highest absolute field number managed by this table

Constructor Detail

AbstractClassTable

public AbstractClassTable(org.jpox.store.mapped.DatastoreIdentifier tableName,
                          RDBMSManager storeMgr)
Constructor.

Parameters:
tableName - Name of the table
storeMgr - Store Manager that is managing this instance
Method Detail

getPrimaryDatastoreContainerObject

public org.jpox.store.mapped.DatastoreContainerObject getPrimaryDatastoreContainerObject()
Convenience method to return the primary table.

Returns:
The primary table for this table

initializePK

protected abstract void initializePK(org.jpox.ClassLoaderResolver clr)
Method to initialise the table primary key field(s).

Parameters:
clr - The ClassLoaderResolver

managesField

public boolean managesField(java.lang.String fieldName)
Convenience method for whether the (fully-specified) field is managed by this table

Parameters:
fieldName - Fully qualified name of the field
Returns:
Whether it is managed

getMappingForFieldName

protected org.jpox.store.mapped.mapping.JavaTypeMapping getMappingForFieldName(java.lang.String fieldName)
Accessor for the JavaTypeMapping that is handling the field of the specified name. Returns the first one that matches.

Parameters:
fieldName - Name of the field
Returns:
The java type mapping

addFieldMapping

protected void addFieldMapping(org.jpox.store.mapped.mapping.JavaTypeMapping fieldMapping)
Utility to add the mapping for a field to the managed list.

Parameters:
fieldMapping - The mapping for the field

getIdentityType

public abstract org.jpox.metadata.IdentityType getIdentityType()
Accessor for the identity-type.

Returns:
identity-type tag value

isObjectIDDatastoreAttributed

public abstract boolean isObjectIDDatastoreAttributed()
Accessor for whether the table has its identity attributed by the datastore (e.g using autoincrement)

Returns:
Whether it is datastore attributed

getDataStoreObjectIdMapping

public org.jpox.store.mapped.mapping.JavaTypeMapping getDataStoreObjectIdMapping()
Accessor for a mapping for the datastore ID (OID) for this table.

Returns:
The (OID) mapping.

getVersionMapping

public org.jpox.store.mapped.mapping.JavaTypeMapping getVersionMapping(boolean allowSuperclasses)
Accessor for the version mapping specified .

Specified by:
getVersionMapping in interface org.jpox.store.mapped.DatastoreContainerObject
Overrides:
getVersionMapping in class AbstractTable
Parameters:
allowSuperclasses - Whether we should return just the mapping from this table or whether we should return it when this table has none and the supertable has
Returns:
The version mapping.

getDiscriminatorMapping

public org.jpox.store.mapped.mapping.JavaTypeMapping getDiscriminatorMapping(boolean allowSuperclasses)
Accessor for the discriminator mapping specified .

Specified by:
getDiscriminatorMapping in interface org.jpox.store.mapped.DatastoreContainerObject
Overrides:
getDiscriminatorMapping in class AbstractTable
Returns:
The mapping for the discriminator column

provideDatastoreIdMappings

public final void provideDatastoreIdMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
Accessor for a mapping for the datastore ID (OID) for this table.

Parameters:
consumer - Consumer for the mappings

providePrimaryKeyMappings

public abstract void providePrimaryKeyMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
Provide the mappings to the consumer for all primary-key fields mapped to this table (for application identity).

Parameters:
consumer - Consumer for the mappings

provideNonPrimaryKeyMappings

public final void provideNonPrimaryKeyMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
Provide the mappings to the consumer for all non primary-key fields mapped to this table.

Parameters:
consumer - Consumer for the mappings

provideMappingsForFields

public void provideMappingsForFields(org.jpox.store.mapped.mapping.MappingConsumer consumer,
                                     org.jpox.metadata.AbstractMemberMetaData[] fieldMetaData,
                                     boolean includeSecondaryTables)
Provide the mappings to the consumer for all absolute field Numbers in this table that are container in the fieldNumbers parameter.

Parameters:
consumer - Consumer for the mappings
fieldMetaData - MetaData for the fields to provide mappings for
includeSecondaryTables - Whether to provide fields in secondary tables

provideVersionMappings

public final void provideVersionMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
Provide the version mappings.

Parameters:
consumer - Consumer for the version mappings

provideDiscriminatorMappings

public final void provideDiscriminatorMappings(org.jpox.store.mapped.mapping.MappingConsumer consumer)
Provide the discriminator mappings

Parameters:
consumer - Consumer for the mappings


Copyright © -2008 . All Rights Reserved.