All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.xmlmiddleware.xmldbms.maps.Table

java.lang.Object
   |
   +----org.xmlmiddleware.xmldbms.maps.MapBase
           |
           +----org.xmlmiddleware.xmldbms.maps.Table

public class Table
extends MapBase
Describes a table; not for general use.

Table contains information about a table. Tables are stored in Maps, ClassMaps, PropertyMaps, ClassTableMaps, and PropertyTableMaps.

In XML-DBMS, tables have four-part names: database, catalog, schema, and table name. The database name is the name of the XML-DBMS database to use; it describes the connection information to use and has nothing to do with clusters, which are the fourth (top) level of names in SQL '92. Catalog, schema, and table names are as in SQL '92.

XML-DBMS also has "universal table names", which have the following form:

    "database-name"."catalog-name"."schema-name"."table-name"
 

These are used in error messages. XML-DBMS applications do not need to use them. Note that it is probably possible to construct two different tables with the same universal name, but since these names are only used in error messages, it shouldn't matter much.

Version:
2.0
Author:
Ronald Bourret, 1998-1999, 2001

Method Index

 o addColumn(Column)
Add a Column.
 o addForeignKey(Key)
Add a foreign key to the table.
 o addPrimaryKey(Key)
Add a primary key to the table.
 o addUniqueKey(Key)
Add a unique key (except the primary key) to the table.
 o checkMetadata()
Checks whether metadata has been set for the columns in the table.
 o create(String, String, String, String)
Create a new Table.
 o createColumn(String)
Create a Column and add it to the Table.
 o createForeignKey(String)
Create a foreign key and add it to the table.
 o createPrimaryKey(String)
Create a primary key and add it to the table.
 o createUniqueKey(String)
Create a unique key (except the primary key) and add it to the table.
 o getCatalogName()
Get the catalog name.
 o getColumn(String)
Get a Column.
 o getColumns()
Get all Columns.
 o getDatabaseName()
Get the database name.
 o getForeignKey(String)
Get a foreign key.
 o getForeignKeys()
Get all foreign keys.
 o getHashName()
Get a "universal" name that is safe for hashing.
 o getHashName(String, String, String, String)
Get a "universal" name that is safe for hashing.
 o getNumberOfColumns()
Get number of Columns.
 o getPrimaryKey()
Get the primary key.
 o getResultSetColumns()
Get all Columns in ascending order according to their result set index.
 o getSchemaName()
Get the schema name.
 o getTableName()
Get the table name.
 o getUniqueKey(String)
Get a unique key (except the primary key).
 o getUniqueKeys()
Get all unique keys (except the primary key).
 o getUniversalName()
Get the universal name of the table.
 o getUniversalName(String, String, String, String)
Construct a universal table name from the specified names.
 o removeAllColumns()
Remove all columns.
 o removeAllForeignKeys()
Remove all foreign keys.
 o removeAllUniqueKeys()
Remove all unique keys (except the primary key).
 o removeColumn(String)
Remove a Column.
 o removeForeignKey(String)
Remove a foreign key.
 o removePrimaryKey()
Remove the primary key.
 o removeUniqueKey(String)
Remove a unique key (except the primary key).

Methods

 o create
 public static Table create(String databaseName,
                            String catalogName,
                            String schemaName,
                            String tableName)
Create a new Table.

Parameters:
databaseName - Name of the database. If this is null, uses "Default".
catalogName - Name of the catalog. May be null.
schemaName - Name of the schema. May be null.
tableName - Name of the table.
Returns:
The Table.
 o getDatabaseName
 public final String getDatabaseName()
Get the database name.

Returns:
The database name.
 o getCatalogName
 public final String getCatalogName()
Get the catalog name.

Returns:
The catalog name.
 o getSchemaName
 public final String getSchemaName()
Get the schema name.

Returns:
The schema name.
 o getTableName
 public final String getTableName()
Get the table name.

Returns:
The table name.
 o getUniversalName
 public final String getUniversalName()
Get the universal name of the table.

This name should be used only in error messages. For a "universal" name that can safely be hashed on, use getHashName().

Returns:
The universal name.
 o getUniversalName
 public static String getUniversalName(String databaseName,
                                       String catalogName,
                                       String schemaName,
                                       String tableName)
Construct a universal table name from the specified names.

This name should be used only in error messages. For a "universal" name that can safely be hashed on, use getHashName(String, String, String, String).

Parameters:
databaseName - Name of the database. If this is null, uses "Default".
catalogName - Name of the catalog. May be null.
schemaName - Name of the schema. May be null.
tableName - Name of the table.
Returns:
The universal name.
 o getHashName
 public final String getHashName()
Get a "universal" name that is safe for hashing.

Returns:
The hash name.
 o getHashName
 public static String getHashName(String databaseName,
                                  String catalogName,
                                  String schemaName,
                                  String tableName)
Get a "universal" name that is safe for hashing.

Parameters:
databaseName - Name of the database. If this is null, uses "Default".
catalogName - Name of the catalog. May be null.
schemaName - Name of the schema. May be null.
tableName - Name of the table.
Returns:
The hash name.
 o getNumberOfColumns
 public final int getNumberOfColumns()
