uk.org.ogsadai.converters.databaseschema.toxml
Class TableMetaDataImpl

java.lang.Object
  |
  +--uk.org.ogsadai.converters.databaseschema.toxml.TableMetaDataImpl
All Implemented Interfaces:
TableMetaData

public class TableMetaDataImpl
extends java.lang.Object
implements TableMetaData

An implementation of the TableMetaData interface which extract and stores the information from JDBC java.sql.ResultSet objects.

Author:
The OGSA-DAI Team.
See Also:
TableMetaData

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
static java.lang.String JDBC_COL_DATA_TYPE
           
static java.lang.String JDBC_COL_DEC_DIGITS
           
static java.lang.String JDBC_COL_NAME
          Column names in JDBC meta data
static java.lang.String JDBC_COL_POSITION
           
static java.lang.String JDBC_COL_SIZE
           
static java.lang.String JDBC_COL_TYPE_NAME
           
static java.lang.String JDBC_FK_CATALOG
           
static java.lang.String JDBC_FK_COL
           
static java.lang.String JDBC_FK_SCHEMA
           
static java.lang.String JDBC_FK_TABLE
           
static java.lang.String JDBC_PK_COL
           
static java.lang.String JDBC_PK_TABLE
           
private  java.lang.String mCatalog
          Catalog name
private  ColumnMetaData[] mColumns
          Column meta data
private  java.util.Set mExportedKeys
          Exported keys meta data
private  java.util.Set mImportedKeys
          Imported keys meta data
private  java.lang.String mName
          Table name
private  java.util.Set mPrimaryKeys
          Primary key names
private  java.lang.String mSchema
          Schema name
 
Constructor Summary
TableMetaDataImpl(java.lang.String catalog, java.lang.String schema, java.lang.String name)
          Constructs a new table object with the given name, schema name and catalog name.
 
Method Summary
 java.lang.String getCatalogName()
          Returns the catalog name of this table.
 ColumnMetaData getColumn(int column)
          Returns the type information of the column at the specified index.
 int getColumnCount()
          Returns the number of columns in this table.
 KeyMetaData[] getExportedKeys()
          Returns the exported keys of this table.
 KeyMetaData[] getImportedKeys()
          Returns the imported keys of this table.
 java.lang.String getName()
          Returns the name of this table.
 java.lang.String[] getPrimaryKeys()
          Returns a set of columns which form the (composite) primary key of this table.
 java.lang.String getSchemaName()
          Returns the schema name of this table.
 void setColumns(java.sql.ResultSet columns)
          Extracts information from the given ResultSet and populates the column metadata.
 void setExportedKeys(java.sql.ResultSet exportedKeys)
          Extract information for exported keys from a ResultSet.
 void setImportedKeys(java.sql.ResultSet importedKeys)
          Extract information for imported keys from a ResultSet.
private  void setKeys(java.sql.ResultSet keys, java.util.Set keySet)
          Extract information for keys from a ResultSet and store them in the given set.
 void setPrimaryKeys(java.sql.ResultSet primaryKeys)
          Extract information for primary keys in this table from a ResultSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mName

private java.lang.String mName
Table name


mSchema

private java.lang.String mSchema
Schema name


mCatalog

private java.lang.String mCatalog
Catalog name


mColumns

private ColumnMetaData[] mColumns
Column meta data


mPrimaryKeys

private java.util.Set mPrimaryKeys
Primary key names


mImportedKeys

private java.util.Set mImportedKeys
Imported keys meta data


mExportedKeys

private java.util.Set mExportedKeys
Exported keys meta data


JDBC_COL_NAME

public static final java.lang.String JDBC_COL_NAME
Column names in JDBC meta data

See Also:
Constant Field Values

JDBC_COL_POSITION

public static final java.lang.String JDBC_COL_POSITION
See Also:
Constant Field Values

JDBC_COL_DATA_TYPE

public static final java.lang.String JDBC_COL_DATA_TYPE
See Also:
Constant Field Values

JDBC_COL_TYPE_NAME

public static final java.lang.String JDBC_COL_TYPE_NAME
See Also:
Constant Field Values

JDBC_COL_SIZE

public static final java.lang.String JDBC_COL_SIZE
See Also:
Constant Field Values

JDBC_COL_DEC_DIGITS

public static final java.lang.String JDBC_COL_DEC_DIGITS
See Also:
Constant Field Values

JDBC_FK_TABLE

public static final java.lang.String JDBC_FK_TABLE
See Also:
Constant Field Values

