com.triactive.jdo.store.adapter
Class CatalogInfoCache

java.lang.Object
  extended bycom.triactive.jdo.store.adapter.CatalogInfoCache

public class CatalogInfoCache
extends java.lang.Object

Used to access all database metadata that is catalog information. Includes catalog info on tables, columns, primary keys, foreign keys, and indexes. Some of this information is pre-read for all tables and cached in order to reduce the number of catalog queries made to the database.

The store manager keeps a soft reference to one of these objects and delegates its catalog info calls to it. It keeps a hard reference for the duration of any class add operation, which is the primary consumer of catalog info.

Author:
Mike Martin

Constructor Summary
CatalogInfoCache(DatabaseAdapter dba, java.lang.String catalogName, java.lang.String schemaName)
          Contructs a new catalog info cache for the specified database schema.
 
Method Summary
 java.util.List getColumnInfo(TableName tableName, java.sql.Connection conn)
          Returns the column info for a database table.
 java.util.List getForeignKeyInfo(TableName tableName, java.sql.Connection conn)
          Returns the foreign key info for a database table.
 java.util.List getIndexInfo(TableName tableName, java.sql.Connection conn)
          Returns the index info for a database table.
 java.util.List getPrimaryKeyInfo(TableName tableName, java.sql.Connection conn)
          Returns the primary key info for a database table.
 TableInfo getTableInfo(TableName tableName, java.sql.Connection conn)
          Returns the table info for a database table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogInfoCache

public CatalogInfoCache(DatabaseAdapter dba,
                        java.lang.String catalogName,
                        java.lang.String schemaName)
Contructs a new catalog info cache for the specified database schema.

Parameters:
dba - the database adapter
catalogName - the database catalog name, or null if not applicable.
schemaName - the database schema name, or null if not applicable.
Method Detail

getTableInfo

public TableInfo getTableInfo(TableName tableName,
                              java.sql.Connection conn)
                       throws java.sql.SQLException
Returns the table info for a database table.

Parameters:
tableName - the name of the table (or view)
conn - a connection to the database
Returns:
A TableInfo object describing the table. If no info is found for the given table, null is returned.
Throws:
java.sql.SQLException

getColumnInfo

public java.util.List getColumnInfo(TableName tableName,
                                    java.sql.Connection conn)
                             throws java.sql.SQLException
Returns the column info for a database table.

Parameters:
tableName - the name of the table (or view)
conn - a connection to the database
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

getPrimaryKeyInfo

public java.util.List getPrimaryKeyInfo(TableName tableName,
                                        java.sql.Connection conn)
                                 throws java.sql.SQLException
Returns the primary key info for a database table.

Parameters:
tableName - the name of the table
conn - a connection to the database
Returns:
A list of PrimaryKeyInfo objects describing the primary keys of the table. The list is in the same order as was supplied by getPrimaryKeys(). If no primary key info is found for the given table, an empty list is returned.
Throws:
java.sql.SQLException

getForeignKeyInfo

public java.util.List getForeignKeyInfo(TableName tableName,
                                        java.sql.Connection conn)
                                 throws java.sql.SQLException
Returns the foreign key info for a database table.

Parameters:
tableName - the name of the table
conn - a connection to the database
Returns:
A list of ForeignKeyInfo objects describing the foreign keys of the table. The list is in the same order as was supplied by getImportedKeys(). If no foreign key info is found for the given table, an empty list is returned.
Throws:
java.sql.SQLException

getIndexInfo

public java.util.List getIndexInfo(TableName tableName,
                                   java.sql.Connection conn)
                            throws java.sql.SQLException
Returns the index info for a database table.

Parameters:
tableName - the name of the table
conn - a connection to the database
Returns:
A list of IndexInfo objects describing the indexes of the table. The list is in the same order as was supplied by getImportedKeys(). If no index info is found for the given table, an empty list is returned.
Throws:
java.sql.SQLException


Copyright 2001-2007 The TJDO Project All Rights Reserved.