Get number of Columns.

Returns:
The number of Columns.
 o getColumn
 public final Column getColumn(String columnName)
Get a Column.

Parameters:
columnName - Name of the column.
Returns:
The Column. Null if the column does not exist.
 o getColumns
 public final Enumeration getColumns()
Get all Columns.

Returns:
An Enumeration of all Columns. May be empty.
 o getResultSetColumns
 public final Column[] getResultSetColumns()
Get all Columns in ascending order according to their result set index.

For more information, see the Column class.

Returns:
The columns
 o createColumn
 public Column createColumn(String columnName)
Create a Column and add it to the Table.

If the Column already exists, returns the existing Column.

Parameters:
columnName - Name of the column.
Returns:
The Column.
 o addColumn
 public void addColumn(Column column) throws XMLMiddlewareException
Add a Column.

Parameters:
column - The Column.
Throws: XMLMiddlewareException
Thrown if the Column already exists.
 o removeColumn
 public void removeColumn(String columnName) throws XMLMiddlewareException
Remove a Column.

This method should be used carefully, as numerous other map objects point to Columns. Those objects should be deleted before this method is called.

Parameters:
columnName - Name of the column.
Throws: XMLMiddlewareException
Thrown if the column does not exist.
 o removeAllColumns
 public void removeAllColumns()
Remove all columns.

This method should be used carefully, as numerous other map objects point to Columns. Those objects should be deleted before this method is called.

 o getPrimaryKey
 public final Key getPrimaryKey()
Get the primary key.

Returns:
The primary key. Null if the primary key does not exist.
 o createPrimaryKey
 public Key createPrimaryKey(String keyName)
Create a primary key and add it to the table.

If the primary key already exists, returns the existing primary key.

Parameters:
keyName - Name of the key. Used in map documents and CREATE TABLE statements. If this is null, "PrimaryKey" is used.
Returns:
The primary key.
 o addPrimaryKey
 public void addPrimaryKey(Key key) throws XMLMiddlewareException
Add a primary key to the table.

Parameters:
key - The primary key.
Throws: XMLMiddlewareException
Thrown if the primary key already exists.
 o removePrimaryKey
 public void removePrimaryKey() throws XMLMiddlewareException
Remove the primary key.

Throws: XMLMiddlewareException
Thrown if a primary key does not exist.
 o getUniqueKey
 public final Key getUniqueKey(String keyName)
Get a unique key (except the primary key).

Parameters:
keyName - Name of the key.
Returns:
The unique key. Null if the key is not found.
 o getUniqueKeys
 public final Enumeration getUniqueKeys()
Get all unique keys (except the primary key).

Returns:
An Enumeration of all unique keys. May be empty.
 o createUniqueKey
 public Key createUniqueKey(String keyName)
Create a unique key (except the primary key) and add it to the table.

If the key already exists, returns the existing key.

Parameters:
keyName - Name of the key.
Returns:
The unique key.
 o addUniqueKey
 public void addUniqueKey(Key key) throws XMLMiddlewareException
Add a unique key (except the primary key) to the table.

Parameters:
key - The unique key.
Throws: XMLMiddlewareException
Thrown if the unique key already exists.
 o removeUniqueKey
 public void removeUniqueKey(String keyName) throws XMLMiddlewareException
Remove a unique key (except the primary key).

Parameters:
keyName - Name of the key.
Throws: XMLMiddlewareException
Thrown if the unique key does not exist.
 o removeAllUniqueKeys
 public void removeAllUniqueKeys()
Remove all unique keys (except the primary key).

 o getForeignKey
 public final Key getForeignKey(String keyName)
Get a foreign key.

Parameters:
keyName - Name of the key.
Returns:
The foreign key. Null if the key is not found.
 o getForeignKeys
 public final Enumeration getForeignKeys()
Get all foreign keys.

Returns:
An Enumeration of all foreign keys. May be empty.
 o createForeignKey
 public Key createForeignKey(String keyName)
Create a foreign key and add it to the table.

If the key already exists, returns the existing key.

Parameters:
keyName - Name of the key.
Returns:
The foreign key.
 o addForeignKey
 public void addForeignKey(Key key) throws XMLMiddlewareException
Add a foreign key to the table.

Parameters:
key - The foreign key.
Throws: XMLMiddlewareException
Thrown if the foreign key already exists.
 o removeForeignKey
 public void removeForeignKey(String keyName) throws XMLMiddlewareException
Remove a foreign key.

Parameters:
keyName - Name of the key.
Throws: XMLMiddlewareException
Thrown if the foreign key does not exist.
 o removeAllForeignKeys
 public void removeAllForeignKeys()
Remove all foreign keys.

 o checkMetadata
 public Column checkMetadata()
Checks whether metadata has been set for the columns in the table.

Returns:
The first Column for which metadata has not been set or null if metadata has been set for all columns.

All Packages  Class Hierarchy  This Package  Previous  Next  Index