View Javadoc
1 /* 2 LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus. 3 Copyright (C) 2003 Together 4 This library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 This library is distributed in the hope that it will be useful, 9 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 Lesser General Public License for more details. 12 You should have received a copy of the GNU Lesser General Public 13 License along with this library; if not, write to the Free Software 14 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 */ 16 17 package org.webdocwf.util.loader.generator; 18 19 import java.io.File; 20 import java.util.Hashtable; 21 import java.util.StringTokenizer; 22 import java.util.Vector; 23 24 import org.webdocwf.util.loader.LoaderException; 25 import org.webdocwf.util.loader.logging.Logger; 26 import org.webdocwf.util.loader.logging.StandardLogger; 27 /*** 28 * InputParameters class sets the input parameters. 29 * @author Radoslav Dutina 30 * @version 1.0 31 */ 32 public class InputParameters { 33 34 private String sourceType = "msql"; 35 private String targetType = "msql"; 36 private String sourceDataBase = null; 37 private String targetDataBase = null; 38 39 private String valueMode = "Overwrite"; 40 private String generatorOutput = ""; 41 private String sourceUser = ""; 42 private String sourcePassword = ""; 43 private String targetUser = ""; 44 private String targetPassword = ""; 45 private String sourceDriverName = ""; 46 private String targetDriverName = ""; 47 private String domlPath = ""; 48 49 private String packageName = null; 50 51 private String alterTablePrimaryKey = null; 52 private String pathToSourceConf = null; 53 private String pathToTargetConf = null; 54 55 // private String path="conf/OctopusDBVendors.xml"; 56 private String path = "OctopusDBVendors.xml"; 57 private SearchXmlFile searchXmlFile = null; 58 59 //sql statements only 60 private Vector sqlToGenerate = new Vector(); 61 private boolean generateSomeSql = false; 62 private boolean generateSqlForAllVendors = false; 63 64 private Vector allVendors = new Vector(); 65 private String generateXml = "false"; 66 private String generateDoml = "false"; 67 private String restoreMode = "false"; 68 69 //optimized modes 70 private boolean fullMode = true; 71 private String[] excludedTables = null; 72 73 private Vector includeTableList = new Vector(); 74 75 private String confJarStructure = ""; 76 77 //oid and version columns 78 private String oidColumnName = "oid"; 79 private String versionColumnName = "version"; 80 private String oidColumnType = "decimal"; 81 private String versionColumnType = "bigint"; 82 83 private String maxConstraintLength = ""; 84 85 //ZK added for new attribute hasSize 86 private Hashtable htHasSize = new Hashtable(); 87 private Hashtable htIsDecimal = new Hashtable(); 88 private Logger logger; 89 //ZK end 90 91 /*** 92 * Set hasSize values for db vendor 93 */ 94 95 public void setHasSize() throws LoaderException { 96 try { 97 setLogger(); 98 // if (this.logger != null) { 99 // this.logger.write("full", "\tsetHasSize is started."); 100 // } 101 SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToSourceConf(), getConfJarStructure()); 102 this.htHasSize = searchXmlFile.getHasSize(); 103 // if (this.logger != null) { 104 // this.logger.write("full", "\tsetHasSize is finished."); 105 // } 106 107 } catch (Exception ex) { 108 109 LoaderException le = new LoaderException("Exception:" + ex.getMessage(), ex); 110 if (this.logger != null) { 111 this.logger.write("full", "Exception:" + le.getStackTraceAsString()); 112 } 113 throw le; 114 } 115 } 116 /*** 117 * Return boolean if size for this type must be defined by user or not 118 * @param sqlType 119 * @return String which represents is this type has size or not 120 * @throws LoaderException 121 */ 122 public String getHasSize(String sqlType) throws LoaderException { 123 try { 124 setLogger(); 125 // this.logger.write("full", "\tgetHasSize is started."); 126 if (htHasSize.containsKey((sqlType).toUpperCase())) { 127 // if (this.logger != null) { 128 // this.logger.write("full", "\tgetHasSize is finished."); 129 // } 130 return this.htHasSize.get((sqlType).toUpperCase()).toString(); 131 } else { 132 // if (this.logger != null) { 133 // this.logger.write("full", "\tgetHasSize is finished."); 134 // } 135 return "false"; 136 } 137 138 } catch (Exception e) { 139 140 LoaderException le = new LoaderException("Exception:", (Throwable) e); 141 if (this.logger != null) { 142 this.logger.write("full", "Exception:" + le.getStackTraceAsString()); 143 } 144 throw le; 145 } 146 147 } 148 /*** 149 * Set decimal types for this DB vendor 150 * @throws LoaderException 151 */ 152 public void setIsDecimal() throws LoaderException { 153 try { 154 setLogger(); 155 // if (this.logger != null) { 156 // this.logger.write("full", "\tsetIsDecimal is started."); 157 // } 158 SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToSourceConf(), getConfJarStructure()); 159 this.htIsDecimal = searchXmlFile.getIsDecimal(); 160 161 } catch (Exception ex) { 162 163 LoaderException le = new LoaderException("Exception" + ex.getMessage(), ex); 164 if (this.logger != null) { 165 this.logger.write("full", "Exception:" + le.getStackTraceAsString()); 166 } 167 throw le; 168 } 169 // if (this.logger != null) { 170 // this.logger.write("full", "\tsetIsDecimal is finished."); 171 // } 172 } 173 /*** 174 * Return boolean if this string represents decimal type or not 175 * @param sqlType 176 * @return String which represents is this number decimal or not 177 * @throws LoaderException 178 */ 179 public String getIsDecimal(String sqlType) throws LoaderException { 180 try { 181 setLogger(); 182 // if (this.logger != null) { 183 // this.logger.write("full", "\tgetIsDecimal is started."); 184 // } 185 if (htIsDecimal.containsKey((sqlType).toUpperCase())) { 186 //this.logger.write("full", "\tgetIsDecimal is finished."); 187 return this.htIsDecimal.get((sqlType).toUpperCase()).toString(); 188 } else { 189 // if (this.logger != null) { 190 // this.logger.write("full", "\tgetIsDecimal is finished."); 191 // } 192 return "false"; 193 } 194 } catch (Exception e) { 195 LoaderException le = new LoaderException("Exception:" + e.getMessage(), e); 196 if (this.logger != null) { 197 this.logger.write("full", "Exception:" + le.getStackTraceAsString()); 198 } 199 throw le; 200 } 201 202 } 203 204 public void setOidAndVersionColumnName() throws LoaderException { 205 206 try { 207 setLogger(); 208 // if (this.logger != null) { 209 // this.logger.write("full", "\tsetOidAndVersionColumnName is started."); 210 // } 211 SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToTargetConf(), getConfJarStructure()); 212 213 this.oidColumnName = searchXmlFile.getOidDbColumn(); 214 this.versionColumnName = searchXmlFile.getVersionDbColumn(); 215 this.oidColumnType = searchXmlFile.getOidDB(); 216 this.versionColumnType = searchXmlFile.getVersionDb(); 217 218 } catch (Exception ex) { 219 LoaderException le = new LoaderException("Exception:" + ex.getMessage(), ex); 220 if (this.logger != null) { 221 this.logger.write("full", "Exception:" + le.getStackTraceAsString()); 222 } 223 throw le; 224 } 225 // if (this.logger != null) { 226 // this.logger.write("full", "\tsetOidAndVersionColumnName is finished."); 227 // } 228 } 229 230 public String getOidColumnName() { 231 return this.oidColumnName; 232 } 233 234 public String getVersionColumnName() { 235 return this.versionColumnName; 236 } 237 238 public String getOidColumnType() { 239 return this.oidColumnType; 240 } 241 242 public String getVersionColumnType() { 243 return this.versionColumnType; 244 } 245 246 /*** 247 * This method set value of includeTableList parameter 248 * @param include_table_list is value of parameter 249 * @throws LoaderException 250 */ 251 public void setIncludeTableList(String include_table_list) throws LoaderException { 252 setLogger(); 253 // if (this.logger != null) { 254 // this.logger.write("full", "\tsetIncludeTableList is started."); 255 // } 256 if (include_table_list.indexOf(",") != -1) { 257 String msg = "\tDelimiter for tables in 'Include Table List' parameter is ';' and not ','"; 258 LoaderException le = new LoaderException("Exception:", new Exception(msg + "\n")); 259 if (this.logger != null) { 260 this.logger.write("full", "Exception:" + "\tDelimiter for tables in 'Include Table List' parameter is ';' and not ','"+le.getStackTraceAsString()); 261 } 262 throw le; 263 } 264 265 StringTokenizer st = new StringTokenizer(include_table_list, ";"); 266 while (st.hasMoreTokens()) { 267 String tableName = st.nextElement().toString(); 268 if (tableName.length() > 0) 269 this.includeTableList.add(tableName); 270 } 271 // if (this.logger != null) { 272 // this.logger.write("full", "\tsetIncludeTableList is finished."); 273 // } 274 } 275 276 /*** 277 * This method read value from includeTableList parameter 278 * @return value of parameter 279 */ 280 public Vector getIncludeTableList() { 281 return this.includeTableList; 282 } 283 284 /*** 285 * This method set value of restroreMode parameter 286 * @param restoreMode is value of parameter 287 */ 288 public void setRestoreMode(String restoreMode) { 289 this.restoreMode = restoreMode; 290 } 291 292 /*** 293 * This method read value from restoreMode parameter 294 * @return value of parameter 295 */ 296 public String getRestoreMode() { 297 return this.restoreMode; 298 } 299 300 /*** 301 * This method set value of fullMode parameter 302 * @param full_mode is value of parameter 303 */ 304 public void setFullMode(String full_mode) { 305 if (full_mode.equalsIgnoreCase("true")) 306 fullMode = true; 307 else 308 fullMode = false; 309 } 310 311 /*** 312 * This method read value of fullMode parameter 313 * @return value of parameter 314 */ 315 public boolean getFullMode() { 316 return fullMode; 317 } 318 319 /*** 320 * This method set value of generateXml parameter 321 * @param generate_Xml is value of parameter 322 */ 323 public void setGenerateXml(String generate_Xml) { 324 this.generateXml = generate_Xml; 325 } 326 327 /*** 328 * This method read value of generateXml parameter 329 * @return value of parameter 330 */ 331 public String getGenerateXml() { 332 return this.generateXml; 333 } 334 335 /*** 336 * This method read value of generateDoml parameter 337 * @return value of parameter 338 */ 339 public String getGenerateDoml() { 340 return this.generateDoml; 341 } 342 343 /*** 344 * This method set value of generateDoml parameter 345 * @param generate_Doml is value of parameter 346 */ 347 public void setGenerateDoml(String generate_Doml) { 348 this.generateDoml = generate_Doml; 349 } 350 351 /*** 352 * This method read value from generateSqlForAllVendors parameter 353 * @return value of parameter 354 */ 355 public boolean getSqlForAllVendors() { 356 return generateSqlForAllVendors; 357 } 358 359 /*** 360 * This method set the value of allVendors parameter 361 * @param generate is value of parameter 362 */ 363 public void setAllVendors(String generate) { 364 if (generate.equalsIgnoreCase("true")) { 365 generateSqlForAllVendors = true; 366 allVendors = searchXmlFile.getAllVendors(); 367 } 368 } 369 370 /*** 371 * This method read value from allVendors parameter 372 * @return value of parameter 373 */ 374 public Vector getAllVendors() { 375 return allVendors; 376 } 377 378 /*** 379 * This method read value form generateSqlOnly parameter 380 * @return value of parameter 381 */ 382 public boolean isGenerateSql() { 383 return generateSomeSql; 384 } 385 386 private void setDefaultSqlStmt() { 387 sqlToGenerate.add(0, null); 388 sqlToGenerate.add(1, null); 389 sqlToGenerate.add(2, null); 390 sqlToGenerate.add(3, null); 391 sqlToGenerate.add(4, null); 392 sqlToGenerate.add(5, null); 393 } 394 395 /*** 396 * This method sets the value of sqlToGenerate parameter. 397 * @param generate_DropTableStmt is value of parameter 398 */ 399 public void setSqlStmtDropTable(String generate_DropTableStmt) { 400 401 if (generate_DropTableStmt.equalsIgnoreCase("true")) { 402 generateSomeSql = true; 403 sqlToGenerate.setElementAt("DropTables", 1); 404 } 405 } 406 407 /*** 408 * This method sets the value of sqlToGenerate parameter. 409 * @param generate_DropIntegrityStmt is value of parameter 410 */ 411 public void setSqlStmtDropIntegrity(String generate_DropIntegrityStmt) { 412 if (generate_DropIntegrityStmt.equalsIgnoreCase("true")) { 413 generateSomeSql = true; 414 sqlToGenerate.setElementAt("DropIntegrity", 0); 415 } 416 } 417 418 /*** 419 * This method sets the value of sqlToGenerate parameter. 420 * @param generate_CreateTableStmt is value of parameter 421 */ 422 public void setSqlStmtCreateTable(String generate_CreateTableStmt) { 423 if (generate_CreateTableStmt.equalsIgnoreCase("true")) { 424 generateSomeSql = true; 425 sqlToGenerate.setElementAt("CreateTables", 2); 426 } 427 } 428 429 /*** 430 * This method sets the value of sqlToGenerate parameter. 431 * @param generate_CreatePKStmt is value of parameter 432 */ 433 public void setSqlStmtCreatePK(String generate_CreatePKStmt) { 434 if (generate_CreatePKStmt.equalsIgnoreCase("true")) { 435 if (!this.alterTablePrimaryKey.equalsIgnoreCase("false")) { 436 generateSomeSql = true; 437 sqlToGenerate.setElementAt("CreatePrimary", 4); 438 } 439 } 440 } 441 442 /*** 443 * This method sets the value of sqlToGenerate parameter. 444 * @param generate_CreateFKStmt is value of parameter 445 */ 446 public void setSqlStmtCreateFK(String generate_CreateFKStmt) { 447 if (generate_CreateFKStmt.equalsIgnoreCase("true")) { 448 generateSomeSql = true; 449 sqlToGenerate.setElementAt("CreateForeigin", 5); 450 } 451 } 452 453 /*** 454 * This method sets the value of sqlToGenerate parameter. 455 * @param generate_CreateIndexStmt is value of parameter 456 */ 457 public void setSqlStmtCreateIndex(String generate_CreateIndexStmt) { 458 if (generate_CreateIndexStmt.equalsIgnoreCase("true")) { 459 generateSomeSql = true; 460 sqlToGenerate.setElementAt("CreateIndexes", 3); 461 } 462 } 463 464 /*** 465 * This method reads value of sqlToGenerate parameter. 466 * @return value of parameter. 467 */ 468 public Vector getSqlToGenerate() { 469 return sqlToGenerate; 470 } 471 472 /*** 473 * This method sets value of sqlToGenerate parameter. 474 */ 475 public void setSqlToGenerate() { 476 477 if (this.alterTablePrimaryKey.equalsIgnoreCase("false")) { 478 sqlToGenerate.setElementAt(null, 4); 479 } 480 } 481 482 /*** 483 * This method reads value of path parameter. 484 * @return value of parameter. 485 */ 486 public String getPath() { 487 return path; 488 } 489 490 /*** 491 * Construct object InputParameters, and initialise the default value of input parameters. 492 * @throws LoaderException 493 */ 494 public InputParameters(String confJarStructure) throws LoaderException { 495 //initialization InputParameters 496 setDefaultSqlStmt(); 497 searchXmlFile = new SearchXmlFile("relative", path, confJarStructure); 498 } 499 500 /*** 501 * This method sets the value of pathToSourceConf parameter. 502 * @param path_ToSourceConf is the value of parameter. 503 */ 504 public void setPathToSourceConf(String path_ToSourceConf) { 505 pathToSourceConf = path_ToSourceConf; 506 } 507 508 /*** 509 * This method read the value of pathToSourceConf parameter. 510 * @return the value of parameter. 511 */ 512 public String getPathToSourceConf() { 513 return pathToSourceConf; 514 } 515 516 /*** 517 * This method sets the value of sourceType parameter. 518 * @param source_Type is the value of parameter. 519 * @throws LoaderException 520 */ 521 public void setSourceType(String source_Type) throws LoaderException { 522 setLogger(); 523 // if (this.logger != null) { 524 // this.logger.write("full", "\tsetSourceType is started."); 525 // } 526 if (source_Type != null) { 527 if (searchXmlFile.getPathToConf(source_Type) != null) { 528 setPathToSourceConf(searchXmlFile.getPathToConf(source_Type)); 529 sourceType = source_Type; 530 } else { 531 String msg = "This type of source database (" + source_Type + ") is not supported!" + " See documentation!"; 532 LoaderException le = new LoaderException("Exception:", new Exception(msg + "\n")); 533 if (this.logger != null) { 534 this.logger.write("full", "Exception:" + "This type of source database (" + source_Type + ") is not supported!" + " See documentation!"+le.getStackTraceAsString()); 535 } 536 537 throw le; 538 } 539 } 540 // if (this.logger != null) { 541 // this.logger.write("full", "\tsetSourceType is finished."); 542 // } 543 } 544 545 /*** 546 * This method read the value of sourceType parameter. 547 * @return value of parameter. 548 */ 549 public String getSourceType() { 550 return sourceType; 551 } 552 553 /*** 554 * This method sets the value of pathToTargetConf parameter. 555 * @param path_ToTargetConf is the value of parameter. 556 */ 557 public void setPathToTargetConf(String path_ToTargetConf) { 558 pathToTargetConf = path_ToTargetConf; 559 } 560 561 /*** 562 * This method read the value of pathToTargetConf parameter. 563 * @return value of parameter. 564 */ 565 public String getPathToTargetConf() { 566 return pathToTargetConf; 567 } 568 569 /*** 570 * This method sets the value of targetType parameter. 571 * @param target_Type is the value of parameter. 572 * @throws LoaderException 573 */ 574 public void setTargetType(String target_Type) throws LoaderException { 575 setLogger(); 576 // if (this.logger != null) { 577 // this.logger.write("full", "\tsetTargetType is started."); 578 // } 579 if (target_Type != null) { 580 //search the OctopusDBVendors.xml file for defined type of database. 581 if (searchXmlFile.getPathToConf(target_Type) != null) { 582 setPathToTargetConf(searchXmlFile.getPathToConf(target_Type)); 583 targetType = target_Type; 584 setAlterTablePrimaryKey2(pathToTargetConf); 585 } else { 586 String msg = "This type of target database (" + target_Type + ") is not supported!" + " See documentation!"; 587 LoaderException le = new LoaderException("Exception:", new Exception(msg)); 588 if (this.logger != null) { 589 this.logger.write("full", "Exception:" + "This type of target database (" + target_Type + ") is not supported!" + " See documentation!"+le.getStackTraceAsString()); 590 } 591 throw le; 592 } 593 } 594 // if (this.logger != null) { 595 // this.logger.write("full", "\tsetTargetType is finished."); 596 // } 597 } 598 599 private void setAlterTablePrimaryKey2(String pathToTargetConf) throws LoaderException { 600 SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToTargetConf(), getConfJarStructure()); 601 if ((searchXmlFile.getAlterTablePrimaryKey(getTargetDriverName()) != null)) 602 setAlterTablePrimaryKey(searchXmlFile.getAlterTablePrimaryKey(getTargetDriverName())); 603 } 604 605 public void setSourceDriverProperties() throws LoaderException { 606 setLogger(); 607 // if (this.logger != null) { 608 // this.logger.write("full", "\tsetSourceDriverProperties is started."); 609 // } 610 SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToSourceConf(), getConfJarStructure()); 611 Vector tmpVector = searchXmlFile.getFileSystemDatabase(getSourceDriverName()); 612 String fileSystemDatabse = tmpVector.get(0).toString(); 613 String connectionPrefix = tmpVector.get(1).toString(); 614 615 if (fileSystemDatabse.equalsIgnoreCase("true")) { 616 File file = new File(getSourceDataBase()); 617 File fileOut = new File(getGeneratorOutput()); 618 if (!file.isAbsolute()) { 619 try { 620 String main = ""; 621 if (!getGeneratorOutput().equalsIgnoreCase("")) 622 main = fileOut.getCanonicalPath() + System.getProperty("file.separator") + getSourceDataBase(); 623 else 624 main = getSourceDataBase(); 625 626 File mainFile = new File(main); 627 setSourceDataBase(mainFile.getCanonicalPath()); 628 } catch (Exception ex) { 629 LoaderException le = new LoaderException("Exception:" + ex.getMessage(), ex); 630 if (this.logger != null) { 631 this.logger.write("full", "Exception:" + le.getStackTraceAsString()); 632 } 633 634 throw le; 635 //ex.printStackTrace(); 636 } 637 } 638 } 639 // if (this.logger != null) { 640 // this.logger.write("full", "\tsetSourceDriverProperties is finished."); 641 // } 642 } 643 644 public void setTargetDriverProperties() throws LoaderException { 645 setLogger(); 646 // if (this.logger != null) { 647 // this.logger.write("full", "\tsetTargetDriverProperties is started."); 648 // } 649 SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", getPathToTargetConf(), getConfJarStructure()); 650 try { 651 this.maxConstraintLength = searchXmlFile.getMaxConstraintLength(getTargetDriverName()); 652 } catch (Exception ex) { 653 LoaderException le = new LoaderException("Exception:" + ex.getMessage(), ex); 654 this.logger.write("full", "Exception:" + le.getStackTraceAsString()); 655 throw le; 656 } 657 // if (this.logger != null) { 658 // this.logger.write("full", "\tsetTargetDriverProperties is finished."); 659 // } 660 661 } 662 663 public String getMaxConstraintLength() { 664 return this.maxConstraintLength; 665 } 666 667 /*** 668 * This method read the value of targetType parameter. 669 * @return value of parameter. 670 */ 671 public String getTargetType() { 672 return targetType; 673 } 674 675 /*** 676 * This method sets the value of sourceDataBase parameter. 677 * @param source_DataBase is the value of parameter. 678 * @throws LoaderException 679 */ 680 public void setSourceDataBase(String source_DataBase) throws LoaderException { 681 setLogger(); 682 // if (this.logger != null) { 683 // this.logger.write("full", "\tsetSourceDataBase is started."); 684 // } 685 if (source_DataBase != null) { 686 if (this.sourceDriverName.equalsIgnoreCase("microsoft")) { 687 int num1 = source_DataBase.indexOf("SelectMethod="); 688 int num2 = source_DataBase.indexOf("selectMethod="); 689 if (num2 != -1) { 690 // source_DataBase=source_DataBase.replaceFirst("selectMethod=","SelectMethod="); 691 if (source_DataBase.indexOf("selectMethod=") != -1) 692 source_DataBase = Utils.replaceAll(source_DataBase, "selectMethod=", "SelectMethod="); 693 694 num1 = 0; 695 } 696 if (num1 != -1) 697 sourceDataBase = source_DataBase; 698 else 699 sourceDataBase = source_DataBase + ";SelectMethod=cursor"; 700 } else 701 sourceDataBase = source_DataBase; 702 } else { 703 String msg = "You must enter the place where is source database is placed (param -sdb)!"; 704 LoaderException le = new LoaderException("Exception:", new Exception(msg)); 705 this.logger.write("full", "Exception:" + "You must enter the place where is source database is placed (param -sdb)!"+le.getStackTraceAsString()); 706 throw le; 707 } 708 // if (this.logger != null) { 709 // this.logger.write("full", "\tsetSourceDataBase is finished."); 710 // } 711 } 712 713 /*** 714 * This method read the value of sourceDataBase parameter. 715 * @return value of parameter. 716 */ 717 public String getSourceDataBase() { 718 return sourceDataBase; 719 } 720 721 /*** 722 * This method sets the value of targetDataBase parameter. 723 * @param target_DataBase is the value of the parameter. 724 * @throws LoaderException 725 */ 726 public void setTargetDataBase(String target_DataBase) throws LoaderException { 727 setLogger(); 728 // if (this.logger != null) { 729 // this.logger.write("full", "\tsetTargetDataBase is started."); 730 // } 731 if (target_DataBase != null) { 732 if (this.targetDriverName.equalsIgnoreCase("microsoft")) { 733 int num1 = target_DataBase.indexOf("SelectMethod="); 734 int num2 = target_DataBase.indexOf("selectMethod="); 735 if (num2 != -1) { 736 // target_DataBase=target_DataBase.replaceFirst("selectMethod=","SelectMethod="); 737 if (target_DataBase.indexOf("selectMethod=") != -1) 738 target_DataBase = Utils.replaceAll(target_DataBase, "selectMethod=", "SelectMethod="); 739 num1 = 0; 740 } 741 if (num1 != -1) 742 targetDataBase = target_DataBase; 743 else 744 targetDataBase = target_DataBase + ";SelectMethod=cursor"; 745 } else 746 targetDataBase = target_DataBase; 747 } else { 748 String msg = "You must enter the place where is target database is placed (param -tdb)!"; 749 LoaderException le = new LoaderException("Exception:", new Exception(msg)); 750 if (this.logger != null) { 751 this.logger.write("full", "Exception:" + "You must enter the place where is target database is placed (param -tdb)!"+le.getStackTraceAsString()); 752 } 753 throw le; 754 } 755 // if (this.logger != null) { 756 // this.logger.write("full", "\tsetTargetDataBase is finished."); 757 // } 758 } 759 760 /*** 761 * This method read the value of targetDataBase parameter. 762 * @return value of parameter. 763 */ 764 public String getTargetDataBase() { 765 return targetDataBase; 766 } 767 768 /*** 769 * This method sets the value of valueMode parameter. 770 * @param value_Mode is the value of the parameter. 771 * @throws LoaderException 772 */ 773 public void setValueMode(String value_Mode) throws LoaderException { 774 setLogger(); 775 // if (this.logger != null) { 776 // this.logger.write("full", "\tsetValueMode is started."); 777 // } 778 if (value_Mode != null) { 779 if (value_Mode.equalsIgnoreCase("copy")) { 780 valueMode = "Overwrite"; 781 } else if (value_Mode.equalsIgnoreCase("sync")) { 782 valueMode = "Update"; 783 } else { 784 String msg = "The possible value of value modes (param -m) are 'copy' or 'sync'.!"; 785 LoaderException le = new LoaderException("Exception:", new Exception(msg)); 786 if (this.logger != null) { 787 this.logger.write("full", "Exception:" + "The possible value of value modes (param -m) are 'copy' or 'sync'.!"+le.getStackTraceAsString()); 788 } 789 throw le; 790 } 791 } 792 // if (this.logger != null) { 793 // this.logger.write("full", "\tsetValueMode is finished."); 794 // } 795 } 796 797 /*** 798 * This method read the value of valueMode parameter. 799 * @return value of parameter. 800 */ 801 public String getValueMode() { 802 return valueMode; 803 } 804 805 /*** 806 * This method sets the value of generatorOutput parameter. 807 * @param generator_Output is the value of the parameter. 808 */ 809 public void setGeneratorOutput(String generator_Output) { 810 if (generator_Output != null) 811 generatorOutput = generator_Output; 812 } 813 814 /*** 815 * This method read the value of generatorOutput parameter. 816 * @return value of parameter. 817 */ 818 public String getGeneratorOutput() { 819 return generatorOutput; 820 } 821 822 /*** 823 * This method sets the value of sourceUser parameter. 824 * @param source_User is the value of the parameter. 825 */ 826 public void setSourceUser(String source_User) { 827 if (source_User != null) 828 sourceUser = source_User; 829 } 830 831 /*** 832 * This method read the value of sourceUser parameter. 833 * @return value of parameter. 834 */ 835 public String getSourceUser() { 836 return sourceUser; 837 } 838 839 /*** 840 * This method sets the value of sourcePassword parameter. 841 * @param source_Password is the value of the parameter. 842 */ 843 public void setSourcePassword(String source_Password) { 844 if (source_Password != null) 845 sourcePassword = source_Password; 846 847 } 848 849 /*** 850 * This method read the value of sourcePassword parameter. 851 * @return value of parameter. 852 */ 853 public String getSourcePassword() { 854 return sourcePassword; 855 } 856 857 /*** 858 * This method sets the value of targetUser parameter. 859 * @param target_User is the value of the parameter. 860 */ 861 public void setTargetUser(String target_User) { 862 if (target_User != null) 863 targetUser = target_User; 864 } 865 866 /*** 867 * This method read the value of targetUser parameter. 868 * @return value of parameter. 869 */ 870 public String getTargetUser() { 871 return targetUser; 872 } 873 874 /*** 875 * This method sets the value of targetPassword parameter. 876 * @param target_Password is the value of the parameter. 877 */ 878 public void setTargetPassword(String target_Password) { 879 if (target_Password != null) 880 targetPassword = target_Password; 881 } 882 883 /*** 884 * This method read the value of targetPassword parameter. 885 * @return value of parameter. 886 */ 887 public String getTargetPassword() { 888 return targetPassword; 889 } 890 891 /*** 892 * This method sets the value of sourceDriverName parameter. 893 * @param source_DriverName is the value of parameter. 894 */ 895 public void setSourceDriverName(String source_DriverName) { 896 if (source_DriverName != null) 897 sourceDriverName = source_DriverName; 898 } 899 900 /*** 901 * This method read the value of sourceDriverName parameter. 902 * @return value of parameter. 903 */ 904 public String getSourceDriverName() { 905 return sourceDriverName; 906 } 907 908 /*** 909 * This method sets the value of targetDriverName parameter. 910 * @param target_DriverName is the value of the parameter. 911 */ 912 public void setTargetDriverName(String target_DriverName) { 913 if (target_DriverName != null) 914 targetDriverName = target_DriverName; 915 } 916 917 /*** 918 * This method read the value of targetDriverName parameter. 919 * @return value of parameter. 920 */ 921 public String getTargetDriverName() { 922 return targetDriverName; 923 } 924 925 /*** 926 * This method sets the value of domlPath parameter. 927 * @param doml_Path is the value of the parameter. 928 */ 929 public void setDomlPath(String doml_Path) { 930 if (doml_Path != null) 931 domlPath = doml_Path; 932 } 933 934 /*** 935 * This method read the value of domlPath parameter. 936 * @return value of parameter. 937 */ 938 public String getDomlPath() { 939 return domlPath; 940 } 941 942 /*** 943 * This method sets the value of packageName parameter. 944 * @param package_Name is the value of parameter. 945 * @throws LoaderException 946 */ 947 public void setPackageName(String package_Name) throws LoaderException { 948 setLogger(); 949 // if (this.logger != null) { 950 // this.logger.write("full", "\tsetPackageName is started."); 951 // } 952 if (generateDoml.equalsIgnoreCase("true")) { 953 if (package_Name != null) { 954 >packageName = package_Name; 955 } else { 956 String msg = "Sorry, but you must enter the package name (param -pack) for the doml file!"; 957 LoaderException le = new LoaderException("Exception", new Exception(msg)); 958 if (this.logger != null) { 959 this.logger.write("full", "Exception:" + "Sorry, but you must enter the package name (param -pack) for the doml file!"+le.getStackTraceAsString()); 960 } 961 throw le; 962 } 963 } 964 // if (this.logger != null) { 965 // this.logger.write("full", "\tsetPackageName is finished."); 966 // } 967 } 968 969 /*** 970 * This method read the value of packageName parameter. 971 * @return value of parameter. 972 */ 973 public String getPackageName() { 974 return packageName; 975 } 976 977 /*** 978 * This method sets the value of alterTablePrimaryKey parameter. 979 * @param alter_TablePrimaryKey is the value of parameter. 980 */ 981 public void setAlterTablePrimaryKey(String alter_TablePrimaryKey) { 982 alterTablePrimaryKey = alter_TablePrimaryKey; 983 } 984 985 /*** 986 * This method read the value of alterTablePrimaryKey parameter. 987 * @return value of parameter.ss 988 */ 989 public String getAlterTablePrimaryKey() { 990 return alterTablePrimaryKey; 991 } 992 993 /*** 994 * This method set excluded tables 995 * @param value 996 */ 997 public void setExcludedTables(String value) { 998 StringTokenizer st = new StringTokenizer(value, ","); 999 this.excludedTables = new String[st.countTokens()]; 1000 int i = 0; 1001 while (st.hasMoreTokens()) { 1002 this.excludedTables[i] = st.nextToken(); 1003 i++; 1004 } 1005 } 1006 1007 /*** 1008 *This method returns excluded tables 1009 * @return String[] with excluded tables 1010 */ 1011 public String[] getExcludedTables() { 1012 return this.excludedTables; 1013 } 1014 1015 /*** 1016 *This method set parameter confJar 1017 */ 1018 public void setConfJarStructure(String confJarStructure) { 1019 if (confJarStructure != null) 1020 this.confJarStructure = confJarStructure; 1021 } 1022 1023 /*** 1024 *This method returns string with path to conf in jar 1025 * @return String 1026 */ 1027 public String getConfJarStructure() { 1028 return this.confJarStructure; 1029 } 1030 /*** 1031 * This method will set logger object 1032 * @param logger 1033 */ 1034 private void setLogger() { 1035 this.logger = StandardLogger.getCentralLogger(); 1036 } 1037 }

This page was automatically generated by Maven