use of org.apache.ranger.kms.dao.RangerKMSDao in project ranger by apache.
the class RangerKeyStore method dbOperationDelete.
private void dbOperationDelete(String alias) {
if (logger.isDebugEnabled()) {
logger.debug("==> RangerKeyStore.dbOperationDelete(" + alias + ")");
}
try {
if (daoManager != null) {
RangerKMSDao rangerKMSDao = new RangerKMSDao(daoManager);
rangerKMSDao.deleteByAlias(alias);
}
} catch (Exception e) {
logger.error("==> RangerKeyStore.dbOperationDelete() error : ", e);
}
}
use of org.apache.ranger.kms.dao.RangerKMSDao in project ranger by apache.
the class RangerKeyStore method dbOperationStore.
public void dbOperationStore(XXRangerKeyStore rangerKeyStore) {
if (logger.isDebugEnabled()) {
logger.debug("==> RangerKeyStore.dbOperationStore()");
}
try {
if (daoManager != null) {
RangerKMSDao rangerKMSDao = new RangerKMSDao(daoManager);
XXRangerKeyStore xxRangerKeyStore = rangerKMSDao.findByAlias(rangerKeyStore.getAlias());
boolean keyStoreExists = true;
if (xxRangerKeyStore == null) {
xxRangerKeyStore = new XXRangerKeyStore();
keyStoreExists = false;
}
xxRangerKeyStore = mapToEntityBean(rangerKeyStore, xxRangerKeyStore);
if (keyStoreExists) {
xxRangerKeyStore = rangerKMSDao.update(xxRangerKeyStore);
} else {
xxRangerKeyStore = rangerKMSDao.create(xxRangerKeyStore);
}
}
} catch (Exception e) {
logger.error("==> RangerKeyStore.dbOperationStore() error : ", e);
}
}
Aggregations