}
}
public void checkMandatoryConfs(Configuration conf) throws HIHOException {
if (conf.get(DBConfiguration.DRIVER_CLASS_PROPERTY) == null) {
throw new HIHOException(
"JDBC driver configuration is not specified,please specify JDBC driver class");
}
if (conf.get(DBConfiguration.URL_PROPERTY) == null) {
throw new HIHOException(
"JDBC url path configuration is empty,please specify JDBC url path");
}
if (!conf.get(DBConfiguration.DRIVER_CLASS_PROPERTY).contains("hsqldb")) {
if (conf.get(DBConfiguration.USERNAME_PROPERTY) == null) {
throw new HIHOException(
"JDBC user name configuration is empty,please specify JDBC user name");
}
if (conf.get(DBConfiguration.PASSWORD_PROPERTY) == null) {
throw new HIHOException(
"JDBC password configuration is empty,please specify JDBC password");
}
}
if (conf.get(HIHOConf.INPUT_OUTPUT_PATH) == null) {
throw new HIHOException(
"Output path is not specified,please specify output path");
}
if (conf.get(HIHOConf.INPUT_OUTPUT_STRATEGY) != null
&& conf.get(HIHOConf.INPUT_OUTPUT_STRATEGY).equals("DELIMITED")) {
if (conf.get(HIHOConf.INPUT_OUTPUT_DELIMITER) == null) {
throw new HIHOException(
"Delimiter is not specified,please specify delimiter");
}
}
if (conf.get(DBConfiguration.INPUT_TABLE_NAME_PROPERTY) == null
&& conf.get(DBConfiguration.INPUT_QUERY) == null) {
throw new HIHOException(
"Input table name and input query both configurations are empty, please specify anyone of them");
}
if (conf.get(DBConfiguration.INPUT_QUERY) != null
&& conf.get(DBConfiguration.INPUT_BOUNDING_QUERY) == null) {
throw new HIHOException(
"Please specify input bounding query as it is mandatory to be defined with input query ");
}
if (conf.get(DBConfiguration.INPUT_TABLE_NAME_PROPERTY) != null
&& conf.get(DBConfiguration.INPUT_FIELD_NAMES_PROPERTY) == null) {
conf.set(DBConfiguration.INPUT_FIELD_NAMES_PROPERTY, "*");
}
if (conf.get(HIHOConf.INPUT_OUTPUT_LOADTO) != null
&& conf.get(HIHOConf.INPUT_OUTPUT_LOADTO_PATH) == null) {
throw new HIHOException(
"Load to path configuration is empty, please specify path to load script in loadTOPath configuration");
}
if (conf.get(HIHOConf.INPUT_OUTPUT_LOADTO) != null
&& conf.get(HIHOConf.INPUT_OUTPUT_LOADTO).equals("hive")) {
if (conf.get(HIHOConf.HIVE_URL) == null) {
throw new HIHOException(
"The Hive url is not defined, please specify hive url");
}
if (conf.get(HIHOConf.HIVE_DRIVER) == null) {
throw new HIHOException(
"The Hive driver is not defined, please specify hive driver");
}
if (checkForMultiplePartition(conf.get(HIHOConf.HIVE_PARTITION_BY))
&& conf.get(HIHOConf.HIVE_TABLE_NAME) == null) {
throw new HIHOException("please specify hive table name");
}
}
}