use of com.sun.identity.policy.InvalidFormatException in project OpenAM by OpenRock.
the class PolicyModelImpl method cachePolicy.
/**
* Caches an existing policy. Returns the cache ID of the policy object.
*
* @param realmName Name of realm.
* @param policyName Name of policy.
* @return cache ID of the policy object.
* @throws AMConsoleException if policy cannot be cached.
*/
public String cachePolicy(String realmName, String policyName) throws AMConsoleException {
try {
PolicyManager policyManager = getPolicyManager(realmName);
Policy policy = policyManager.getPolicy(policyName);
PolicyCache cache = PolicyCache.getInstance();
return cache.cachePolicy(getUserSSOToken(), new CachedPolicy(policy));
} catch (InvalidFormatException e) {
throw new AMConsoleException(getErrorString(e));
} catch (InvalidNameException e) {
throw new AMConsoleException(getErrorString(e));
} catch (NoPermissionException e) {
throw new AMConsoleException(getErrorString(e));
} catch (NameNotFoundException e) {
throw new AMConsoleException(getErrorString(e));
} catch (PolicyException e) {
throw new AMConsoleException(getErrorString(e));
} catch (SSOException e) {
throw new AMConsoleException(getErrorString(e));
}
}
Aggregations