Search in sources :

Example 86 with AMConsoleException

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

the class PolicyModelImpl method getSvcTypeNameToActionsMap.

private Map getSvcTypeNameToActionsMap(Policy policy, String realmName) {
    if (mapSvcTypeNameToActions == null) {
        try {
            Set serviceTypeNames = getServiceTypeNames().keySet();
            int sz = serviceTypeNames.size();
            mapSvcTypeNameToActions = new HashMap(sz * 2);
            mapSvcTypeNameToResBundle = new HashMap(sz * 2);
            ServiceTypeManager mgr = getServiceTypeManager();
            for (Iterator i = serviceTypeNames.iterator(); i.hasNext(); ) {
                String serviceTypeName = (String) i.next();
                ServiceType serviceType = mgr.getServiceType(serviceTypeName);
                if (serviceType != null) {
                    ResourceBundle rb = getResourceBundle(serviceType, getUserLocale());
                    if (rb != null) {
                        mapSvcTypeNameToResBundle.put(serviceTypeName, rb);
                        Set as = getActionSchemas(serviceType);
                        filterActionSchemaWithI18nKey(as);
                        if ((as != null) && !as.isEmpty()) {
                            mapSvcTypeNameToActions.put(serviceTypeName, as);
                            if (requiresResourceName(policy, realmName, serviceTypeName, as, true)) {
                                requiredResourceNameService.add(serviceTypeName);
                            }
                            if (requiresResourceName(policy, realmName, serviceTypeName, as, false)) {
                                notRequiredResourceNameService.add(serviceTypeName);
                            }
                        }
                    }
                }
            }
        } catch (AMConsoleException e) {
            debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
        } catch (SSOException e) {
            debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
        } catch (NameNotFoundException e) {
            debug.warning("PolicyModelImppl.getSvcTypeNameToActionsMap", e);
        }
    }
    return mapSvcTypeNameToActions;
}
Also used : ServiceTypeManager(com.sun.identity.policy.ServiceTypeManager) Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) NameNotFoundException(com.sun.identity.policy.NameNotFoundException) ServiceType(com.sun.identity.policy.ServiceType) Iterator(java.util.Iterator) ResourceBundle(java.util.ResourceBundle) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 87 with AMConsoleException

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

the class PolicyModelImpl method getResponseProviderInstance.

