}
public SentrySchemaTool(String sentryScripPath, Configuration sentryConf,
String dbType) throws SentryUserException {
if (sentryScripPath == null || sentryScripPath.isEmpty()) {
throw new SentryUserException("No Sentry script dir provided");
}
this.sentryConf = sentryConf;
this.dbType = dbType;
this.SentryStoreSchemaInfo = new SentryStoreSchemaInfo(sentryScripPath,
dbType);
userName = sentryConf.get(ServiceConstants.ServerConfig.SENTRY_STORE_JDBC_USER,
ServiceConstants.ServerConfig.SENTRY_STORE_JDBC_USER_DEFAULT);
passWord = sentryConf.get(ServiceConstants.ServerConfig.SENTRY_STORE_JDBC_PASS,
ServiceConstants.ServerConfig.SENTRY_STORE_JDBC_PASS_DEFAULT);
try {
connectionURL = getValidConfVar(ServiceConstants.ServerConfig.SENTRY_STORE_JDBC_URL);
if(dbType.equalsIgnoreCase(SentrySchemaHelper.DB_DERBY)) {
driver = sentryConf.get(ServiceConstants.ServerConfig.SENTRY_STORE_JDBC_DRIVER,
ServiceConstants.ServerConfig.SENTRY_STORE_JDBC_DRIVER_DEFAULT);
} else {
driver = getValidConfVar(ServiceConstants.ServerConfig.SENTRY_STORE_JDBC_DRIVER);
}
// load required JDBC driver
Class.forName(driver);
} catch (IOException e) {
throw new SentryUserException("Missing property: " + e.getMessage());
} catch (ClassNotFoundException e) {
throw new SentryUserException("Failed to load driver", e);
}
}