bail(ExitCode.DIRECTORY_CREATION_FAILED);
}
wrkdir.mkdir();
}
DatabaseService dbsvc = new DatabaseServiceImpl();
// validate kamstore connection
final String url = syscfg.getKamURL();
final String user = syscfg.getKamUser();
final String pass = syscfg.getKamPassword();
try {
if (!dbsvc.validConnection(url, user, pass)) {
bail(ExitCode.KAM_CONNECTION_FAILURE);
}
} catch (DBConnectionFailure e) {
reportable.error(e.getUserFacingMessage());
bail(ExitCode.KAM_CONNECTION_FAILURE);
}
// If "--no-preserve" is not specified, query the database for an
// existing KAM w/same name. If one exists, exit with proper ExitCode.
if (!hasOption(LONG_OPT_NO_PRESERVE)){
String kamName = getOptionValue("k");
try{
dbConnection = dbsvc.dbConnection(
syscfg.getKamURL(),
syscfg.getKamUser(),
syscfg.getKamPassword());
kamStore = new KAMStoreImpl(dbConnection);
kams = kamStore.getCatalog();