📄 restoretask.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.generator.LoaderGenerator;
import org.webdocwf.util.loader.Loader;
import java.io.File;
/**
* RestoreTask Task class extends jakarta-ant Task class and uses to start
* @author Radoslav Dutina
* @version 1.0
*/
public class RestoreTask
extends Task {
protected String generatorOutput = null;
protected String sourceDatabase = null;
protected String sourceUser = "";
protected String sourcePassword = "";
protected String sourceType = null;
protected String sourceDriverName = "";
protected String targetDatabase = null;
protected String targetUser = "";
protected String targetPassword = "";
protected String targetType = null;
protected String targetDriverName = "";
protected String octopusHome = null;
//sql statements
protected String generateDropTableStmt = "false";
protected String generateDropIntegrityStmt = "false";
protected String generateCreateTableStmt = "false";
protected String generateCreatePKStmt = "false";
protected String generateCreateFKStmt = "false";
protected String generateCreateIndexStmt = "false";
protected String generateSqlForAllVendors = "false";
//xml files
protected String fullMode = "false";
protected String generateXml = "true";
protected String generateDoml = "false";
protected String restoreMode = "true";
protected String valueMode = "copy";
protected String includeTableList="";
protected String confJarStructure="";
public RestoreTask() {
}
/**
*
* @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 (sourceType == null) {
throw new BuildException("sourceDatabaseType attribute must be set!");
}
if (targetDatabase == null) {
throw new BuildException("targetDatabase attribute must be set!");
}
if (targetType == null) {
throw new BuildException("targetDatabaseType attribute must be set!");
}
if (octopusHome != null)
System.setProperty("OCTOPUS_HOME", octopusHome);
try {
LoaderGenerator loaderGenerator = new LoaderGenerator(sourceType,
sourceDatabase,
valueMode, generatorOutput, sourceDriverName,
targetDriverName, targetDatabase, targetType, sourceUser,
sourcePassword, targetUser, targetPassword, null, null,
generateDropTableStmt,generateDropIntegrityStmt, generateCreateTableStmt, generateCreatePKStmt,
generateCreateFKStmt,
generateCreateIndexStmt, generateSqlForAllVendors, generateXml,
generateDoml,
fullMode, restoreMode, includeTableList,confJarStructure);
loaderGenerator.generate();
}
catch (Exception ex) {
ex.printStackTrace();
}
try { //Octopus loader
String loadJobFileName = "";
if (!generatorOutput.equalsIgnoreCase("")) {
File file = new File(generatorOutput);
generatorOutput = file.getAbsolutePath();
loadJobFileName = generatorOutput + System.getProperty("file.separator") +
"LoaderJob.olj";
}
else {
loadJobFileName = "LoaderJob.olj";
}
Loader octopusLoader = new Loader(loadJobFileName,confJarStructure);
octopusLoader.load();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
/**
* This method set value of confJarStructure parameter
* @param confJarStructure is value of parameter
*/
public void setConfJarStructure(String confJarStructure) {
this.confJarStructure = confJarStructure;
}
/**
* This method read value of confJarStructure parameter
* @return value of parameter
*/
public String getConfJarStructure() {
return this.confJarStructure;
}
/**
* This method set value of includeTableList parameter
* @param includeTableList is value of parameter
*/
public void setIncludeTableList(String includeTableList) {
this.includeTableList = includeTableList;
}
/**
* This method read value of includeTableList parameter
* @return value of parameter
*/
public String getIncludeTableList() {
return this.includeTableList;
}
/**
* This method set value of generatorOutput parameter
* @param generatorOutput is value of parameter
*/
public void setGeneratorOutput(String generatorOutput) {
this.generatorOutput = generatorOutput;
}
/**
* This method read value of generatorOutput parameter
* @return value of parameter
*/
public String getGeneratorOutput() {
return this.generatorOutput;
}
/**
* This method set value of sourceDatabase parameter
* @param sourceDatabase is value of parameter
*/
public void setSourceDatabase(String sourceDatabase) {
this.sourceDatabase = sourceDatabase;
}
/**
* This method read value of sourceDatabase parameter
* @return value of parameter
*/
public String getSourceDatabase() {
return this.sourceDatabase;
}
/**
* This method set value of sourceUser parameter
* @param sourceUser is value of parameter
*/
public void setSourceUser(String sourceUser) {
this.sourceUser = sourceUser;
}
/**
* This method read value of sourceUser parameter
* @return value of parameter
*/
public String getSourceUser() {
return this.sourceUser;
}
/**
* This method set value of sourcePassword parameter
* @param sourcePassword is value of parameter
*/
public void setSourcePassword(String sourcePassword) {
this.sourcePassword = sourcePassword;
}
/**
* This method read value of sourcePassword parameter
* @return value of parameter
*/
public String getSourcePassword() {
return this.sourcePassword;
}
/**
* This method set value of sourceType parameter
* @param sourceType is value of parameter
*/
public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}
/**
* This method read value of sourceType parameter
* @return value of parameter
*/
public String getSourceType() {
return this.sourceType;
}
/**
* This method set value of sourceDriverName parameter
* @param sourceDriverName is value of parameter
*/
public void setSourceDriverName(String sourceDriverName) {
this.sourceDriverName = sourceDriverName;
}
/**
* This method read value of sourceDriverName parameter
* @return value of parameter
*/
public String getSourceDriverName() {
return this.sourceDriverName;
}
/**
* This method set value of targetDatabase parameter
* @param targetDatabase is value of parameter
*/
public void setTargetDatabase(String targetDatabase) {
this.targetDatabase = targetDatabase;
}
/**
* This method read value of targetDatabase parameter
* @return value of parameter
*/
public String getTargetDatabase() {
return this.targetDatabase;
}
/**
* This method set value of targetUser parameter
* @param targetUser is value of parameter
*/
public void setTargetUser(String targetUser) {
this.targetUser = targetUser;
}
/**
* This method read value of targetDatabase parameter
* @return value of parameter
*/
public String getTargetUser() {
return this.targetUser;
}
/**
* This method set value of targetPassword parameter
* @param targetPassword is value of parameter
*/
public void setTargetPassword(String targetPassword) {
this.targetPassword = targetPassword;
}
/**
* This method read value of targetPassword parameter
* @return value of parameter
*/
public String getTargetPassword() {
return this.targetPassword;
}
/**
* This method set value of targetType parameter
* @param targetType is value of parameter
*/
public void setTargetType(String targetType) {
this.targetType = targetType;
}
/**
* This method read value of targetType parameter
* @return value of parameter
*/
public String getTargetType() {
return this.targetType;
}
/**
* This method set value of targetDriverName parameter
* @param targetDriverName is value of parameter
*/
public void setTargetDriverName(String targetDriverName) {
this.targetDriverName = targetDriverName;
}
/**
* This method read value of targetDriverName parameter
* @return value of parameter
*/
public String getTargetDriverName() {
return this.targetDriverName;
}
/**
* This method set value of octopusHome parameter
* @param octopusHome is value of parameter
*/
public void setOctopusHome(String octopusHome) {
this.octopusHome = octopusHome;
}
/**
* This method read value of octopusHome parameter
* @return value of parameter
*/
public String getOctopusHome() {
return this.octopusHome;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -