Search in sources :

Example 6 with ResponseProviderTypeManager

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

the class PolicyModelImpl method getActiveResponseProviderTypes.

/**
     * Returns a map of active response provider types for a realm to its
     * display name.
     *
     * @param realmName Name of Realm.
     * @return a map of active response provider types for a realm to its
     *         display name.
     */
public Map getActiveResponseProviderTypes(String realmName) {
    Map providerTypes = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ResponseProviderTypeManager providerTypeMgr = policyMgr.getResponseProviderTypeManager();
            if (providerTypeMgr != null) {
                Set types = providerTypeMgr.getSelectedResponseProviderTypeNames();
                providerTypes = new HashMap(types.size() * 2);
                for (Iterator iter = types.iterator(); iter.hasNext(); ) {
                    String rName = (String) iter.next();
                    providerTypes.put(rName, providerTypeMgr.getDisplayName(rName));
                }
            }
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getActiveResponseProviderTypes", e);
    } catch (SSOException e) {
        debug.warning("PolicyModelImpl.getActiveResponseProviderTypes", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getActiveResponseProviderTypes", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getActiveResponseProviderTypes", e);
    }
    return (providerTypes == null) ? Collections.EMPTY_MAP : providerTypes;
}
Also used : PolicyManager(com.sun.identity.policy.PolicyManager) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) PolicyException(com.sun.identity.policy.PolicyException) Iterator(java.util.Iterator) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap) ResponseProviderTypeManager(com.sun.identity.policy.ResponseProviderTypeManager)

Aggregations

AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)6 PolicyManager (com.sun.identity.policy.PolicyManager)6 ResponseProviderTypeManager (com.sun.identity.policy.ResponseProviderTypeManager)6 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)4 PolicyException (com.sun.identity.policy.PolicyException)4 ResponseProvider (com.sun.identity.policy.interfaces.ResponseProvider)3 SSOException (com.iplanet.sso.SSOException)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