org.datanucleus.store.rdbms.table
Interface Table

All Superinterfaces:
DatastoreContainerObject, DatastoreObject
All Known Subinterfaces:
SCOTable
All Known Implementing Classes:
AbstractClassTable, AbstractTable, ArrayTable, ClassTable, ClassView, CollectionTable, ElementContainerTable, JoinTable, MapTable, ProbeTable, SchemaTable, SecondaryTable, SequenceTable, TableImpl, ViewImpl

public interface Table
extends DatastoreContainerObject

Representation of a table in a datastore.

There are 2 aspects to a table. The first is the internal representation, provided here. This has a state. The second aspect to the table is its external (datastore) representation. This reflects whether it exists, or whether it has been deleted, etc.

This interface provides some methods for mapping from the internal representation to the external representation. These are the methods

Version:
$Revision: 1.10 $

Field Summary
static int TABLE_STATE_INITIALIZED
          Table object has been initialised.
static int TABLE_STATE_INITIALIZED_MODIFIED
          Table object has been initialized but has had structural modifications since.
static int TABLE_STATE_NEW
          Table object has just been created.
static int TABLE_STATE_PK_INITIALIZED
          Table object is created and PK initialised.
static int TABLE_STATE_VALIDATED
          Table object has been validated.
 
Method Summary
 boolean create(java.sql.Connection conn)
          Method to create the table in the datastore representation.
 void drop(java.sql.Connection conn)
          Method to drop the table from the datastore representation.
 boolean exists(java.sql.Connection conn, boolean create)
          Accessor for whether the table exists in the datastore.
 java.lang.String getCatalogName()
          Accessor for the Catalog name for this table.
 java.lang.String getSchemaName()
          Accessor for the Schema name for this table.
 void initialize(org.datanucleus.ClassLoaderResolver clr)
          Method to initialise the table.
 boolean isInitialized()
          Accessor for whether the table has been initialised.
 boolean isInitializedModified()
          Accessor for whether the table has been modified after being initialised.
 boolean isValidated()
          Accessor for whether the table is validated.
 void postInitialize(org.datanucleus.ClassLoaderResolver clr)
          Post initilize.
 void preInitialize(org.datanucleus.ClassLoaderResolver clr)
          Pre initialize.
 boolean validate(java.sql.Connection conn, boolean validateColumnStructure, boolean autoCreate, java.util.Collection autoCreateErrors)
          Method to validate the table against what is in the datastore
 
Methods inherited from interface org.datanucleus.store.mapped.DatastoreContainerObject
addDatastoreField, getDatastoreField, getDatastoreFieldsMetaData, getDiscriminatorMapping, getDiscriminatorMetaData, getFieldMapping, getIDMapping, getVersionMapping, getVersionMetaData, hasDatastoreField
 
Methods inherited from interface org.datanucleus.store.mapped.DatastoreObject
getIdentifier, getStoreManager
 

Field Detail

TABLE_STATE_NEW

static final int TABLE_STATE_NEW
Table object has just been created.

See Also:
Constant Field Values

TABLE_STATE_PK_INITIALIZED

static final int TABLE_STATE_PK_INITIALIZED
Table object is created and PK initialised.

See Also:
Constant Field Values

TABLE_STATE_INITIALIZED

static final int TABLE_STATE_INITIALIZED
Table object has been initialised.

See Also:
Constant Field Values

TABLE_STATE_INITIALIZED_MODIFIED

static final int TABLE_STATE_INITIALIZED_MODIFIED
Table object has been initialized but has had structural modifications since.

See Also:
Constant Field Values

TABLE_STATE_VALIDATED

static final int TABLE_STATE_VALIDATED
Table object has been validated.

See Also:
Constant Field Values
Method Detail

getCatalogName

java.lang.String getCatalogName()
Accessor for the Catalog name for this table.

Returns:
The Catalog name.

getSchemaName

java.lang.String getSchemaName()
Accessor for the Schema name for this table.

Returns:
The Schema name.

initialize

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

Parameters:
clr - The ClassLoaderResolver

preInitialize

void preInitialize(org.datanucleus.ClassLoaderResolver clr)
Pre initialize. For things that must be initialized right after constructor

Parameters:
clr - the ClassLoaderResolver

postInitialize

void postInitialize(org.datanucleus.ClassLoaderResolver clr)
Post initilize. For things that must be set after all classes have been initialized before

Parameters:
clr - the ClassLoaderResolver

isInitialized

boolean isInitialized()
Accessor for whether the table has been initialised.

Returns:
Whether it is initialised.

isInitializedModified

boolean isInitializedModified()
Accessor for whether the table has been modified after being initialised.

Returns:
Whether it has been modified after being initialised.

validate

boolean validate(java.sql.Connection conn,
                 boolean validateColumnStructure,
                 boolean autoCreate,
                 java.util.Collection autoCreateErrors)
                 throws java.sql.SQLException
Method to validate the table against what is in the datastore

Parameters:
conn - The connection
validateColumnStructure - Whether to validate down to the column structure, or just the existence
autoCreate - Whether to update the table to fix any errors.
autoCreateErrors - Errors found during the auto-create process
Returns:
Whether it validates successfully
Throws:
java.sql.SQLException - Thrown if an error occurrs in the validation

isValidated

boolean isValidated()
Accessor for whether the table is validated.

Returns:
Whether it is validated.

exists

boolean exists(java.sql.Connection conn,
               boolean create)
               throws java.sql.SQLException
Accessor for whether the table exists in the datastore. Will throw a MissingTableException if the table doesn't exist.

Parameters:
conn - The connecton to use to verify it
create - Whether to create it if it doesn't exist
Returns:
Whether the table was added.
Throws:
java.sql.SQLException - Thrown if an error occurs in the check

create

boolean create(java.sql.Connection conn)
               throws java.sql.SQLException
Method to create the table in the datastore representation.

Parameters:
conn - The connection to use
Returns:
true if the table was created
Throws:
java.sql.SQLException - Thrown if an error occurs creating the table.

drop

void drop(java.sql.Connection conn)
          throws java.sql.SQLException
Method to drop the table from the datastore representation.

Parameters:
conn - The connection to use
Throws:
java.sql.SQLException - Thrown if an error occurs


Copyright © 2009. All Rights Reserved.