public void removeDomain(SecurityDomain domain) throws SecurityException { if (!domainExists(domain)) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.create(domain.getName())); } try { getPersistenceBrokerTemplate().delete(domain); // evict from cache to notify jspmCache.evictDomain(domain.getDomainId()); } catch (Exception pbe) { if (pbe instanceof DataIntegrityViolationException) { logger.error(pbe.getMessage(), pbe); throw new SecurityException(SecurityException.SECURITY_DOMAIN_NOT_REMOVABLE.create(domain.getName())); } KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager", "removeDomain", pbe.getMessage()); logger.error(msg, pbe); throw new SecurityException(msg, pbe); } }
public void updateDomain(SecurityDomain domain) throws SecurityException { if (!domainExists(domain)){ throw new SecurityException(SecurityException.SECURITY_DOMAIN_DOES_NOT_EXIST.create(domain.getName())); } try { getPersistenceBrokerTemplate().store(domain); // evict from and put in cache to notify jspmCache.evictDomain(domain.getDomainId()); jspmCache.putDomain(domain.getDomainId(), domain); } catch (Exception pbe) { if (pbe instanceof DataIntegrityViolationException) { logger.error(pbe.getMessage(), pbe); throw new SecurityException(SecurityException.SECURITY_DOMAIN_UPDATE_FAILURE.create(domain.getDomainId())); } KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager", "updateDomain", pbe.getMessage()); logger.error(msg, pbe); throw new SecurityException(msg, pbe); } }
public void addDomain(SecurityDomain domain) throws SecurityException { if (domainExists(domain)) { throw new SecurityException(SecurityException.SECURITY_DOMAIN_EXISTS.create(domain.getName())); } try { getPersistenceBrokerTemplate().store(domain); // evict from and put in cache to notify jspmCache.evictDomain(domain.getDomainId()); jspmCache.putDomain(domain.getDomainId(), domain); } catch (Exception pbe) { KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager", "addDomain", pbe.getMessage()); logger.error(msg, pbe); throw new SecurityException(msg, pbe); } }