org.ejen.ext.db
Class MetaDataNodeBuilder

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

public abstract class MetaDataNodeBuilder
extends Object

Database/table metadata abstract class. (see BasicMetaDataConnection for usage).

Version:
1.0
Author:
F. Wolff

Field Summary
protected static Connection _activeConn
          Current active connection
protected static NodeSet _errors
          NodeSet containing errors informations
static String S_DI_DATABASE_PRODUCT_NAME
           
static String S_DI_DATABASE_PRODUCT_VERSION
           
static String S_DI_NODE_NAME
           
static String S_EIK_DEFERRABILITY
           
static String S_EIK_DELETE_RULE
           
static String S_EIK_EK_NODE_NAME
           
static String S_EIK_FK_NAME
           
static String S_EIK_FKCOLUMN_NAME
           
static String S_EIK_FKTABLE_CAT
           
static String S_EIK_FKTABLE_NAME
           
static String S_EIK_FKTABLE_SCHEM
           
static String S_EIK_IK_NODE_NAME
           
static String S_EIK_KEY_SEQ
           
static String S_EIK_PK_NAME
           
static String S_EIK_PKCOLUMN_NAME
           
static String S_EIK_PKTABLE_CAT
           
static String S_EIK_PKTABLE_NAME
           
static String S_EIK_PKTABLE_SCHEM
           
static String S_EIK_UPDATE_RULE
           
static String S_EXCEPTION_CLASS_NAME
           
static String S_EXCEPTION_CODE
           
static String S_EXCEPTION_NODE_NAME
           
static String S_II_ASC_OR_DESC
           
static String S_II_CARDINALITY
           
static String S_II_COLUMN_NAME
           
static String S_II_FILTER_CONDITION
           
static String S_II_INDEX_NAME
           
static String S_II_INDEX_QUALIFIER
           
static String S_II_NODE_NAME
           
static String S_II_NON_UNIQUE
           
static String S_II_ORDINAL_POSITION
           
static String S_II_PAGES
           
static String S_II_TABLE_CAT
           
static String S_II_TABLE_NAME
           
static String S_II_TABLE_SCHEM
           
static String S_II_TYPE
           
static String S_NOT_SUPPORTED
           
static String S_NULL
           
static String S_PK_COLUMN_NAME
           
static String S_PK_KEY_SEQ
           
static String S_PK_NODE_NAME
           
static String S_PK_PK_NAME
           
static String S_PK_TABLE_CAT
           
static String S_PK_TABLE_NAME
           
static String S_PK_TABLE_SCHEM
           
static String S_RS_AUTO_INCREMENT
           
static String S_RS_CASE_SENSITIVE
           
static String S_RS_CATALOG_NAME
           
static String S_RS_COLUMN_CLASS_NAME
           
static String S_RS_COLUMN_DISPLAY_SIZE
           
static String S_RS_COLUMN_LABEL
           
static String S_RS_COLUMN_NAME
           
static String S_RS_COLUMN_NO_NULLS
           
static String S_RS_COLUMN_NODE_NAME
           
static String S_RS_COLUMN_NULLABLE
           
static String S_RS_COLUMN_NULLABLE_UNKNOWN
           
static String S_RS_COLUMN_TYPE
           
static String S_RS_COLUMN_TYPE_NAME
           
static String S_RS_CURRENCY
           
static String S_RS_DEFINITELY_WRITABLE
           
static String S_RS_NULLABLE
           
static String S_RS_PRECISION
           
static String S_RS_READ_ONLY
           
static String S_RS_SCALE
           
static String S_RS_SCHEMA_NAME
           
static String S_RS_SEARCHABLE
           
static String S_RS_SIGNED
           
static String S_RS_TABLE_NAME
           
static String S_RS_WRITABLE
           
 
Constructor Summary
MetaDataNodeBuilder()
           
 
Method Summary
protected static void appendErrorNode(Exception e)
          Appends an error Node to the current _errors NodeSet.
protected static Connection getConnection()
          Gets the current active JDBC connection.
static Node getDatabaseInformation(ExpressionContext context)
          Returns a Node that contains basic database informations.
