public void removePrincipal(JetspeedPrincipal principal) throws SecurityException
{
if (!principalExists(principal))
{
throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(principal.getType().getName(), principal.getName()));
}
try
{
getPersistenceBrokerTemplate().delete(principal);
}
catch (Exception pbe)
{
if (pbe instanceof DataIntegrityViolationException)
{
logger.error(pbe.getMessage(), pbe);
throw new SecurityException(SecurityException.PRINCIPAL_NOT_REMOVABLE.createScoped(principal.getType().getName(), principal.getName()));
}
KeyedMessage msg = SecurityException.UNEXPECTED.create("JetspeedSecurityPersistenceManager",
"removePrincipal",
pbe.getMessage());
logger.error(msg, pbe);
throw new SecurityException(msg, pbe);
}
}