1 21 22 package org.webdocwf.util.loader.generator; 23 24 import java.util.Vector ; 25 26 import org.webdocwf.util.loader.LoaderException; 27 import org.webdocwf.util.loader.logging.Logger; 28 import org.webdocwf.util.loader.logging.StandardLogger; 29 30 36 public class GenerateSqlForAllVendors { 37 38 private Logger logger; 39 40 46 47 public GenerateSqlForAllVendors(InputParameters generatorParameters) throws LoaderException { 48 49 setLogger(); 50 this.logger.write("normal", "GenerateSqlForAllVendors is started."); 51 generateParameters(generatorParameters); 52 this.logger.write("normal", "GenerateSqlForAllVendors is finished."); 53 } 54 59 private void generateParameters(InputParameters generatorParameters) throws LoaderException { 60 Vector allVendors = generatorParameters.getAllVendors(); 61 62 try { 63 for (int i = 0; i < allVendors.size(); i++) { 64 String vendorName = allVendors.get(i).toString(); 65 66 this.logger.write("normal", "Working.... SQL Statements for " + vendorName + " Vendor"); 69 72 generatorParameters.setTargetDriverName(""); 73 generatorParameters.setTargetType(vendorName); 74 generatorParameters.setSqlToGenerate(); 75 String generatorOutputOld = generatorParameters.getGeneratorOutput(); 76 if (generatorOutputOld.equalsIgnoreCase("") || generatorOutputOld == null) 77 generatorParameters.setGeneratorOutput("SQLForAllVendors/" + vendorName); 78 else 79 generatorParameters.setGeneratorOutput(generatorOutputOld + "/SQLForAllVendors/" + vendorName); 80 81 if (generatorParameters.getDomlPath() == null || generatorParameters.getDomlPath().equalsIgnoreCase("")) { 82 CreateIncludeFiles createIncludeFiles = new CreateIncludeFiles(generatorParameters); 83 } else { 84 CreateIncludeDomlFiles createIncludeDomlFiles = new CreateIncludeDomlFiles(generatorParameters); 85 } 86 if (generatorParameters.getGenerateXml().equalsIgnoreCase("true")) { 87 LoadJobWriter loadJobWriter = new LoadJobWriter(generatorParameters); 88 } 89 generatorParameters.setGeneratorOutput(generatorOutputOld); 90 } 91 } catch (LoaderException e) { 92 93 LoaderException le = new LoaderException("Error while generate sql statements for all vendors.", e); 94 this.logger.write("full", "Error while generate sql statements for all vendors." + le.getStackTraceAsString()); 96 throw le; 98 } 99 } 100 104 private void setLogger() { 105 this.logger = StandardLogger.getCentralLogger(); 106 } 107 } | Popular Tags |