static NodeSet getErrors(ExpressionContext context)
          Returns a NodeSet that contains errors informations.
static NodeSet getExportedKeys(ExpressionContext context, String table)
          Returns a NodeSet that contains exported keys metadata.
static NodeSet getExportedKeys(ExpressionContext context, String catalog, String schema, String table)
          Returns a NodeSet that contains exported keys metadata.
protected static NodeSet getExportedKeys(String catalog, String schema, String table, Document doc)
          Returns a NodeSet that contains exported keys metadata.
static NodeSet getImportedKeys(ExpressionContext context, String table)
          Returns a NodeSet that contains imported keys metadata.
static NodeSet getImportedKeys(ExpressionContext context, String catalog, String schema, String table)
          Returns a NodeSet that contains imported keys metadata.
protected static NodeSet getImportedKeys(String catalog, String schema, String table, Document doc)
          Returns a NodeSet that contains imported keys metadata.
protected static void getImportedOrExportedKeys(ResultSet rs, String eltName, NodeSet ns, Document doc)
          Returns a NodeSet that contains exported or imported keys metadata.
static NodeSet getIndexInfo(ExpressionContext context, String table)
          Returns a NodeSet that contains indexes metadata.
static NodeSet getIndexInfo(ExpressionContext context, String catalog, String schema, String table)
          Returns a NodeSet that contains indexes metadata.
protected static NodeSet getIndexInfo(String catalog, String schema, String table, Document doc)
          Returns a NodeSet that contains indexes metadata.
static NodeSet getPrimaryKeys(ExpressionContext context, String table)
          Returns a NodeSet that contains primary keys metadata.
static NodeSet getPrimaryKeys(ExpressionContext context, String catalog, String schema, String table)
          Returns a NodeSet that contains primary keys metadata.
protected static NodeSet getPrimaryKeys(String catalog, String schema, String table, Document doc)
          Returns a NodeSet that contains primary keys metadata.
static NodeSet getResultSetMetaData(ExpressionContext context, String table)
          Returns a NodeSet that contains ResultSet metadata (for all columns).
static NodeSet getResultSetMetaData(ExpressionContext context, String table, String columns)
          Returns a NodeSet that contains ResultSet metadata (for the given column names).
protected static NodeSet getResultSetMetaData(String table, String columns, String eltName, Document doc)
          Returns a NodeSet that contains ResultSet metadata (for the given column names).
protected static String noNull(String s)
          Returns s if s is not null, "#NULL" otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_DI_NODE_NAME

public static final String S_DI_NODE_NAME
See Also:
Constant Field Values

S_DI_DATABASE_PRODUCT_NAME

public static final String S_DI_DATABASE_PRODUCT_NAME
See Also:
Constant Field Values

S_DI_DATABASE_PRODUCT_VERSION

public static final String S_DI_DATABASE_PRODUCT_VERSION
See Also:
Constant Field Values

S_RS_COLUMN_NODE_NAME

public static final String S_RS_COLUMN_NODE_NAME
See Also:
Constant Field Values

S_RS_CATALOG_NAME

public static final String S_RS_CATALOG_NAME
See Also:
Constant Field Values

S_RS_COLUMN_CLASS_NAME

public static final String S_RS_COLUMN_CLASS_NAME
See Also:
Constant Field Values

S_RS_COLUMN_DISPLAY_SIZE

public static final String S_RS_COLUMN_DISPLAY_SIZE
See Also:
Constant Field Values

S_RS_COLUMN_LABEL

public static final String S_RS_COLUMN_LABEL
See Also:
Constant Field Values

S_RS_COLUMN_NAME

public static final String S_RS_COLUMN_NAME
See Also:
Constant Field Values

S_RS_COLUMN_TYPE

public static final String S_RS_COLUMN_TYPE
See Also:
Constant Field Values

S_RS_COLUMN_TYPE_NAME

public static final String S_RS_COLUMN_TYPE_NAME
See Also:
Constant Field Values

S_RS_PRECISION

public static final String S_RS_PRECISION
See Also:
Constant Field Values

S_RS_SCALE

public static final String S_RS_SCALE
See Also:
Constant Field Values

S_RS_SCHEMA_NAME

public static final String S_RS_SCHEMA_NAME
See Also:
Constant Field Values

S_RS_TABLE_NAME

public static final String S_RS_TABLE_NAME
See Also:
Constant Field Values

S_RS_AUTO_INCREMENT

public static final String S_RS_AUTO_INCREMENT
See Also:
Constant Field Values

S_RS_CASE_SENSITIVE

public static final String S_RS_CASE_SENSITIVE
See Also:
Constant Field Values

S_RS_CURRENCY

public static final String S_RS_CURRENCY
See Also:
Constant Field Values

S_RS_DEFINITELY_WRITABLE

public static final String S_RS_DEFINITELY_WRITABLE
See Also:
Constant Field Values

S_RS_NULLABLE

public static final String S_RS_NULLABLE
See Also:
Constant Field Values

S_RS_READ_ONLY

public static final String S_RS_READ_ONLY
See Also:
Constant Field Values

S_RS_SEARCHABLE

public static final String S_RS_SEARCHABLE
See Also:
Constant Field Values

S_RS_SIGNED

public static final String S_RS_SIGNED
See Also:
Constant Field Values

S_RS_WRITABLE

public static final String S_RS_WRITABLE
See Also:
Constant Field Values

S_RS_COLUMN_NO_NULLS

public static final String S_RS_COLUMN_NO_NULLS
See Also:
Constant Field Values

S_RS_COLUMN_NULLABLE

public static final String S_RS_COLUMN_NULLABLE
See Also:
Constant Field Values

S_RS_COLUMN_NULLABLE_UNKNOWN

public static final String S_RS_COLUMN_NULLABLE_UNKNOWN
See Also:
Constant Field Values

S_PK_NODE_NAME

public static final String S_PK_NODE_NAME
See Also:
Constant Field Values

S_PK_TABLE_CAT

public static final String S_PK_TABLE_CAT
See Also:
Constant Field Values

S_PK_TABLE_SCHEM

public static final String S_PK_TABLE_SCHEM
See Also:
Constant Field Values

S_PK_TABLE_NAME

public static final String S_PK_TABLE_NAME
See Also:
Constant Field Values

S_PK_COLUMN_NAME

public static final String S_PK_COLUMN_NAME
See Also:
Constant Field Values

S_PK_KEY_SEQ

public static final String S_PK_KEY_SEQ
See Also:
Constant Field Values

S_PK_PK_NAME

public static final String S_PK_PK_NAME
See Also:
Constant Field Values

S_EIK_EK_NODE_NAME

public static final String S_EIK_EK_NODE_NAME
See Also:
Constant Field Values

S_EIK_IK_NODE_NAME

public static final String S_EIK_IK_NODE_NAME
See Also:
Constant Field Values

S_EIK_PKTABLE_CAT

public static final String S_EIK_PKTABLE_CAT
See Also:
Constant Field Values

S_EIK_PKTABLE_SCHEM

public static final String S_EIK_PKTABLE_SCHEM
See Also:
Constant Field Values

S_EIK_PKTABLE_NAME

public static final String S_EIK_PKTABLE_NAME
See Also:
Constant Field Values

S_EIK_PKCOLUMN_NAME

public static final String S_EIK_PKCOLUMN_NAME
See Also:
Constant Field Values

S_EIK_FKTABLE_CAT

public static final String S_EIK_FKTABLE_CAT
See Also:
Constant Field Values

S_EIK_FKTABLE_SCHEM

public static final String S_EIK_FKTABLE_SCHEM
See Also:
Constant Field Values

S_EIK_FKTABLE_NAME

public static final String S_EIK_FKTABLE_NAME
See Also:
Constant Field Values

S_EIK_FKCOLUMN_NAME

public static final String S_EIK_FKCOLUMN_NAME
See Also:
Constant Field Values

S_EIK_KEY_SEQ

public static final String S_EIK_KEY_SEQ
See Also:
Constant Field Values

S_EIK_UPDATE_RULE

public static final String S_EIK_UPDATE_RULE
See Also:
Constant Field Values

S_EIK_DELETE_RULE

public static final String S_EIK_DELETE_RULE
See Also:
Constant Field Values

