org.ejen.ext.db
Class TableMetaDataNodeBuilder

java.lang.Object
  |
  +--org.ejen.ext.db.MetaDataNodeBuilder
        |
        +--org.ejen.ext.db.TableMetaDataNodeBuilder
Direct Known Subclasses:
BasicMetaDataConnection

public abstract class TableMetaDataNodeBuilder
extends MetaDataNodeBuilder

Table metadata abstract class (see BasicMetaDataConnection for usage).

Version:
1.0
Author:
F. Wolff

Field Summary
static String S_TABLE_METADATA_NODE_NAME
           
 
Fields inherited from class org.ejen.ext.db.MetaDataNodeBuilder
_activeConn, _errors, S_DI_DATABASE_PRODUCT_NAME, S_DI_DATABASE_PRODUCT_VERSION, S_DI_NODE_NAME, S_EIK_DEFERRABILITY, S_EIK_DELETE_RULE, S_EIK_EK_NODE_NAME, S_EIK_FK_NAME, S_EIK_FKCOLUMN_NAME, S_EIK_FKTABLE_CAT, S_EIK_FKTABLE_NAME, S_EIK_FKTABLE_SCHEM, S_EIK_IK_NODE_NAME, S_EIK_KEY_SEQ, S_EIK_PK_NAME, S_EIK_PKCOLUMN_NAME, S_EIK_PKTABLE_CAT, S_EIK_PKTABLE_NAME, S_EIK_PKTABLE_SCHEM, S_EIK_UPDATE_RULE, S_EXCEPTION_CLASS_NAME, S_EXCEPTION_CODE, S_EXCEPTION_NODE_NAME, S_II_ASC_OR_DESC, S_II_CARDINALITY, S_II_COLUMN_NAME, S_II_FILTER_CONDITION, S_II_INDEX_NAME, S_II_INDEX_QUALIFIER, S_II_NODE_NAME, S_II_NON_UNIQUE, S_II_ORDINAL_POSITION, S_II_PAGES, S_II_TABLE_CAT, S_II_TABLE_NAME, S_II_TABLE_SCHEM, S_II_TYPE, S_NOT_SUPPORTED, S_NULL, S_PK_COLUMN_NAME, S_PK_KEY_SEQ, S_PK_NODE_NAME, S_PK_PK_NAME, S_PK_TABLE_CAT, S_PK_TABLE_NAME, S_PK_TABLE_SCHEM, S_RS_AUTO_INCREMENT, S_RS_CASE_SENSITIVE, S_RS_CATALOG_NAME, S_RS_COLUMN_CLASS_NAME, S_RS_COLUMN_DISPLAY_SIZE, S_RS_COLUMN_LABEL, S_RS_COLUMN_NAME, S_RS_COLUMN_NO_NULLS, S_RS_COLUMN_NODE_NAME, S_RS_COLUMN_NULLABLE, S_RS_COLUMN_NULLABLE_UNKNOWN, S_RS_COLUMN_TYPE, S_RS_COLUMN_TYPE_NAME, S_RS_CURRENCY, S_RS_DEFINITELY_WRITABLE, S_RS_NULLABLE, S_RS_PRECISION, S_RS_READ_ONLY, S_RS_SCALE, S_RS_SCHEMA_NAME, S_RS_SEARCHABLE, S_RS_SIGNED, S_RS_TABLE_NAME, S_RS_WRITABLE
 
Constructor Summary
TableMetaDataNodeBuilder()
           
 
Method Summary
static Node getTableMetaData(ExpressionContext context, String table)
          Gets table metadata.
static Node getTableMetaData(ExpressionContext context, String catalog, String schema, String table)
          Gets table metadata.
protected static Node getTableMetaData(String catalog, String schema, String table, Document doc)
          Gets table metadata.
 
Methods inherited from class org.ejen.ext.db.MetaDataNodeBuilder
appendErrorNode, getConnection, getDatabaseInformation, getErrors, getExportedKeys, getExportedKeys, getExportedKeys, getImportedKeys, getImportedKeys, getImportedKeys, getImportedOrExportedKeys, getIndexInfo, getIndexInfo, getIndexInfo, getPrimaryKeys, getPrimaryKeys, getPrimaryKeys, getResultSetMetaData, getResultSetMetaData, getResultSetMetaData, noNull
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_TABLE_METADATA_NODE_NAME

