org.enableit.db.darrt
Class SchemaExporter

java.lang.Object
  |
  +--org.enableit.db.darrt.AbstractFileHandler
        |
        +--org.enableit.db.darrt.AbstractSchemaHandler
              |
              +--org.enableit.db.darrt.SchemaExporter

public class SchemaExporter
extends AbstractSchemaHandler

Export database schemas as XML.

Note on ASA interpretation of DatabaseMetaData object: SchemaConstants.SCHEMA = users and groups.


Field Summary
static java.lang.String COL_TYPE
           
static java.lang.String FK
           
static java.lang.String FK_DATA_COL_NAME
           
static java.lang.String FK_DATA_COLUMN
           
static java.lang.String FK_DISPLAY_COL_NAME
           
static java.lang.String FK_DISPLAY_COLUMN
           
static java.lang.String FK_TABLE
           
static java.lang.String NULLABLE
           
static java.lang.String PK
           
 
Fields inherited from class org.enableit.db.darrt.AbstractFileHandler
ABOUT
 
Constructor Summary
SchemaExporter()
          Default Constructor.
 
Method Summary
 org.w3c.dom.Document export(org.enableit.db.beans.Provider provider)
          Export the schema identified by the Provider parameter.
 org.w3c.dom.Document export(java.lang.String dataSourceName)
          Export the schema identified by the provided connection parameters.
 org.w3c.dom.Document export(java.lang.String driver, java.lang.String url, java.lang.String userid, java.lang.String password)
          Export the schema identified by the provided connection parameters.
 org.w3c.dom.Document exportToFile(org.enableit.db.beans.Provider provider, int outputMode)
          Export the schema identified by the Provider parameter to a file.
 java.lang.String getFileName(org.enableit.db.beans.Provider provider)
          Algorhythm is as follows: If set, use the filename provided. If set, use the name of the provider. Use data source name or URL within Provider to infer a name that should be unique in most cases.
static void main(java.lang.String[] args)
           
 void setFileName(java.lang.String fileName)
          The name of the file to write schema to if exportToFile invoked.
 void setSchemaName(java.lang.String targetSchema)
          The name of the schema to be exported.
 void setTableTypes(java.lang.String tableTypes)
          Set the table types to export.
 void setTableTypes(java.lang.String[] tableTypes)
          An array of table types to be exported.
 
Methods inherited from class org.enableit.db.darrt.AbstractSchemaHandler
addListener, addListeners, diffSchemas, getDatabase, getDebug, getListeners, getOnlineRefSchema, getOnlineTargetSchema, getRefDatabase, getRefSchemaName, getRefSchemaUrl, getTablePattern, getTargetDatabase, getTargetSchemaUrl, setDebug, setOnlineRefSchema, setOnlineTargetSchema, setRefDatabase, setRefSchemaName, setRefSchemaUrl, setTablePattern, setTargetDatabase, setTargetSchemaUrl
 
Methods inherited from class org.enableit.db.darrt.AbstractFileHandler
getOperDir, setOperDir
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COL_TYPE

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

NULLABLE

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

PK

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

FK

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

FK_TABLE

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

FK_DATA_COLUMN

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

FK_DATA_COL_NAME

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

FK_DISPLAY_COLUMN

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

FK_DISPLAY_COL_NAME

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

SchemaExporter

public SchemaExporter()
Default Constructor.

Method Detail

setFileName

public void setFileName(java.lang.String fileName)
The name of the file to write schema to if exportToFile invoked.

If not specified the file will be named according to the logical name contained in the Provider parameter.

Parameters:
fileName - to export to.

getFileName

public java.lang.String getFileName(org.enableit.db.beans.Provider provider)
Algorhythm is as follows:
  1. If set, use the filename provided.
  2. If set, use the name of the provider.
  3. Use data source name or URL within Provider to infer a name that should be unique in most cases.

Returns:
fileName To write to.

setSchemaName

public void setSchemaName(java.lang.String targetSchema)
The name of the schema to be exported.

If no schema is specified all will be exported.


setTableTypes

public void setTableTypes(java.lang.String tableTypes)
Set the table types to export.


setTableTypes

public void setTableTypes(java.lang.String[] tableTypes)
An array of table types to be exported.

Table types include such things as 'TABLE' and 'VIEW', though the exact list depends on the database vendor.

If no table types are specified all will be exported.


export

public org.w3c.dom.Document export(org.enableit.db.beans.Provider provider)
                            throws DBException
Export the schema identified by the Provider parameter.

Parameters:
provider - Encapsulation of the Data Source information.
DBException

export

public org.w3c.dom.Document export(java.lang.String driver,
                                   java.lang.String url,
                                   java.lang.String userid,
                                   java.lang.String password)
                            throws DBException
Export the schema identified by the provided connection parameters.

DBException

export

public org.w3c.dom.Document export(java.lang.String dataSourceName)
                            throws DBException
Export the schema identified by the provided connection parameters.

DBException

exportToFile

public org.w3c.dom.Document exportToFile(org.enableit.db.beans.Provider provider,
                                         int outputMode)
                                  throws DBException
Export the schema identified by the Provider parameter to a file.

To control where the file is written call setOperDir first.

Parameters:
provider - Encapsulation of the Data Source information.
outputMode - Controls the number of files output. Enumerated in SchemaConstants. One of OM_SINGLE_FILE, OM_SINGLE_FILE_AND_FILE_PER_TABLE, OM_FILE_PER_TABLE.
DBException

main

public static void main(java.lang.String[] args)
Parameters:
args - args[0] - tableName to turn into XML representation


Copyright © 1999-2004 enableIT.org. All Rights Reserved.