View Javadoc
1 package org.webdocwf.util.loader; 2 3 /*** 4 JdbcParametersElement - Element in parallel to importDefinitions and sql's. 5 6 Copyright (C) 2002-2003 Together 7 8 This library is free software; you can redistribute it and/or 9 modify it under the terms of the GNU Lesser General Public 10 License as published by the Free Software Foundation; either 11 version 2.1 of the License, or (at your option) any later version. 12 13 This library is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 Lesser General Public License for more details. 17 18 You should have received a copy of the GNU Lesser General Public 19 License along with this library; if not, write to the Free Software 20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 22 JdbcParametersElement.java 23 Date: 20.5.2003. 24 @version 1.0.0 25 @author: Zoran Milakovic zoran@prozone.co.yu 26 */ 27 28 import java.io.*; 29 import java.util.*; 30 31 import javax.xml.parsers.*; 32 33 import org.w3c.dom.*; 34 import org.webdocwf.util.loader.logging.*; 35 36 /*** 37 * 38 * JdbcParametersElement class sets the jdbc parameters 39 * @author Radoslav Dutina 40 * @version 1.0 41 */ 42 public class JdbcParametersElement { 43 44 private String strJDBCSourceParameterDriver = ""; 45 private String strJDBCTargetParameterDriver = ""; 46 private String strJDBCSourceParameterConnection = ""; 47 private String strJDBCTargetParameterConnection = ""; 48 private String strJDBCSourceParameterUser = ""; 49 private String strJDBCTargetParameterUser = ""; 50 private String strJDBCSourceParameterPassword = ""; 51 private String strJDBCTargetParameterPassword = ""; 52 53 private String strJDBCDefaultSourceParameterDriver = ""; 54 private String strJDBCDefaultTargetParameterDriver = ""; 55 private String strJDBCDefaultSourceParameterConnection = ""; 56 private String strJDBCDefaultTargetParameterConnection = ""; 57 private String strJDBCDefaultSourceParameterUser = ""; 58 private String strJDBCDefaultTargetParameterUser = ""; 59 private String strJDBCDefaultSourceParameterPassword = ""; 60 private String strJDBCDefaultTargetParameterPassword = ""; 61 62 private String strDbVendor = ""; 63 private String strDriverName = ""; 64 65 private String strTargetDbVendor = ""; 66 private String strTargetDriverName = ""; 67 68 private String strDbVendorDefault = ""; 69 private String strDriverNameDefault = ""; 70 71 private String strTargetDbVendorDefault = ""; 72 private String strTargetDriverNameDefault = ""; 73 74 private Logger logger; 75 private Vector targetConnections; 76 77 private String loaderJobFile=""; 78 private ConfigReader configReaderSource; 79 80 81 /*** 82 * Method parseTargetJDBCParameters is used to analyse import XML file 83 * @param inStream Data from inputXML file which is converted into InputStream. 84 * @throws LoaderException 85 */ 86 public void parseTargetJDBCParameters(InputStream inStream) throws LoaderException{ 87 Document doc = null; 88 targetConnections=new Vector(); 89 try { 90 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 91 DocumentBuilder db = null; 92 db = dbf.newDocumentBuilder(); 93 doc = db.parse(inStream); 94 } catch (Exception e) { 95 this.logger.write("normal", "Sorry, an error occurred: " + e); 96 LoaderException le = new LoaderException("Exception: ", 97 (Throwable)e); 98 throw le; 99 } 100 if (doc != null) { 101 NodeList targetList = doc.getElementsByTagName( "jdbcTargetParameters" ); 102 int position=0; 103 if(targetList.getLength()!=0){ 104 for(int i=0;i<targetList.getLength();i++){ 105 106 targetConnections.add(position,""); 107 targetConnections.add(position+1,""); 108 targetConnections.add(position+2,""); 109 targetConnections.add(position+3,""); 110 111 NodeList childs=targetList.item(i).getChildNodes(); 112 for(int k=0;k<childs.getLength();k++){ 113 if(childs.item(k).getNodeType()==3){ 114 // 115 }else{ 116 NamedNodeMap attributes= childs.item(k).getAttributes(); 117 String name=attributes.getNamedItem("name").getNodeValue(); 118 if(name.equalsIgnoreCase("JdbcDriver")) 119 targetConnections.set(position,attributes.getNamedItem("value").getNodeValue()); 120 else if(name.equalsIgnoreCase("Connection.Url")){ 121 targetConnections.set(position+1,attributes.getNamedItem("value").getNodeValue()); 122 }else if(name.equalsIgnoreCase("User")) 123 targetConnections.set(position+2,attributes.getNamedItem("value").getNodeValue()); 124 else if(name.equalsIgnoreCase("Password")) 125 targetConnections.set(position+3,attributes.getNamedItem("value").getNodeValue()); 126 127 } 128 } 129 position=position+4; 130 } 131 } 132 } 133 try { 134 inStream.reset(); 135 } catch (IOException e) { 136 this.logger.write("normal", "Sorry, an error occurred: " + e); 137 LoaderException le = new LoaderException("IOException: ",(Throwable)e); 138 throw le; 139 } 140 } 141 142 /*** 143 * This method read the value of targetConnections parameter 144 * @return value of parameter 145 */ 146 public Vector getTargetConnections(){ 147 return targetConnections; 148 } 149 150 /*** 151 * Method parseImportJDBCParameters is used to analyse import XML file 152 * about JDBC parameters tags. Puts values of first importDefinition's JDBC parameters in global variables. 153 * @param inStream Data from inputXML file which is converted into InputStream. 154 * @param number order number of importDefinition or sql tag which is proceeded. 155 * @param tagName name of tag which is proceeded 156 * @throws LoaderException 157 */ 158 public void parseImportJDBCParameters (InputStream inStream,int number,String tagName) throws LoaderException{ 159 this.strJDBCSourceParameterDriver = ""; 160 this.strJDBCTargetParameterDriver = ""; 161 this.strJDBCSourceParameterConnection = ""; 162 this.strJDBCTargetParameterConnection = ""; 163 this.strJDBCSourceParameterUser = ""; 164 this.strJDBCTargetParameterUser = ""; 165 this.strJDBCSourceParameterPassword = ""; 166 this.strJDBCTargetParameterPassword = ""; 167 this.strDbVendor = ""; 168 this.strDriverName = ""; 169 this.strTargetDbVendor = ""; 170 this.strTargetDriverName = ""; 171 number--; 172 Document doc = null; 173 Vector vecJDBCTargetValue = new Vector(); 174 Vector vecJDBCTargetName = new Vector(); 175 Vector vecJDBCSourceValue = new Vector(); 176 Vector vecJDBCSourceName = new Vector(); 177 boolean isOK = false; 178 179 this.logger.write("full", "\tparseImportJDBCParameters method is started."); 180 try { 181 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 182 DocumentBuilder db = null; 183 db = dbf.newDocumentBuilder(); 184 doc = db.parse(inStream); 185 } catch (Exception e) { 186 this.logger.write("normal", "Sorry, an error occurred: " + e); 187 LoaderException le = new LoaderException("Exception: ", 188 (Throwable)e); 189 throw le; 190 // System.exit(1); 191 } 192 if (doc != null) { 193 NodeList tagDefault = doc.getElementsByTagName( tagName ); 194 if (tagDefault.getLength() != 0) { 195 Element docFragment = (Element)tagDefault.item( number ); 196 //source parameters 197 NodeList tag = docFragment.getElementsByTagName("jdbcSourceParameters"); 198 if (tag.getLength() != 0) { 199 NamedNodeMap jdbc = tag.item(0).getAttributes(); 200 Node nodeJdbc = jdbc.getNamedItem("dbVendor"); 201 if (nodeJdbc != null) 202 this.strDbVendor = nodeJdbc.getNodeValue(); 203 nodeJdbc = jdbc.getNamedItem("driverName"); 204 if (nodeJdbc != null) 205 this.strDriverName = nodeJdbc.getNodeValue(); 206 } 207 //target parameters 208 tag = docFragment.getElementsByTagName("jdbcTargetParameters"); 209 if (tag.getLength() != 0) { 210 NamedNodeMap jdbc = tag.item(0).getAttributes(); 211 Node nodeJdbc = jdbc.getNamedItem("dbVendor"); 212 if (nodeJdbc != null) 213 this.strTargetDbVendor = nodeJdbc.getNodeValue(); 214 nodeJdbc = jdbc.getNamedItem("driverName"); 215 if (nodeJdbc != null) 216 this.strTargetDriverName = nodeJdbc.getNodeValue(); 217 } 218 219 tag = docFragment.getElementsByTagName("jdbcSourceParameter"); 220 for (int i = 0; i < tag.getLength(); i++) { 221 String nodeValueValue = ""; 222 String nodeNameValue = ""; 223 NamedNodeMap attrs = tag.item(i).getAttributes(); 224 Node nodeValue = attrs.getNamedItem("value"); 225 Node nodeName = attrs.getNamedItem("name"); 226 if (nodeValue != null && nodeName != null) { 227 nodeValueValue = nodeValue.getNodeValue(); 228 nodeNameValue = nodeName.getNodeValue(); 229 } 230 vecJDBCSourceValue.addElement(nodeValueValue); 231 vecJDBCSourceName.addElement(nodeNameValue); 232 } 233 for (int i = 0; i < vecJDBCSourceValue.size(); i++) { 234 if (vecJDBCSourceName.get(i).toString().equalsIgnoreCase("JdbcDriver")) 235 this.strJDBCSourceParameterDriver = vecJDBCSourceValue.get(i).toString(); 236 else if (vecJDBCSourceName.get(i).toString().equalsIgnoreCase("Connection.Url")) { 237 //Testing SelectMethod parameter in microsoft MSSQL driver 238 if(vecJDBCSourceValue.get(i).toString().indexOf("jdbc:microsoft:sqlserver")!=-1) { 239 if(vecJDBCSourceValue.get(i).toString().indexOf("SelectMethod")==-1) { 240 this.strJDBCSourceParameterConnection = vecJDBCSourceValue.get(i).toString()+";SelectMethod=cursor"; 241 } else { 242 if(vecJDBCSourceValue.get(i).toString().indexOf("cursor")!=-1) { 243 this.strJDBCSourceParameterConnection = vecJDBCSourceValue.get(i).toString(); 244 } else { 245 this.logger.write("normal", "Sorry, an error occurred: value of Connection.Url perameter SelectMethod has to be cursor" ); 246 LoaderException le = new LoaderException("Exception:", new Exception("value of Connection.Url perameter SelectMethod has to be cursor")); 247 throw le; 248 } 249 } 250 } else { 251 this.strJDBCSourceParameterConnection = vecJDBCSourceValue.get(i).toString(); 252 } 253 } 254 else if (vecJDBCSourceName.get(i).toString().equalsIgnoreCase("User")) 255 this.strJDBCSourceParameterUser = vecJDBCSourceValue.get(i).toString(); 256 else if (vecJDBCSourceName.get(i).toString().equalsIgnoreCase("Password")) 257 this.strJDBCSourceParameterPassword = vecJDBCSourceValue.get(i).toString(); 258 } 259 tag = docFragment.getElementsByTagName("jdbcTargetParameter"); 260 for (int i = 0; i < tag.getLength(); i++) { 261 String nodeValueValue = ""; 262 String nodeNameValue = ""; 263 NamedNodeMap attrs = tag.item(i).getAttributes(); 264 Node nodeValue = attrs.getNamedItem("value"); 265 Node nodeName = attrs.getNamedItem("name"); 266 if (nodeValueValue != null && nodeName != null) { 267 nodeValueValue = nodeValue.getNodeValue(); 268 nodeNameValue = nodeName.getNodeValue(); 269 } 270 vecJDBCTargetValue.addElement(nodeValueValue); 271 vecJDBCTargetName.addElement(nodeNameValue); 272 } 273 for (int i = 0; i < vecJDBCTargetValue.size(); i++) { 274 if (vecJDBCTargetName.get(i).toString().equalsIgnoreCase("JdbcDriver")) 275 this.strJDBCTargetParameterDriver = vecJDBCTargetValue.get(i).toString(); 276 else if (vecJDBCTargetName.get(i).toString().equalsIgnoreCase("Connection.Url")) { 277 //Testing SelectMethod parameter in microsoft MSSQL driver 278 if(vecJDBCTargetValue.get(i).toString().indexOf("jdbc:microsoft:sqlserver")!=-1) { 279 if(vecJDBCTargetValue.get(i).toString().indexOf("SelectMethod")==-1) { 280 this.strJDBCTargetParameterConnection = vecJDBCTargetValue.get(i).toString()+";SelectMethod=cursor"; 281 } else { 282 if(vecJDBCTargetValue.get(i).toString().indexOf("cursor")!=-1) { 283 this.strJDBCTargetParameterConnection = vecJDBCTargetValue.get(i).toString(); 284 } else { 285 this.logger.write("normal", "Sorry, an error occurred: value of Connection.Url perameter SelectMethod has to be cursor" ); 286 LoaderException le = new LoaderException("Exception:", new Exception("value of Connection.Url perameter SelectMethod has to be cursor")); 287 throw le; 288 } 289 } 290 } else { 291 this.strJDBCTargetParameterConnection = vecJDBCTargetValue.get(i).toString(); 292 } 293 } 294 else if (vecJDBCTargetName.get(i).toString().equalsIgnoreCase("User")) 295 this.strJDBCTargetParameterUser = vecJDBCTargetValue.get(i).toString(); 296 else if (vecJDBCTargetName.get(i).toString().equalsIgnoreCase("Password")) 297 this.strJDBCTargetParameterPassword = vecJDBCTargetValue.get(i).toString(); 298 } 299 } 300 isOK=true; 301 } 302 try { 303 inStream.reset(); 304 } catch (IOException e) { 305 this.logger.write("normal", "Sorry, an error occurred: " + e); 306 LoaderException le = new LoaderException("IOException: ", 307 (Throwable)e); 308 throw le; 309 } 310 this.logger.write("full", "\tparseImportJDBCDefaultParameters method is finished."); 311 } 312 313 314 /*** 315 * Method parseImportJDBCDefaultParameters is used to analyse import XML file 316 * about Default JDBC parameters tags. 317 * @param inStream Data from inputXML file which is converted into InputStream. 318 * @return boolean - true default jdbc parameters exists, false otherwise 319 * @throws LoaderException 320 */ 321 public boolean parseImportJDBCDefaultParameters (InputStream inStream) throws LoaderException{ 322 Document doc = null; 323 Vector vecJDBCTargetValue = new Vector(); 324 Vector vecJDBCTargetName = new Vector(); 325 Vector vecJDBCSourceValue = new Vector(); 326 Vector vecJDBCSourceName = new Vector(); 327 boolean isOK = false; 328 329 this.logger.write("full", "\tparseImportJDBCDefaultParameters method is started."); 330 try { 331 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 332 DocumentBuilder db = null; 333 db = dbf.newDocumentBuilder(); 334 doc = db.parse(inStream); 335 } catch (Exception e) { 336 this.logger.write("normal", "Sorry, an error occurred: " + e); 337 LoaderException le = new LoaderException("Exception: ", 338 (Throwable)e); 339 throw le; 340 } 341 if (doc != null) { 342 NodeList tagDefault = doc.getElementsByTagName("jdbcDefaultParameters"); 343 if (tagDefault.getLength() != 0) { 344 Element docFragment = (Element)tagDefault.item(0); 345 NodeList tag = docFragment.getElementsByTagName("jdbcSourceParameters"); 346 if (tag.getLength() != 0) { 347 NamedNodeMap jdbc = tag.item(0).getAttributes(); 348 Node nodeJdbc = jdbc.getNamedItem("dbVendor"); 349 if (nodeJdbc != null) 350 this.strDbVendorDefault = nodeJdbc.getNodeValue(); 351 nodeJdbc = jdbc.getNamedItem("driverName"); 352 if (nodeJdbc != null) 353 this.strDriverNameDefault = nodeJdbc.getNodeValue(); 354 } 355 tag = docFragment.getElementsByTagName("jdbcTargetParameters"); 356 if (tag.getLength() != 0) { 357 NamedNodeMap jdbc = tag.item(0).getAttributes(); 358 Node nodeJdbc = jdbc.getNamedItem("dbVendor"); 359 if (nodeJdbc != null) 360 this.strTargetDbVendorDefault = nodeJdbc.getNodeValue(); 361 nodeJdbc = jdbc.getNamedItem("driverName"); 362 if (nodeJdbc != null) 363 this.strTargetDriverNameDefault = nodeJdbc.getNodeValue(); 364 } 365 tag = docFragment.getElementsByTagName("jdbcSourceParameter"); 366 for (int i = 0; i < tag.getLength(); i++) { 367 String nodeValueValue = ""; 368 String nodeNameValue = ""; 369 NamedNodeMap attrs = tag.item(i).getAttributes(); 370 Node nodeValue = attrs.getNamedItem("value"); 371 Node nodeName = attrs.getNamedItem("name"); 372 if (nodeValue != null && nodeName != null) { 373 nodeValueValue = nodeValue.getNodeValue(); 374 nodeNameValue = nodeName.getNodeValue(); 375 } 376 vecJDBCSourceValue.addElement(nodeValueValue); 377 vecJDBCSourceName.addElement(nodeNameValue); 378 } 379 for (int i = 0; i < vecJDBCSourceValue.size(); i++) { 380 if (vecJDBCSourceName.get(i).toString().equalsIgnoreCase("JdbcDriver")) 381 this.strJDBCDefaultSourceParameterDriver = vecJDBCSourceValue.get(i).toString(); 382 else if (vecJDBCSourceName.get(i).toString().equalsIgnoreCase("Connection.Url")) { 383 //Testing SelectMethod parameter in microsoft MSSQL driver 384 if(vecJDBCSourceValue.get(i).toString().indexOf("jdbc:microsoft:sqlserver")!=-1) { 385 if(vecJDBCSourceValue.get(i).toString().indexOf("SelectMethod")==-1) { 386 this.strJDBCDefaultSourceParameterConnection = vecJDBCSourceValue.get(i).toString()+";SelectMethod=cursor"; 387 } else { 388 if(vecJDBCSourceValue.get(i).toString().indexOf("cursor")!=-1) { 389 this.strJDBCDefaultSourceParameterConnection = vecJDBCSourceValue.get(i).toString(); 390 } else { 391 this.logger.write("normal", "Sorry, an error occurred: value of Connection.Url perameter SelectMethod has to be cursor" ); 392 LoaderException le = new LoaderException("Exception:", new Exception("value of Connection.Url perameter SelectMethod has to be cursor")); 393 throw le; 394 } 395 } 396 } else { 397 this.strJDBCDefaultSourceParameterConnection = vecJDBCSourceValue.get(i).toString(); 398 } 399 } 400 else if (vecJDBCSourceName.get(i).toString().equalsIgnoreCase("User")) 401 this.strJDBCDefaultSourceParameterUser = vecJDBCSourceValue.get(i).toString(); 402 else if (vecJDBCSourceName.get(i).toString().equalsIgnoreCase("Password")) 403 this.strJDBCDefaultSourceParameterPassword = vecJDBCSourceValue.get(i).toString(); 404 } 405 tag = docFragment.getElementsByTagName("jdbcTargetParameter"); 406 for (int i = 0; i < tag.getLength(); i++) { 407 String nodeValueValue = ""; 408 String nodeNameValue = ""; 409 NamedNodeMap attrs = tag.item(i).getAttributes(); 410 Node nodeValue = attrs.getNamedItem("value"); 411 Node nodeName = attrs.getNamedItem("name"); 412 if (nodeValueValue != null && nodeName != null) { 413 nodeValueValue = nodeValue.getNodeValue(); 414 nodeNameValue = nodeName.getNodeValue(); 415 } 416 vecJDBCTargetValue.addElement(nodeValueValue); 417 vecJDBCTargetName.addElement(nodeNameValue); 418 } 419 for (int i = 0; i < vecJDBCTargetValue.size(); i++) { 420 if (vecJDBCTargetName.get(i).toString().equalsIgnoreCase("JdbcDriver")) 421 this.strJDBCDefaultTargetParameterDriver = vecJDBCTargetValue.get(i).toString(); 422 else if (vecJDBCTargetName.get(i).toString().equalsIgnoreCase("Connection.Url")) { 423 //Testing SelectMethod parameter in microsoft MSSQL driver 424 if(vecJDBCTargetValue.get(i).toString().indexOf("jdbc:microsoft:sqlserver")!=-1) { 425 if(vecJDBCTargetValue.get(i).toString().indexOf("SelectMethod")==-1) { 426 this.strJDBCDefaultTargetParameterConnection = vecJDBCTargetValue.get(i).toString()+";SelectMethod=cursor"; 427 } else { 428 if(vecJDBCTargetValue.get(i).toString().indexOf("cursor")!=-1) { 429 this.strJDBCDefaultTargetParameterConnection = vecJDBCTargetValue.get(i).toString(); 430 } else { 431 this.logger.write("normal", "Sorry, an error occurred: value of Connection.Url perameter SelectMethod has to be cursor" ); 432 LoaderException le = new LoaderException("Exception:", new Exception("value of Connection.Url perameter SelectMethod has to be cursor")); 433 throw le; 434 } 435 } 436 } else { 437 this.strJDBCDefaultTargetParameterConnection = vecJDBCTargetValue.get(i).toString(); 438 } 439 } 440 else if (vecJDBCTargetName.get(i).toString().equalsIgnoreCase("User")) 441 this.strJDBCDefaultTargetParameterUser = vecJDBCTargetValue.get(i).toString(); 442 else if (vecJDBCTargetName.get(i).toString().equalsIgnoreCase("Password")) 443 this.strJDBCDefaultTargetParameterPassword = vecJDBCTargetValue.get(i).toString(); 444 } 445 } 446 isOK=true; 447 } 448 try { 449 inStream.reset(); 450 } catch (IOException e) { 451 this.logger.write("normal", "Sorry, an error occurred: " + e); 452 LoaderException le = new LoaderException("IOException: ", 453 (Throwable)e); 454 throw le; 455 } 456 this.logger.write("full", "\tparseImportJDBCDefaultParameters method is finished."); 457 return isOK; 458 } 459 460 //set and get methods 461 /*** 462 * Set Logger of this class. 463 * @param logger Logger object which is used to write to log and standard output. 464 */ 465 public void setLogger(Logger logger) { 466 this.logger = logger; 467 } 468 469 /*** 470 * Set ConfigReader of this class. 471 * @param configReader defines ConfigReader object which is used to store data 472 * about source driver. 473 */ 474 public void setConfigReaderSource(ConfigReader configReader) { 475 this.configReaderSource = configReader; 476 } 477 478 479 /*** 480 * This method set the absolute path to loader job file 481 * @param loaderJobName is relativ path to loader job file 482 */ 483 public void setLoaderJobPath(String loaderJobName){ 484 File file=new File(loaderJobName); 485 this.loaderJobFile=file.getAbsoluteFile().getParent()+System.getProperty("file.separator"); 486 } 487 488 /*** 489 * This method make absoulte path from relative path 490 * @param urlToDatabase relative path 491 * @return absolute path 492 * @throws LoaderException 493 */ 494 public String getAbsolutePathFromDatabaseURL(String urlToDatabase) throws LoaderException{ 495 496 if(configReaderSource.getFileSystemDatabase()==true){ 497 String urlPrefix = configReaderSource.getConnectionPrefix(); 498 String pathToDatabase=urlToDatabase.substring(urlPrefix.length()); 499 File file=new File(pathToDatabase); 500 if (!file.isAbsolute()){ 501 pathToDatabase=this.loaderJobFile + pathToDatabase; 502 File absolutePath=new File(pathToDatabase); 503 try { 504 pathToDatabase=absolutePath.getCanonicalPath(); 505 } 506 catch (Exception ex) { 507 this.logger.write("normal", ex.getMessage()); 508 LoaderException le = new LoaderException("Exception: ",(Throwable)ex); 509 throw le; 510 } 511 urlToDatabase = urlToDatabase.substring(0, (urlPrefix.length())) + 512 pathToDatabase; 513 } 514 } 515 return urlToDatabase; 516 } 517 518 519 //source parameters 520 /*** 521 * Method return JDBCSourceParameterConnection,or if that 522 * parameter is not defined method will return default value which is 523 * strJDBCDefaultSourceParameterConnection 524 * @return JDBCSourceParameterConnection 525 * @throws LoaderException 526 */ 527 public String getJDBCSourceParameterConnection() throws LoaderException { 528 String parseUrl=""; 529 try{ 530 if (!this.strJDBCSourceParameterConnection.equals("")) { 531 parseUrl= getAbsolutePathFromDatabaseURL(this.strJDBCSourceParameterConnection); 532 } else { 533 parseUrl= getAbsolutePathFromDatabaseURL(this.strJDBCDefaultSourceParameterConnection); 534 } 535 }catch(LoaderException ex){ 536 throw ex; 537 } 538 return parseUrl; 539 } 540 541 /*** 542 * This method set value of strJDBCSourceParameterConnection parameter 543 * @param arg set JDBCSouceParameterConnection to value of arg 544 */ 545 public void setJDBCSourceParameterConnection(String arg) { 546 this.strJDBCSourceParameterConnection = arg; 547 } 548 549 private String getJDBCDefaultSourceParameterConnection() { 550 return this.strJDBCDefaultSourceParameterConnection; 551 } 552 553 /*** 554 * Method return JDBCSourceParameterDriver,or if that 555 * parameter is not defined method will return default value which is 556 * strJDBCDefaultSourceParameterDriver 557 * @return JDBCSourceParameterDriver 558 */ 559 public String getJDBCSourceParameterDriver() { 560 if( !this.strJDBCSourceParameterDriver.equals("") ) 561 return this.strJDBCSourceParameterDriver; 562 else 563 return this.strJDBCDefaultSourceParameterDriver; 564 } 565 566 /*** 567 * This method set value of strJDBCSourceParameterDriver parameter 568 * @param arg set JDBCSouceParameterDriver to value of arg 569 */ 570 public void setJDBCSourceParameterDriver(String arg) { 571 this.strJDBCSourceParameterDriver = arg; 572 } 573 574 private String getJDBCDefaultSourceParameterDriver() { 575 return this.strJDBCDefaultSourceParameterDriver; 576 } 577 578 /*** 579 * Method return JDBCSourceParameterDriver,or if that 580 * parameter is not defined method will return default value which is 581 * strJDBCDefaultSourceParameterDriver 582 * @return JDBCSourceParameterDriver 583 */ 584 public String getJDBCSourceParameterPassword() { 585 if( !this.strJDBCSourceParameterPassword.equals("") ) 586 return this.strJDBCSourceParameterPassword; 587 else 588 return this.strJDBCDefaultSourceParameterPassword; 589 } 590 591 /*** 592 * This method set value of strJDBCSourceParameterPassword parameter 593 * @param arg setJDBCSourceParameterPassword to value of arg 594 */ 595 public void setJDBCSourceParameterPassword(String arg) { 596 this.strJDBCSourceParameterPassword = arg; 597 } 598 599 private String getJDBCDefaultSourceParameterPassword() { 600 return this.strJDBCDefaultSourceParameterPassword; 601 } 602 603 /*** 604 * Method return JDBCSourceParameterUser,or if that 605 * parameter is not defined method will return default value which is 606 * strJDBCDefaultSourceParameterUser 607 * @return JDBCSourceParameterUser 608 */ 609 public String getJDBCSourceParameterUser() { 610 if( !this.strJDBCSourceParameterUser.equals("") ) 611 return this.strJDBCSourceParameterUser; 612 else 613 return this.strJDBCDefaultSourceParameterUser; 614 } 615 616 /*** 617 * This method set value of strJDBCSourceParameterUser parameter 618 * @param arg set JDBCSourceParameterUser to value of arg 619 */ 620 public void setJDBCSourceParameterUser(String arg) { 621 this.strJDBCSourceParameterUser = arg; 622 } 623 624 private String getJDBCDefaultSourceParameterUser() { 625 return this.strJDBCDefaultSourceParameterUser; 626 } 627 628 629 //targets parameters 630 /*** 631 * Method return JDBCTargetParameterConnection,or if that 632 * parameter is not defined method will return default value which is 633 * strJDBCTargetParameterConnection 634 * @return JDBCTargetParameterConnection 635 */ 636 public String getJDBCTargetParameterConnection() { 637 if( !this.strJDBCTargetParameterConnection.equals("") ) 638 return this.strJDBCTargetParameterConnection; 639 else 640 return this.strJDBCDefaultTargetParameterConnection; 641 } 642 643 /*** 644 * This method set value of strJDBCTargetParameterConnection parameter 645 * @param arg set JDBCTargetParameterConnection to value of arg 646 */ 647 public void setJDBCTargetParameterConnection(String arg) { 648 this.strJDBCTargetParameterConnection = arg; 649 } 650 651 private String getJDBCDefaultTargetParameterConnection() { 652 return this.strJDBCDefaultTargetParameterConnection; 653 } 654 655 /*** 656 * Method return JDBCTargetParameterDriver,or if that 657 * parameter is not defined method will return default value which is 658 * strJDBCDefaultTargetParameterDriver 659 * @return JDBCTargetParameterDriver 660 */ 661 public String getJDBCTargetParameterDriver() { 662 if( !this.strJDBCTargetParameterDriver.equals("") ) 663 return this.strJDBCTargetParameterDriver; 664 else 665 return this.strJDBCDefaultTargetParameterDriver; 666 } 667 668 /*** 669 * This method set value of strJDBCTargetParameterDriver parameter 670 * @param arg set JDBCTargetParameterDriver to value of arg 671 */ 672 public void setJDBCTargetParameterDriver(String arg) { 673 this.strJDBCTargetParameterDriver = arg; 674 } 675 676 private String getJDBCDefaultTargetParameterDriver() { 677 return this.strJDBCDefaultTargetParameterDriver; 678 } 679 680 /*** 681 * Method return JDBCTargetParameterPassword,or if that 682 * parameter is not defined method will return default value which is 683 * strJDBCDefaultTargetParameterPassword 684 * @return JDBCTargetParameterPassword 685 */ 686 public String getJDBCTargetParameterPassword() { 687 if( !this.strJDBCTargetParameterPassword.equals("") ) 688 return this.strJDBCTargetParameterPassword; 689 else 690 return this.strJDBCDefaultTargetParameterPassword; 691 } 692 693 /*** 694 * This method set value of strJDBCTargetParameterPassword parmeter 695 * @param arg set JDBCTargetParameterPassword to value of arg 696 */ 697 public void setJDBCTargetParameterPassword(String arg) { 698 this.strJDBCTargetParameterPassword = arg; 699 } 700 701 private String getJDBCDefaultTargetParameterPassword() { 702 return this.strJDBCDefaultTargetParameterPassword; 703 } 704 705 /*** 706 * Method return JDBCTargetParameterPassword,or if that 707 * parameter is not defined method will return default value which is 708 * strJDBCDefaultTargetParameterPassword 709 * @return JDBCTargetParameterPassword 710 */ 711 public String getJDBCTargetParameterUser() { 712 if( !this.strJDBCTargetParameterUser.equals("") ) 713 return this.strJDBCTargetParameterUser; 714 else 715 return this.strJDBCDefaultTargetParameterUser; 716 } 717 718 /*** 719 * This method set value of strJDBCTargetParameterUser parameter 720 * @param arg set JDBCTargetParameterUser to value of arg 721 */ 722 public void setJDBCTargetParameterUser(String arg) { 723 this.strJDBCTargetParameterUser = arg; 724 } 725 726 private String getJDBCDefaultTargetParameterUser() { 727 return this.strJDBCDefaultTargetParameterUser; 728 } 729 730 private String getDBVendorDefault() { 731 return this.strDbVendorDefault; 732 } 733 734 private String getDriverNameDefault() { 735 return this.strDriverNameDefault; 736 } 737 738 private String getTargetDbVendorDefault() { 739 return this.strTargetDbVendorDefault; 740 } 741 742 private String getTargetDriverNameDefault() { 743 return this.strTargetDriverNameDefault; 744 } 745 746 /*** 747 * Method return TargetDBVendor,or if that 748 * parameter is not defined method will return default value which is 749 * strTargetDBVendorDefault 750 * @return TargetDBVendor 751 */ 752 public String getTargetDBVendor() { 753 if( !this.strTargetDbVendor.equals("") ) 754 return this.strTargetDbVendor; 755 else 756 return this.strTargetDbVendorDefault; 757 } 758 759 /*** 760 * Method return TargetDriverName,or if that 761 * parameter is not defined method will return default value which is 762 * strTargetDriverNameDefault 763 * @return TargetDriverName 764 */ 765 public String getTargetDriverName() { 766 if( !this.strTargetDriverName.equals("") ) 767 return this.strTargetDriverName; 768 else{ 769 if(this.strTargetDbVendor.equalsIgnoreCase("")&&this.strTargetDriverName.equalsIgnoreCase("")){ 770 return this.strTargetDriverNameDefault; 771 }else 772 return ""; 773 } 774 } 775 776 /*** 777 * Method return DriverName for source database,or if that 778 * parameter is not defined method will return default value which is 779 * strDriverNameDefault 780 * @return DriverName 781 */ 782 public String getDriverName() { 783 if( !this.strDriverName.equals("") ) 784 return this.strDriverName; 785 else{ 786 if(this.strDbVendor.equalsIgnoreCase("")&&this.strDriverName.equalsIgnoreCase("")){ 787 return this.strDriverNameDefault; 788 }else 789 return ""; 790 } 791 } 792 793 /*** 794 * Method return DbVendor for source database,or if that 795 * parameter is not defined method will return default value which is 796 * strDbVendorDefault 797 * @return DbVendor 798 */ 799 public String getDbVendor() { 800 if( !this.strDbVendor.equals("") ) 801 return this.strDbVendor; 802 else 803 return this.strDbVendorDefault; 804 } 805 806 }

This page was automatically generated by Maven