Java Doc for DBTool.java in  » J2EE » Expresso » com » jcorporate » expresso » core » utility » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Expresso » com.jcorporate.expresso.core.utility 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


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:
  1. Verify data in the database with respect to referential integrity
  2. Generate the code for a Database Object by reading the data in a database
  3. Export data in a database object to an external XML file
  4. 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  ListcompareTables(InstallLog theLog, Vector allSchemas, String dbName)
    
public static synchronized  voidcreateTables(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  voiddeleteSchema(Page myPage, String dbName, Vector schemas)
     Method wipes out more than one installed schema.
public static synchronized  voiddeleteSchema(Page myPage, String dbName, String schemaName)
     Method to remove an installed schema.
public static  voiddeleteTable(String dbName, String tableName)
    
public static  voidmain(String[] args)
    
public static synchronized  voidotherSetups(InstallLog theLog, Vector allSchemas, String dbName)
    
public static synchronized  voidpopulateTables(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  voidsetupConfig(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  voidsetupSecurity(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.


Constructor Detail
DBTool
public DBTool()(Code)
Constructor




Method Detail
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 page

Modify 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



Fields inherited from java.lang.Thread
final public static int MAX_PRIORITY(Code)(Java Doc)
final public static int MIN_PRIORITY(Code)(Java Doc)
final public static int NORM_PRIORITY(Code)(Java Doc)

Methods inherited from java.lang.Thread
public static int activeCount()(Code)(Java Doc)
final public void checkAccess()(Code)(Java Doc)
native public int countStackFrames()(Code)(Java Doc)
native public static Thread currentThread()(Code)(Java Doc)
public void destroy()(Code)(Java Doc)
public static void dumpStack()(Code)(Java Doc)
public static int enumerate(Thread tarray)(Code)(Java Doc)
public static Map<Thread, StackTraceElement[]> getAllStackTraces()(Code)(Java Doc)
public ClassLoader getContextClassLoader()(Code)(Java Doc)
public static UncaughtExceptionHandler getDefaultUncaughtExceptionHandler()(Code)(Java Doc)
public long getId()(Code)(Java Doc)
final public String getName()(Code)(Java Doc)
final public int getPriority()(Code)(Java Doc)
public StackTraceElement[] getStackTrace()(Code)(Java Doc)
public State getState()(Code)(Java Doc)
final public ThreadGroup getThreadGroup()(Code)(Java Doc)
public UncaughtExceptionHandler getUncaughtExceptionHandler()(Code)(Java Doc)
native public static boolean holdsLock(Object obj)(Code)(Java Doc)
public void interrupt()(Code)(Java Doc)
public static boolean interrupted()(Code)(Java Doc)
final native public boolean isAlive()(Code)(Java Doc)
final public boolean isDaemon()(Code)(Java Doc)
public boolean isInterrupted()(Code)(Java Doc)
final public synchronized void join(long millis) throws InterruptedException(Code)(Java Doc)
final public synchronized void join(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void join() throws InterruptedException(Code)(Java Doc)
final public void resume()(Code)(Java Doc)
public void run()(Code)(Java Doc)
public void setContextClassLoader(ClassLoader cl)(Code)(Java Doc)
final public void setDaemon(boolean on)(Code)(Java Doc)
public static void setDefaultUncaughtExceptionHandler(UncaughtExceptionHandler eh)(Code)(Java Doc)
final public void setName(String name)(Code)(Java Doc)
final public void setPriority(int newPriority)(Code)(Java Doc)
public void setUncaughtExceptionHandler(UncaughtExceptionHandler eh)(Code)(Java Doc)
native public static void sleep(long millis) throws InterruptedException(Code)(Java Doc)
public static void sleep(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
public synchronized void start()(Code)(Java Doc)
final public void stop()(Code)(Java Doc)
final public synchronized void stop(Throwable obj)(Code)(Java Doc)
final public void suspend()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
native public static void yield()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.