S_EIK_FK_NAME

public static final String S_EIK_FK_NAME
See Also:
Constant Field Values

S_EIK_PK_NAME

public static final String S_EIK_PK_NAME
See Also:
Constant Field Values

S_EIK_DEFERRABILITY

public static final String S_EIK_DEFERRABILITY
See Also:
Constant Field Values

S_II_NODE_NAME

public static final String S_II_NODE_NAME
See Also:
Constant Field Values

S_II_TABLE_CAT

public static final String S_II_TABLE_CAT
See Also:
Constant Field Values

S_II_TABLE_SCHEM

public static final String S_II_TABLE_SCHEM
See Also:
Constant Field Values

S_II_TABLE_NAME

public static final String S_II_TABLE_NAME
See Also:
Constant Field Values

S_II_NON_UNIQUE

public static final String S_II_NON_UNIQUE
See Also:
Constant Field Values

S_II_INDEX_QUALIFIER

public static final String S_II_INDEX_QUALIFIER
See Also:
Constant Field Values

S_II_INDEX_NAME

public static final String S_II_INDEX_NAME
See Also:
Constant Field Values

S_II_TYPE

public static final String S_II_TYPE
See Also:
Constant Field Values

S_II_ORDINAL_POSITION

public static final String S_II_ORDINAL_POSITION
See Also:
Constant Field Values

S_II_COLUMN_NAME

public static final String S_II_COLUMN_NAME
See Also:
Constant Field Values

S_II_ASC_OR_DESC

public static final String S_II_ASC_OR_DESC
See Also:
Constant Field Values

S_II_CARDINALITY

public static final String S_II_CARDINALITY
See Also:
Constant Field Values

S_II_PAGES

public static final String S_II_PAGES
See Also:
Constant Field Values

S_II_FILTER_CONDITION

public static final String S_II_FILTER_CONDITION
See Also:
Constant Field Values

S_EXCEPTION_NODE_NAME

public static final String S_EXCEPTION_NODE_NAME
See Also:
Constant Field Values

S_EXCEPTION_CLASS_NAME

public static final String S_EXCEPTION_CLASS_NAME
See Also:
Constant Field Values

S_EXCEPTION_CODE

public static final String S_EXCEPTION_CODE
See Also:
Constant Field Values

S_NOT_SUPPORTED

public static final String S_NOT_SUPPORTED
See Also:
Constant Field Values

S_NULL

public static final String S_NULL
See Also:
Constant Field Values

_errors

protected static NodeSet _errors
NodeSet containing errors informations


_activeConn

protected static Connection _activeConn
Current active connection

Constructor Detail

MetaDataNodeBuilder

public MetaDataNodeBuilder()
Method Detail

getConnection

protected static Connection getConnection()
                                   throws SQLException
Gets the current active JDBC connection.

Returns:
the connection.
Throws:
SQLException - if there is no active connection (ie: no connections at all).

getErrors

public static NodeSet getErrors(ExpressionContext context)
Returns a NodeSet that contains errors informations.


  <xsl:variable name="errors" select="mta:getErrors()"/>
 

The returned NodeSet has the following format:


  [... other 'exception' nodes with earlier errors]
  <exception class-name="java.sql.SQLException" code="0">
    Table not found: ADRESS in statement [SELECT * FROM ADRESS]
  </exception>
 

Parameters:
context - automatically passed by the xalan extension mechanism.
Returns:
the errors NodeSet.

getDatabaseInformation

public static Node getDatabaseInformation(ExpressionContext context)
Returns a Node that contains basic database informations.


  <xsl:copy-of select="mta:getDatabaseInformation()/@*"/>
 

The returned Node has the following format:


  <database-information database-product-name="..."
                        database-product-version="..."/>
 

Database errors (SQLException) are not thrown. Instead, an errors NodeSet is built that can be retreived by the getErrors(ExpressionContext) method.

See DatabaseMetaData.getDatabaseProductName() and DatabaseMetaData.getDatabaseProductVersion().

Parameters:
context - automatically passed by the xalan extension mechanism.
Returns:
the database informations Node.
Throws:
WrappedRuntimeException - DOM error.

getResultSetMetaData

