Java Doc for SyncSchema.java in  » J2EE » Jaffa » org » jaffa » tools » database » 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 » Jaffa » org.jaffa.tools.database 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jaffa.tools.database.SyncSchema

SyncSchema
public class SyncSchema (Code)
This tool calculates the difference between two database schemas

This is an example of how it can be used


 try {
 SyncSchema s = new SyncSchema();
 s.setSourceDriverString("oracle.jdbc.driver.OracleDriver");
 s.setSourceConnection("jdbc:oracle:thin:@xxx.com:1521:source");
 s.setSourceUser("source");
 s.setSourcePassword("test");
 s.setSourceSchema("MySchema");
 s.setTargetDriverString("oracle.jdbc.driver.OracleDriver");
 s.setTargetConnection("jdbc:oracle:thin:@xxx.com:1521:target");
 s.setTargetUser("target");
 s.setTargetPassword("test");
 s.setTargetSchema("MySchema");
 s.setTableFilter("A%");
 s.process();
 Collection l = s.getTables();
 for(Iterator i = l.iterator(); i.hasNext(); ) {
 SyncSchema.Table t = (SyncSchema.Table) i.next();
 System.out.println("Schema:" + t.getSchema() + ", Table:" + t.getName() + " (" + t.getType() + ") [" + SyncSchema.getSyncName(t.getSyncStatus()) + "]");
 if(t.getFields() != null && t.getSyncStatus() == SyncSchema.TABLE_CHANGED ) {
 for(Iterator i2 = t.getFields().values().iterator(); i2.hasNext(); ) {
 SyncSchema.Field f = (SyncSchema.Field) i2.next();
 if(f.getSyncStatus() != SyncSchema.FIELD_SAME)
 System.out.println("    " + f.getSeq() + "." + f.getName() + " [" + SyncSchema.getSyncName(f.getSyncStatus()) + "] - " + f.getChanges() );
 }
 }
 }
 } catch (Exception e) {
 e.printStackTrace();
 }
 

author:
   paule
version:
   1.0

Inner Class :public class Table
Inner Class :public class Field

Field Summary
final public static  intFIELD_ADDDED
    
final public static  intFIELD_CHANGED
    
final public static  intFIELD_CHANGED_SIZE
    
final public static  intFIELD_CHANGED_TYPE
     Used on Field.getSyncStatus() to indicate this field has had its data type changed.
