1 16 17 package org.webdocwf.util.loader.task; 18 19 import org.apache.tools.ant.BuildException; 20 import org.apache.tools.ant.Task; 21 22 import org.webdocwf.util.loader.LoaderException; 23 import org.webdocwf.util.loader.generator.LoaderGenerator; 24 25 57 public class LoadGeneratorTask extends Task { 58 59 protected String sourceType = null; 60 protected String targetType = null; 61 protected String sourceDriverName = null; 62 protected String targetDriverName = null; 63 protected String sourceDataBase = null; 64 protected String targetDataBase = null; 65 protected String valueMode = null; 66 protected String generatorOutput = null; 67 protected String sourceUser = null; 68 protected String sourcePassword = null; 69 protected String targetUser = null; 70 protected String targetPassword = null; 71 protected String domlUrl = null; 72 protected String packageName = null; 73 protected String octopusHome = null; 74 protected String generateDropTableStmt = null; 76 protected String generateDropIntegrityStmt = null; 77 protected String generateCreateTableStmt = null; 78 protected String generateCreatePKStmt = null; 79 protected String generateCreateFKStmt = null; 80 protected String generateCreateIndexStmt = null; 81 protected String generateXml = null; 82 protected String generateDoml = null; 83 protected String fullMode = null; 84 protected String includeTableList = null; 85 protected String confJarStructure = null; 86 protected String logMode = null; 87 protected String logDirName = null; 88 protected String logFileName = null; 89 protected String restoreMode = "false"; 90 protected String generateSqlForAllVendors = null; 92 93 96 public LoadGeneratorTask() { 97 } 98 99 103 public void execute() throws org.apache.tools.ant.BuildException { 104 if (sourceDataBase == null) { 105 throw new BuildException("sourceDataBase attribute must be set!"); 106 } 107 if (targetDataBase == null) { 108 throw new BuildException("targetDataBase directory attribute must be set!"); 109 } 110 111 if (sourceType == null) { 112 throw new BuildException("sourceType directory attribute must be set!"); 113 } 114 115 if (targetType == null) { 116 throw new BuildException("targetType directory attribute must be set!"); 117 } 118 119 try { 120 if (octopusHome != null) 121 System.setProperty("OCTOPUS_HOME", octopusHome); 122 123 LoaderGenerator generator = new LoaderGenerator(sourceType, sourceDataBase, valueMode, generatorOutput, sourceDriverName, targetDriverName, targetDataBase, targetType, sourceUser, sourcePassword, targetUser, targetPassword, domlUrl, packageName, generateDropTableStmt, generateDropIntegrityStmt, generateCreateTableStmt, generateCreatePKStmt, generateCreateFKStmt, generateCreateIndexStmt, generateSqlForAllVendors, generateXml, generateDoml, fullMode, restoreMode, includeTableList, confJarStructure, logMode, logDirName, logFileName); 124 try { 125 generator.generate(); 126 127 } catch (Exception e) { 128 LoaderException le = new LoaderException("Exception:", e); 130 throw le; 131 } 132 133 } catch (Exception e) { 134 throw new BuildException(e); 135 } 136 } 137 138 142 public void setIncludeTableList(String includeTableList) { 143 this.includeTableList = includeTableList; 144 } 145 146 150 public void setGenerateDropIntegrityStmt(String generateDropIntegrityStmt) { 151 this.generateDropIntegrityStmt = generateDropIntegrityStmt; 152 } 153 154 158 public void setOctopusHome(String octopusHome) { 159 this.octopusHome = octopusHome; 160 } 161 162 166 public void setSourceType(String sourceType) { 167 this.sourceType = sourceType; 168 } 169 170 174 public void setTargetType(String targetType) { 175 this.targetType = targetType; 176 } 177 178 182 public void setSourceDriverName(String sourceDriverName) { 183 this.sourceDriverName = sourceDriverName; 184 } 185 186 190 public void setTargetDriverName(String targetDriverName) { 191 this.targetDriverName = targetDriverName; 192 } 193 194 198 public void setSourceDataBase(String sourceDataBase) { 199 this.sourceDataBase = sourceDataBase; 200 } 201 202 206 public void setTargetDataBase(String targetDataBase) { 207 this.targetDataBase = targetDataBase; 208 } 209 210 214 public void setValueMode(String valueMode) { 215 this.valueMode = valueMode; 216 } 217 218 222 public void setGeneratorOutput(String generatorOutput) { 223 this.generatorOutput = generatorOutput; 224 } 225 226 230 public void setSourceUser(String sourceUser) { 231 this.sourceUser = sourceUser; 232 } 233 234 238 public void setSourcePassword(String sourcePassword) { 239 this.sourcePassword = sourcePassword; 240 } 241 242 246 public void setTargetUser(String targetUser) { 247 this.targetUser = targetUser; 248 } 249 250 254 public void setTargetPassword(String targetPassword) { 255 this.targetPassword = targetPassword; 256 } 257 258 262 public void setDomlUrl(String domlUrl) { 263 this.domlUrl = domlUrl; 264 } 265 266 270 public void setPackageName(String packageName) { 271 this.packageName = packageName; 272 } 273 274 278 public void setGenerateDropTableStmt(String generateDropTableStmt) { 279 this.generateDropTableStmt = generateDropTableStmt; 280 } 281 282 286 public void setGenerateCreateTableStmt(String generateCreateTableStmt) { 287 this.generateCreateTableStmt = generateCreateTableStmt; 288 } 289 290 294 public void setGenerateCreatePKStmt(String generateCreatePKStmt) { 295 this.generateCreatePKStmt = generateCreatePKStmt; 296 } 297 298 302 public void setGenerateCreateFKStmt(String generateCreateFKStmt) { 303 this.generateCreateFKStmt = generateCreateFKStmt; 304 } 305 306 310 public void setGenerateCreateIndexStmt(String generateCreateIndexStmt) { 311 this.generateCreateIndexStmt = generateCreateIndexStmt; 312 } 313 314 318 public void setGenerateXml(String generateXml) { 319 this.generateXml = generateXml; 320 } 321 322 326 public void setGenerateDoml(String generateDoml) { 327 this.generateDoml = generateDoml; 328 } 329 330 334 public void setFullMode(String fullMode) { 335 this.fullMode = fullMode; 336 } 337 338 346 350 public void setLogMode(String logMode) { 351 this.logMode = logMode; 352 } 353 357 public void setLogDirName(String logDirName) { 358 this.logDirName = logDirName; 359 } 360 364 public void setLogFileName(String logFileName) { 365 this.logFileName = logFileName; 366 } 367 368 372 public void setGenerateSqlForAllVendors(String generateSqlForAllVendors) { 373 this.generateSqlForAllVendors = generateSqlForAllVendors; 374 } 375 376 377 378 382 public void setConfJarStructure(String confJarStructure) { 383 this.confJarStructure = confJarStructure; 384 } 385 386 387 388 } 389 | Popular Tags |