public static NodeSet getResultSetMetaData(ExpressionContext context,
                                           String table)
Returns a NodeSet that contains ResultSet metadata (for all columns).


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

The returned NodeSet has the following format


  <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]
 

Note: column-no-nulls, column-nullable and column-nullable-unknown are just constant values used by nullable attribute.

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 getErrors(ExpressionContext) method.

See ResultSetMetaData.

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

Parameters:
context - automatically passed by the xalan extension mechanism.
table - name of the table.
Returns:
the ResultSet metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getResultSetMetaData

public static NodeSet getResultSetMetaData(ExpressionContext context,
                                           String table,
                                           String columns)
Returns a NodeSet that contains ResultSet metadata (for the given column names).


  <xsl:copy-of select="mta:getResultSetMetaData('ADDRESS','COL1,COL2')"/>
 

See getResultSetMetaData(ExpressionContext,String) method.

XSLT parameters:
[Mandatory/AVT] name of the table.
[Mandatory/AVT] comma separated list column names.

Parameters:
context - automatically passed by the xalan extension mechanism.
table - name of the table.
columns - comma separated list of columns.
Returns:
the ResultSet metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getResultSetMetaData

protected static NodeSet getResultSetMetaData(String table,
                                              String columns,
                                              String eltName,
                                              Document doc)
Returns a NodeSet that contains ResultSet metadata (for the given column names).

See getResultSetMetaData(ExpressionContext,String) method.

Parameters:
table - name of the table.
columns - comma separated list of columns.
eltName - name of each columns node name.
doc - a Document.
Returns:
the ResultSet metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getPrimaryKeys

public static NodeSet getPrimaryKeys(ExpressionContext context,
                                     String table)
Returns a NodeSet that contains primary keys metadata.


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

The returned NodeSet has the following format:


  <primary-key column-name="ID"
               key-seq="1"
               pk-name="SYSTEM_PK"
               table-cat="#NULL"
               table-name="ADDRESS"
               table-shem="#NULL"/>
 

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 getErrors(ExpressionContext) method.

See DatabaseMetaData.getPrimaryKeys(String,String,String).

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

Parameters:
context - automatically passed by the xalan extension mechanism.
table - name of the table.
Returns:
the primary keys metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getPrimaryKeys

public static NodeSet getPrimaryKeys(ExpressionContext context,
                                     String catalog,
                                     String schema,
                                     String table)
Returns a NodeSet that contains primary keys metadata.


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