JDBC_FK_SCHEMA

public static final java.lang.String JDBC_FK_SCHEMA
See Also:
Constant Field Values

JDBC_FK_CATALOG

public static final java.lang.String JDBC_FK_CATALOG
See Also:
Constant Field Values

JDBC_FK_COL

public static final java.lang.String JDBC_FK_COL
See Also:
Constant Field Values

JDBC_PK_TABLE

public static final java.lang.String JDBC_PK_TABLE
See Also:
Constant Field Values

JDBC_PK_COL

public static final java.lang.String JDBC_PK_COL
See Also:
Constant Field Values
Constructor Detail

TableMetaDataImpl

public TableMetaDataImpl(java.lang.String catalog,
                         java.lang.String schema,
                         java.lang.String name)
Constructs a new table object with the given name, schema name and catalog name.

Parameters:
catalog - Catalog name where this table is stored.
schema - Schema name where this table stored.
name - Table name.
Method Detail

setPrimaryKeys

public void setPrimaryKeys(java.sql.ResultSet primaryKeys)
                    throws ResultSetTableMetaDataException
Extract information for primary keys in this table from a ResultSet.

Parameters:
primaryKeys - ResultSet containg primary keys metadata.
Throws:
ResultSetTableMetaDataException - if there is a problem accessing information from the ResultSet.

setImportedKeys

public void setImportedKeys(java.sql.ResultSet importedKeys)
                     throws ResultSetTableMetaDataException
Extract information for imported keys from a ResultSet.

Parameters:
importedKeys - ResultSet containing imported keys.
Throws:
ResultSetTableMetaDataException - if there is a problem accessing information from the ResultSet.

setExportedKeys

public void setExportedKeys(java.sql.ResultSet exportedKeys)
                     throws ResultSetTableMetaDataException
Extract information for exported keys from a ResultSet.

Parameters:
exportedKeys - ResultSet containing exported keys.
Throws:
ResultSetTableMetaDataException - if there is a problem accessing information from the ResultSet.

setKeys

private void setKeys(java.sql.ResultSet keys,
                     java.util.Set keySet)
              throws ResultSetTableMetaDataException
Extract information for keys from a ResultSet and store them in the given set.

Parameters:
keys - ResultSet containing keys.
keySet - Set into which keys are to be inserted.
Throws:
ResultSetTableMetaDataException - if there is a problem accessing key information from the ResultSet.

setColumns

public void setColumns(java.sql.ResultSet columns)
                throws ResultSetTableMetaDataException
Extracts information from the given ResultSet and populates the column metadata.

Parameters:
columns - ResultSet containing column metadata.
Throws:
ResultSetTableMetaDataException - if there is a problem accessing information from the ResultSet.

getName

public java.lang.String getName()
Description copied from interface: TableMetaData
Returns the name of this table.

Specified by:
getName in interface TableMetaData
Returns:
name.

getSchemaName

public java.lang.String getSchemaName()
Description copied from interface: TableMetaData
Returns the schema name of this table.

Specified by:
getSchemaName in interface TableMetaData
Returns:
schema name.

getCatalogName

public java.lang.String getCatalogName()
Description copied from interface: TableMetaData
Returns the catalog name of this table.

Specified by:
getCatalogName in interface TableMetaData
Returns:
catalog name.

getColumn

public ColumnMetaData getColumn(int column)
Description copied from interface: TableMetaData
Returns the type information of the column at the specified index.

Specified by:
getColumn in interface TableMetaData
Parameters:
column - The column index.
Returns:
column type information.

getColumnCount

public int getColumnCount()
Description copied from interface: TableMetaData
Returns the number of columns in this table.

Specified by:
getColumnCount in interface TableMetaData
Returns:
number of columns.

getPrimaryKeys

public java.lang.String[] getPrimaryKeys()
Description copied from interface: TableMetaData
Returns a set of columns which form the (composite) primary key of this table.

Specified by:
getPrimaryKeys in interface TableMetaData
Returns:
set of column names

getImportedKeys

public KeyMetaData[] getImportedKeys()
Description copied from interface: TableMetaData
Returns the imported keys of this table.

Specified by:
getImportedKeys in interface TableMetaData
Returns:
imported keys.

getExportedKeys

public KeyMetaData[] getExportedKeys()
Description copied from interface: TableMetaData
Returns the exported keys of this table.

Specified by:
getExportedKeys in interface TableMetaData
Returns:
imported keys.