| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jaffa.tools.database.SyncSchema
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();
  }
 
| Nested Class Summary | |
|  class | SyncSchema.FieldJava bean to store Field information for | 
|  class | SyncSchema.TableJava bean to store Table information | 
| Field Summary | |
| static int | FIELD_ADDDEDUsed on Field.getSyncStatus() to indicate this field has been added | 
| static int | FIELD_CHANGEDUsed on Field.getSyncStatus() to indicate this field has been changed some how | 
| static int | FIELD_CHANGED_SIZEUsed on Field.getSyncStatus() to indicate this field has been changed in size, it may also have had other properties changed | 
| static int | FIELD_CHANGED_TYPEUsed on Field.getSyncStatus() to indicate this field has had its data type changed. | 
| static int | FIELD_MOVEDUsed 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) | 
| static int | FIELD_REMOVEDUsed on Field.getSyncStatus() to indicate this field has been removed | 
| static int | FIELD_SAMEUsed on Field.getSyncStatus() to indicate this field has not been changed | 
| static int | TABLE_ADDEDUsed on Table.getSyncStatus() to indicate this table has been added | 
| static int | TABLE_CHANGEDUsed on Table.getSyncStatus() to indicate this table has been changed | 
| static int | TABLE_REMOVEDUsed on Table.getSyncStatus() to indicate this table has been removed | 
| static int | TABLE_SAMEUsed on Table.getSyncStatus() to indicate this table has not been changed | 
| Constructor Summary | |
| SyncSchema()Creates a new instance of SyncSchema | |
| Method Summary | |
|  String | getSourceConnection()Getter for property sourceConnection. | 
|  String | getSourceDriverString()Getter for property sourceDriverString. | 
|  String | getSourcePassword()Getter for property sourcePassword. | 
|  String | getSourceSchema()Getter for property sourceSchema. | 
|  String | getSourceUser()Getter for property sourceUser. | 
| static String | getSyncName(int sync)Get the description for a given SyncState value | 
|  String | getTableFilter()Getter for property tableFilter. | 
|  Collection | getTables()Get the list of processed tables | 
|  String | getTargetConnection()Getter for property targetConnection. | 
|  String | getTargetDriverString()Getter for property targetDriverString. | 
|  String | getTargetPassword()Getter for property targetPassword. | 
|  String | getTargetSchema()Getter for property targetSchema. | 
|  String | getTargetUser()Getter for property targetUser. | 
|  void | process()Run the main compare process. | 
|  void | setSourceConnection(String sourceConnection)Setter for property sourceConnection. | 
|  void | setSourceDriverString(String sourceDriverString)Setter for property sourceDriverString. | 
|  void | setSourcePassword(String sourcePassword)Setter for property sourcePassword. | 
|  void | setSourceSchema(String sourceSchema)Setter for property sourceSchema. | 
|  void | setSourceUser(String sourceUser)Setter for property sourceUser. | 
|  void | setTableFilter(String tableFilter)Setter for property tableFilter. | 
|  void | setTargetConnection(String targetConnection)Setter for property targetConnection. | 
|  void | setTargetDriverString(String targetDriverString)Setter for property targetDriverString. | 
|  void | setTargetPassword(String targetPassword)Setter for property targetPassword. | 
|  void | setTargetSchema(String targetSchema)Setter for property targetSchema. | 
|  void | setTargetUser(String targetUser)Setter for property targetUser. | 
| Methods inherited from class java.lang.Object | 
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
public static final int TABLE_ADDED
public static final int TABLE_REMOVED
public static final int TABLE_SAME
public static final int TABLE_CHANGED
public static final int FIELD_REMOVED
public static final int FIELD_ADDDED
public static final int FIELD_MOVED
public static final int FIELD_CHANGED
public static final int FIELD_CHANGED_SIZE
public static final int FIELD_CHANGED_TYPE
public static final int FIELD_SAME
| Constructor Detail | 
public SyncSchema()
| Method Detail | 
public void process()
             throws Exception
Exception - General Exception thrown if there is a processing error. Typically the
 underlying exception is an SQLException.public Collection getTables()
public String getSourceDriverString()
public void setSourceDriverString(String sourceDriverString)
sourceDriverString - New value of property sourceDriverString.public String getTargetDriverString()
public void setTargetDriverString(String targetDriverString)
targetDriverString - New value of property targetDriverString.public String getSourceConnection()
public void setSourceConnection(String sourceConnection)
sourceConnection - New value of property sourceConnection.public String getTargetConnection()
public void setTargetConnection(String targetConnection)
targetConnection - New value of property targetConnection.public String getSourceUser()
public void setSourceUser(String sourceUser)
sourceUser - New value of property sourceUser.public String getTargetUser()
public void setTargetUser(String targetUser)
targetUser - New value of property targetUser.public String getSourcePassword()
public void setSourcePassword(String sourcePassword)
sourcePassword - New value of property sourcePassword.public String getTargetPassword()
public void setTargetPassword(String targetPassword)
targetPassword - New value of property targetPassword.public static String getSyncName(int sync)
sync - sync code to get description for
public String getTableFilter()
public void setTableFilter(String tableFilter)
tableFilter - New value of property tableFilter.public String getSourceSchema()
public void setSourceSchema(String sourceSchema)
sourceSchema - New value of property sourceSchema.public String getTargetSchema()
public void setTargetSchema(String targetSchema)
targetSchema - New value of property targetSchema.| 
 | |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||