uk.org.ogsadai.dataresource
Class SimpleJDBCMetaDataExtractor

java.lang.Object
  |
  +--uk.org.ogsadai.dataresource.MetaDataExtractor
        |
        +--uk.org.ogsadai.dataresource.SimpleJDBCMetaDataExtractor
All Implemented Interfaces:
PropertyCallback
Direct Known Subclasses:
MySQLMetaDataExtractor

public class SimpleJDBCMetaDataExtractor
extends MetaDataExtractor

This is a helper class that will assist in the extraction of a database schema and the return of this schema in a DOM object.


Field Summary
static java.lang.String ATTR_COL_FULL_NAME
           
static java.lang.String ATTR_COL_LENGTH
           
static java.lang.String ATTR_COL_NAME
           
static java.lang.String ATTR_FK_COL
           
static java.lang.String ATTR_FK_TABLE
           
static java.lang.String ATTR_PK_COL
           
static java.lang.String ATTR_PK_TABLE
           
static java.lang.String ATTR_TABLE_NAME
           
static java.lang.String COLUMN
           
static java.lang.String COLUMN_JAVA_TYPE
           
static java.lang.String COLUMN_SQL_TYPE
           
static java.lang.String DATABASE_SCHEMA
          Database Schema Element and Attribute Names
static java.lang.String EXPORTED_KEY
           
static java.lang.String IMPORTED_KEY
           
static java.lang.String LOGICAL_SCHEMA
           
static java.lang.String PHYSICAL_SCHEMA
           
static java.lang.String PRIMARY_KEY
           
static java.lang.String PRIMARY_KEY_FULL_NAME
           
static java.lang.String TABLE
           
 
Fields inherited from class uk.org.ogsadai.dataresource.MetaDataExtractor
mConnectionManager, mSecurityContext
 
Constructor Summary
SimpleJDBCMetaDataExtractor()
           
 
Method Summary
protected  void addColumns(java.sql.DatabaseMetaData metadata, java.lang.String catalog, java.lang.String schemaName, org.w3c.dom.Element tableElt, java.lang.String tableName, org.w3c.dom.Document schema)
          Add to the schema document information on database table columns.
protected  void addExportedKeys(java.sql.DatabaseMetaData metadata, java.lang.String catalog, java.lang.String schemaName, org.w3c.dom.Element tableElt, java.lang.String tableName, org.w3c.dom.Document schema)
          Add to the schema document information on the exported keys of a database table.
protected  void addImportedKeys(java.sql.DatabaseMetaData metadata, java.lang.String catalog, java.lang.String schemaName, org.w3c.dom.Element tableElt, java.lang.String tableName, org.w3c.dom.Document schema)
          Add to the schema document information on the imported keys of a database table.
protected  void addPrimaryKeys(java.sql.DatabaseMetaData metadata, java.lang.String catalog, java.lang.String schemaName, org.w3c.dom.Element tableElt, java.lang.String tableName, org.w3c.dom.Document schema)
          Add to the schema document information on the primary keys of a database table.
protected  java.sql.Connection checkArguments(java.lang.Object connection, javax.xml.namespace.QName name)
           
 java.lang.Object getDatabaseMetaData(java.lang.Object connection, javax.xml.namespace.QName name)
           
protected  java.lang.Object getMetaData(SecurityContext securityContext, javax.xml.namespace.QName name)
           
 void setConnectionManager(ConnectionManager cm)
           
 
Methods inherited from class uk.org.ogsadai.dataresource.MetaDataExtractor
createFaultDocument, getValue, setSecurityContext, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_SCHEMA

public static final java.lang.String DATABASE_SCHEMA
Database Schema Element and Attribute Names

See Also:
Constant Field Values

LOGICAL_SCHEMA

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

PHYSICAL_SCHEMA

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

TABLE

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

ATTR_TABLE_NAME

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

COLUMN

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

ATTR_COL_NAME

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

ATTR_COL_FULL_NAME

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

ATTR_COL_LENGTH

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

COLUMN_SQL_TYPE

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

COLUMN_JAVA_TYPE

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

PRIMARY_KEY

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

PRIMARY_KEY_FULL_NAME

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

IMPORTED_KEY

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

EXPORTED_KEY

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

ATTR_FK_TABLE

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

ATTR_FK_COL

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

ATTR_PK_TABLE

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

ATTR_PK_COL

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

SimpleJDBCMetaDataExtractor

public SimpleJDBCMetaDataExtractor()
Method Detail

setConnectionManager

public void setConnectionManager(ConnectionManager cm)
                          throws CoreSystemException
Overrides:
setConnectionManager in class MetaDataExtractor
CoreSystemException

getMetaData

protected java.lang.Object getMetaData(SecurityContext securityContext,
                                       javax.xml.namespace.QName name)
Specified by:
getMetaData in class MetaDataExtractor

getDatabaseMetaData

public java.lang.Object getDatabaseMetaData(java.lang.Object connection,
                                            javax.xml.namespace.QName name)
                                     throws CoreSystemException,
                                            CoreUserException
CoreSystemException
CoreUserException

checkArguments

protected java.sql.Connection checkArguments(java.lang.Object connection,
                                             javax.xml.namespace.QName name)
                                      throws CoreUserException
CoreUserException

addColumns

protected void addColumns(java.sql.DatabaseMetaData metadata,
                          java.lang.String catalog,
                          java.lang.String schemaName,
                          org.w3c.dom.Element tableElt,
                          java.lang.String tableName,
                          org.w3c.dom.Document schema)
                   throws java.sql.SQLException
Add to the schema document information on database table columns.

Parameters:
metadata - Metadata about the database.
catalog - Current database catalog name.
tableElt - DOM element holding information about the column to which the table belongs.
tableName - Name of table to which the column belongs.
schema - schema document DOM object.
Throws:
SQLException - if any problems arise in extracting database information.
java.sql.SQLException

addPrimaryKeys

protected void addPrimaryKeys(java.sql.DatabaseMetaData metadata,
                              java.lang.String catalog,
                              java.lang.String schemaName,
                              org.w3c.dom.Element tableElt,
                              java.lang.String tableName,
                              org.w3c.dom.Document schema)
                       throws java.sql.SQLException
Add to the schema document information on the primary keys of a database table.

Parameters:
metadata - Metadata about the database.
catalog - Current database catalog name.
tableElt - DOM element holding information about the table.
tableName - Name of table.
schema - schema document DOM object.
Throws:
SQLException - if any problems arise in extracting database information.
java.sql.SQLException

addImportedKeys

protected void addImportedKeys(java.sql.DatabaseMetaData metadata,
                               java.lang.String catalog,
                               java.lang.String schemaName,
                               org.w3c.dom.Element tableElt,
                               java.lang.String tableName,
                               org.w3c.dom.Document schema)
                        throws java.sql.SQLException
Add to the schema document information on the imported keys of a database table.

Parameters:
metadata - Metadata about the database.
catalog - Current database catalog name.
tableElt - DOM element holding information about the table.
tableName - Name of table.
schema - schema document DOM object.
Throws:
SQLException - if any problems arise in extracting database information.
java.sql.SQLException

addExportedKeys

protected void addExportedKeys(java.sql.DatabaseMetaData metadata,
                               java.lang.String catalog,
                               java.lang.String schemaName,
                               org.w3c.dom.Element tableElt,
                               java.lang.String tableName,
                               org.w3c.dom.Document schema)
                        throws java.sql.SQLException
Add to the schema document information on the exported keys of a database table.

Parameters:
metadata - Metadata about the database.
catalog - Current database catalog name.
tableElt - DOM element holding information about the table.
tableName - Name of table.
schema - schema document DOM object.
Throws:
SQLException - if any problems arise in extracting database information.
java.sql.SQLException