Search in sources :

Example 1 with RangerKMSDao

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);
    }
}
Also used : RangerKMSDao(org.apache.ranger.kms.dao.RangerKMSDao) KeyStoreException(java.security.KeyStoreException) IllegalBlockSizeException(javax.crypto.IllegalBlockSizeException) InvocationTargetException(java.lang.reflect.InvocationTargetException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) UnrecoverableKeyException(java.security.UnrecoverableKeyException) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) JsonParseException(org.codehaus.jackson.JsonParseException)

Example 2 with RangerKMSDao

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);
    }
}
Also used : RangerKMSDao(org.apache.ranger.kms.dao.RangerKMSDao) XXRangerKeyStore(org.apache.ranger.entity.XXRangerKeyStore) KeyStoreException(java.security.KeyStoreException) IllegalBlockSizeException(javax.crypto.IllegalBlockSizeException) InvocationTargetException(java.lang.reflect.InvocationTargetException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) UnrecoverableKeyException(java.security.UnrecoverableKeyException) IOException(java.io.IOException) CertificateException(java.security.cert.CertificateException) JsonParseException(org.codehaus.jackson.JsonParseException)

Aggregations

IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 KeyStoreException (java.security.KeyStoreException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 UnrecoverableKeyException (java.security.UnrecoverableKeyException)2 CertificateException (java.security.cert.CertificateException)2 IllegalBlockSizeException (javax.crypto.IllegalBlockSizeException)2 RangerKMSDao (org.apache.ranger.kms.dao.RangerKMSDao)2 JsonParseException (org.codehaus.jackson.JsonParseException)2 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)2 XXRangerKeyStore (org.apache.ranger.entity.XXRangerKeyStore)1