com.triactive.jdo.store
Class StoreManager.MgmtTransaction

java.lang.Object
  extended bycom.triactive.jdo.store.RetryableTransaction
      extended bycom.triactive.jdo.store.StoreManager.MgmtTransaction
Enclosing class:
StoreManager

public abstract class StoreManager.MgmtTransaction
extends RetryableTransaction

An abstract base class for StoreManager transactions that perform some management function on the database.

Management transactions may be retried in the face of SQL exceptions to work around failures caused by transient conditions, such as DB deadlocks.


Field Summary
 
Fields inherited from class com.triactive.jdo.store.RetryableTransaction
conn
 
Constructor Summary
StoreManager.MgmtTransaction(int isolationLevel)
           
StoreManager.MgmtTransaction(int isolationLevel, int maxRetries)
           
 
Method Summary
 void addMapTable(FieldMetaData fmd)
          Called by Mapping objects in the midst of StoreManager.addClasses() to request the creation of a map table.
 void addSetTable(FieldMetaData fmd)
          Called by Mapping objects in the midst of StoreManager.addClasses() to request the creation of a set table.
 java.util.List getColumnInfo(TableName tableName)
          Returns the column info for a database table.
protected  InitializedConnectionFactory getConnectionFactory()
          Returns the connection factory from which this object obtains its JDBC connections.
 DatabaseAdapter getDatabaseAdapter()
          Returns the database adapter associated with connections provided by this object's connection factory.
 java.util.List getForeignKeyInfo(TableName tableName)
          Returns the foreign key info for a database table.
 java.util.List getIndexInfo(TableName tableName)
          Returns the index info for a database table.
 java.util.List getPrimaryKeyInfo(TableName tableName)
          Returns the primary key info for a database table.
 SchemaTable getSchemaTable(boolean ifItExists)
          Returns the schema table (JDO_TABLE).
 StoreManager getStoreManager()
          Returns the store manager that initiated this transaction.
 int getTableType(TableName tableName)
          Returns the type of a database table.
 boolean tableExists(TableName tableName)
          Tests if a database table exists.
 
Methods inherited from class com.triactive.jdo.store.RetryableTransaction
execute, execute, executeStatements, getConnection, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StoreManager.MgmtTransaction

public StoreManager.MgmtTransaction(int isolationLevel)

StoreManager.MgmtTransaction

public StoreManager.MgmtTransaction(int isolationLevel,
                                    int maxRetries)
Method Detail

getConnectionFactory

protected InitializedConnectionFactory getConnectionFactory()
Description copied from class: RetryableTransaction
Returns the connection factory from which this object obtains its JDBC connections. Subclasses override this method to provide a specific factory.

Specified by:
getConnectionFactory in class RetryableTransaction

getDatabaseAdapter

public DatabaseAdapter getDatabaseAdapter()
Description copied from class: RetryableTransaction
Returns the database adapter associated with connections provided by this object's connection factory. Subclasses override this method to provide a specific adapter.

Specified by:
getDatabaseAdapter in class RetryableTransaction

getStoreManager

public StoreManager getStoreManager()
Returns the store manager that initiated this transaction.


getSchemaTable

public SchemaTable getSchemaTable(boolean ifItExists)
                           throws java.sql.SQLException
Returns the schema table (JDO_TABLE). Must be called instead of using the schemaTable field directly.

Parameters:
ifItExists - If true only return the schema table if it exists. If false always return it, making sure it exists and is validated, creating it if necessary if auto-create mode is enabled.
Returns:
the schema table, or null if it doesn't exist and ifItExists is true.
Throws:
java.sql.SQLException

tableExists

public boolean tableExists(TableName tableName)
                    throws java.sql.SQLException
Tests if a database table exists.

Parameters:
tableName - The name of the table (or view).
Returns:
true if the table exists in the database, false otherwise.
Throws:
java.sql.SQLException

getTableType

public int getTableType(TableName tableName)
                 throws java.sql.SQLException
Returns the type of a database table.

Parameters:
tableName - The name of the table (or view).
Returns:
one of the TABLE_TYPE_* values from Table.
Throws:
java.sql.SQLException
See Also:
Table

getColumnInfo

public java.util.List getColumnInfo(TableName tableName)
                             throws java.sql.SQLException
Returns the column info for a database table. Should be used instead of making direct calls to DatabaseMetaData.getColumns() because it employs caching.

Parameters:
tableName - The name of the table (or view).
Returns:
A list of ColumnInfo objects describing the columns of the table. The list is in the same order as was supplied by getColumns(). If no column info is found for the given table, an empty list is returned.
Throws:
java.sql.SQLException
See Also:
ColumnInfo

getPrimaryKeyInfo

public java.util.List getPrimaryKeyInfo(TableName tableName)
                                 throws java.sql.SQLException
Returns the primary key info for a database table. This should be used instead of making direct calls to DatabaseMetaData.getPrimaryKeys().

Parameters:
tableName - The name of the table (or view).
Returns:
A list of PrimaryKeyInfo objects describing the columns of the table's primary keys. The list is in the same order as was supplied by getPrimaryKeys(). If no column info is found for the given table, an empty list is returned.
Throws:
java.sql.SQLException
See Also:
PrimaryKeyInfo

getForeignKeyInfo

public java.util.List getForeignKeyInfo(TableName tableName)
                                 throws java.sql.SQLException
Returns the foreign key info for a database table. This should be used instead of making direct calls to DatabaseMetaData.getImportedKeys().

Parameters:
tableName - The name of the table (or view).
Returns:
A list of ForeignKeyInfo objects describing the columns of the table's foreign keys. The list is in the same order as was supplied by getImportedKeys(). If no column info is found for the given table, an empty list is returned.
Throws:
java.sql.SQLException
See Also:
ForeignKeyInfo

getIndexInfo

public java.util.List getIndexInfo(TableName tableName)
                            throws java.sql.SQLException
Returns the index info for a database table. This should be used instead of making direct calls to DatabaseMetaData.getIndexInfo().

Parameters:
tableName - The name of the table (or view).
Returns:
A list of IndexInfo objects describing the columns of the table's indexes. The list is in the same order as was supplied by getImportedKeys(). If no column info is found for the given table, an empty list is returned.
Throws:
java.sql.SQLException
See Also:
IndexInfo

addSetTable

public void addSetTable(FieldMetaData fmd)
Called by Mapping objects in the midst of StoreManager.addClasses() to request the creation of a set table.

Parameters:
fmd - The field metadata describing the set field.

addMapTable

public void addMapTable(FieldMetaData fmd)
Called by Mapping objects in the midst of StoreManager.addClasses() to request the creation of a map table.

Parameters:
fmd - The field metadata describing the map field.


Copyright © 2001-2007 The TJDO Project All Rights Reserved.