Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enableit.db.darrt
Class SchemaExporter  view SchemaExporter download SchemaExporter.java

java.lang.Object
  extended byorg.enableit.db.darrt.AbstractSchemaHandler
      extended byorg.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
private  boolean approxIndexStats
           
private  java.lang.String catalog
           
static java.lang.String COL_NAME
           
static java.lang.String COL_TYPE
           
static java.lang.String COLUMN
           
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
           
private  java.text.SimpleDateFormat formatter
           
private static org.apache.log4j.Category logger
          Define a static Category instance for logging.
static java.lang.String NULLABLE
           
static java.lang.String PK
           
private  org.enableit.db.darrt.schema.ProviderExt provider
           
static java.lang.String SCHEMAS
           
private  java.lang.String[] tableTypes
           
private  java.lang.String targetDir
           
private  java.lang.String targetSchema
           
private  boolean uniqueIndexOnly
           
private  ViewExporter viewExporter
           
 
Fields inherited from class org.enableit.db.darrt.AbstractSchemaHandler
 
Constructor Summary
SchemaExporter()
          Default Constructor
 
Method Summary
private  void addTables(java.sql.DatabaseMetaData dmd, org.w3c.dom.Document doc, java.lang.String schemaName, org.w3c.dom.Element schemaTag, java.lang.String[] tableTypes)
          Extract table metadata adding appropriate tags.
private  org.w3c.dom.Document export(java.sql.Connection conn)
          Export the schema at the database already connected to.
 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.
private  java.lang.String getPackageDir(java.lang.String javaPackage)
          Returns the directory name classes should be stored in based on the Java package name received
static void main(java.lang.String[] args)
           
 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.
 void setTargetSchema(java.lang.String targetSchema)
          The name of the schema 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

catalog

private java.lang.String catalog

targetDir

private java.lang.String targetDir

targetSchema

private java.lang.String targetSchema

tableTypes

private java.lang.String[] tableTypes

uniqueIndexOnly

private boolean uniqueIndexOnly

approxIndexStats

private boolean approxIndexStats

provider

private org.enableit.db.darrt.schema.ProviderExt provider

viewExporter

private ViewExporter viewExporter

formatter

private java.text.SimpleDateFormat formatter

SCHEMAS

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

COLUMN

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

COL_NAME

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

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

logger

private static org.apache.log4j.Category logger
Define a static Category instance for logging.

Constructor Detail

SchemaExporter

public SchemaExporter()
Default Constructor

Method Detail

setTargetSchema

public void setTargetSchema(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(java.lang.String driver,
                                   java.lang.String url,
                                   java.lang.String userid,
                                   java.lang.String password)
                            throws org.enableit.db.DBException
Export the schema identified by the provided connection parameters.


export

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


export

private org.w3c.dom.Document export(java.sql.Connection conn)
                             throws org.enableit.db.DBException
Export the schema at the database already connected to.


addTables

private void addTables(java.sql.DatabaseMetaData dmd,
                       org.w3c.dom.Document doc,
                       java.lang.String schemaName,
                       org.w3c.dom.Element schemaTag,
                       java.lang.String[] tableTypes)
                throws SchemaHandlingException
Extract table metadata adding appropriate tags.


main

public static void main(java.lang.String[] args)

getPackageDir

private java.lang.String getPackageDir(java.lang.String javaPackage)
Returns the directory name classes should be stored in based on the Java package name received