See getPrimaryKeys(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 - name of the catalog.
schema - name of the schema.
table - name of the table.
Returns:
the primary keys metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getPrimaryKeys

protected static NodeSet getPrimaryKeys(String catalog,
                                        String schema,
                                        String table,
                                        Document doc)
Returns a NodeSet that contains primary keys metadata.

See getPrimaryKeys(ExpressionContext,String).

Parameters:
catalog - name of the catalog.
schema - name of the schema.
table - name of the table.
doc - a Document.
Returns:
the ResultSet metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getImportedKeys

public static NodeSet getImportedKeys(ExpressionContext context,
                                      String table)
Returns a NodeSet that contains imported keys metadata.


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

The returned NodeSet has the following format:


  <imported-key pktable-cat="..."
                pktable-shem="..."
                pktable-name="..."
                pkcolumn-name="..."
                fktable-cat="..."
                fktable-shem="..."
                fktable-name="..."
                fkcolumn-name="..."
                key-seq="..."
                update-rule="..."
                delete-rule="..."
                fk-name="..."
                pk-name="..."
                deferrability="..."/>
  [... Other imported-key nodes]
 

Any null value is marked as #NULL.

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

See DatabaseMetaData.getImportedKeys(String,String,String).

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

Parameters:
context - automatically passed by the xalan extension mechanism.
table - name of the table.
Returns:
the primary keys metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getImportedKeys

public static NodeSet getImportedKeys(ExpressionContext context,
                                      String catalog,
                                      String schema,
                                      String table)
Returns a NodeSet that contains imported keys metadata.


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

See getImportedKeys(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 - name of the catalog.
schema - name of the schema.
table - name of the table.
Returns:
the primary keys metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getImportedKeys

protected static NodeSet getImportedKeys(String catalog,
                                         String schema,
                                         String table,
                                         Document doc)
Returns a NodeSet that contains imported keys metadata.

See getImportedKeys(ExpressionContext,String).

Parameters:
catalog - name of the catalog.
schema - name of the schema.
table - name of the table.
doc - a Document.
Returns:
the ResultSet metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getExportedKeys

public static NodeSet getExportedKeys(ExpressionContext context,
                                      String table)
Returns a NodeSet that contains exported keys metadata.


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

The returned NodeSet has the following format:


  <exported-key pktable-cat="..."
                pktable-shem="..."
                pktable-name="..."
                pkcolumn-name="..."
                fktable-cat="..."
                fktable-shem="..."
                fktable-name="..."
                fkcolumn-name="..."
                key-seq="..."
                update-rule="..."
                delete-rule="..."
                fk-name="..."
                pk-name="..."
                deferrability="..."/>
  [... Other exported-key nodes]
 

Any null value is marked as #NULL.

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

See DatabaseMetaData.getExportedKeys(String,String,String).

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

Parameters:
context - automatically passed by the xalan extension mechanism.
table - name of the table.
Returns:
the primary keys metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getExportedKeys

public static NodeSet getExportedKeys(ExpressionContext context,
                                      String catalog,
                                      String schema,
                                      String table)
Returns a NodeSet that contains exported keys metadata.


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

See getExportedKeys(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 - name of the catalog.
schema - name of the schema.
table - name of the table.
Returns:
the primary keys metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getExportedKeys

protected static NodeSet getExportedKeys(String catalog,
                                         String schema,
                                         String table,
                                         Document doc)
Returns a NodeSet that contains exported keys metadata.

See getExportedKeys(ExpressionContext,String).

Parameters:
catalog - name of the catalog.
schema - name of the schema.
table - name of the table.
doc - a Document.
Returns:
the ResultSet metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getImportedOrExportedKeys

protected static void getImportedOrExportedKeys(ResultSet rs,
                                                String eltName,
                                                NodeSet ns,
                                                Document doc)
                                         throws Exception
Returns a NodeSet that contains exported or imported keys metadata.

See getExportedKeys(ExpressionContext,String) and getImportedKeys(ExpressionContext,String).

Parameters:
rs - a ResutSet with imported or exported keys metadata.
eltName - name of the Nodes to be built.
ns - NodeSet to fill with Nodes.
doc - a Document.
Throws:
Exception - any...

getIndexInfo

public static NodeSet getIndexInfo(ExpressionContext context,
                                   String table)
Returns a NodeSet that contains indexes metadata.


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

The returned NodeSet has the following format:


  <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]
 

Any null value is marked as #NULL.

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

See DatabaseMetaData.getIndexInfo(String,String,String,boolean,boolean).

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

Parameters:
context - automatically passed by the xalan extension mechanism.
table - name of the table.
Returns:
the primary keys metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getIndexInfo

public static NodeSet getIndexInfo(ExpressionContext context,
                                   String catalog,
                                   String schema,
                                   String table)
Returns a NodeSet that contains indexes metadata.


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

See getIndexInfo(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 - name of the catalog.
schema - name of the schema.
table - name of the table.
Returns:
the primary keys metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

getIndexInfo

protected static NodeSet getIndexInfo(String catalog,
                                      String schema,
                                      String table,
                                      Document doc)
Returns a NodeSet that contains indexes metadata.

See getIndexInfo(ExpressionContext,String).

Parameters:
catalog - name of the catalog.
schema - name of the schema.
table - name of the table.
doc - a Document.
Returns:
the ResultSet metadata NodeSet.
Throws:
WrappedRuntimeException - DOM error.

appendErrorNode

protected static void appendErrorNode(Exception e)
Appends an error Node to the current _errors NodeSet.

Parameters:
e - the exception that must be add as an error Node.
Throws:
WrappedRuntimeException - DOM error.

noNull

protected static String noNull(String s)
Returns s if s is not null, "#NULL" otherwise.

Parameters:
s - the String to test for nullity.
Returns:
the s if s is not null, "#NULL" otherwise.