1 18 19 package org.webdocwf.util.loader; 20 21 import java.io.*; 22 23 import javax.xml.parsers.*; 24 import org.w3c.dom.*; 25 import org.webdocwf.util.loader.logging.*; 26 import java.util.Hashtable ; 27 28 34 public class ConfigReader { 35 36 private Logger logger; 37 private String strVendorFileName = null; 38 private String strDriverClassName = ""; 39 private int iFirstColumnResult = 1; 40 private boolean bRequiredUser = false; 41 private boolean bEnableJumpResult = false; 42 private boolean bAfterLastRow = true; 43 private boolean bEnableOrderBy = false; 44 private boolean bRowCountEnabled = false; 45 private boolean bSetFetchSizeEnabled = false; 46 private String oidDbType = ""; 47 private String versionDbType = ""; 48 private String oidColumnName = "oid"; 49 private String versionColumnName = "version"; 50 private String dateFormat = "yyyy-MM-dd"; 53 54 private boolean bSetCursorNameEnabled = false; 55 private boolean bSetEmptyStringAsNull = false; 56 private boolean bReadingOrderRelevant = false; 57 private boolean bGetColumnsSupported = false; 58 private boolean bSetMaxRowsSupported = false; 59 private String bConnectionPrefix = ""; 60 private boolean bFileSystemDatabase = false; 61 private String confJarStructure = ""; 62 private boolean useSeparateConfFiles = false; 63 private Hashtable javaTypeMapp = new Hashtable (); 64 private Hashtable isNumberMapp = new Hashtable (); 66 private Hashtable isBinaryObjectMap = new Hashtable (); 67 private Hashtable isDateMap = new Hashtable (); 68 private Hashtable isWithNMap = new Hashtable (); 69 private String currentDriverName = ""; 71 private String currentDatabaseName = ""; 72 73 private static final String BYTE_ARRAY="1"; 74 private static final String JAVA_MATH_BIGDECIMAL="2"; 75 private static final String JAVA_LANG_DOUBLE="3"; 76 private static final String JAVA_LANG_FLOAT="4"; 77 private static final String JAVA_LANG_INTEGER="5"; 78 private static final String JAVA_LANG_LONG="6"; 79 private static final String JAVA_LANG_SHORT="7"; 80 private static final String JAVA_LANG_STRING="8"; 81 private static final String JAVA_SQL_DATE="9"; 82 private static final String JAVA_SQL_TIME="10"; 83 private static final String JAVA_SQL_TIMESTAMP="11"; 84 private static final String JAVA_LANG_BOOLEAN="12"; 85 private static final String JAVA_LANG_BYTE="13"; 86 private static final String JAVA_LANG_OBJECT="14"; 87 88 89 public static final String SPACE_ESCAPE = "__"; 90 91 99 public void readConfigValues(String dbVendor, String driverName, 100 String strType) throws LoaderException { 101 Document doc = null; 102 this.logger.write("full", "\treadConfigValues method is started."); 103 if(this.javaTypeMapp.size()>0) 104 this.javaTypeMapp.clear(); 105 try { 106 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 107 DocumentBuilder db = null; 108 db = dbf.newDocumentBuilder(); 109 110 String OCTOPUS_HOME = System.getProperty("OCTOPUS_HOME"); 111 String databaseConfFile = null; 112 InputStream confFile = null; 113 File configFile = null; 114 115 if (dbVendor.equalsIgnoreCase("mssql")) 117 dbVendor = "MSQL"; 118 if (dbVendor.equalsIgnoreCase("Hsqldb")) 119 dbVendor = "HypersonicSQL"; 120 121 if (this.strVendorFileName != null && !this.strVendorFileName.equals("")) { 122 configFile = new File(this.strVendorFileName); 123 if (configFile.exists()) { 124 doc = db.parse(configFile); 125 } 126 } else { 127 if (OCTOPUS_HOME != null) { 128 if (! (OCTOPUS_HOME.endsWith("\\") || OCTOPUS_HOME.endsWith("/"))) 129 OCTOPUS_HOME += "/"; 130 configFile = new File(OCTOPUS_HOME + "conf/OctopusDBVendors.xml"); 131 if (configFile.exists()) 132 doc = db.parse(configFile); 133 } else { 134 if (this.useSeparateConfFiles) { 135 confFile = this.getClass().getClassLoader().getResourceAsStream( 136 this.confJarStructure + "/OctopusDBVendors.xml"); 137 } else { 138 confFile = this.getClass().getClassLoader().getResourceAsStream( 139 "xml/conf/OctopusDBVendors.xml"); 140 } 141 if (confFile != null) 142 doc = db.parse(confFile); 143 } 144 } 145 if (doc != null) { 146 NodeList tagConfFile = doc.getElementsByTagName("Vendor"); 147 out:for (int i = 0; i < tagConfFile.getLength(); i++) { 148 Node nodeMain = tagConfFile.item(i); 149 NamedNodeMap attrs = nodeMain.getAttributes(); 150 Node nodeDriver = attrs.getNamedItem("name"); 151 if (nodeDriver != null && 152 nodeDriver.getFirstChild().getNodeValue(). 153 equalsIgnoreCase(dbVendor)) { 154 databaseConfFile = nodeMain.getFirstChild().getNodeValue(); 155 break out; 156 } 157 } 158 } else { 159 if (strType.equalsIgnoreCase("source")) 161 databaseConfFile = "CsvConf.xml"; 162 else 163 databaseConfFile = "MSQLConf.xml"; 164 } 165 166 doc = null; 167 if (OCTOPUS_HOME == null) { 168 if (this.useSeparateConfFiles) { 169 confFile = getClass().getClassLoader().getResourceAsStream( 170 this.confJarStructure + "/" + databaseConfFile); 171 } else { 172 confFile = getClass().getClassLoader().getResourceAsStream( 173 "xml/conf/" + databaseConfFile); 174 } 175 if (confFile != null) 176 doc = db.parse(confFile); 177 } else { 178 179 if (databaseConfFile != null) { 180 configFile = new File(databaseConfFile); 181 if(!configFile.exists()) { 183 configFile = new File( OCTOPUS_HOME + "/conf/" + databaseConfFile ); 184 } 185 } 186 else { 187 configFile = new File("null"); 189 } 190 191 if (configFile.exists()) { 192 doc = db.parse(configFile); 193 } 194 } 195 196 if (doc == null) { 197 if (strType.equalsIgnoreCase("source")) { 198 this.logger.write("normal", 199 "Failed to load config file for source database, load default configuration."); 200 this.strDriverClassName = "org.relique.jdbc.csv.CsvDriver"; 201 this.iFirstColumnResult = 1; 202 this.bRequiredUser = false; 203 this.bEnableJumpResult = false; 204 this.bAfterLastRow = true; 205 this.bEnableOrderBy = false; 206 if (driverName == null || driverName.equals("")) 207 driverName = "csv"; 208 this.bFileSystemDatabase = true; 209 } else { 210 this.logger.write("normal", 211 "Failed to load config file for target database, load default configuration."); 212 this.strDriverClassName = "com.newatlanta.jturbo.driver.Driver"; 213 this.iFirstColumnResult = 1; 214 this.bRequiredUser = true; 215 if (driverName == null || driverName.equals("")) 216 driverName = "jTurbo"; 217 } 218 } 219 } 220 catch (Exception e) { 221 this.logger.write("normal", "Sorry, an error occurred: " + e.getMessage()); 222 LoaderException le = new LoaderException("Exception: ", (Throwable )e); 223 throw le; 224 } 225 226 String strDriverName = ""; 227 if (doc != null) { 228 if (driverName == null || driverName.equalsIgnoreCase("")) { 229 if (dbVendor.equalsIgnoreCase("MSQL")) 230 driverName = "jTurbo"; 231 } 232 233 234 if (doc.getElementsByTagName("OidDbType").getLength()!=0){ 236 NodeList tagOidDbType = doc.getElementsByTagName("OidDbType"); 237 Node tempChildNode = tagOidDbType.item(0).getFirstChild(); 238 if (tempChildNode != null){ 239 this.oidDbType = tagOidDbType.item(0).getFirstChild().getNodeValue(); 240 }else{ 241 LoaderException le = new LoaderException("You must set data in tag <OidDbType> in conf file for database vendor!"); 242 throw le; 243 } 244 }else{ 245 LoaderException le = new LoaderException("Tag <OidDbType> doesn't exist in conf file for database vendor. You must set this tag with appropriate value."); 246 throw le; 247 } 248 249 if (doc.getElementsByTagName("VersionDbType").getLength()!=0){ 251 NodeList tagVersionDbType = doc.getElementsByTagName("VersionDbType"); 252 Node tempChildNode = tagVersionDbType.item(0).getFirstChild(); 253 if (tempChildNode != null){ 254 this.versionDbType = tagVersionDbType.item(0).getFirstChild().getNodeValue(); 255 }else{ 256 LoaderException le = new LoaderException("You must set data in tag <VersionDbType>in conf file for database vendor!"); 257 throw le; 258 } 259 }else{ 260 LoaderException le = new LoaderException("Tag <VersionDbType> doesn't exist in conf file for database vendor. You must set this tag with appropriate value."); 261 throw le; 262 } 263 264 if(doc.getElementsByTagName("OidDbColumnName").getLength()!=0){ 266 NodeList tagOidColumnName = doc.getElementsByTagName("OidDbColumnName"); 267 Node tempChildNode = tagOidColumnName.item(0).getFirstChild(); 268 if (tempChildNode != null ){ 269 this.oidColumnName = tagOidColumnName.item(0).getFirstChild().getNodeValue(); 270 }else{ 271 LoaderException le = new LoaderException("You must set data in tag <OidDbColumnName> in conf file for database vendor."); 272 throw le; 273 } 274 }else{ 275 LoaderException le = new LoaderException("Tag <OidDbColumnName> doesn't exist in conf file for database vendor.You must set this tag with appropriate value."); 276 throw le; 277 } 278 279 if(doc.getElementsByTagName("VersionDbColumnName").getLength()!=0){ 281 NodeList tagVersionColumnName = doc.getElementsByTagName("VersionDbColumnName"); 282 Node tempChildNode = tagVersionColumnName.item(0).getFirstChild(); 283 if (tempChildNode != null ){ 284 this.versionColumnName = tagVersionColumnName.item(0).getFirstChild().getNodeValue(); 285 }else{ 286 LoaderException le = new LoaderException("You must set data in tag <VersionDbColumnName> in conf file for database vendor."); 287 throw le; 288 } 289 }else{ 290 LoaderException le = new LoaderException("Tag <VersionDbColumnName> doesn't exist in conf file for database vendor. You must set this tag with appropriate value."); 291 throw le; 292 } 293 294 if (doc.getElementsByTagName("DateFormat").getLength()!=0){ 296 NodeList tagDateFormat = doc.getElementsByTagName("DateFormat"); 297 Node tempChildNode = tagDateFormat.item(0).getFirstChild(); 298 if (tempChildNode != null ){ 299 this.dateFormat =tagDateFormat.item(0).getFirstChild().getNodeValue(); 300 } 301 }else{ 302 LoaderException le = new LoaderException("Tag <DateFormat> doesn't exist in conf file for database vendor. You must set this tag with appropriate value."); 303 throw le; 304 } 305 306 NodeList tagJavaType = doc.getElementsByTagName("SQLType"); 308 Node nodeJavaTMain = tagJavaType.item(0); 309 NodeList dataTypeNodes = nodeJavaTMain.getChildNodes(); 310 String nodeAttrIsNumber = ""; 311 String nodeAttrIsBinary = ""; 312 String nodeAttrIsDate = ""; 313 String nodeAttrIsWithN = ""; 314 for (int i = 0; i < dataTypeNodes.getLength(); i++) { 315 if (dataTypeNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { 316 String nodeName = dataTypeNodes.item(i).getNodeName(); 317 String nodeAttr = dataTypeNodes.item(i).getAttributes() 318 .getNamedItem("javaType").getNodeValue(); 319 if (dataTypeNodes.item(i).getAttributes().getNamedItem("isNumber")!=null){ 321 nodeAttrIsNumber = dataTypeNodes.item(i).getAttributes().getNamedItem("isNumber").getNodeValue(); 322 }else{ 323 nodeAttrIsNumber = "false"; 324 } 325 326 if (dataTypeNodes.item(i).getAttributes().getNamedItem("isBinary")!=null){ 327 nodeAttrIsBinary = dataTypeNodes.item(i).getAttributes().getNamedItem("isBinary").getNodeValue(); 328 }else{ 329 nodeAttrIsBinary = "false"; 330 } 331 332 if (dataTypeNodes.item(i).getAttributes().getNamedItem("isDate")!=null){ 333 nodeAttrIsDate = dataTypeNodes.item(i).getAttributes().getNamedItem("isDate").getNodeValue(); 334 }else{ 335 nodeAttrIsDate = "false"; 336 } 337 338 if (dataTypeNodes.item(i).getAttributes().getNamedItem("isWithN")!=null){ 339 nodeAttrIsWithN = dataTypeNodes.item(i).getAttributes().getNamedItem("isWithN").getNodeValue(); 340 }else{ 341 nodeAttrIsWithN = "false"; 342 } 343 344 345 String nodeAttrInt; 347 if (nodeAttr.equalsIgnoreCase("byte[]")) 348 nodeAttrInt = BYTE_ARRAY; 349 else if (nodeAttr.equalsIgnoreCase("java.math.BigDecimal")) 350 nodeAttrInt = JAVA_MATH_BIGDECIMAL; 351 else if (nodeAttr.equalsIgnoreCase("java.lang.Double")) 352 nodeAttrInt = JAVA_LANG_DOUBLE; 353 else if (nodeAttr.equalsIgnoreCase("java.lang.Float")) 354 nodeAttrInt = JAVA_LANG_FLOAT; 355 else if (nodeAttr.equalsIgnoreCase("java.lang.Integer")) 356 nodeAttrInt = JAVA_LANG_INTEGER; 357 else if (nodeAttr.equalsIgnoreCase("java.lang.Long")) 358 nodeAttrInt = JAVA_LANG_LONG; 359 else if (nodeAttr.equalsIgnoreCase("java.lang.Short")) 360 nodeAttrInt = JAVA_LANG_SHORT; 361 else if (nodeAttr.equalsIgnoreCase("java.lang.String")) 362 nodeAttrInt = JAVA_LANG_STRING; 363 else if (nodeAttr.equalsIgnoreCase("java.sql.Date")) 364 nodeAttrInt = JAVA_SQL_DATE; 365 else if (nodeAttr.equalsIgnoreCase("java.sql.Time")) 366 nodeAttrInt = JAVA_SQL_TIME; 367 else if (nodeAttr.equalsIgnoreCase("java.sql.Timestamp")) 368 nodeAttrInt = JAVA_SQL_TIMESTAMP; 369 else if (nodeAttr.equalsIgnoreCase("java.lang.Boolean")) 370 nodeAttrInt = JAVA_LANG_BOOLEAN; 371 else if (nodeAttr.equalsIgnoreCase("java.lang.Byte")) 372 nodeAttrInt = JAVA_LANG_BYTE; 373 else 374 nodeAttrInt = JAVA_LANG_OBJECT; 375 376 Utils.replaceAll(nodeName,ConfigReader.SPACE_ESCAPE," "); 378 379 isNumberMapp.put(nodeName.toLowerCase(), nodeAttrIsNumber); 380 381 isBinaryObjectMap.put(nodeName.toLowerCase(), nodeAttrIsBinary); 382 383 isDateMap.put(nodeName.toLowerCase(), nodeAttrIsDate); 384 385 isWithNMap.put(nodeName.toLowerCase(), nodeAttrIsWithN); 386 387 javaTypeMapp.put(nodeName, nodeAttrInt); 388 } 389 } 390 NodeList tagDbVendor = doc.getElementsByTagName("Driver"); 392 out:for (int i = 0; i < tagDbVendor.getLength(); i++) { 393 Node nodeMain = tagDbVendor.item(i); 394 NamedNodeMap attrs = nodeMain.getAttributes(); 395 Node nodeDriver = attrs.getNamedItem("name"); 396 if (nodeDriver != null) { 397 strDriverName = nodeDriver.getNodeValue(); 398 if (driverName == null || driverName.equalsIgnoreCase("")) 399 driverName = strDriverName; 400 if (! (driverName == null || driverName.equalsIgnoreCase(""))) { 401 if (strDriverName.equalsIgnoreCase(driverName)) { 402 NodeList configNodes = nodeMain.getChildNodes(); 403 for (int j = 0; j < configNodes.getLength(); j++) { 404 if (configNodes.item(j).getNodeName().equalsIgnoreCase("FirstColumnResult")) { 405 NamedNodeMap configAttributes = null; 406 Node nodeValue = null; 407 configAttributes = configNodes.item(j).getAttributes(); 408 if (configAttributes != null) { 409 if ( (nodeValue = configAttributes.getNamedItem("value")) != null) { 410 this.iFirstColumnResult = Integer.parseInt(nodeValue.getNodeValue()); 411 } 412 } 413 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase("RequiredUser")) { 414 NamedNodeMap configAttributes = null; 415 Node nodeValue = null; 416 configAttributes = configNodes.item(j).getAttributes(); 417 if (configAttributes != null) { 418 if ( (nodeValue = configAttributes.getNamedItem("value")) != null) { 419 this.bRequiredUser = (new Boolean (nodeValue.getNodeValue())).booleanValue(); 420 } 421 } 422 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( 423 "EnableJumpInResult")) { 424 NamedNodeMap configAttributes = null; 425 Node nodeValue = null; 426 configAttributes = configNodes.item(j).getAttributes(); 427 if (configAttributes != null) { 428 if ( (nodeValue = configAttributes.getNamedItem("value")) 429 != null) { 430 this.bEnableJumpResult = (new Boolean (nodeValue. 431 getNodeValue())).booleanValue(); 432 } 433 } 434 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "Connection")) { 436 NamedNodeMap configAttributes = null; 437 Node nodeValue = null; 438 configAttributes = configNodes.item(j).getAttributes(); 439 if (configAttributes != null) { 440 if ( (nodeValue = configAttributes.getNamedItem("value")) 441 != null) { 442 this.bConnectionPrefix = nodeValue.getNodeValue(); 443 } 444 } 445 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "AfterLastRow")) { 447 NamedNodeMap configAttributes = null; 448 Node nodeValue = null; 449 configAttributes = configNodes.item(j).getAttributes(); 450 if (configAttributes != null) { 451 if ( (nodeValue = configAttributes.getNamedItem("value")) 452 != null) { 453 this.bAfterLastRow = (new Boolean (nodeValue.getNodeValue())). 454 booleanValue(); 455 } 456 } 457 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( 458 "EnableOrderBy")) { 459 NamedNodeMap configAttributes = null; 460 Node nodeValue = null; 461 configAttributes = configNodes.item(j).getAttributes(); 462 if (configAttributes != null) { 463 if ( (nodeValue = configAttributes.getNamedItem("value")) 464 != null) { 465 this.bEnableOrderBy = (new Boolean (nodeValue.getNodeValue())). 466 booleanValue(); 467 } 468 } 469 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( 470 "ClassName")) { 471 NamedNodeMap configAttributes = null; 472 Node nodeValue = null; 473 configAttributes = configNodes.item(j).getAttributes(); 474 if (configAttributes != null) { 475 if ( (nodeValue = configAttributes.getNamedItem("value")) 476 != null) { 477 this.strDriverClassName = (nodeValue.getNodeValue()). 478 toString(); 479 } 480 } 481 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "RowCountEnabled")) { 483 NamedNodeMap configAttributes = null; 484 Node nodeValue = null; 485 configAttributes = configNodes.item(j).getAttributes(); 486 if (configAttributes != null) { 487 if ( (nodeValue = configAttributes.getNamedItem("value")) 488 != null) { 489 this.bRowCountEnabled = (new Boolean (nodeValue. 490 getNodeValue())).booleanValue(); 491 } 492 } 493 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "SetFetchSizeEnabled")) { 495 NamedNodeMap configAttributes = null; 496 Node nodeValue = null; 497 configAttributes = configNodes.item(j).getAttributes(); 498 if (configAttributes != null) { 499 if ( (nodeValue = configAttributes.getNamedItem("value")) 500 != null) { 501 this.bSetFetchSizeEnabled = (new Boolean (nodeValue. 502 getNodeValue())).booleanValue(); 503 } 504 } 505 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "SetCursorNameEnabled")) { 507 NamedNodeMap configAttributes = null; 508 Node nodeValue = null; 509 configAttributes = configNodes.item(j).getAttributes(); 510 if (configAttributes != null) { 511 if ( (nodeValue = configAttributes.getNamedItem("value")) 512 != null) { 513 this.bSetCursorNameEnabled = (new Boolean (nodeValue. 514 getNodeValue())).booleanValue(); 515 } 516 } 517 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "SetEmptyStringAsNull")) { 519 NamedNodeMap configAttributes = null; 520 Node nodeValue = null; 521 configAttributes = configNodes.item(j).getAttributes(); 522 if (configAttributes != null) { 523 if ( (nodeValue = configAttributes.getNamedItem("value")) 524 != null) { 525 this.bSetEmptyStringAsNull = (new Boolean (nodeValue. 526 getNodeValue())).booleanValue(); 527 } 528 } 529 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "ReadingOrderRelevant")) { 531 NamedNodeMap configAttributes = null; 532 Node nodeValue = null; 533 configAttributes = configNodes.item(j).getAttributes(); 534 if (configAttributes != null) { 535 if ( (nodeValue = configAttributes.getNamedItem("value")) 536 != null) { 537 this.bReadingOrderRelevant = (new Boolean (nodeValue. 538 getNodeValue())).booleanValue(); 539 } 540 } 541 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "FileSystemDatabase")) { 543 NamedNodeMap configAttributes = null; 544 Node nodeValue = null; 545 configAttributes = configNodes.item(j).getAttributes(); 546 if (configAttributes != null) { 547 if ( (nodeValue = configAttributes.getNamedItem("value")) 548 != null) { 549 this.bFileSystemDatabase = (new Boolean (nodeValue. 550 getNodeValue())).booleanValue(); 551 } 552 } 553 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "GetColumnsSupported")) { 555 NamedNodeMap configAttributes = null; 556 Node nodeValue = null; 557 configAttributes = configNodes.item(j).getAttributes(); 558 if (configAttributes != null) { 559 if ( (nodeValue = configAttributes.getNamedItem("value")) 560 != null) { 561 this.bGetColumnsSupported = (new Boolean (nodeValue. 562 getNodeValue())).booleanValue(); 563 } 564 } 565 } else if (configNodes.item(j).getNodeName().equalsIgnoreCase( "SetMaxRowsSupported")) { 567 NamedNodeMap configAttributes = null; 568 Node nodeValue = null; 569 configAttributes = configNodes.item(j).getAttributes(); 570 if (configAttributes != null) { 571 if ( (nodeValue = configAttributes.getNamedItem("value")) 572 != null) { 573 this.bSetMaxRowsSupported = (new Boolean (nodeValue. 574 getNodeValue())).booleanValue(); 575 } 576 } 577 } 578 579 } break out; 581 } 582 } 583 } 584 } 585 } 586 this.logger.write("full", "\treadConfigValues method is finished."); 587 } 588 589 593 public Hashtable getJavaTypeMapings() { 594 return this.javaTypeMapp; 595 } 596 600 public Hashtable getIsNumberMapp() { 601 return this.isNumberMapp; 602 } 603 604 609 public boolean isNumber(String s) throws LoaderException{ 610 if( s != null ) 611 s = s.toLowerCase(); 612 boolean isNumber = false; 613 if (this.isNumberMapp.containsKey(s)){ 620 Object bValue = this.isNumberMapp.get(s); 621 if( bValue != null && (bValue.toString()).equalsIgnoreCase("true")) { 622 return true; 624 } 625 }else{ 626 LoaderException le = new LoaderException("Exception:",new Exception ("Type "+s+" is not supported. You must add it in conf file for this database vendor.")); 627 throw le; 628 } 629 return isNumber; 630 631 } 632 633 638 public boolean isBinaryObject(String s) throws LoaderException{ 639 if( s != null ) 640 s = s.toLowerCase(); 641 boolean isBinaryObject = false; 642 if (this.isBinaryObjectMap.containsKey(s)){ 650 651 Object bValue = this.isBinaryObjectMap.get(s); 652 if( bValue != null && (bValue.toString()).equalsIgnoreCase("true")) { 653 return true; 655 } 656 }else{ 657 LoaderException le = new LoaderException("Exception:",new Exception ("Type "+s+" is not supported. You must add it in conf file for this database vendor.")); 658 throw le; 659 } 660 return isBinaryObject; 661 662 } 663 668 public boolean isDate(String s) throws LoaderException{ 669 if (s != null) 670 s = s.toLowerCase(); 671 boolean isDate = false; 672 if (this.isDateMap.containsKey(s)){ 680 Object dValue = this.isDateMap.get(s); 681 if ((dValue != null) && (dValue.toString()).equalsIgnoreCase("true")){ 682 return true; 684 } 685 686 }else{ 687 LoaderException le = new LoaderException("Exception:",new Exception ("Type "+s+" is not supported. You must add it in conf file for this database vendor.")); 688 throw le; 689 } 690 return isDate; 691 692 } 693 694 699 public boolean isWithN(String s) throws LoaderException{ 700 if( s != null ) 701 s = s.toLowerCase(); 702 boolean isWithN = false; 703 if (this.isWithNMap.containsKey(s)){ 707 Object bValue = this.isWithNMap.get(s); 708 if( bValue != null && (bValue.toString()).equalsIgnoreCase("true")) { 709 return true; 710 } 711 }else{ 712 LoaderException le = new LoaderException("Exception:",new Exception ("Type "+s+" is not supported. You must add it in conf file for this database vendor.")); 713 throw le; 714 } 715 return isWithN; 716 717 } 718 719 720 724 public boolean getColumnsSupported() { 725 return this.bGetColumnsSupported; 726 } 727 731 public boolean getMaxRowsSupported() { 732 return this.bSetMaxRowsSupported; 733 } 734 735 739 public String getOidColumnName() { 740 return this.oidColumnName; 741 } 742 743 747 public String getVersionColumnName() { 748 return this.versionColumnName; 749 } 750 751 755 public String getConnectionPrefix() { 756 return this.bConnectionPrefix; 757 } 758 759 763 public boolean getReadingOrderRelevant() { 764 return this.bReadingOrderRelevant; 765 } 766 767 771 public boolean getSetEmptyStringAsNull() { 772 return this.bSetEmptyStringAsNull; 773 } 774 775 779 public boolean getSetCursorNameEnabled() { 780 return this.bSetCursorNameEnabled; 781 } 782 783 787 public boolean getSetFetchSizeEnabled() { 788 return this.bSetFetchSizeEnabled; 789 } 790 791 795 public boolean getRowCountEnabled() { 796 return this.bRowCountEnabled; 797 } 798 799 803 public boolean getEnableOrderBy() { 804 return this.bEnableOrderBy; 805 } 806 807 811 public boolean getAfterLastRow() { 812 return this.bAfterLastRow; 813 } 814 815 819 public boolean getFileSystemDatabase() { 820 return this.bFileSystemDatabase; 821 } 822 823 827 public boolean getEnableJumpResult() { 828 return this.bEnableJumpResult; 829 } 830 831 835 public boolean getRequiredUser() { 836 return this.bRequiredUser; 837 } 838 839 843 public int getFirstColumnResult() { 844 return this.iFirstColumnResult; 845 } 846 847 851 public String getDriverClassName() { 852 return this.strDriverClassName; 853 } 854 855 859 public String getVendorFileName() { 860 return this.strVendorFileName; 861 } 862 863 867 public void setVendorFileName(String fileName) { 868 this.strVendorFileName = fileName; 869 } 870 871 875 public void setLogger(Logger logger) { 876 this.logger = logger; 877 } 878 879 883 public String getOidDbType() { 884 return this.oidDbType; 885 } 886 887 891 public String getVersionDbType() { 892 return this.versionDbType; 893 } 894 895 899 public String getDateFormat() { 900 return this.dateFormat; 901 } 902 903 907 public void setConfJarStructure(String confJarStructure) { 908 if (confJarStructure != null && !confJarStructure.equalsIgnoreCase("")) { 909 if (confJarStructure.endsWith("/") || confJarStructure.endsWith("\\")) 910 confJarStructure = confJarStructure.substring(0, 911 confJarStructure.length() - 1); 912 913 this.confJarStructure = confJarStructure; 914 this.useSeparateConfFiles = true; 915 } 916 } 917 918 } 919 | Popular Tags |