Source Code Cross Referenced 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 Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * ====================================================================
0003:         * JAFFA - Java Application Framework For All
0004:         *
0005:         * Copyright (C) 2002 JAFFA Development Group
0006:         *
0007:         *     This library is free software; you can redistribute it and/or
0008:         *     modify it under the terms of the GNU Lesser General Public
0009:         *     License as published by the Free Software Foundation; either
0010:         *     version 2.1 of the License, or (at your option) any later version.
0011:         *
0012:         *     This library is distributed in the hope that it will be useful,
0013:         *     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014:         *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015:         *     Lesser General Public License for more details.
0016:         *
0017:         *     You should have received a copy of the GNU Lesser General Public
0018:         *     License along with this library; if not, write to the Free Software
0019:         *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0020:         *
0021:         * Redistribution and use of this software and associated documentation ("Software"),
0022:         * with or without modification, are permitted provided that the following conditions are met:
0023:         * 1.	Redistributions of source code must retain copyright statements and notices.
0024:         *         Redistributions must also contain a copy of this document.
0025:         * 2.	Redistributions in binary form must reproduce the above copyright notice,
0026:         * 	this list of conditions and the following disclaimer in the documentation
0027:         * 	and/or other materials provided with the distribution.
0028:         * 3.	The name "JAFFA" must not be used to endorse or promote products derived from
0029:         * 	this Software without prior written permission. For written permission,
0030:         * 	please contact mail to: jaffagroup@yahoo.com.
0031:         * 4.	Products derived from this Software may not be called "JAFFA" nor may "JAFFA"
0032:         * 	appear in their names without prior written permission.
0033:         * 5.	Due credit should be given to the JAFFA Project (http://jaffa.sourceforge.net).
0034:         *
0035:         * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
0036:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0037:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
0038:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
0039:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0040:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0041:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
0042:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0043:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
0044:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
0045:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0046:         * SUCH DAMAGE.
0047:         * ====================================================================
0048:         */
0049:        /*
0050:         * SyncSchema.java
0051:         *
0052:         * Created on January 6, 2004, 11:17 AM
0053:         */
0054:
0055:        package org.jaffa.tools.database;
0056:
0057:        import java.sql.Connection;
0058:        import java.sql.DatabaseMetaData;
0059:        import java.sql.DriverManager;
0060:        import java.sql.ResultSet;
0061:        import java.sql.SQLException;
0062:        import java.util.Collection;
0063:        import java.util.LinkedHashMap;
0064:        import java.util.Map;
0065:        import java.util.TreeMap;
0066:
0067:        /** This tool calculates the difference between two database schemas
0068:         * <p> 
0069:         * This is an example of how it can be used
0070:         * <p><pre><code>
0071:         *  try {
0072:         *      SyncSchema s = new SyncSchema();
0073:         *  
0074:         *      s.setSourceDriverString("oracle.jdbc.driver.OracleDriver");
0075:         *      s.setSourceConnection("jdbc:oracle:thin:@xxx.com:1521:source");
0076:         *      s.setSourceUser("source");
0077:         *      s.setSourcePassword("test");
0078:         *      s.setSourceSchema("MySchema");
0079:         *  
0080:         *      s.setTargetDriverString("oracle.jdbc.driver.OracleDriver");
0081:         *      s.setTargetConnection("jdbc:oracle:thin:@xxx.com:1521:target");
0082:         *      s.setTargetUser("target");
0083:         *      s.setTargetPassword("test");
0084:         *      s.setTargetSchema("MySchema");
0085:         *  
0086:         *      s.setTableFilter("A%");
0087:         *  
0088:         *      s.process();
0089:         *      Collection l = s.getTables();
0090:         *      for(Iterator i = l.iterator(); i.hasNext(); ) {
0091:         *          SyncSchema.Table t = (SyncSchema.Table) i.next();
0092:         *          System.out.println("Schema:" + t.getSchema() + ", Table:" + t.getName() + " (" + t.getType() + ") [" + SyncSchema.getSyncName(t.getSyncStatus()) + "]");
0093:         *          if(t.getFields() != null && t.getSyncStatus() == SyncSchema.TABLE_CHANGED ) {
0094:         *              for(Iterator i2 = t.getFields().values().iterator(); i2.hasNext(); ) {
0095:         *                  SyncSchema.Field f = (SyncSchema.Field) i2.next();
0096:         *                  if(f.getSyncStatus() != SyncSchema.FIELD_SAME)
0097:         *                  System.out.println("    " + f.getSeq() + "." + f.getName() + " [" + SyncSchema.getSyncName(f.getSyncStatus()) + "] - " + f.getChanges() );
0098:         *              }
0099:         *          }
0100:         *      }
0101:         *  } catch (Exception e) {
0102:         *      e.printStackTrace();
0103:         *  }
0104:         * </pre></code>
0105:         *
0106:         * @author  paule
0107:         * @version 1.0
0108:         */
0109:        public class SyncSchema {
0110:
0111:            /** Used on Table.getSyncStatus() to indicate this table has been added */
0112:            public static final int TABLE_ADDED = 0;
0113:            /** Used on Table.getSyncStatus() to indicate this table has been removed */
0114:            public static final int TABLE_REMOVED = 1;
0115:            /** Used on Table.getSyncStatus() to indicate this table has not been changed */
0116:            public static final int TABLE_SAME = 2;
0117:            /** Used on Table.getSyncStatus() to indicate this table has been changed */
0118:            public static final int TABLE_CHANGED = 3;
0119:            /** Used on Field.getSyncStatus() to indicate this field has been removed */
0120:            public static final int FIELD_REMOVED = 4;
0121:            /** Used on Field.getSyncStatus() to indicate this field has been added */
0122:            public static final int FIELD_ADDDED = 5;
0123:            /** Used on Field.getSyncStatus() to indicate this field has been moved
0124:             * (i.e. its position in the table has moved due to additions or deletions before it)
0125:             */
0126:            public static final int FIELD_MOVED = 6;
0127:            /** Used on Field.getSyncStatus() to indicate this field has been changed some how */
0128:            public static final int FIELD_CHANGED = 7;
0129:            /** Used on Field.getSyncStatus() to indicate this field has been changed in size,
0130:             * it may also have had other properties changed
0131:             */
0132:            public static final int FIELD_CHANGED_SIZE = 8;
0133:            /** Used on Field.getSyncStatus() to indicate this field has had its data type
0134:             * changed. It may also have had other properties changed, including size
0135:             */
0136:            public static final int FIELD_CHANGED_TYPE = 9;
0137:            /** Used on Field.getSyncStatus() to indicate this field has not been changed */
0138:            public static final int FIELD_SAME = 10;
0139:            /** List of descriptions for the SyncState values */
0140:            private static final String[] SYNC_TYPES = new String[] {
0141:                    "Table Added", "Table Removed", "Table Same",
0142:                    "Table Changed", "Field Removed", "Field Addded",
0143:                    "Field Moved", "Field Changed", "Field Changed Size",
0144:                    "Field Changed Type", "Field Same" };
0145:
0146:            TreeMap tables = null;
0147:
0148:            /** Holds value of property sourceDriverString. */
0149:            private String sourceDriverString;
0150:
0151:            /** Holds value of property targetDriveString. */
0152:            private String targetDriverString;
0153:
0154:            /** Holds value of property sourceConnection. */
0155:            private String sourceConnection;
0156:
0157:            /** Holds value of property targetConnection. */
0158:            private String targetConnection;
0159:
0160:            /** Holds value of property sourceUser. */
0161:            private String sourceUser;
0162:
0163:            /** Holds value of property targetUser. */
0164:            private String targetUser;
0165:
0166:            /** Holds value of property sourcePassword. */
0167:            private String sourcePassword;
0168:
0169:            /** Holds value of property targetPassword. */
0170:            private String targetPassword;
0171:
0172:            /** Holds value of property tableFilter. */
0173:            private String tableFilter;
0174:
0175:            /** Holds value of property sourceSchema. */
0176:            private String sourceSchema;
0177:
0178:            /** Holds value of property targetSchema. */
0179:            private String targetSchema;
0180:
0181:            /** Creates a new instance of SyncSchema */
0182:            public SyncSchema() {
0183:            }
0184:
0185:            /** Run the main compare process. Make sure you have called all the correct setters
0186:             * to configure the process. After this you can use getTables() to see
0187:             * the output
0188:             * @throws Exception General Exception thrown if there is a processing error. Typically the
0189:             * underlying exception is an SQLException.
0190:             */
0191:            public void process() throws Exception {
0192:
0193:                //------------------------------------
0194:                // Load Drivers
0195:                try {
0196:                    Class.forName(sourceDriverString);
0197:                } catch (ClassNotFoundException e) {
0198:                    System.out.println("Source Driver Class Not Found : "
0199:                            + sourceDriverString);
0200:                    throw e;
0201:                }
0202:                if (!sourceDriverString.equals(targetDriverString))
0203:                    try {
0204:                        Class.forName(targetDriverString);
0205:                    } catch (ClassNotFoundException e) {
0206:                        System.out.println("Target Driver Class Not Found : "
0207:                                + targetDriverString);
0208:                        throw e;
0209:                    }
0210:
0211:                //------------------------------------
0212:                // Open Connections
0213:                Connection sConn = null;
0214:                Connection tConn = null;
0215:                try {
0216:                    sConn = DriverManager.getConnection(this .sourceConnection,
0217:                            this .sourceUser, this .sourcePassword);
0218:                } catch (SQLException e) {
0219:                    System.out.println("Can't Connect to Source : "
0220:                            + e.getLocalizedMessage());
0221:                    throw e;
0222:                }
0223:                try {
0224:                    tConn = DriverManager.getConnection(this .targetConnection,
0225:                            this .targetUser, this .targetPassword);
0226:                } catch (SQLException e) {
0227:                    System.out.println("Can't Connect to Target : "
0228:                            + e.getLocalizedMessage());
0229:                    throw e;
0230:                }
0231:
0232:                // Create a list of tables based on the target
0233:                tables = new TreeMap();
0234:
0235:                DatabaseMetaData tMeta = tConn.getMetaData();
0236:                ResultSet rs = tMeta.getTables(null, targetSchema, tableFilter,
0237:                        new String[] { "TABLE" });
0238:                while (rs.next()) {
0239:                    Table table = new Table();
0240:                    table.setName(rs.getString("TABLE_NAME"));
0241:                    tables.put(table.getName(), table);
0242:                    System.out.println(rs.getRow() + ". Process Target Table: "
0243:                            + table.getName());
0244:
0245:                    // Store other details
0246:                    table.setSyncStatus(TABLE_REMOVED);
0247:                    populateTable(table, rs);
0248:
0249:                    // Read Target Fields
0250:                    ResultSet rsc = tMeta.getColumns(table.getCatalog(), table
0251:                            .getSchema(), table.getName(), null);
0252:                    while (rsc.next()) {
0253:                        Field field = new Field();
0254:                        field.setName(rsc.getString("COLUMN_NAME"));
0255:                        table.getFields().put(field.getName(), field);
0256:                        //System.out.println("   " + rsc.getRow() + ". Process Target Field: " + table.getName() + "." + field.getName());
0257:
0258:                        // Store other details
0259:                        field.setSyncStatus(FIELD_REMOVED); // Assume removed until verified it is in the source
0260:                        populateField(field, rsc);
0261:                    }
0262:                    rsc.close();
0263:                }
0264:                rs.close();
0265:                tConn.close();
0266:
0267:                // Look at the Source and compare...
0268:                DatabaseMetaData sMeta = sConn.getMetaData();
0269:                rs = sMeta.getTables(null, sourceSchema, tableFilter,
0270:                        new String[] { "TABLE" });
0271:                while (rs.next()) {
0272:                    String name = rs.getString("TABLE_NAME");
0273:                    System.out.println(rs.getRow() + ". Process Source Table: "
0274:                            + name);
0275:                    //Lookup table
0276:                    Table table = (Table) tables.get(name);
0277:                    if (table == null) {
0278:                        // This is a new table
0279:                        table = new Table();
0280:                        table.setName(rs.getString("TABLE_NAME"));
0281:                        tables.put(table.getName(), table);
0282:                        // Store other details
0283:                        table.setSyncStatus(TABLE_ADDED);
0284:                        populateTable(table, rs);
0285:
0286:                        // Add in source Fields
0287:                        ResultSet rsc = sMeta.getColumns(table.getCatalog(),
0288:                                table.getSchema(), table.getName(), null);
0289:                        while (rsc.next()) {
0290:                            Field field = new Field();
0291:                            field.setName(rsc.getString("COLUMN_NAME"));
0292:                            table.getFields().put(field.getName(), field);
0293:                            //System.out.println("   " + rsc.getRow() + ". Process Source Field: " + table.getName() + "." + field.getName());
0294:                            // Store other details
0295:                            field.setSyncStatus(FIELD_ADDDED);
0296:                            populateField(field, rsc);
0297:                        }
0298:                        rsc.close();
0299:                    } else {
0300:                        table.setSyncStatus(TABLE_SAME);
0301:                        // Now we need to compare fields
0302:                        ResultSet rsc = sMeta.getColumns(rs
0303:                                .getString("TABLE_CAT"), rs
0304:                                .getString("TABLE_SCHEM"), table.getName(),
0305:                                null);
0306:                        while (rsc.next()) {
0307:                            String fname = rsc.getString("COLUMN_NAME");
0308:                            //System.out.println("   " + rsc.getRow() + ". Process Source Field: " + table.getName() + "." + fname);
0309:                            Field field = (Field) table.getFields().get(fname);
0310:                            if (field == null) {
0311:                                // This is a new field, add it!!!
0312:                                field = new Field();
0313:                                field.setName(fname);
0314:                                table.getFields().put(field.getName(), field);
0315:                                field.setSyncStatus(FIELD_ADDDED);
0316:                                populateField(field, rsc);
0317:                                table.setSyncStatus(TABLE_CHANGED);
0318:                            } else {
0319:
0320:                                // This fields exists, compare it..
0321:                                Field sfield = new Field();
0322:                                populateField(sfield, rsc);
0323:                                StringBuffer changes = new StringBuffer();
0324:
0325:                                // Field Moved
0326:                                if (field.getSeq() != sfield.getSeq()) {
0327:                                    changes.append(",Seq [");
0328:                                    changes.append(field.getSeq());
0329:                                    changes.append("->");
0330:                                    changes.append(sfield.getSeq());
0331:                                    changes.append("]");
0332:                                    field.setSyncStatus(FIELD_MOVED);
0333:                                }
0334:
0335:                                // Field - General Changes
0336:                                if ((field.getDefaultValue() == null && sfield
0337:                                        .getDefaultValue() != null)
0338:                                        || (field.getDefaultValue() != null && !field
0339:                                                .getDefaultValue()
0340:                                                .equals(
0341:                                                        sfield
0342:                                                                .getDefaultValue()))) {
0343:                                    changes.append(",DefaultValue [");
0344:                                    changes.append(field.getDefaultValue());
0345:                                    changes.append("->");
0346:                                    changes.append(sfield.getDefaultValue());
0347:                                    changes.append("]");
0348:                                }
0349:                                if ((field.getRemarks() == null && sfield
0350:                                        .getRemarks() != null)
0351:                                        || (field.getRemarks() != null && !field
0352:                                                .getRemarks().equals(
0353:                                                        sfield.getRemarks()))) {
0354:                                    changes.append(",Remarks [");
0355:                                    changes.append(field.getRemarks());
0356:                                    changes.append("->");
0357:                                    changes.append(sfield.getRemarks());
0358:                                    changes.append("]");
0359:                                }
0360:
0361:                                // Field - Size Changes
0362:                                if (field.getFracSize() != sfield.getFracSize()) {
0363:                                    changes.append(",FracSize [");
0364:                                    changes.append(field.getFracSize());
0365:                                    changes.append("->");
0366:                                    changes.append(sfield.getFracSize());
0367:                                    changes.append("]");
0368:                                    field.setSyncStatus(FIELD_CHANGED_SIZE);
0369:                                }
0370:
0371:                                if (field.getColSize() != sfield.getColSize()) {
0372:                                    changes.append(",ColSize [");
0373:                                    changes.append(field.getColSize());
0374:                                    changes.append("->");
0375:                                    changes.append(sfield.getColSize());
0376:                                    changes.append("]");
0377:                                    field.setSyncStatus(FIELD_CHANGED_SIZE);
0378:                                }
0379:                                if (field.getMaxLength() != sfield
0380:                                        .getMaxLength()) {
0381:                                    changes.append(",MaxLength [");
0382:                                    changes.append(field.getMaxLength());
0383:                                    changes.append("->");
0384:                                    changes.append(sfield.getMaxLength());
0385:                                    changes.append("]");
0386:                                    field.setSyncStatus(FIELD_CHANGED_SIZE);
0387:                                }
0388:
0389:                                // Field - DataType Changes
0390:                                if (field.getDataType() != sfield.getDataType()) {
0391:                                    changes.append(",DataType [");
0392:                                    changes.append(field.getDataType());
0393:                                    changes.append("->");
0394:                                    changes.append(sfield.getDataType());
0395:                                    changes.append("]");
0396:                                    field.setSyncStatus(FIELD_CHANGED_TYPE);
0397:                                }
0398:                                if ((field.getDataTypeName() == null && sfield
0399:                                        .getDataTypeName() != null)
0400:                                        || (field.getDataTypeName() != null && !field
0401:                                                .getDataTypeName()
0402:                                                .equals(
0403:                                                        sfield
0404:                                                                .getDataTypeName()))) {
0405:                                    changes.append(",DataTypeName [");
0406:                                    changes.append(field.getDataTypeName());
0407:                                    changes.append("->");
0408:                                    changes.append(sfield.getDataTypeName());
0409:                                    changes.append("]");
0410:                                }
0411:
0412:                                if (changes.length() < 1) {
0413:                                    // The same
0414:                                    field.setSyncStatus(FIELD_SAME);
0415:                                } else {
0416:                                    // Different
0417:                                    field.setSourceField(sfield);
0418:                                    field.setChanges(changes.toString()
0419:                                            .substring(1));
0420:                                    table.setSyncStatus(TABLE_CHANGED);
0421:                                }
0422:                            }
0423:                        }
0424:                        rsc.close();
0425:                    }
0426:                }
0427:                rs.close();
0428:                sConn.close();
0429:
0430:            }
0431:
0432:            private void populateTable(Table t, ResultSet rs)
0433:                    throws SQLException {
0434:                // Store other details
0435:                t.setCatalog(rs.getString("TABLE_CAT"));
0436:                t.setSchema(rs.getString("TABLE_SCHEM"));
0437:                t.setType(rs.getString("TABLE_TYPE"));
0438:                //t.setRemarks(rs.getString("TABLE_REMARKS"));
0439:            }
0440:
0441:            private void populateField(Field f, ResultSet rs)
0442:                    throws SQLException {
0443:                f.setDataType(rs.getShort("DATA_TYPE"));
0444:                f.setDataTypeName(rs.getString("TYPE_NAME"));
0445:                f.setColSize(rs.getInt("COLUMN_SIZE"));
0446:                f.setFracSize(rs.getInt("DECIMAL_DIGITS"));
0447:                //field.setRadix(rsc.getInt("NUM_PREC_RADIX"));
0448:                //field.setNullable(rsc.getInt("NULLABLE"));
0449:                f.setRemarks(rs.getString("REMARKS"));
0450:                f.setDefaultValue(rs.getString("COLUMN_DEF"));
0451:                f.setMaxLength(rs.getInt("CHAR_OCTET_LENGTH"));
0452:                f.setSeq(rs.getInt("ORDINAL_POSITION"));
0453:                f.setMandatory("NO".equals(rs.getString("IS_NULLABLE")));
0454:            }
0455:
0456:            /** Get the list of processed tables
0457:             * @return A collection of tables, this is in a list sorted by table name
0458:             */
0459:            public Collection getTables() {
0460:                return tables.values();
0461:            }
0462:
0463:            /** Getter for property sourceDriverString.
0464:             * @return Value of property sourceDriverString.
0465:             *
0466:             */
0467:            public String getSourceDriverString() {
0468:                return this .sourceDriverString;
0469:            }
0470:
0471:            /** Setter for property sourceDriverString.
0472:             * @param sourceDriverString New value of property sourceDriverString.
0473:             *
0474:             */
0475:            public void setSourceDriverString(String sourceDriverString) {
0476:                this .sourceDriverString = sourceDriverString;
0477:            }
0478:
0479:            /** Getter for property targetDriverString.
0480:             * @return Value of property targetDriveCrlass.
0481:             *
0482:             */
0483:            public String getTargetDriverString() {
0484:                return this .targetDriverString;
0485:            }
0486:
0487:            /** Setter for property targetDriverString.
0488:             * @param targetDriverString New value of property targetDriverString.
0489:             */
0490:            public void setTargetDriverString(String targetDriverString) {
0491:                this .targetDriverString = targetDriverString;
0492:            }
0493:
0494:            /** Getter for property sourceConnection.
0495:             * @return Value of property sourceConnection.
0496:             *
0497:             */
0498:            public String getSourceConnection() {
0499:                return this .sourceConnection;
0500:            }
0501:
0502:            /** Setter for property sourceConnection.
0503:             * @param sourceConnection New value of property sourceConnection.
0504:             *
0505:             */
0506:            public void setSourceConnection(String sourceConnection) {
0507:                this .sourceConnection = sourceConnection;
0508:            }
0509:
0510:            /** Getter for property targetConnection.
0511:             * @return Value of property targetConnection.
0512:             *
0513:             */
0514:            public String getTargetConnection() {
0515:                return this .targetConnection;
0516:            }
0517:
0518:            /** Setter for property targetConnection.
0519:             * @param targetConnection New value of property targetConnection.
0520:             *
0521:             */
0522:            public void setTargetConnection(String targetConnection) {
0523:                this .targetConnection = targetConnection;
0524:            }
0525:
0526:            /** Getter for property sourceUser.
0527:             * @return Value of property sourceUser.
0528:             *
0529:             */
0530:            public String getSourceUser() {
0531:                return this .sourceUser;
0532:            }
0533:
0534:            /** Setter for property sourceUser.
0535:             * @param sourceUser New value of property sourceUser.
0536:             *
0537:             */
0538:            public void setSourceUser(String sourceUser) {
0539:                this .sourceUser = sourceUser;
0540:            }
0541:
0542:            /** Getter for property targetUser.
0543:             * @return Value of property targetUser.
0544:             *
0545:             */
0546:            public String getTargetUser() {
0547:                return this .targetUser;
0548:            }
0549:
0550:            /** Setter for property targetUser.
0551:             * @param targetUser New value of property targetUser.
0552:             *
0553:             */
0554:            public void setTargetUser(String targetUser) {
0555:                this .targetUser = targetUser;
0556:            }
0557:
0558:            /** Getter for property sourcePassword.
0559:             * @return Value of property sourcePassword.
0560:             *
0561:             */
0562:            public String getSourcePassword() {
0563:                return this .sourcePassword;
0564:            }
0565:
0566:            /** Setter for property sourcePassword.
0567:             * @param sourcePassword New value of property sourcePassword.
0568:             *
0569:             */
0570:            public void setSourcePassword(String sourcePassword) {
0571:                this .sourcePassword = sourcePassword;
0572:            }
0573:
0574:            /** Getter for property targetPassword.
0575:             * @return Value of property targetPassword.
0576:             *
0577:             */
0578:            public String getTargetPassword() {
0579:                return this .targetPassword;
0580:            }
0581:
0582:            /** Setter for property targetPassword.
0583:             * @param targetPassword New value of property targetPassword.
0584:             *
0585:             */
0586:            public void setTargetPassword(String targetPassword) {
0587:                this .targetPassword = targetPassword;
0588:            }
0589:
0590:            /** Java bean to store Table information */
0591:            public class Table {
0592:
0593:                /** Holds value of property syncStatus. */
0594:                private int syncStatus;
0595:
0596:                /** Holds value of property name. */
0597:                private String name;
0598:
0599:                /** Holds value of property fields. */
0600:                private Map fields = new LinkedHashMap();
0601:
0602:                /** Holds value of property catalog. */
0603:                private String catalog;
0604:
0605:                /** Holds value of property schema. */
0606:                private String schema;
0607:
0608:                /** Holds value of property type. */
0609:                private String type;
0610:
0611:                /** Holds value of property remarks. */
0612:                private String remarks;
0613:
0614:                /** Getter for property syncStatus.
0615:                 * @return Value of property syncStatus.
0616:                 *
0617:                 */
0618:                public int getSyncStatus() {
0619:                    return this .syncStatus;
0620:                }
0621:
0622:                /** Setter for property syncStatus.
0623:                 * @param syncStatus New value of property syncStatus.
0624:                 *
0625:                 */
0626:                public void setSyncStatus(int syncStatus) {
0627:                    this .syncStatus = syncStatus;
0628:                }
0629:
0630:                /** Getter for property name.
0631:                 * @return Value of property name.
0632:                 *
0633:                 */
0634:                public String getName() {
0635:                    return this .name;
0636:                }
0637:
0638:                /** Setter for property name.
0639:                 * @param name New value of property name.
0640:                 *
0641:                 */
0642:                public void setName(String name) {
0643:                    this .name = name;
0644:                }
0645:
0646:                /** Getter for property fields.
0647:                 * @return Value of property fields.
0648:                 *
0649:                 */
0650:                public Map getFields() {
0651:                    return this .fields;
0652:                }
0653:
0654:                /** Setter for property fields.
0655:                 * @param fields New value of property fields.
0656:                 *
0657:                 */
0658:                public void setFields(Map fields) {
0659:                    this .fields = fields;
0660:                }
0661:
0662:                /** Getter for property catalog.
0663:                 * @return Value of property catalog.
0664:                 *
0665:                 */
0666:                public String getCatalog() {
0667:                    return this .catalog;
0668:                }
0669:
0670:                /** Setter for property catalog.
0671:                 * @param catalog New value of property catalog.
0672:                 *
0673:                 */
0674:                public void setCatalog(String catalog) {
0675:                    this .catalog = catalog;
0676:                }
0677:
0678:                /** Getter for property schema.
0679:                 * @return Value of property schema.
0680:                 *
0681:                 */
0682:                public String getSchema() {
0683:                    return this .schema;
0684:                }
0685:
0686:                /** Setter for property schema.
0687:                 * @param schema New value of property schema.
0688:                 *
0689:                 */
0690:                public void setSchema(String schema) {
0691:                    this .schema = schema;
0692:                }
0693:
0694:                /** Getter for property type.
0695:                 * @return Value of property type.
0696:                 *
0697:                 */
0698:                public String getType() {
0699:                    return this .type;
0700:                }
0701:
0702:                /** Setter for property type.
0703:                 * @param type New value of property type.
0704:                 *
0705:                 */
0706:                public void setType(String type) {
0707:                    this .type = type;
0708:                }
0709:
0710:                /** Getter for property remarks.
0711:                 * @return Value of property remarks.
0712:                 *
0713:                 */
0714:                public String getRemarks() {
0715:                    return this .remarks;
0716:                }
0717:
0718:                /** Setter for property remarks.
0719:                 * @param remarks New value of property remarks.
0720:                 *
0721:                 */
0722:                public void setRemarks(String remarks) {
0723:                    this .remarks = remarks;
0724:                }
0725:
0726:            }
0727:
0728:            /** Java bean to store Field information for */
0729:            public class Field {
0730:
0731:                /** Holds value of property syncStatus. */
0732:                private int syncStatus;
0733:
0734:                /** Holds value of property name. */
0735:                private String name;
0736:
0737:                /** Holds value of property dataType. */
0738:                private short dataType;
0739:
0740:                /** Holds value of property dataTypeName. */
0741:                private String dataTypeName;
0742:
0743:                /** Holds value of property colSize. */
0744:                private int colSize;
0745:
0746:                /** Holds value of property fracSize. */
0747:                private int fracSize;
0748:
0749:                /** Holds value of property remarks. */
0750:                private String remarks;
0751:
0752:                /** Holds value of property defaultValue. */
0753:                private String defaultValue;
0754:
0755:                /** Holds value of property maxLength. */
0756:                private int maxLength;
0757:
0758:                /** Holds value of property seq. */
0759:                private int seq;
0760:
0761:                /** Holds value of property mandatory. */
0762:                private boolean mandatory;
0763:
0764:                /** Holds value of property sourceField. */
0765:                private Field sourceField;
0766:
0767:                /** Holds value of property changes. */
0768:                private String changes;
0769:
0770:                /** Getter for property syncStatus.
0771:                 * @return Value of property syncStatus.
0772:                 *
0773:                 */
0774:                public int getSyncStatus() {
0775:                    return this .syncStatus;
0776:                }
0777:
0778:                /** Setter for property syncStatus.
0779:                 * @param syncStatus New value of property syncStatus.
0780:                 *
0781:                 */
0782:                public void setSyncStatus(int syncStatus) {
0783:                    this .syncStatus = syncStatus;
0784:                }
0785:
0786:                /** Getter for property name.
0787:                 * @return Value of property name.
0788:                 *
0789:                 */
0790:                public String getName() {
0791:                    return this .name;
0792:                }
0793:
0794:                /** Setter for property name.
0795:                 * @param name New value of property name.
0796:                 *
0797:                 */
0798:                public void setName(String name) {
0799:                    this .name = name;
0800:                }
0801:
0802:                /** Getter for property dataType.
0803:                 * @return Value of property dataType.
0804:                 *
0805:                 */
0806:                public short getDataType() {
0807:                    return this .dataType;
0808:                }
0809:
0810:                /** Setter for property dataType.
0811:                 * @param dataType New value of property dataType.
0812:                 *
0813:                 */
0814:                public void setDataType(short dataType) {
0815:                    this .dataType = dataType;
0816:                }
0817:
0818:                /** Getter for property dataTypeName.
0819:                 * @return Value of property dataTypeName.
0820:                 *
0821:                 */
0822:                public String getDataTypeName() {
0823:                    return this .dataTypeName;
0824:                }
0825:
0826:                /** Setter for property dataTypeName.
0827:                 * @param dataTypeName New value of property dataTypeName.
0828:                 *
0829:                 */
0830:                public void setDataTypeName(String dataTypeName) {
0831:                    this .dataTypeName = dataTypeName;
0832:                }
0833:
0834:                /** Getter for property colSize.
0835:                 * @return Value of property colSize.
0836:                 *
0837:                 */
0838:                public int getColSize() {
0839:                    return this .colSize;
0840:                }
0841:
0842:                /** Setter for property colSize.
0843:                 * @param colSize New value of property colSize.
0844:                 *
0845:                 */
0846:                public void setColSize(int colSize) {
0847:                }
0848:
0849:                /** Getter for property fracSize.
0850:                 * @return Value of property fracSize.
0851:                 *
0852:                 */
0853:                public int getFracSize() {
0854:                    return this .fracSize;
0855:                }
0856:
0857:                /** Setter for property fracSize.
0858:                 * @param fracSize New value of property fracSize.
0859:                 *
0860:                 */
0861:                public void setFracSize(int fracSize) {
0862:                    this .fracSize = fracSize;
0863:                }
0864:
0865:                /** Getter for property remarks.
0866:                 * @return Value of property remarks.
0867:                 *
0868:                 */
0869:                public String getRemarks() {
0870:                    return this .remarks;
0871:                }
0872:
0873:                /** Setter for property remarks.
0874:                 * @param remarks New value of property remarks.
0875:                 *
0876:                 */
0877:                public void setRemarks(String remarks) {
0878:                    this .remarks = remarks;
0879:                }
0880:
0881:                /** Getter for property defaultValue.
0882:                 * @return Value of property defaultValue.
0883:                 *
0884:                 */
0885:                public String getDefaultValue() {
0886:                    return this .defaultValue;
0887:                }
0888:
0889:                /** Setter for property defaultValue.
0890:                 * @param defaultValue New value of property defaultValue.
0891:                 *
0892:                 */
0893:                public void setDefaultValue(String defaultValue) {
0894:                    this .defaultValue = defaultValue;
0895:                }
0896:
0897:                /** Getter for property maxLength.
0898:                 * @return Value of property maxLength.
0899:                 *
0900:                 */
0901:                public int getMaxLength() {
0902:                    return this .maxLength;
0903:                }
0904:
0905:                /** Setter for property maxLength.
0906:                 * @param maxLength New value of property maxLength.
0907:                 *
0908:                 */
0909:                public void setMaxLength(int maxLength) {
0910:                    this .maxLength = maxLength;
0911:                }
0912:
0913:                /** Getter for property seq.
0914:                 * @return Value of property seq.
0915:                 *
0916:                 */
0917:                public int getSeq() {
0918:                    return this .seq;
0919:                }
0920:
0921:                /** Setter for property seq.
0922:                 * @param seq New value of property seq.
0923:                 *
0924:                 */
0925:                public void setSeq(int seq) {
0926:                    this .seq = seq;
0927:                }
0928:
0929:                /** Getter for property mandatory.
0930:                 * @return Value of property mandatory.
0931:                 *
0932:                 */
0933:                public boolean isMandatory() {
0934:                    return this .mandatory;
0935:                }
0936:
0937:                /** Setter for property mandatory.
0938:                 * @param mandatory New value of property mandatory.
0939:                 *
0940:                 */
0941:                public void setMandatory(boolean mandatory) {
0942:                    this .mandatory = mandatory;
0943:                }
0944:
0945:                /** Getter for property sourceField.
0946:                 * @return Value of property sourceField.
0947:                 *
0948:                 */
0949:                public Field getSourceField() {
0950:                    return this .sourceField;
0951:                }
0952:
0953:                /** Setter for property sourceField.
0954:                 * @param sourceField New value of property sourceField.
0955:                 *
0956:                 */
0957:                public void setSourceField(Field sourceField) {
0958:                    this .sourceField = sourceField;
0959:                }
0960:
0961:                /** Getter for property changes.
0962:                 * @return Value of property changes.
0963:                 *
0964:                 */
0965:                public String getChanges() {
0966:                    return this .changes;
0967:                }
0968:
0969:                /** Setter for property changes.
0970:                 * @param changes New value of property changes.
0971:                 *
0972:                 */
0973:                public void setChanges(String changes) {
0974:                    this .changes = changes;
0975:                }
0976:
0977:            }
0978:
0979:            /** Get the description for a given SyncState value
0980:             * @param sync sync code to get description for
0981:             * @return description of code
0982:             */
0983:            public static String getSyncName(int sync) {
0984:                if (sync < 0 || sync >= SYNC_TYPES.length)
0985:                    return "Unknown";
0986:                else
0987:                    return SYNC_TYPES[sync];
0988:            }
0989:
0990:            /** Getter for property tableFilter.
0991:             * @return Value of property tableFilter.
0992:             *
0993:             */
0994:            public String getTableFilter() {
0995:                return this .tableFilter;
0996:            }
0997:
0998:            /** Setter for property tableFilter.
0999:             * @param tableFilter New value of property tableFilter.
1000:             *
1001:             */
1002:            public void setTableFilter(String tableFilter) {
1003:                this .tableFilter = tableFilter;
1004:            }
1005:
1006:            /** Getter for property sourceSchema.
1007:             * @return Value of property sourceSchema.
1008:             *
1009:             */
1010:            public String getSourceSchema() {
1011:                return this .sourceSchema;
1012:            }
1013:
1014:            /** Setter for property sourceSchema.
1015:             * @param sourceSchema New value of property sourceSchema.
1016:             *
1017:             */
1018:            public void setSourceSchema(String sourceSchema) {
1019:                this .sourceSchema = sourceSchema;
1020:            }
1021:
1022:            /** Getter for property targetSchema.
1023:             * @return Value of property targetSchema.
1024:             *
1025:             */
1026:            public String getTargetSchema() {
1027:                return this .targetSchema;
1028:            }
1029:
1030:            /** Setter for property targetSchema.
1031:             * @param targetSchema New value of property targetSchema.
1032:             *
1033:             */
1034:            public void setTargetSchema(String targetSchema) {
1035:                this.targetSchema = targetSchema;
1036:            }
1037:
1038:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.