Search in sources :

Example 11 with NameNotFoundException

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

the class PolicyModelImpl method getProtectedResourceNames.

public Set getProtectedResourceNames(String realmName, String policyName) throws AMConsoleException {
    Set resourceNames = new HashSet();
    String policyID = cachePolicy(realmName, policyName);
    CachedPolicy cachedPolicy = getCachedPolicy(policyID);
    Policy policy = cachedPolicy.getPolicy();
    Set ruleNames = policy.getRuleNames();
    if ((ruleNames != null) && !ruleNames.isEmpty()) {
        for (Iterator iter = ruleNames.iterator(); iter.hasNext(); ) {
            String ruleName = (String) iter.next();
            try {
                Rule rule = policy.getRule(ruleName);
                if (rule != null) {
                    String resName = rule.getResourceName();
                    if ((resName != null) && (resName.trim().length() > 0)) {
                        resourceNames.add(resName);
                    }
                }
            } catch (NameNotFoundException nnfe) {
                if (debug.warningEnabled()) {
                    debug.warning("Cannot find the rule with name '" + ruleName + " in policy " + policy.getName(), nnfe);
                }
            }
        }
    }
    return resourceNames;
}
Also used : Policy(com.sun.identity.policy.Policy) Set(java.util.Set) HashSet(java.util.HashSet) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) Iterator(java.util.Iterator) Rule(com.sun.identity.policy.Rule) HashSet(java.util.HashSet)

Example 12 with NameNotFoundException

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

the class PolicyModelImpl method getResponseProviderViewBeanURL.

/**
     * Returns properties view bean URL of a response provider.
     *
     * @param realmName Name of realm.
     * @param typeName Name of response provider Type.
     * @return properties view bean URL of a response provider.
     */
public String getResponseProviderViewBeanURL(String realmName, String typeName) {
    String url = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ResponseProviderTypeManager mgr = policyMgr.getResponseProviderTypeManager();
            ResponseProvider provider = mgr.getResponseProvider(typeName);
            url = mgr.getViewBeanURL(provider);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getResponseProviderViewBeanURL", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getResponseProviderViewBeanURL", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getResponseProviderViewBeanURL", e);
    }
    return url;
}
Also used : PolicyManager(com.sun.identity.policy.PolicyManager) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) ResponseProvider(com.sun.identity.policy.interfaces.ResponseProvider) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) ResponseProviderTypeManager(com.sun.identity.policy.ResponseProviderTypeManager)

Example 13 with NameNotFoundException

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

the class PolicyModelImpl method createResponseProvider.

/**
     * Returns a response provider object.
     *
     * @param realmName Name of Realm.
     * @param providerType Name of response provider type.
     * @param values Values of the response provider.
     * @return response provider object.
     * @throws AMConsoleException if response provider cannot be created.
     */
public ResponseProvider createResponseProvider(String realmName, String providerType, Map values) throws AMConsoleException {
    ResponseProvider provider = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ResponseProviderTypeManager mgr = policyMgr.getResponseProviderTypeManager();
            provider = mgr.getResponseProvider(providerType);
            provider.setProperties(values);
        }
    } catch (NameNotFoundException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (PolicyException e) {
        throw new AMConsoleException(getErrorString(e));
    }
    return provider;
}
Also used : PolicyManager(com.sun.identity.policy.PolicyManager) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) ResponseProvider(com.sun.identity.policy.interfaces.ResponseProvider) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) ResponseProviderTypeManager(com.sun.identity.policy.ResponseProviderTypeManager)

Example 14 with NameNotFoundException

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

the class PolicyModelImpl method getConditionViewBeanURL.

/**
     * Returns properties view bean URL of a condition.
     *
     * @param realmName Name of realm.
     * @param conditionTypeName Name of Condition Type.
     * @return properties view bean URL of a condition.
     */
public String getConditionViewBeanURL(String realmName, String conditionTypeName) {
    String url = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ConditionTypeManager condTypeMgr = policyMgr.getConditionTypeManager();
            Condition condition = condTypeMgr.getCondition(conditionTypeName);
            url = condTypeMgr.getViewBeanURL(condition);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
    }
    return url;
}
Also used : Condition(com.sun.identity.policy.interfaces.Condition) PolicyManager(com.sun.identity.policy.PolicyManager) ConditionTypeManager(com.sun.identity.policy.ConditionTypeManager) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 15 with NameNotFoundException

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

the class PolicyModelImpl method getReferralPossibleValues.

/**
     * Returns a set of possible values for a referral type.
     *
     * @param realmName Name of Realm.
     * @param referralType Name of Referral Type.
     * @param filter wildcards for filtering the results.
     * @return a set of possible values for a referral type.
     */
public ValidValues getReferralPossibleValues(String realmName, String referralType, String filter) {
    ValidValues values = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
            Referral referral = referralTypeMgr.getReferral(referralType);
            values = referral.getValidValues(getUserSSOToken(), filter);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
    } catch (SSOException e) {
        debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
    }
    return values;
}
Also used : ReferralTypeManager(com.sun.identity.policy.ReferralTypeManager) PolicyManager(com.sun.identity.policy.PolicyManager) ValidValues(com.sun.identity.policy.ValidValues) Referral(com.sun.identity.policy.interfaces.Referral) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

NameNotFoundException (com.sun.identity.policy.NameNotFoundException)52 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)41 Policy (com.sun.identity.policy.Policy)24 PolicyManager (com.sun.identity.policy.PolicyManager)23 PolicyException (com.sun.identity.policy.PolicyException)22 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)21 Set (java.util.Set)21 Map (java.util.Map)17 Iterator (java.util.Iterator)15 HashMap (java.util.HashMap)14 SSOException (com.iplanet.sso.SSOException)11 PolicyModel (com.sun.identity.console.policy.model.PolicyModel)11 Subject (com.sun.identity.policy.interfaces.Subject)11 Referral (com.sun.identity.policy.interfaces.Referral)10 HashSet (java.util.HashSet)10 Condition (com.sun.identity.policy.interfaces.Condition)8 ResponseProvider (com.sun.identity.policy.interfaces.ResponseProvider)7 InvalidNameException (com.sun.identity.policy.InvalidNameException)6 ReferralTypeManager (com.sun.identity.policy.ReferralTypeManager)6 Rule (com.sun.identity.policy.Rule)6