Search in sources :

Example 1 with NoPermissionException

use of com.sun.identity.policy.NoPermissionException in project OpenAM by OpenRock.

the class PolicyModelImpl method getServiceTypeNames.

/**
     * Returns all registered service type names. Map of service name to its
     * localized name.
     *
     * @return all registered service type names.
     */
public Map getServiceTypeNames() {
    Map map = null;
    try {
        Set types = getServiceTypeManager().getServiceTypeNames();
        if ((types != null) && !types.isEmpty()) {
            map = new HashMap(types.size() * 2);
            for (Iterator iter = types.iterator(); iter.hasNext(); ) {
                String name = (String) iter.next();
                String lname = getLocalizedServiceName(name, null);
                if (lname != null) {
                    map.put(name, lname);
                }
            }
        }
    } catch (SSOException e) {
        debug.warning("PolicyModelImpl.getServiceTypeNames", e);
    } catch (NoPermissionException e) {
        debug.warning("PolicyModelImpl.getServiceTypeNames", e);
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getServiceTypeNames", e);
    }
    return (map == null) ? Collections.EMPTY_MAP : map;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) Iterator(java.util.Iterator) NoPermissionException(com.sun.identity.policy.NoPermissionException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with NoPermissionException

use of com.sun.identity.policy.NoPermissionException 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));
    }
}
Also used : Policy(com.sun.identity.policy.Policy) PolicyManager(com.sun.identity.policy.PolicyManager) InvalidNameException(com.sun.identity.policy.InvalidNameException) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) NoPermissionException(com.sun.identity.policy.NoPermissionException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) InvalidFormatException(com.sun.identity.policy.InvalidFormatException)

Aggregations

SSOException (com.iplanet.sso.SSOException)2 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)2 NoPermissionException (com.sun.identity.policy.NoPermissionException)2 InvalidFormatException (com.sun.identity.policy.InvalidFormatException)1 InvalidNameException (com.sun.identity.policy.InvalidNameException)1 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)1 Policy (com.sun.identity.policy.Policy)1 PolicyException (com.sun.identity.policy.PolicyException)1 PolicyManager (com.sun.identity.policy.PolicyManager)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Set (java.util.Set)1