org.eclipse.datatools.connectivity.sqm.loader
Class JDBCTableLoader

java.lang.Object
  extended by org.eclipse.datatools.connectivity.sqm.loader.JDBCBaseLoader
      extended by org.eclipse.datatools.connectivity.sqm.loader.JDBCTableLoader
Direct Known Subclasses:
MySqlTableLoader, SchemaASABaseLoader.ASABaseTableLoader

public class JDBCTableLoader
extends JDBCBaseLoader

Base loader implementation for loading a database's catalog objects. This class may be specialized as necessary to meet a particular vendor's needs.

Author:
rcernich Created on Aug 28, 2006

Nested Class Summary
static class JDBCTableLoader.GlobalTempTableFactory
          Base factory implementation for GLOBAL TEMPORARY type tables.
static interface JDBCTableLoader.ITableFactory
          Interface for providing creation logic for tables.
static class JDBCTableLoader.LocalTempTableFactory
          Base factory implementation for LOCAL TEMPORARY type tables.
static class JDBCTableLoader.TableFactory
          Base factory implementation for TABLE type tables.
static class JDBCTableLoader.ViewFactory
          Base factory implementation for VIEW type tables.
 
Field Summary
static java.lang.String COLUMN_REF_GENERATION
          The column name containing the table's reference generation method.
static java.lang.String COLUMN_REMARKS
          The column name containing the table's description.
static java.lang.String COLUMN_SELF_REFERENCING_COL_NAME
          The column name containing the name of the table's self referencing column.
static java.lang.String COLUMN_TABLE_NAME
          The column name containing the table's name.
static java.lang.String COLUMN_TABLE_TYPE
          The column name containing the table's type.
static java.lang.String TYPE_GLOBAL_TEMPORARY
          GLOBAL TEMPORARY table type.
static java.lang.String TYPE_LOCAL_TEMPORARY
          LOCAL TEMPORARY table type.
static java.lang.String TYPE_REF_DERIVED
          DERIVED reference type.
static java.lang.String TYPE_REF_SYSTEM
          SYSTEM reference type.
static java.lang.String TYPE_REF_USER
          USER reference type.
static java.lang.String TYPE_SYSTEM_TABLE
          SYSTEM TABLE table type.
static java.lang.String TYPE_TABLE
          TABLE table type.
static java.lang.String TYPE_VIEW
          VIEW table type.
 
Constructor Summary
JDBCTableLoader(ICatalogObject catalogObject)
          This constructs the loader using a ConnectionFilter.TABLE_FILTER filter.
JDBCTableLoader(ICatalogObject catalogObject, IConnectionFilterProvider connectionFilterProvider)
           
 
Method Summary
 void clearTables(java.util.List tables)
          Removes the specified tables from the model.
 JDBCTableLoader.ITableFactory getTableFactory(java.lang.String type)
          Returns the table factory associated with the specified type.
 java.util.List loadTables()
          Deprecated. see loadTables(List, Collection)
 void loadTables(java.util.List containmentList, java.util.Collection existingTables)
          Loads the "table" objects from the database.
 JDBCTableLoader.ITableFactory registerTableFactory(java.lang.String type, JDBCTableLoader.ITableFactory factory)
          Register a factory for the specified type.
 JDBCTableLoader.ITableFactory unregisterTableFactory(java.lang.String type)
          Unregister a factory for the specified type.
 
Methods inherited from class org.eclipse.datatools.connectivity.sqm.loader.JDBCBaseLoader
getCatalogObject, setCatalogObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLUMN_TABLE_NAME

public static final java.lang.String COLUMN_TABLE_NAME
The column name containing the table's name.

See Also:
java.sql.DatabaseMetaData.getTables(), Constant Field Values

COLUMN_TABLE_TYPE

public static final java.lang.String COLUMN_TABLE_TYPE
The column name containing the table's type.

See Also:
java.sql.DatabaseMetaData.getTables(), Constant Field Values

COLUMN_REMARKS

public static final java.lang.String COLUMN_REMARKS
The column name containing the table's description.

See Also:
java.sql.DatabaseMetaData.getTables(), Constant Field Values

COLUMN_SELF_REFERENCING_COL_NAME

public static final java.lang.String COLUMN_SELF_REFERENCING_COL_NAME
The column name containing the name of the table's self referencing column.