private ResponseProvider getResponseProviderInstance(String realmName, String typeName) {
    ResponseProvider provider = null;
    try {
        PolicyManager policyMgr = getPolicyManager(realmName);
        if (policyMgr != null) {
            ResponseProviderTypeManager mgr = policyMgr.getResponseProviderTypeManager();
            provider = mgr.getResponseProvider(typeName);
        }
    } catch (AMConsoleException e) {
        debug.warning("PolicyModelImpl.getResponseProviderInstance", e);
    } catch (NameNotFoundException e) {
        debug.warning("PolicyModelImpl.getResponseProviderInstance", e);
    } catch (PolicyException e) {
        debug.warning("PolicyModelImpl.getResponseProviderInstance", 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 88 with AMConsoleException

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

the class SelectRealmModelImpl method getRealmNames.

/**
     * Returns realms that have names matching with a filter.
     *
     * @param base Base realm name for this search. null indicates root
     *        suffix.
     * @param filter Filter string.
     * @return realms that have names matching with a filter.
     * @throws AMConsoleException if search fails.
     */
public Set getRealmNames(String base, String filter) throws AMConsoleException {
    if ((base == null) || (base.length() == 0)) {
        base = getStartDN();
    }
    String[] param = { base };
    logEvent("ATTEMPT_GET_REALM_NAMES", param);
    try {
        OrganizationConfigManager orgMgr = new OrganizationConfigManager(getUserSSOToken(), base);
        logEvent("SUCCEED_GET_REALM_NAMES", param);
        return PolicyModelImpl.appendBaseDN(base, orgMgr.getSubOrganizationNames(filter, true), filter, this);
    } catch (SMSException e) {
        String strError = getErrorString(e);
        String[] paramsEx = { base, strError };
        logEvent("SMS_EXCEPTION_GET_REALM_NAMES", paramsEx);
        throw new AMConsoleException(strError);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) OrganizationConfigManager(com.sun.identity.sm.OrganizationConfigManager) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 89 with AMConsoleException

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

the class SelectRealmModelImpl method getAuthenticationInstances.

/**
     * Returns set of authentication instances.
     *
     * @param realmName Name of Realm.
     * @return set of authentication instances.
     * @throws AMConsoleException if authentication instances cannot be
     *         obtained.
     */
public Set getAuthenticationInstances(String realmName) throws AMConsoleException {
    Set names = Collections.EMPTY_SET;
    try {
        AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), realmName);
        Set instances = mgr.getAuthenticationInstances();
        if ((instances != null) && !instances.isEmpty()) {
            names = new HashSet(instances.size());
            for (Iterator i = instances.iterator(); i.hasNext(); ) {
                names.add(((AMAuthenticationInstance) i.next()).getName());
            }
        }
    } catch (AMConfigurationException e) {
        throw new AMConsoleException(getErrorString(e));
    }
    return names;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) Iterator(java.util.Iterator) AMConfigurationException(com.sun.identity.authentication.config.AMConfigurationException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) AMAuthenticationManager(com.sun.identity.authentication.config.AMAuthenticationManager) HashSet(java.util.HashSet)

Example 90 with AMConsoleException

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

the class PropertyXMLBuilder method getXML.

/**
     * Returns a XML for displaying attribute in property sheet.
     *
     * @param readonly Set of readonly attributes.
     * @param bPropertySheetElementNode true to include
     *        <code>&lt;propertysheet&gt;</code> tag.
     * @throws SMSException if attribute schema cannot obtained.
     * @throws SSOException if single sign on token is invalid.
     * @throws AMConsoleException if there are no attribute to display.
     * @return XML for displaying attribute in property sheet.
     */
public String getXML(Set readonly, boolean bPropertySheetElementNode) throws SMSException, SSOException, AMConsoleException {
    StringBuffer xml = new StringBuffer(1000);
    onBeforeBuildingXML(mapTypeToAttributeSchema);
    if (bPropertySheetElementNode) {
        xml.append(getXMLDefinitionHeader()).append(START_TAG);
    }
    if (supportSubConfig) {
        String configTable = SUB_CONFIG_TABLE_XML;
        configTable = tagSwap(configTable, SUB_CONFIG_TABLE_VIEW_BEAN, viewBeanName);
        xml.append(configTable);
    }
    if (!supportSubConfig && hasNoAttributes()) {
        throw new AMConsoleException(model.getLocalizedString("propertysheet.no.attributes.message"));
    }
    Set attributeSchema = (Set) mapTypeToAttributeSchema.get(NULL_TYPE);
    if ((attributeSchema != null) && !attributeSchema.isEmpty()) {
        String display = "blank.header";
        SchemaType type = null;
        if ((schemaTypes != null) && (schemaTypes.size() == 1)) {
            Iterator<SchemaType> it = schemaTypes.iterator();
            type = it.next();
        }
        if (getSectionsForType(type) == null) {
            buildSchemaTypeXML(display, attributeSchema, xml, model, serviceBundle, readonly);
        } else {
            String label = "lbl" + display.replace('.', '_');
            Object[] params = { label, display };
            xml.append(MessageFormat.format(SECTION_START_TAG, params));
            for (String section : sectionForType.get(type)) {
                String sectionName = model.getLocalizedString("section.label." + serviceName + "." + type.getType() + "." + section);
                buildSchemaTypeXML(sectionName, attributeSchema, xml, model, serviceBundle, readonly, sectionOrder.get(section));
            }
            xml.append(SECTION_END_TAG);
        }
    }
    for (Iterator iter = orderDisplaySchemaType.iterator(); iter.hasNext(); ) {
        SchemaType type = (SchemaType) iter.next();
        attributeSchema = (Set) mapTypeToAttributeSchema.get(type);
        if ((attributeSchema != null) && !attributeSchema.isEmpty()) {
            String display = model.getLocalizedString((String) mapSchemaTypeToName.get(type));
            if (getSectionsForType(type) == null) {
                buildSchemaTypeXML(display, attributeSchema, xml, model, serviceBundle, readonly);
            } else {
                String label = "lbl" + display.replace('.', '_');
                Object[] params = { label, display };
                xml.append(MessageFormat.format(SECTION_START_TAG, params));
                for (String section : sectionForType.get(type)) {
                    String sectionName = model.getLocalizedString("section.label." + serviceName + "." + type.getType() + "." + section);
                    buildSchemaTypeXML(sectionName, attributeSchema, xml, model, serviceBundle, readonly, sectionOrder.get(section));
                }
                xml.append(SECTION_END_TAG);
            }
        }
    }
    if (bPropertySheetElementNode) {
        xml.append(END_TAG);
    }
    return xml.toString();
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) Iterator(java.util.Iterator) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) SchemaType(com.sun.identity.sm.SchemaType)

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