📄 loadgeneratortask.java
字号:
/*
LoaderGenerator - tool for generated xml, sql and doml file needed for Octopus.
Copyright (C) 2003 Together
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.webdocwf.util.loader.task;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.webdocwf.util.loader.LoaderException;
import org.webdocwf.util.loader.generator.LoaderGenerator;
/**
* LoaderGenerator Task class extends jakarta-ant Task class and uses to start
* LoaderGenerator application as a jakarta-ant task in build.xml file.
*
* <p><br>
* sourceType, defines the type of the source database. Default value is 'msql'.<br>
* targetType, defines the type of the target database. Default value is 'msql'.<br>
* sourceDriverName, defines the driver of defined source database.<br>
* targetDriverName, defines the driver of defined target database.<br>
* sourceDataBase, defines the place where you're put the source database tables.<br>
* targetDataBase, defines the place where you're put the target database tables.<br>
* valueMode, defines the difference from overwrite and update attribute. If the valueMode<br>
* has value 'copy', attribute has value 'Overwrite', or if the valueMode has value 'sync', attribute<br>
* has value 'Update'. Default value of valueMode is 'copy'.<br>
* generatorOutput, is optional. That represent the directory, where the Octopus place created files.<br>
* If this argument don't exists, Octopus place created files in to current directory!<br>
* sourceUser, defines the user of the source database.<br>
* sourcePassword, defines the user password for the source database.<br>
* targetUser, defines the user of the target database.<br>
* targetPassword, defines the user password for the target database.<br>
* domlUrl, defines the place where the doml file is placed.<br>
* outputMode, defines which document you wont to generate. If the generateDoc has value<br>
* all, application generates xml, sql and doml files as ouput files. If the generateDoc has value<br>
* doml, application generates only the doml file, and if generateDoc has the value wdoml, application<br>
* generates xml and sql files.<br>
* packageName, defines the package name for the generated doml file.<br>
* generateDropTableStmt, defines if you want to generate only Sql statement for DROP TABLE.<br>
* <br></p>
*
* @author Radoslav Dutina
* @version 1.0
*/
public class LoadGeneratorTask extends Task {
protected String sourceType = null;
protected String targetType = null;
protected String sourceDriverName = null;
protected String targetDriverName = null;
protected String sourceDataBase = null;
protected String targetDataBase = null;
protected String valueMode = null;
protected String generatorOutput = null;
protected String sourceUser = null;
protected String sourcePassword = null;
protected String targetUser = null;
protected String targetPassword = null;
protected String domlUrl = null;
protected String packageName = null;
protected String octopusHome = null;
//for generate Sql only
protected String generateDropTableStmt = null;
protected String generateDropIntegrityStmt = null;
protected String generateCreateTableStmt = null;
protected String generateCreatePKStmt = null;
protected String generateCreateFKStmt = null;
protected String generateCreateIndexStmt = null;
protected String generateXml = null;
protected String generateDoml = null;
protected String fullMode = null;
protected String includeTableList = null;
protected String confJarStructure = null;
protected String logMode = null;
protected String logDirName = null;
protected String logFileName = null;
protected String restoreMode = "false";
//for generate sql for all vendors
protected String generateSqlForAllVendors = null;
/**
* Construct object LoadGeneratorTask.
*/
public LoadGeneratorTask() {
}
/**
*
* @throws org.apache.tools.ant.BuildException
*/
public void execute() throws org.apache.tools.ant.BuildException {
if (sourceDataBase == null) {
throw new BuildException("sourceDataBase attribute must be set!");
}
if (targetDataBase == null) {
throw new BuildException("targetDataBase directory attribute must be set!");
}
if (sourceType == null) {
throw new BuildException("sourceType directory attribute must be set!");
}
if (targetType == null) {
throw new BuildException("targetType directory attribute must be set!");
}
try {
if (octopusHome != null)
System.setProperty("OCTOPUS_HOME", octopusHome);
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);
try {
generator.generate();
} catch (Exception e) {
//e.printStackTrace();
LoaderException le = new LoaderException("Exception:", e);
throw le;
}
} catch (Exception e) {
throw new BuildException(e);
}
}
/**
* This method sets the value of includeTableList parameter.
* @param includeTableList is the value of parameter.
*/
public void setIncludeTableList(String includeTableList) {
this.includeTableList = includeTableList;
}
/**
* This method sets the value of generateDropIntegrityStmt parameter.
* @param generateDropIntegrityStmt is the value of parameter.
*/
public void setGenerateDropIntegrityStmt(String generateDropIntegrityStmt) {
this.generateDropIntegrityStmt = generateDropIntegrityStmt;
}
/**
* This method sets the value of octopusHome parameter.
* @param octopusHome is the value of parameter.
*/
public void setOctopusHome(String octopusHome) {
this.octopusHome = octopusHome;
}
/**
* This method sets the value of sourceType parameter.
* @param sourceType is the value of parameter.
*/
public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
/**
* This method sets the value of targetType parameter.
* @param targetType is the value of parameter.
*/
public void setTargetType(String targetType) {
this.targetType = targetType;
}
/**
* This method read the value of sourceDriverName parameter.
* @param sourceDriverName is the value of parameter.
*/
public void setSourceDriverName(String sourceDriverName) {
this.sourceDriverName = sourceDriverName;
}
/**
* This method read the value of targetDriverName parameter.
* @param targetDriverName is the value of parameter.
*/
public void setTargetDriverName(String targetDriverName) {
this.targetDriverName = targetDriverName;
}
/**
* This method read the value of sourceDataBase parameter.
* @param sourceDataBase is the value of parameter.
*/
public void setSourceDataBase(String sourceDataBase) {
this.sourceDataBase = sourceDataBase;
}
/**
** This method read the value of targetDataBase parameter.
* @param targetDataBase is the value of parameter.
*/
public void setTargetDataBase(String targetDataBase) {
this.targetDataBase = targetDataBase;
}
/**
* This method read the value of valueMode parameter.
* @param valueMode is the value of parameter.
*/
public void setValueMode(String valueMode) {
this.valueMode = valueMode;
}
/**
* This method read the value of generatorOutput parameter.
* @param generatorOutput is the value of parameter.
*/
public void setGeneratorOutput(String generatorOutput) {
this.generatorOutput = generatorOutput;
}
/**
* This method read the value of sourceUser parameter.
* @param sourceUser is the value of parameter.
*/
public void setSourceUser(String sourceUser) {
this.sourceUser = sourceUser;
}
/**
* This method read the value of sourcePassword parameter.
* @param sourcePassword is the value of parameter.
*/
public void setSourcePassword(String sourcePassword) {
this.sourcePassword = sourcePassword;
}
/**
* This method read the value of targetUser parameter.
* @param targetUser is the value of parameter.
*/
public void setTargetUser(String targetUser) {
this.targetUser = targetUser;
}
/**
* This method read the value of targetPassword parameter.
* @param targetPassword is the value of parameter.
*/
public void setTargetPassword(String targetPassword) {
this.targetPassword = targetPassword;
}
/**
* This method read the value of domlPath parameter.
* @param domlUrl is the value of parameter.
*/
public void setDomlUrl(String domlUrl) {
this.domlUrl = domlUrl;
}
/**
* This method read the value of packageName parameter.
* @param packageName is the value of parameter.
*/
public void setPackageName(String packageName) {
this.packageName = packageName;
}
/**
* This method set value of generateDropTableStmt parameter
* @param generateDropTableStmt is value of parameter
*/
public void setGenerateDropTableStmt(String generateDropTableStmt) {
this.generateDropTableStmt = generateDropTableStmt;
}
/**
* This method set value of generateCreateTableStmt parameter
* @param generateCreateTableStmt is value of parameter
*/
public void setGenerateCreateTableStmt(String generateCreateTableStmt) {
this.generateCreateTableStmt = generateCreateTableStmt;
}
/**
* This method set value of generateCreatePKStmt parameter
* @param generateCreatePKStmt is value of parameter
*/
public void setGenerateCreatePKStmt(String generateCreatePKStmt) {
this.generateCreatePKStmt = generateCreatePKStmt;
}
/**
* This method set value of generateCreateFKStmt parameter
* @param generateCreateFKStmt is value of parameter
*/
public void setGenerateCreateFKStmt(String generateCreateFKStmt) {
this.generateCreateFKStmt = generateCreateFKStmt;
}
/**
* This method set value of generateCreateIndexStmt parameter
* @param generateCreateIndexStmt is value of parameter
*/
public void setGenerateCreateIndexStmt(String generateCreateIndexStmt) {
this.generateCreateIndexStmt = generateCreateIndexStmt;
}
/**
* This method set value of generateXml parameter
* @param generateXml is value of parameter
*/
public void setGenerateXml(String generateXml) {
this.generateXml = generateXml;
}
/**
* This method sets the value of generateDoml parameter.
* @param generateDoml is the value of parameter.
*/
public void setGenerateDoml(String generateDoml) {
this.generateDoml = generateDoml;
}
/**
* This method set value of fullMode parameter
* @param fullMode is value of parameter
*/
public void setFullMode(String fullMode) {
this.fullMode = fullMode;
}
// /**
// * This method set value of confJarStructure parameter
// * @param confFileStructure is value of parameter
// */
// public void setConfFileStructure(String confFileStructure) {
// this.confJarStructure = confFileStructure;
// }
/**
* This method set value of logMode parameter
* @param logMode is value of parameter
*/
public void setLogMode(String logMode) {
this.logMode = logMode;
}
/**
* This method set value of logDirName parameter
* @param logDirName is value of parameter
*/
public void setLogDirName(String logDirName) {
this.logDirName = logDirName;
}
/**
* This method set value of logFileName parameter
* @param logFileName is value of parameter
*/
public void setLogFileName(String logFileName) {
this.logFileName = logFileName;
}
/**
* This method set value for generateSqlForAllVendors
* @param generateSqlForAllVendors
*/
public void setGenerateSqlForAllVendors(String generateSqlForAllVendors) {
this.generateSqlForAllVendors = generateSqlForAllVendors;
}
/**
* This method set value of confJarStructure parameter
* @param confJarStructure is value of parameter
*/
public void setConfJarStructure(String confJarStructure) {
this.confJarStructure = confJarStructure;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -