1 2 22 23 package org.webdocwf.util.loader.wizard; 24 25 import java.util.Vector ; 26 import org.webdocwf.util.loader.generator.SearchXmlFile; 27 import org.webdocwf.util.loader.LoaderException; 28 30 36 public class OctopusGeneratorData { 37 38 private static String [] logModes = { 39 "none", "normal", "full"}; 40 private String logMode = ""; 41 private String logFileDirectory = ""; 42 private String logFileName = ""; 43 44 private String sourceType = ""; 45 private String targetType = ""; 46 private String sourceDatabase = ""; 47 private String targetDatabase = ""; 48 private String sourceDriverName = ""; 49 private String targetDriverName = ""; 50 private String valueMode = ""; 51 private String generatorOutput = ""; 52 private String packageName = ""; 54 private String domlPath = ""; 55 private String sourceUser = ""; 56 private String sourcePassword = ""; 57 private String targetUser = ""; 58 private String targetPassword = ""; 59 private String additonalPaths = ""; 60 private String includeTableList = ""; 61 private String confJarStructure = ""; 62 63 private String xmlGenerate = "true"; 66 private String sqlGenerate = "true"; 67 private String domlGenerate = ""; 68 private String sqlStmtDropTable = "true"; 70 private String sqlStmtDropIntegrity = "true"; 71 private String sqlStmtCreateTable = "true"; 72 private String sqlStmtCreatePK = "true"; 73 private String sqlStmtCreateFK = "true"; 74 private String sqlStmtCreateIndex = "true"; 75 private String fullMode = "false"; 77 78 private String sqlStmtForAllVendors = ""; 80 private static Vector targetVendors = new Vector (); 81 private static Vector sourceVendors = new Vector (); 82 private static Vector allVendorsPath = new Vector (); 83 private static Vector sourceDrivers = new Vector (); 84 private static Vector targetDrivers = new Vector (); 85 86 private static String [] targetDatabaseTypes; 87 private static String [] sourceDatabaseTypes; 88 private static String [] sourceDriverNames; 89 private static String [] targetDriverNames; 90 private static final String [] valueModes = { "copy" }; 91 92 96 public OctopusGeneratorData(String confJarStructure) throws LoaderException { 97 SearchXmlFile searchXmlFile = 98 new SearchXmlFile("relative", "OctopusDBVendors.xml", confJarStructure); 99 this.confJarStructure = confJarStructure; 100 this.targetVendors = searchXmlFile.getAllVendors(); 101 this.allVendorsPath = searchXmlFile.getAllVendorsPath(); 102 setAllVendorsAndDrivers(targetVendors, allVendorsPath); 103 } 104 105 111 public void setAllVendorsAndDrivers(Vector all_Vendors, Vector all_VendorsPath) 112 throws LoaderException { 113 for (int i = 0; i < all_VendorsPath.size(); i++) { 114 Vector targetDriversTemp = new Vector (); 115 Vector sourceDriversTemp = new Vector (); 116 String path = all_VendorsPath.get(i).toString(); 117 SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", path, confJarStructure); 118 Vector drivers = searchXmlFile.getAllDriversForVendor(); 119 targetDriversTemp = (Vector ) drivers.get(0); 120 sourceDriversTemp = (Vector ) drivers.get(1); 121 String isSourceVendor = (String ) drivers.get(2); 122 123 if (isSourceVendor.equalsIgnoreCase("true")) { 124 if (!sourceVendors.contains(all_Vendors.get(i))) 125 sourceVendors.add(all_Vendors.get(i)); 126 } 127 128 boolean repeatTarget = false; 129 boolean repeatSource = false; 130 for (int j = 0; j < targetDriversTemp.size(); j++) { 131 String targetDriverName = targetDriversTemp.get(j).toString(); 132 for (int k = 0; k < targetDrivers.size(); k++) { 133 if (targetDrivers.get(k).toString().equalsIgnoreCase(targetDriverName)) { 134 repeatTarget = true; 135 break; 136 } 137 } 138 if (repeatTarget == false) 139 this.targetDrivers.add(targetDriverName); 140 } 141 for (int j = 0; j < sourceDriversTemp.size(); j++) { 142 String sourceDriverName = sourceDriversTemp.get(j).toString(); 143 for (int k = 0; k < sourceDrivers.size(); k++) { 144 if (sourceDrivers.get(k).toString().equalsIgnoreCase(sourceDriverName)) { 145 repeatSource = true; 146 break; 147 } 148 } 149 if (repeatSource == false) 150 this.sourceDrivers.add(sourceDriverName); 151 } 152 } 153 } 154 155 159 public static String [] getTargetDatabaseTypes() { 160 targetDatabaseTypes = new String [targetVendors.size()]; 161 for (int i = 0; i < targetVendors.size(); i++) { 162 targetDatabaseTypes[i] = targetVendors.get(i).toString(); 163 } 164 return targetDatabaseTypes; 165 } 166 167 171 public static String [] getSourceDatabaseTypes() { 172 sourceDatabaseTypes = new String [sourceVendors.size()]; 173 for (int i = 0; i < sourceVendors.size(); i++) { 174 sourceDatabaseTypes[i] = sourceVendors.get(i).toString(); 175 } 176 return sourceDatabaseTypes; 177 } 178 179 183 public static String [] getSourceDriverNames() { 184 sourceDriverNames = new String [sourceDrivers.size()]; 185 for (int i = 0; i < sourceDrivers.size(); i++) { 186 sourceDriverNames[i] = sourceDrivers.get(i).toString(); 187 } 188 return sourceDriverNames; 189 } 190 191 195 public static String [] getTargetDriverNames() { 196 targetDriverNames = new String [targetDrivers.size()]; 197 for (int i = 0; i < targetDrivers.size(); i++) { 198 targetDriverNames[i] = targetDrivers.get(i).toString(); 199 } 200 return targetDriverNames; 201 } 202 203 207 public static String [] getValueModes() { 208 return valueModes; 209 } 210 211 215 public void setAdditionalPaths(String additonal_Paths) { 216 if (additonal_Paths.startsWith(";")) { 217 if (additonal_Paths.endsWith(";")) 218 additonalPaths = additonal_Paths.substring(1, additonal_Paths.length() - 1); 219 else 220 additonalPaths = additonal_Paths.substring(1); 221 } else 222 if (additonal_Paths.endsWith(";")) { 223 additonalPaths = additonal_Paths.substring(0, additonal_Paths.length() - 1); 224 } else { 225 additonalPaths = additonal_Paths; 226 } 227 } 228 229 230 234 public static String [] getLogModes() { 235 return logModes; 236 } 237 241 public void setLogMode(String log_Mode) { 242 this.logMode = log_Mode; 243 } 244 245 249 public String getLogMode() { 250 return logMode; 251 } 252 253 257 public void setLogFileDir(String log_FileDirectory) { 258 this.logFileDirectory = log_FileDirectory; 259 } 260 261 265 public String getLogFileDir() { 266 return this.logFileDirectory; 267 } 268 269 273 public void setLogFileName(String log_FileName) { 274 this.logFileName = log_FileName; 275 } 276 277 281 public String getLogFileName() { 282 return this.logFileName; 283 } 284 288 public String getAdditionalPaths() { 289 return additonalPaths; 290 } 291 292 296 public void setSourceType(String source_Type) { 297 sourceType = source_Type; 298 } 299 300 304 public String getSourceType() { 305 return sourceType; 306 } 307 308 312 public void setTargetType(String target_Type) { 313 targetType = target_Type; 314 } 315 316 320 public String getTargetType() { 321 return targetType; 322 } 323 324 328 public void setSourceDatabase(String source_Database) { 329 sourceDatabase = source_Database; 330 } 331 332 336 public String getSourceDatabase() { 337 return sourceDatabase; 338 } 339 340 344 public void setTargetDatabase(String target_Database) { 345 targetDatabase = target_Database; 346 } 347 348 352 public String getTargetDatabase() { 353 return targetDatabase; 354 } 355 356 360 public void setValueMode(String value_Mode) { 361 valueMode = value_Mode; 362 } 363 364 368 public String getValueMode() { 369 return valueMode; 370 } 371 372 376 public void setGeneratorOutput(String generator_Output) { 377 generatorOutput = generator_Output; 378 } 379 380 384 public String getGeneratorOutput() { 385 return generatorOutput; 386 } 387 388 392 public void setSourceUser(String source_User) { 393 sourceUser = source_User; 394 } 395 396 400 public String getSourceUser() { 401 return sourceUser; 402 } 403 404 408 public void setSourcePassword(String source_Password) { 409 sourcePassword = source_Password; 410 } 411 412 416 public String getSourcePassword() { 417 return sourcePassword; 418 } 419 420 424 public void setTargetUser(String target_User) { 425 targetUser = target_User; 426 } 427 428 432 public String getTargetUser() { 433 return targetUser; 434 } 435 436 440 public void setTargetPassword(String target_Password) { 441 targetPassword = target_Password; 442 } 443 444 448 public String getTargetPassword() { 449 return targetPassword; 450 } 451 452 456 460 464 public void setPackageName(String package_Name) { 465 packageName = package_Name; 466 } 467 468 472 public String getPackageName() { 473 return packageName; 474 } 475 476 480 public void setDomlPath(String doml_Path) { 481 domlPath = doml_Path; 482 } 483 484 488 public String getDomlPath() { 489 return domlPath; 490 } 491 492 496 public void setSourceDriverName(String source_DriverName) { 497 sourceDriverName = source_DriverName; 498 } 499 500 504 public String getSourceDriverName() { 505 return sourceDriverName; 506 } 507 508 512 public void setTargetDriverName(String target_DriverName) { 513 targetDriverName = target_DriverName; 514 } 515 516 520 public String getTargetDriverName() { 521 return targetDriverName; 522 } 523 524 528 public void setSqlStmtDropTable(String sqlStmt_DropTable) { 529 sqlStmtDropTable = sqlStmt_DropTable; 530 } 531 532 536 public String getSqlStmtDropTable() { 537 return sqlStmtDropTable; 538 } 539 540 544 public void setSqlStmtDropIntegrity(String sqlStmt_DropIntegrity) { 545 sqlStmtDropIntegrity = sqlStmt_DropIntegrity; 546 } 547 548 552 public String getSqlStmtDropIntegrity() { 553 return sqlStmtDropIntegrity; 554 } 555 556 560 public void setSqlStmtCreateTable(String sqlStmt_CreateTable) { 561 sqlStmtCreateTable = sqlStmt_CreateTable; 562 } 563 564 568 public String getSqlStmtCreateTable() { 569 return sqlStmtCreateTable; 570 } 571 572 576 public void setSqlStmtCreatePK(String sqlStmt_CreatePK) { 577 sqlStmtCreatePK = sqlStmt_CreatePK; 578 } 579 580 584 public String getSqlStmtCreatePK() { 585 return sqlStmtCreatePK; 586 } 587 588 592 public void setSqlStmtCreateFK(String sqlStmt_CreateFK) { 593 sqlStmtCreateFK = sqlStmt_CreateFK; 594 } 595 596 600 public String getSqlStmtCreateFK() { 601 return sqlStmtCreateFK; 602 } 603 604 608 public void setSqlStmtCreateIndex(String sqlStmt_CreateIndex) { 609 sqlStmtCreateIndex = sqlStmt_CreateIndex; 610 } 611 612 616 public String getSqlStmtCreateIndex() { 617 return sqlStmtCreateIndex; 618 } 619 620 624 public void setSqlStmtForAllVendors(String sqlStmt_ForAllVendors) { 625 sqlStmtForAllVendors = sqlStmt_ForAllVendors; 626 } 627 628 632 public String getSqlStmtForAllVendors() { 633 return sqlStmtForAllVendors; 634 } 635 636 640 public String getXmlGenerate() { 641 return xmlGenerate; 642 } 643 644 648 public void setXmlGenerate(String xml_Generate) { 649 xmlGenerate = xml_Generate; 650 } 651 652 656 public String getSqlGenerate() { 657 return sqlGenerate; 658 } 659 660 664 public void setSqlGenerate(String sql_Generate) { 665 sqlGenerate = sql_Generate; 666 } 667 668 672 public String getDomlGenerate() { 673 return domlGenerate; 674 } 675 676 680 public void setDomlGenerate(String doml_Generate) { 681 domlGenerate = doml_Generate; 682 } 683 684 688 public void setFullMode(String full_mode) { 689 fullMode = full_mode; 690 } 691 692 696 public String getFullMode() { 697 return fullMode; 698 } 699 700 704 public void setIncludeTableList(String incude_table_list) { 705 includeTableList = incude_table_list; 706 } 707 708 712 public String getIncludeTableList() { 713 return includeTableList; 714 } 715 716 720 public void setConfJarStructure(String conf_jar_structure) { 721 confJarStructure = conf_jar_structure; 722 } 723 724 728 public String getConfJarStructure() { 729 return confJarStructure; 730 } 731 732 public String toConfString() { 733 String retVal = ""; 734 retVal += "\nGenerator.AdditionalPaths="+this.getAdditionalPaths(); 735 retVal += "\nGenerator.ConfJarStructure="+this.getConfJarStructure(); 736 retVal += "\nGenerator.DomlGenerate="+this.getDomlGenerate(); 737 retVal += "\nGenerator.DomlPath="+this.getDomlPath(); 738 retVal += "\nGenerator.FullMode="+this.getFullMode(); 739 retVal += "\nGenerator.GeneratorOutput="+this.getGeneratorOutput(); 740 retVal += "\nGenerator.IncludeTableList="+this.getIncludeTableList(); 741 retVal += "\nGenerator.PackageName="+this.getPackageName(); 742 retVal += "\nGenerator.SourceDatabase="+this.getSourceDatabase(); 743 retVal += "\nGenerator.SourceDriverName="+this.getSourceDriverName(); 744 retVal += "\nGenerator.SourcePassword="+this.getSourcePassword(); 745 retVal += "\nGenerator.SourceType="+this.getSourceType(); 746 retVal += "\nGenerator.SourceUser="+this.getSourceUser(); 747 retVal += "\nGenerator.SqlGenerate="+this.getSqlGenerate(); 748 retVal += "\nGenerator.SqlStmtCreateFK="+this.getSqlStmtCreateFK(); 749 retVal += "\nGenerator.SqlStmtCreateIndex="+this.getSqlStmtCreateIndex(); 750 retVal += "\nGenerator.SqlStmtCreatePK="+this.getSqlStmtCreatePK(); 751 retVal += "\nGenerator.SqlStmtCreateTable="+this.getSqlStmtCreateTable(); 752 retVal += "\nGenerator.SqlStmtDropIntegrity="+this.getSqlStmtDropIntegrity(); 753 retVal += "\nGenerator.SqlStmtDropTable="+this.getSqlStmtDropTable(); 754 retVal += "\nGenerator.SqlStmtForAllVendors="+this.getSqlStmtForAllVendors(); 755 retVal += "\nGenerator.TargetDatabase="+this.getTargetDatabase(); 756 retVal += "\nGenerator.TargetDriverName="+this.getTargetDriverName(); 757 758 retVal += "\nGenerator.TargetPassword="+this.getTargetPassword(); 759 retVal += "\nGenerator.TargetType="+this.getTargetType(); 760 retVal += "\nGenerator.TargetUser="+this.getTargetUser(); 761 retVal += "\nGenerator.ValueMode="+this.getValueMode(); 762 retVal += "\nGenerator.XmlGenerate="+this.getXmlGenerate(); 763 764 retVal += "\nGenerator.LogMode="+this.getLogMode(); 765 retVal += "\nGenerator.LogFileName="+this.getLogFileName(); 766 retVal += "\nGenerator.LogFileDir="+this.getLogFileDir(); 767 return retVal; 768 } 769 770 } 771 | Popular Tags |