📄 searchxmlfile.java
字号:
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetHasSize is finished.");
// }
return resHashtable;
}
/**
* This method search the named xml document, and read the value of isDecimal parameter
* @return hasSize.
* @throws LoaderException
*/
public Hashtable getIsDecimal() throws LoaderException {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetIsDecimal is started.");
// }
Hashtable resHashtable = new Hashtable();
searchDocument = (SearchElement) SearchElement.newInstance(document);
NodeList SQLTypesTagX = searchDocument.getSubElementsByTagName("SQLType");
NodeList SQLTypesTag = SQLTypesTagX.item(0).getChildNodes();
if (SQLTypesTag.getLength() != 0) {
for (int i = 0; i < SQLTypesTag.getLength(); i++) {
if (!(SQLTypesTag.item(i) instanceof org.enhydra.xml.SearchElement))
continue;
String hasSize = ((Element) SQLTypesTag.item(i)).getAttribute("isDecimal");
if (hasSize == null || hasSize.equalsIgnoreCase(""))
hasSize = "false";
resHashtable.put(((Element) SQLTypesTag.item(i)).getNodeName(), hasSize);
}
} else {
String msg = "Exception in method getIsDecimal in class SearchXmlFile.";
LoaderException le = new LoaderException("Exception:", new Exception(msg));
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetIsDecimal is finished.");
// }
return resHashtable;
}
/**
* This method search the named xml document, and read the value of sqlType parameter,
* which represents the sql type of data of the named jdbc type of data.
* @param jdbc_Type is the jdbc type of data.
* @return the sql type of data.
* @throws LoaderException
*/
public String getSQLFromJDBCType(String jdbc_Type) throws LoaderException {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetSQLFromJDBCType is started.");
// }
searchDocument = (SearchElement) SearchElement.newInstance(document);
NodeList JDBCTypeTag = searchDocument.getSubElementsByTagName("JDBCType/" + jdbc_Type.toUpperCase());
if (JDBCTypeTag.getLength() != 0) {
sqlType = JDBCTypeTag.item(0).getFirstChild().getNodeValue();
} else {
String msg = "This type of data (" + jdbc_Type + ") doesn't exists on the target table conf file!";
LoaderException le = new LoaderException("Exception:", new Exception(msg));
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetSQLFromJDBCType is finished.");
// }
return sqlType;
}
/**
* This method search the named xml document, and read the value of javaType parameter,
* which represents the java type of data of the named jdbc type of data.
* @param java_Type is the jdbc type of data.
* @return java type of data.
* @throws LoaderException
*/
public String getJAVAType(String java_Type) throws LoaderException {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetJAVAType is started.");
// }
searchDocument = (SearchElement) SearchElement.newInstance(document);
java_Type = Utils.replaceAll(java_Type, " ", "_");
NodeList JAVATypeTag = searchDocument.getSubElementsByTagName("JAVAType/" + java_Type.toUpperCase());
if (JAVATypeTag.getLength() != 0) {
javaType = JAVATypeTag.item(0).getFirstChild().getNodeValue();
} else {
String msg = "This type of data (" + java_Type + ") doesn't exists in Java Type class!";
LoaderException le = new LoaderException("Exception:", new Exception(msg));
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetJAVAType is finished.");
// }
return javaType;
}
/**
* This method search the named xml document, and read the value of oidDbType parameter, which
* represents the oid type for the named database.
* @return oid type.
* @throws LoaderException
*/
public String getOidDB() throws LoaderException {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetOidDB is started.");
// }
searchDocument = (SearchElement) SearchElement.newInstance(document);
NodeList OidDb = searchDocument.getSubElementsByTagName("OidDbType");
if (OidDb.getLength() != 0) {
this.oidDbType = OidDb.item(0).getFirstChild().getNodeValue();
} else {
String msg = "You must cofigure your conf file for this Oid type!";
LoaderException le = new LoaderException("Exception:", new Exception(msg));
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetOidDB is finished.");
// }
return oidDbType;
}
/**
* This method search the named xml document, and read the value of versionDbType parameter, which
* represents the version type of the named database.
* @return version type.
* @throws LoaderException
*/
public String getVersionDb() throws LoaderException {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetVersionDb is started.");
// }
searchDocument = (SearchElement) SearchElement.newInstance(document);
NodeList VersionDb = searchDocument.getSubElementsByTagName("VersionDbType");
if (VersionDb.getLength() != 0) {
this.versionDbType = VersionDb.item(0).getFirstChild().getNodeValue();
} else {
String msg = "You must cofigure yoor conf file for this Version type!";
LoaderException le = new LoaderException("Exception:", new Exception(msg));
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetVersionDb is finished.");
// }
return versionDbType;
}
/**
* This method search the named xml document, and read the value of oidDbColumnName parameter,
* which represents the oid name for the named database.
* @return oid name.
* @throws LoaderException
*/
public String getOidDbColumn() throws LoaderException {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetOidDbColumn is started.");
// }
searchDocument = (SearchElement) SearchElement.newInstance(document);
NodeList OidDbColumn = searchDocument.getSubElementsByTagName("OidDbColumnName");
if (OidDbColumn.getLength() != 0) {
this.oidDbColumnName = OidDbColumn.item(0).getFirstChild().getNodeValue();
} else {
String msg = "You must cofigure yoor conf file for this Oid name!";
LoaderException le = new LoaderException("Exception:", new Exception(msg));
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetOidDbColumn is finished.");
// }
return oidDbColumnName;
}
/**
* This method search the named xml document, and read the value of versionDbColumnName parameter,
* which represents the version name of the named database.
* @return version name.
* @throws LoaderException
*/
public String getVersionDbColumn() throws LoaderException {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetVersionDbColumn is started.");
// }
searchDocument = (SearchElement) SearchElement.newInstance(document);
NodeList VersionDbColumn = searchDocument.getSubElementsByTagName("VersionDbColumnName");
if (VersionDbColumn.getLength() != 0) {
this.versionDbColumnName = VersionDbColumn.item(0).getFirstChild().getNodeValue();
} else {
String msg = "You must cofigure yoor conf file for this Version name!";
LoaderException le = new LoaderException("Exception:", new Exception(msg));
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetVersionDbColumn is finished.");
// }
return versionDbColumnName;
}
/**
* This method search the named xml document, and read the value of name (Driver) parameter,
* which represents the driver name.
* @return value of parameter.
*/
public String getDriverName() {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetDriverName is started.");
// }
searchDocument = (SearchElement) SearchElement.newInstance(document);
NodeList driverTag = searchDocument.getSubElementsByTagName("Driver");
// if (this.logger!=null){
// this.logger.write("full", "\tgetDriverName is finished.");
// }
return ((Element) driverTag.item(0)).getAttribute("name");
}
public String getExcludedTables() throws LoaderException {
setLogger();
// if (this.logger!=null){
// this.logger.write("full", "\tgetExcludedTables is started.");
// }
String ret = "";
searchDocument = (SearchElement) SearchElement.newInstance(document);
NodeList excludeTableTag = searchDocument.getSubElementsByTagName("ExcludeTables");
if (excludeTableTag.getLength() != 0) {
if (excludeTableTag.item(0).getFirstChild() != null)
ret = excludeTableTag.item(0).getFirstChild().getNodeValue();
else
ret = "";
} else {
String msg = "ExcludeTables tag doesn't exist in source conf file!";
LoaderException le = new LoaderException("Exception:", (Throwable) new Exception(msg));
if (this.logger!=null){
this.logger.write("full", "Error:"+le.getStackTraceAsString());
}
throw le;
}
// if (this.logger!=null){
// this.logger.write("full", "\tgetExcludedTables is finished.");
// }
return ret;
}
/**
* This method will set logger object
* @param logger
*/
private void setLogger() {
this.logger = StandardLogger.getCentralLogger();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -