convert

public static Document getDoc(File file) throws FileNotFoundException,
DocumentException, MalformedURLException {
Document doc = null;
if (file.exists()) {
SAXReader reader = new SAXReader();
doc = reader.read(file);
}
return doc;
}

/*
* 安全校验、数据库结构校验
*/
public boolean checkSecurity() {
return this.targetDB.checkSecurity();
}

/*
* 转换表数据
*/
public void convertTables() throws Exception {
DBtoDB dbToDb = null;
DataFilter filter = null;
if (this.originDB.getDbType().equalsIgnoreCase("oracle")
&& this.targetDB.getDbType().equalsIgnoreCase("hsql")) {
dbToDb = new OraToHsql();
System.out.println("getFilter");
filter = new DataFilter(Constant.dbScriptFile, users, originDB);
System.out.println("getFilter end");
if (null == filter.getSqls() | filter.getSqls().size() < 1) {
throw new Exception("");
}
} else if (this.originDB.getDbType().equalsIgnoreCase("hsql")
&& this.targetDB.getDbType().equalsIgnoreCase("oracle")) {
dbToDb = new HsqlToOra();
}
if (null != dbToDb) {
for (int i = 0; i < users.size(); i++) {
DBUser user = users.get(i);
dbToDb.convertAllTable(originDB, user, targetDB, user, filter);
}
}
}

// private void prepairHSqlDB(String path) throws Exception {
// File dir = new File(path);
//
// //如果没有这个目录,创建这个目录
// dir.mkdirs();
//
// //如果有子目录,删除所有子目录
// File[] subDirFile = dir.listFiles();
// for (int i = 0; i < subDirFile.length; i++) {
// subDirFile[i].delete();
// }
// }

/**
* <一句话功能简述> <功能详细描述> [参数说明]
*
* @return void [返回类型说明]
* @exception throws
*                [违例类型] [违例说明]
* @see [类、类#方法、类#成员]
*/
public void convertAllViews() {
DBtoDB dbToDb = null;
if (this.originDB.getDbType().equalsIgnoreCase("oracle")
&& this.targetDB.getDbType().equalsIgnoreCase("hsql")) {
dbToDb = new OraToHsql();
} else if (this.originDB.getDbType().equalsIgnoreCase("hsql")
&& this.targetDB.getDbType().equalsIgnoreCase("oracle")) {
dbToDb = new HsqlToOra();
}
if (null != dbToDb) {
for (int i = 0; i < users.size(); i++) {
DBUser user = users.get(i);
dbToDb.convertAllViews(originDB, user, targetDB, user, null);
}
}
}

你可能感兴趣的:(数据结构,oracle)