public static final String S_TABLE_METADATA_NODE_NAME
See Also:
Constant Field Values
Constructor Detail

TableMetaDataNodeBuilder

public TableMetaDataNodeBuilder()
Method Detail

getTableMetaData

public static Node getTableMetaData(ExpressionContext context,
                                    String table)
Gets table metadata.


  <xsl:copy-of select="mta:getTableMetaData('ADDRESS')"/>
 

The returned Node has the following format:


  <metadata>
    <primary-key column-name="ID"
                 key-seq="1"
                 pk-name="SYSTEM_PK"
                 table-cat="#NULL"
                 table-name="ADDRESS"
                 table-shem="#NULL"/>
    <index asc-or-desc="A"
           cardinality="#NULL"
           column-name="ID"
           filter-condition="#NULL"
           index-name="SYSTEM_PK"
           index-qualifier="#NULL"
           non-unique="false"
           ordinal-position="1"
           pages="#NULL"
           table-cat="#NULL"
           table-name="ADDRESS"
           table-shem="#NULL" type="3"/>
    [... Other index nodes]
    <column auto-increment="false"
            case-sensitive="true"
            catalog-name=""
            column-class-name="#NOT_SUPPORTED"
            column-display-size="0"
            column-label="ID"
            column-name="ID"
            column-no-nulls="0"
            column-nullable="1"
            column-nullable-unknown="2"
            column-type="4"
            column-type-name="INTEGER"
            currency="false"
            definitely-writable="true"
            nullable="1"
            precision="0"
            read-only="false"
            scale="0"
            schema-name=""
            searchable="true"
            sequence="true"
            signed="true"
            table-name="ADDRESS"
            writable="true"/>
    [... Other column nodes]
  </metadata>
 

Any null value returned by a ResultSetMetaData.get*() or a ResultSet.get*(int columnIndex) is marked as #NULL.

Any exception thrown by a ResultSetMetaData.get*() method is marked as #NOT_SUPPORTED.

Important database errors (table does not exists, ...) are not thrown. Instead, an errors NodeSet is built and can be retreived by the MetaDataNodeBuilder.getErrors(ExpressionContext) method.

See MetaDataNodeBuilder.getPrimaryKeys(ExpressionContext,String), MetaDataNodeBuilder.getIndexInfo(ExpressionContext,String) and MetaDataNodeBuilder.getResultSetMetaData(ExpressionContext,String).

XSLT parameters:
[Mandatory/AVT] name of the table.

Parameters:
context - automatically passed by the xalan extension mechanism.
table - table name from which metadata are to be retreived.
Returns:
a Node containing the table metadata informations.

getTableMetaData

public static Node getTableMetaData(ExpressionContext context,
                                    String catalog,
                                    String schema,
                                    String table)
Gets table metadata.


  <xsl:copy-of select="mta:getTableMetaData('CAT','SCH','ADDRESS')"/>
 

See getTableMetaData(ExpressionContext,String).

XSLT parameters:
[Mandatory/AVT] name of the catalog.
[Mandatory/AVT] name of the schema.
[Mandatory/AVT] name of the table.

Parameters:
context - automatically passed by the xalan extension mechanism.
catalog - the table catalog name.
schema - the table schema name.
table - the table name from which metadata are to be retreived.
Returns:
a Node containing the table metadata informations.

getTableMetaData

protected static Node getTableMetaData(String catalog,
                                       String schema,
                                       String table,
                                       Document doc)
Gets table metadata.

See getTableMetaData(ExpressionContext,String).

Parameters:
catalog - the table catalog name.
schema - the table schema name.
table - the table name from which metadata are to be retreived.
doc - a Document object used to build the metadata Node.
Returns:
a Node containing the table metadata informations.
Throws:
WrappedRuntimeException - if something goes wrong (except database errors).