final public static  intFIELD_MOVED
     Used on Field.getSyncStatus() to indicate this field has been moved (i.e.
final public static  intFIELD_REMOVED
    
final public static  intFIELD_SAME
    
final public static  intTABLE_ADDED
    
final public static  intTABLE_CHANGED
    
final public static  intTABLE_REMOVED
    
final public static  intTABLE_SAME
    
 TreeMaptables
    

Constructor Summary
public  SyncSchema()
    

Method Summary
public  StringgetSourceConnection()
     Getter for property sourceConnection.
public  StringgetSourceDriverString()
     Getter for property sourceDriverString.
public  StringgetSourcePassword()
     Getter for property sourcePassword.
public  StringgetSourceSchema()
     Getter for property sourceSchema.
public  StringgetSourceUser()
     Getter for property sourceUser.
public static  StringgetSyncName(int sync)
    
public  StringgetTableFilter()
     Getter for property tableFilter.
public  CollectiongetTables()
    
public  StringgetTargetConnection()
     Getter for property targetConnection.
public  StringgetTargetDriverString()
     Getter for property targetDriverString.
public  StringgetTargetPassword()
     Getter for property targetPassword.
public  StringgetTargetSchema()
     Getter for property targetSchema.
public  StringgetTargetUser()
     Getter for property targetUser.
public  voidprocess()
     Run the main compare process.
public  voidsetSourceConnection(String sourceConnection)
     Setter for property sourceConnection.
public  voidsetSourceDriverString(String sourceDriverString)
     Setter for property sourceDriverString.
public  voidsetSourcePassword(String sourcePassword)
     Setter for property sourcePassword.
public  voidsetSourceSchema(String sourceSchema)
     Setter for property sourceSchema.
public  voidsetSourceUser(String sourceUser)
     Setter for property sourceUser.
public  voidsetTableFilter(String tableFilter)
     Setter for property tableFilter.
public  voidsetTargetConnection(String targetConnection)
     Setter for property targetConnection.
public  voidsetTargetDriverString(String targetDriverString)
     Setter for property targetDriverString.
public  voidsetTargetPassword(String targetPassword)
     Setter for property targetPassword.
public  voidsetTargetSchema(String targetSchema)
     Setter for property targetSchema.
public  voidsetTargetUser(String targetUser)
     Setter for property targetUser.

Field Detail
FIELD_ADDDED
final public static int FIELD_ADDDED(Code)
Used on Field.getSyncStatus() to indicate this field has been added



FIELD_CHANGED
final public static int FIELD_CHANGED(Code)
Used on Field.getSyncStatus() to indicate this field has been changed some how



FIELD_CHANGED_SIZE
final public static int FIELD_CHANGED_SIZE(Code)
Used on Field.getSyncStatus() to indicate this field has been changed in size, it may also have had other properties changed



FIELD_CHANGED_TYPE
final public static int FIELD_CHANGED_TYPE(Code)
Used on Field.getSyncStatus() to indicate this field has had its data type changed. It may also have had other properties changed, including size



FIELD_MOVED
final public static int FIELD_MOVED(Code)
Used on Field.getSyncStatus() to indicate this field has been moved (i.e. its position in the table has moved due to additions or deletions before it)



FIELD_REMOVED
final public static int FIELD_REMOVED(Code)
Used on Field.getSyncStatus() to indicate this field has been removed



FIELD_SAME
final public static int FIELD_SAME(Code)
Used on Field.getSyncStatus() to indicate this field has not been changed



TABLE_ADDED
final public static int TABLE_ADDED(Code)
Used on Table.getSyncStatus() to indicate this table has been added



TABLE_CHANGED
final public static int TABLE_CHANGED(Code)
Used on Table.getSyncStatus() to indicate this table has been changed



TABLE_REMOVED
final public static int TABLE_REMOVED(Code)
Used on Table.getSyncStatus() to indicate this table has been removed



TABLE_SAME
final public static int TABLE_SAME(Code)
Used on Table.getSyncStatus() to indicate this table has not been changed



tables
TreeMap tables(Code)




Constructor Detail
SyncSchema
public SyncSchema()(Code)
Creates a new instance of SyncSchema




Method Detail
getSourceConnection
public String getSourceConnection()(Code)
Getter for property sourceConnection. Value of property sourceConnection.



getSourceDriverString
public String getSourceDriverString()(Code)
Getter for property sourceDriverString. Value of property sourceDriverString.



getSourcePassword
public String getSourcePassword()(Code)
Getter for property sourcePassword. Value of property sourcePassword.



getSourceSchema
public String getSourceSchema()(Code)
Getter for property sourceSchema. Value of property sourceSchema.



getSourceUser
public String getSourceUser()(Code)
Getter for property sourceUser. Value of property sourceUser.



getSyncName
public static String getSyncName(int sync)(Code)
Get the description for a given SyncState value
Parameters:
  sync - sync code to get description for description of code



getTableFilter
public String getTableFilter()(Code)
Getter for property tableFilter. Value of property tableFilter.



getTables
public Collection getTables()(Code)
Get the list of processed tables A collection of tables, this is in a list sorted by table name



getTargetConnection
public String getTargetConnection()(Code)
Getter for property targetConnection. Value of property targetConnection.



getTargetDriverString
public String getTargetDriverString()(Code)
Getter for property targetDriverString. Value of property targetDriveCrlass.



getTargetPassword
public String getTargetPassword()(Code)
Getter for property targetPassword. Value of property targetPassword.



getTargetSchema
public String getTargetSchema()(Code)
Getter for property targetSchema. Value of property targetSchema.



getTargetUser
public String getTargetUser()(Code)
Getter for property targetUser. Value of property targetUser.



process
public void process() throws Exception(Code)
Run the main compare process. Make sure you have called all the correct setters to configure the process. After this you can use getTables() to see the output
throws:
  Exception - General Exception thrown if there is a processing error. Typically theunderlying exception is an SQLException.



setSourceConnection
public void setSourceConnection(String sourceConnection)(Code)
Setter for property sourceConnection.
Parameters:
  sourceConnection - New value of property sourceConnection.



setSourceDriverString
public void setSourceDriverString(String sourceDriverString)(Code)
Setter for property sourceDriverString.
Parameters:
  sourceDriverString - New value of property sourceDriverString.



setSourcePassword
public void setSourcePassword(String sourcePassword)(Code)
Setter for property sourcePassword.
Parameters:
  sourcePassword - New value of property sourcePassword.



setSourceSchema
public void setSourceSchema(String sourceSchema)(Code)
Setter for property sourceSchema.
Parameters:
  sourceSchema - New value of property sourceSchema.



setSourceUser
public void setSourceUser(String sourceUser)(Code)
Setter for property sourceUser.
Parameters:
  sourceUser - New value of property sourceUser.



setTableFilter
public void setTableFilter(String tableFilter)(Code)
Setter for property tableFilter.
Parameters:
  tableFilter - New value of property tableFilter.



setTargetConnection
public void setTargetConnection(String targetConnection)(Code)
Setter for property targetConnection.
Parameters:
  targetConnection - New value of property targetConnection.



setTargetDriverString
public void setTargetDriverString(String targetDriverString)(Code)
Setter for property targetDriverString.
Parameters:
  targetDriverString - New value of property targetDriverString.



setTargetPassword
public void setTargetPassword(String targetPassword)(Code)
Setter for property targetPassword.
Parameters:
  targetPassword - New value of property targetPassword.



setTargetSchema
public void setTargetSchema(String targetSchema)(Code)
Setter for property targetSchema.
Parameters:
  targetSchema - New value of property targetSchema.



setTargetUser
public void setTargetUser(String targetUser)(Code)
Setter for property targetUser.
Parameters:
  targetUser - New value of property targetUser.



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.