| java.lang.Object java.lang.Thread com.jcorporate.expresso.core.utility.DBTool
DBTool | public class DBTool extends Thread (Code) | | DBTool is a multi-purpose tool for working with database objects. It can:
- Verify data in the database with respect to referential integrity
- Generate the code for a Database Object by reading the data in a
database
- Export data in a database object to an external XML file
- Import data from an external XML file into a database object
Command Line Parameters
Required Command Line Arguments
configDir - <Directory that contains your config files>
webbAppDir -<The Expresso webapp directory>
db=<The database to create>
Optional Command Line Argumments
These arguments define the role to use as well as some arguments
are specific for a given task.
- setup - Setup the database schema
- pooltest - Stress Test the Connection Pool
- test - @todo document
- generate - Generate DBObjects given an active database with tables.
- gen_package generate dbobject with this package name.
- import - import DBObjects.
- export - export DBObjects.
file - The file to import or export to
format - Either tab or comma, or XML file format.
- passwords - @todo Document
- bench - Run some basic benchmarks.
- config - Run configuration utility.
- nameChange - Update packages to latest package format.
- uidChange -Convert your database to integer- keyed index for users .
author: Michael Nash author: author: Modify by Yves Henri AMAIZO |
Constructor Summary | |
public | DBTool() |
Method Summary | |
public static List | compareTables(InstallLog theLog, Vector allSchemas, String dbName) | public static synchronized void | createTables(InstallLog theLog, Vector allSchemas, String dataContext) Create the tables required by the database objects in the list
of schemas.
Each database object knows how to create the database table it
requires - this
method goes through the list
of registered schemas and calls the create method for all of the
database objects in the schema. | public static synchronized void | deleteSchema(Page myPage, String dbName, Vector schemas) Method wipes out more than one installed schema. | public static synchronized void | deleteSchema(Page myPage, String dbName, String schemaName) Method to remove an installed schema. | public static void | deleteTable(String dbName, String tableName) | public static void | main(String[] args) | public static synchronized void | otherSetups(InstallLog theLog, Vector allSchemas, String dbName) | public static synchronized void | populateTables(InstallLog installLog, Vector allSchemas, String dbName) This method goes through the schemas and populates tables with default values
if they do not exist. | public static synchronized void | setupConfig(InstallLog installLog, Vector allSchemas, String dbName) Method to set up the default Setup values for each schema.
Every schema object has a list of the Setup values and default
values for them that are required by the application that the
schema applies to. | public static synchronized void | setupSecurity(InstallLog theLog, Vector allSchemas, String dbName) This method creates default security entries for all of the
database objects and controller objects for the known schemas. |
DBTool | public DBTool()(Code) | | Constructor
|
compareTables | public static List compareTables(InstallLog theLog, Vector allSchemas, String dbName) throws DBException, ConfigurationException(Code) | | Reverse engineer the table for each db object for every known schema, then
compare the fields in the database to the fields in the db object and report
on the differences to the the log and to System.err
todo why isn't this log passed in used?
Parameters: theLog - the Install log to output to Parameters: allSchemas - a vector of all the schemas to compare Parameters: dbName - the data context to use list of string error messages |
createTables | public static synchronized void createTables(InstallLog theLog, Vector allSchemas, String dataContext) throws DBException(Code) | | Create the tables required by the database objects in the list
of schemas.
Each database object knows how to create the database table it
requires - this
method goes through the list
of registered schemas and calls the create method for all of the
database objects in the schema. If the table is already there,
nothing is done.
Parameters: theLog - The installLog object. Use ConsoleInstallLog if youdon't know what this does. Parameters: allSchemas - List of the schema objects Parameters: dataContext - The database context to create the database in. throws: DBException - If there is a problem creating the tables |
deleteSchema | public static synchronized void deleteSchema(Page myPage, String dbName, Vector schemas) throws DBException, HtmlException, IllegalArgumentException(Code) | | Method wipes out more than one installed schema.
Parameters: myPage - an HTML page to render output to (optional) Parameters: dbName - The database context to create the database in. Parameters: schemas - List of the schema objects to delete throws: HtmlException - if an error occurs constructing the HTML code |
deleteSchema | public static synchronized void deleteSchema(Page myPage, String dbName, String schemaName) throws DBException, HtmlException, IllegalArgumentException(Code) | | Method to remove an installed schema. Deletes all the tables associated
with the schema
Parameters: myPage - - The page to output the 'log' to. Parameters: dbName - - the name of the database to perform this operation Parameters: schemaName - - the full classname of the schema to delete. throws: IllegalArgumentException - if the schema doesn't exist. throws: DBException - If there is a database problem creatingthe new default values throws: HtmlException - If there is a problem building theconfirmation pageModify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/20 20:11:53 $ |
deleteTable | public static void deleteTable(String dbName, String tableName) throws DBException(Code) | | Delete Table - Deletes a table from the specified db
Parameters: dbName - - the name of the db that contains this table Parameters: tableName - - The name of the table to delete. |
main | public static void main(String[] args)(Code) | | Main method so that DBTool can be launched from a command line
Parameters: args - Command line arguments to supply the information toconnect to the database |
otherSetups | public static synchronized void otherSetups(InstallLog theLog, Vector allSchemas, String dbName) throws DBException(Code) | | Method to perform any other additonal setup required by each
schema
Parameters: theLog - InstallLog object to save the data to Parameters: allSchemas - List of the schema objects Parameters: dbName - The database context to create the database in. throws: DBException - If there is a database problem creatingthe new default values |
populateTables | public static synchronized void populateTables(InstallLog installLog, Vector allSchemas, String dbName) throws DBException(Code) | | This method goes through the schemas and populates tables with default values
if they do not exist. Works closely with
Parameters: installLog - The InstallLog to save the output traces to Parameters: allSchemas - List of the schema objects Parameters: dbName - The database context to create the database in. throws: DBException - If a problem occurrs putting the default recordsin the database |
setupConfig | public static synchronized void setupConfig(InstallLog installLog, Vector allSchemas, String dbName) throws DBException(Code) | | Method to set up the default Setup values for each schema.
Every schema object has a list of the Setup values and default
values for them that are required by the application that the
schema applies to. The default schema is done first, then
any other registered schema objects
Parameters: installLog - - The installation log to log output to Parameters: allSchemas - A list of all of the schema objects Parameters: dbName - The database context to setup the config in. throws: DBException - If there is a database problem creatingthe new default values |
setupSecurity | public static synchronized void setupSecurity(InstallLog theLog, Vector allSchemas, String dbName) throws DBException(Code) | | This method creates default security entries for all of the
database objects and controller objects for the known schemas.
This includes full access for a group and user called User.ADMIN_USER
Parameters: theLog - Installation Log Parameters: allSchemas - List of the schema objects Parameters: dbName - The database context to create the database in. throws: DBException - If a problem occurrs putting the security infoin the database |
|
|