See Also:
java.sql.DatabaseMetaData.getTables(), Constant Field Values

COLUMN_REF_GENERATION

public static final java.lang.String COLUMN_REF_GENERATION
The column name containing the table's reference generation method.

See Also:
java.sql.DatabaseMetaData.getTables(), Constant Field Values

TYPE_TABLE

public static final java.lang.String TYPE_TABLE
TABLE table type.

See Also:
Constant Field Values

TYPE_VIEW

public static final java.lang.String TYPE_VIEW
VIEW table type.

See Also:
Constant Field Values

TYPE_SYSTEM_TABLE

public static final java.lang.String TYPE_SYSTEM_TABLE
SYSTEM TABLE table type.

See Also:
Constant Field Values

TYPE_GLOBAL_TEMPORARY

public static final java.lang.String TYPE_GLOBAL_TEMPORARY
GLOBAL TEMPORARY table type.

See Also:
Constant Field Values

TYPE_LOCAL_TEMPORARY

public static final java.lang.String TYPE_LOCAL_TEMPORARY
LOCAL TEMPORARY table type.

See Also:
Constant Field Values

TYPE_REF_SYSTEM

public static final java.lang.String TYPE_REF_SYSTEM
SYSTEM reference type.

See Also:
Constant Field Values

TYPE_REF_USER

public static final java.lang.String TYPE_REF_USER
USER reference type.

See Also:
Constant Field Values

TYPE_REF_DERIVED

public static final java.lang.String TYPE_REF_DERIVED
DERIVED reference type.

See Also:
Constant Field Values
Constructor Detail

JDBCTableLoader

public JDBCTableLoader(ICatalogObject catalogObject)
This constructs the loader using a ConnectionFilter.TABLE_FILTER filter.

Parameters:
catalogObject - the Database object upon which this loader operates.

JDBCTableLoader

public JDBCTableLoader(ICatalogObject catalogObject,
                       IConnectionFilterProvider connectionFilterProvider)
Parameters:
catalogObject - the Catalog object upon which this loader operates.
connectionFilterProvider - the filter provider used for filtering the "schema" objects being loaded
Method Detail

loadTables

public java.util.List loadTables()
                          throws java.sql.SQLException
Deprecated. see loadTables(List, Collection)

Returns:
a collection of Table objects
Throws:
java.sql.SQLException - if an error occurred during loading.

loadTables

public void loadTables(java.util.List containmentList,
                       java.util.Collection existingTables)
                throws java.sql.SQLException
Loads the "table" objects from the database. This method uses the result set from createResultSet() to load the "table" objects from the server. This method first checks the name of the "table" to determine whether or not it should be filtered. If it is not filtered, it checks to see if an object with that name was loaded previously. If it finds an existing object, it refreshes that object and adds it to the containment list. If the named object does not exist, the result set is passed to processRow(). Table objects are created and initialized using one of the registered factories. This method should only be overridden as a last resort when the desired behavior cannot be acheived by overriding createResultSet(), closeResultSet(), processRow(), and a specialized factories.

Parameters:
existingTables - the catalog objects which were previously loaded
containmentList - the containment list held by parent
Throws:
java.sql.SQLException - if an error occurred during loading.

clearTables

public void clearTables(java.util.List tables)
Removes the specified tables from the model.

Parameters:
tables - the tables to be removed from the model.

registerTableFactory

public JDBCTableLoader.ITableFactory registerTableFactory(java.lang.String type,
                                                          JDBCTableLoader.ITableFactory factory)
Register a factory for the specified type. The type should match a type contained within the result set's "TABLE_TYPE" column.

Parameters:
type - the table type (e.g. VIEW, TABLE, etc.)
factory - the factory
Returns:
the previously registered factory; null if no factory was registered for that type.

unregisterTableFactory

public JDBCTableLoader.ITableFactory unregisterTableFactory(java.lang.String type)
Unregister a factory for the specified type.

Parameters:
type - the table type (e.g. VIEW, TABLE, etc.)
Returns:
the previously registered factory; null if no factory was registered for that type.

getTableFactory

public JDBCTableLoader.ITableFactory getTableFactory(java.lang.String type)
Returns the table factory associated with the specified type. Returns null if no factory has been associated with the specified type.

Parameters:
type - the table type (e.g. VIEW, TABLE, etc.)
Returns:
the registered factory; null if no factory is registered for the specified type.