Search in sources :

Example 16 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException 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)

Example 17 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class PolicyModelImpl method getActiveReferralTypes.

/**
     * Returns a map of active referral types for a realm to its display name.
     *
     * @param realmName Name of Realm.
     * @return a map of active referral types for a realm to its display name.
     */
public Map getActiveReferralTypes(String realmName) {
    Map referralTypes = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
            if (referralTypeMgr != null) {
                Set types = referralTypeMgr.getSelectedReferralTypeNames();
                referralTypes = new HashMap(types.size() * 2);
                for (Iterator iter = types.iterator(); iter.hasNext(); ) {
                    String rName = (String) iter.next();
                    Referral referral = referralTypeMgr.getReferral(rName);
                    if (referral != null) {
                        Syntax syntax = referral.getValueSyntax(getUserSSOToken());
                        if (!syntax.equals(Syntax.NONE)) {
                            referralTypes.put(rName, referralTypeMgr.getDisplayName(rName));
                        }
                    }
                }
            }
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
    } catch (SSOException e) {
        debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getActiveReferralTypes", e);
    }
    return (referralTypes == null) ? Collections.EMPTY_MAP : referralTypes;
}
Also used : ReferralTypeManager(com.sun.identity.policy.ReferralTypeManager) PolicyManager(com.sun.identity.policy.PolicyManager) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) SSOException(com.iplanet.sso.SSOException) Referral(com.sun.identity.policy.interfaces.Referral) PolicyException(com.sun.identity.policy.PolicyException) Iterator(java.util.Iterator) Syntax(com.sun.identity.policy.Syntax) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map) HashMap(java.util.HashMap)

Example 18 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException 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 19 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class PolicyModelImpl method getManagedResources.

/**
     * Returns a list of managed resource names.
     *
     * @param realmName Name of realm.
     * @param serviceTypeName Name of service type.
     * @return a list of managed resource names.
     */
public List getManagedResources(String realmName, String serviceTypeName) {
    List managedResources = (List) mapSvcNameToManagedResource.get(serviceTypeName);
    if (managedResources == null) {
        managedResources = Collections.EMPTY_LIST;
        try {
            PolicyManager mgr = getPolicyManager(realmName);
            if (mgr != null) {
                Set resources = mgr.getManagedResourceNames(serviceTypeName);
                if ((resources != null) && !resources.isEmpty()) {
                    managedResources = AMFormatUtils.sortItems(resources, getUserLocale());
                }
            }
        } catch (PolicyException e) {
            debug.warning("PolicyModelImpl.getManagedResources", e);
        } catch (AMConsoleException e) {
            debug.warning("PolicyModelImpl.getManagedResources", e);
        }
        mapSvcNameToManagedResource.put(serviceTypeName, managedResources);
    }
    return managedResources;
}
Also used : PolicyManager(com.sun.identity.policy.PolicyManager) Set(java.util.Set) HashSet(java.util.HashSet) PolicyException(com.sun.identity.policy.PolicyException) List(java.util.List) ArrayList(java.util.ArrayList) OptionList(com.iplanet.jato.view.html.OptionList) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 20 with AMConsoleException

use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.

the class SMDiscoEntryData method setDiscoStr.

public void setDiscoStr(boolean isUserView) throws AMConsoleException {
    try {
        ResourceOfferingType res = discoFac.createResourceOfferingType();
        ResourceIDType rid = discoFac.createResourceIDType();
        // if user resource offering then set resource id type.
        if (isUserView) {
            if ((resourceIdAttribute != null) && resourceIdAttribute.length() > 0) {
                rid.setId(resourceIdAttribute);
            }
            rid.setValue(resourceIdValue);
            res.setEntryID(entryId);
        } else {
            /*
                 * jaxb api requires that we set resource id value to empty
                 * string if there is no value so that it will create empty tag
                 * for Resource ID.
                 */
            rid.setValue("");
        }
        ServiceInstanceType svc = createServiceInstanceEntry();
        List descriptionTypeList = (List) svc.getDescription();
        res.setServiceInstance(svc);
        res.setResourceID(rid);
        if (abstractValue != null && abstractValue.length() > 0) {
            res.setAbstract(abstractValue);
        }
        if (!noOption) {
            res.setOptions(createOptionsEntry());
        }
        DiscoEntryElement de = entryFac.createDiscoEntryElement();
        de.setResourceOffering(res);
        createDirectivesEntry(de, descriptionTypeList);
        String str = convertDiscoEntryToXmlStr(de);
        if (str == null || str.length() == 0) {
            throw new AMConsoleException("discoEntryFailed.message");
        } else {
            discoStr = str;
        }
    } catch (JAXBException e) {
        Throwable t = e.getLinkedException();
        String str = (t != null) ? t.getMessage() : e.toString();
        throw new AMConsoleException(str);
    }
}
Also used : ServiceInstanceType(com.sun.identity.liberty.ws.disco.jaxb.ServiceInstanceType) JAXBException(javax.xml.bind.JAXBException) ResourceOfferingType(com.sun.identity.liberty.ws.disco.jaxb.ResourceOfferingType) ArrayList(java.util.ArrayList) List(java.util.List) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) ResourceIDType(com.sun.identity.liberty.ws.disco.jaxb.ResourceIDType) DiscoEntryElement(com.sun.identity.liberty.ws.disco.plugins.jaxb.DiscoEntryElement)

Aggregations

AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)701 Map (java.util.Map)255 Set (java.util.Set)206 HashMap (java.util.HashMap)193 HashSet (java.util.HashSet)148 SSOException (com.iplanet.sso.SSOException)126 Iterator (java.util.Iterator)122 List (java.util.List)97 SMSException (com.sun.identity.sm.SMSException)83 ArrayList (java.util.ArrayList)78 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)76 IdRepoException (com.sun.identity.idm.IdRepoException)58 SAML2MetaException (com.sun.identity.saml2.meta.SAML2MetaException)47 SAML2MetaManager (com.sun.identity.saml2.meta.SAML2MetaManager)46 AMIdentity (com.sun.identity.idm.AMIdentity)44 SAMLv2Model (com.sun.identity.console.federation.model.SAMLv2Model)41 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)41 CCActionTable (com.sun.web.ui.view.table.CCActionTable)40 TreeSet (java.util.TreeSet)39 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)38