📄 octopusgeneratordata.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.wizard;
import java.util.Vector;
import org.webdocwf.util.loader.generator.SearchXmlFile;
import org.webdocwf.util.loader.LoaderException;
//import org.webdocwf.util.loader.Utils;
/**
*
* LoaderGeneratorEntry class sets the input parameters
* @author Radoslav Dutina
* @version 1.0
*/
public class OctopusGeneratorData {
private static String[] logModes = {
"none", "normal", "full"};
private String logMode = "";
private String logFileDirectory = "";
private String logFileName = "";
private String sourceType = "";
private String targetType = "";
private String sourceDatabase = "";
private String targetDatabase = "";
private String sourceDriverName = "";
private String targetDriverName = "";
private String valueMode = "";
private String generatorOutput = "";
// private String generatedDoc = "";
private String packageName = "";
private String domlPath = "";
private String sourceUser = "";
private String sourcePassword = "";
private String targetUser = "";
private String targetPassword = "";
private String additonalPaths = "";
private String includeTableList = "";
private String confJarStructure = "";
//Output Mode
//main
private String xmlGenerate = "true";
private String sqlGenerate = "true";
private String domlGenerate = "";
//for generate sql statements
private String sqlStmtDropTable = "true";
private String sqlStmtDropIntegrity = "true";
private String sqlStmtCreateTable = "true";
private String sqlStmtCreatePK = "true";
private String sqlStmtCreateFK = "true";
private String sqlStmtCreateIndex = "true";
//optimized modes
private String fullMode = "false";
//for generate sql statements for all vendors
private String sqlStmtForAllVendors = "";
private static Vector targetVendors = new Vector();
private static Vector sourceVendors = new Vector();
private static Vector allVendorsPath = new Vector();
private static Vector sourceDrivers = new Vector();
private static Vector targetDrivers = new Vector();
private static String[] targetDatabaseTypes;
private static String[] sourceDatabaseTypes;
private static String[] sourceDriverNames;
private static String[] targetDriverNames;
private static final String[] valueModes = { "copy" };
/**
* Constuctor of LoaderGeneratorEntry class
* @throws LoaderException
*/
public OctopusGeneratorData(String confJarStructure) throws LoaderException {
SearchXmlFile searchXmlFile =
new SearchXmlFile("relative", "OctopusDBVendors.xml", confJarStructure);
this.confJarStructure = confJarStructure;
this.targetVendors = searchXmlFile.getAllVendors();
this.allVendorsPath = searchXmlFile.getAllVendorsPath();
setAllVendorsAndDrivers(targetVendors, allVendorsPath);
}
/**
* This method set value of targetDrivers and sourceDrivers parameters
* @param all_Vendors is vector which represents all named vendors
* @param all_VendorsPath is vector which represents all vendors path
* @throws LoaderException
*/
public void setAllVendorsAndDrivers(Vector all_Vendors, Vector all_VendorsPath)
throws LoaderException {
for (int i = 0; i < all_VendorsPath.size(); i++) {
Vector targetDriversTemp = new Vector();
Vector sourceDriversTemp = new Vector();
String path = all_VendorsPath.get(i).toString();
SearchXmlFile searchXmlFile = new SearchXmlFile("absolute", path, confJarStructure);
Vector drivers = searchXmlFile.getAllDriversForVendor();
targetDriversTemp = (Vector) drivers.get(0);
sourceDriversTemp = (Vector) drivers.get(1);
String isSourceVendor = (String) drivers.get(2);
if (isSourceVendor.equalsIgnoreCase("true")) {
if (!sourceVendors.contains(all_Vendors.get(i)))
sourceVendors.add(all_Vendors.get(i));
}
boolean repeatTarget = false;
boolean repeatSource = false;
for (int j = 0; j < targetDriversTemp.size(); j++) {
String targetDriverName = targetDriversTemp.get(j).toString();
for (int k = 0; k < targetDrivers.size(); k++) {
if (targetDrivers.get(k).toString().equalsIgnoreCase(targetDriverName)) {
repeatTarget = true;
break;
}
}
if (repeatTarget == false)
this.targetDrivers.add(targetDriverName);
}
for (int j = 0; j < sourceDriversTemp.size(); j++) {
String sourceDriverName = sourceDriversTemp.get(j).toString();
for (int k = 0; k < sourceDrivers.size(); k++) {
if (sourceDrivers.get(k).toString().equalsIgnoreCase(sourceDriverName)) {
repeatSource = true;
break;
}
}
if (repeatSource == false)
this.sourceDrivers.add(sourceDriverName);
}
}
}
/**
* This method read the value of targetDatabaseTypes parameter
* @return value of parameter
*/
public static String[] getTargetDatabaseTypes() {
targetDatabaseTypes = new String[targetVendors.size()];
for (int i = 0; i < targetVendors.size(); i++) {
targetDatabaseTypes[i] = targetVendors.get(i).toString();
}
return targetDatabaseTypes;
}
/**
* This method read the value of sourceDatabaseTypes parameter
* @return value of parameter
*/
public static String[] getSourceDatabaseTypes() {
sourceDatabaseTypes = new String[sourceVendors.size()];
for (int i = 0; i < sourceVendors.size(); i++) {
sourceDatabaseTypes[i] = sourceVendors.get(i).toString();
}
return sourceDatabaseTypes;
}
/**
* This method read the value of sourceDriverNames parameter
* @return value of parameter
*/
public static String[] getSourceDriverNames() {
sourceDriverNames = new String[sourceDrivers.size()];
for (int i = 0; i < sourceDrivers.size(); i++) {
sourceDriverNames[i] = sourceDrivers.get(i).toString();
}
return sourceDriverNames;
}
/**
* This method read the value of sourceDriverNames parameter
* @return value of parameter
*/
public static String[] getTargetDriverNames() {
targetDriverNames = new String[targetDrivers.size()];
for (int i = 0; i < targetDrivers.size(); i++) {
targetDriverNames[i] = targetDrivers.get(i).toString();
}
return targetDriverNames;
}
/**
* This method read the value of valueModes parameter
* @return value of parameter
*/
public static String[] getValueModes() {
return valueModes;
}
/**
* This method sets the additionalPaths parameter
* @param additonal_Paths is the value of paramter
*/
public void setAdditionalPaths(String additonal_Paths) {
if (additonal_Paths.startsWith(";")) {
if (additonal_Paths.endsWith(";"))
additonalPaths = additonal_Paths.substring(1, additonal_Paths.length() - 1);
else
additonalPaths = additonal_Paths.substring(1);
} else
if (additonal_Paths.endsWith(";")) {
additonalPaths = additonal_Paths.substring(0, additonal_Paths.length() - 1);
} else {
additonalPaths = additonal_Paths;
}
}
/**
* This method read value of logMod parameter
* @return value of parameter
*/
public static String[] getLogModes() {
return logModes;
}
/**
* This mehod set value of logMode parameter
* @param log_Mode is value of parameter
*/
public void setLogMode(String log_Mode) {
this.logMode = log_Mode;
}
/**
* This method read value of logMods parameter
* @return value of parameter
*/
public String getLogMode() {
return logMode;
}
/**
* This method set value of logFileDirectory parameter
* @param log_FileDirectory is value of parameter
*/
public void setLogFileDir(String log_FileDirectory) {
this.logFileDirectory = log_FileDirectory;
}
/**
* This method read value of logFileDirectory parameter
* @return value of parameter
*/
public String getLogFileDir() {
return this.logFileDirectory;
}
/**
* This method set value of logFileName parameter
* @param log_FileName is value of parameter
*/
public void setLogFileName(String log_FileName) {
this.logFileName = log_FileName;
}
/**
* This method read value of logFileName parameter
* @return value of parameter
*/
public String getLogFileName() {
return this.logFileName;
}
/**
* This method read the value of additonalPaths parameter
* @return value of parameter
*/
public String getAdditionalPaths() {
return additonalPaths;
}
/**
* This method sets the value of sourceType parameter
* @param source_Type is value of parameter
*/
public void setSourceType(String source_Type) {
sourceType = source_Type;
}
/**
* This method read value of sourceType parameter
* @return value of parameter
*/
public String getSourceType() {
return sourceType;
}
/**
* This method sets value of targetType parameter
* @param target_Type is value of parameter
*/
public void setTargetType(String target_Type) {
targetType = target_Type;
}
/**
* This method read value of targetType parameter
* @return value of parameter
*/
public String getTargetType() {
return targetType;
}
/**
* This method sets value of sourceDatabase parameter
* @param source_Database is value of parameter
*/
public void setSourceDatabase(String source_Database) {
sourceDatabase = source_Database;
}
/**
* This method read value of sourceDatabase parameter
* @return value of parameter
*/
public String getSourceDatabase() {
return sourceDatabase;
}
/**
* This method sets value of targetDatabase parameter
* @param target_Database is value of parameter
*/
public void setTargetDatabase(String target_Database) {
targetDatabase = target_Database;
}
/**
* This method read value of targetDatabase parameter
* @return value of parameter
*/
public String getTargetDatabase() {
return targetDatabase;
}
/**
* This method sets value of valueMode parameter
* @param value_Mode is value of parameter
*/
public void setValueMode(String value_Mode) {
valueMode = value_Mode;
}
/**
* This method read value of valueMode parameter
* @return value of parameter
*/
public String getValueMode() {
return valueMode;
}
/**
* This method sets value of generatorOutput parameter
* @param generator_Output is value of parameter
*/
public void setGeneratorOutput(String generator_Output) {
generatorOutput = generator_Output;
}
/**
* This method read value of generatorOutput parameter
* @return value of parameter
*/
public String getGeneratorOutput() {
return generatorOutput;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -