|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.torque.task.TorqueJDBCTransformTask
public class TorqueJDBCTransformTask
This class generates an XML schema of an existing database from JDBC metadata.
Field Summary | |
---|---|
protected Hashtable |
columnTableMap
Hashtable to track what table a column belongs to. |
protected Element |
databaseNode
The document root element. |
protected String |
dbDriver
JDBC driver. |
protected String |
dbPassword
JDBC password. |
protected String |
dbSchema
DB schema to use. |
protected String |
dbUrl
JDBC URL. |
protected String |
dbUser
JDBC user name. |
protected org.apache.xerces.dom.DocumentImpl |
doc
DOM document produced. |
protected Hashtable |
primaryKeys
Hashtable of columns that have primary keys. |
protected boolean |
sameJavaName
|
protected String |
xmlSchema
Name of XML database schema produced. |
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
TorqueJDBCTransformTask()
|
Method Summary | |
---|---|
void |
execute()
Default constructor. |
void |
generateXML()
Generates an XML database schema from JDBC metadata. |
List |
getColumns(DatabaseMetaData dbMeta,
String tableName)
Retrieves all the column names and types for a given table from JDBC metadata. |
String |
getDbSchema()
|
Collection |
getForeignKeys(DatabaseMetaData dbMeta,
String tableName)
Retrieves a list of foreign key columns for a given table. |
List |
getPrimaryKeys(DatabaseMetaData dbMeta,
String tableName)
Retrieves a list of the columns composing the primary key for a given table. |
List |
getTableNames(DatabaseMetaData dbMeta)
Get all the table names in the current database that are not system tables. |
boolean |
isSameJavaName()
|
void |
setDbDriver(String v)
|
void |
setDbPassword(String v)
|
void |
setDbSchema(String dbSchema)
|
void |
setDbUrl(String v)
|
void |
setDbUser(String v)
|
void |
setOutputFile(String v)
|
void |
setSameJavaName(boolean v)
|
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String xmlSchema
protected String dbUrl
protected String dbDriver
protected String dbUser
protected String dbPassword
protected String dbSchema
protected org.apache.xerces.dom.DocumentImpl doc
protected Element databaseNode
protected Hashtable primaryKeys
protected Hashtable columnTableMap
protected boolean sameJavaName
Constructor Detail |
---|
public TorqueJDBCTransformTask()
Method Detail |
---|
public String getDbSchema()
public void setDbSchema(String dbSchema)
public void setDbUrl(String v)
public void setDbDriver(String v)
public void setDbUser(String v)
public void setDbPassword(String v)
public void setOutputFile(String v)
public void setSameJavaName(boolean v)
public boolean isSameJavaName()
public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
public void generateXML() throws Exception
Exception
- a generic exception.public List getTableNames(DatabaseMetaData dbMeta) throws SQLException
dbMeta
- JDBC database metadata.
SQLException
public List getColumns(DatabaseMetaData dbMeta, String tableName) throws SQLException
dbMeta
- JDBC metadata.tableName
- Table from which to retrieve column information.
tableName
.
SQLException
public List getPrimaryKeys(DatabaseMetaData dbMeta, String tableName) throws SQLException
dbMeta
- JDBC metadata.tableName
- Table from which to retrieve PK information.
tableName
.
SQLException
public Collection getForeignKeys(DatabaseMetaData dbMeta, String tableName) throws SQLException
dbMeta
- JDBC metadata.tableName
- Table from which to retrieve FK information.
tableName
.
SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |