Search in sources :

Example 11 with ServiceAlreadyExistsException

use of com.sun.identity.sm.ServiceAlreadyExistsException in project OpenAM by OpenRock.

the class AMServiceUtils method createOrgConfig.

/**
     * Create Service Template for a AMro profile, could be used to set policy
     * to a profile
     * 
     * @param token
     *            SSOToken
     * @param orgDN
     *            DN of the org or org unit
     * @param serviceName
     *            Service Name
     * @param avPair
     *            attributes to be set
     * @return String DN of the newly created template
     */
protected static ServiceConfig createOrgConfig(SSOToken token, String orgDN, String serviceName, Map avPair) throws SSOException, AMException {
    try {
        ServiceConfigManager scm = new ServiceConfigManager(serviceName, token);
        ServiceConfig sc = scm.createOrganizationConfig(orgDN, avPair);
        return sc;
    } catch (ServiceNotFoundException ex) {
        Object[] args = { serviceName };
        String locale = AMCommonUtils.getUserLocale(token);
        throw new AMException(AMSDKBundle.getString("481", args, locale), "481", args);
    } catch (ServiceAlreadyExistsException ex) {
        Object[] args = { serviceName };
        String locale = AMCommonUtils.getUserLocale(token);
        throw new AMException(AMSDKBundle.getString("479", args, locale), "479", args);
    } catch (SMSException ex) {
        Object[] args = { serviceName };
        String locale = AMCommonUtils.getUserLocale(token);
        throw new AMException(AMSDKBundle.getString("482", args, locale), "482", args);
    }
}
Also used : ServiceConfig(com.sun.identity.sm.ServiceConfig) SMSException(com.sun.identity.sm.SMSException) ServiceNotFoundException(com.sun.identity.sm.ServiceNotFoundException) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager) ServiceAlreadyExistsException(com.sun.identity.sm.ServiceAlreadyExistsException)

Aggregations

ServiceAlreadyExistsException (com.sun.identity.sm.ServiceAlreadyExistsException)11 SMSException (com.sun.identity.sm.SMSException)10 Set (java.util.Set)8 ServiceConfig (com.sun.identity.sm.ServiceConfig)6 HashSet (java.util.HashSet)6 CaseInsensitiveHashSet (com.sun.identity.common.CaseInsensitiveHashSet)4 File (java.io.File)4 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 SSOException (com.iplanet.sso.SSOException)3 CaseInsensitiveTreeSet (com.sun.identity.common.CaseInsensitiveTreeSet)3 ServiceConfigManager (com.sun.identity.sm.ServiceConfigManager)3 Map (java.util.Map)3 CaseInsensitiveHashMap (com.sun.identity.common.CaseInsensitiveHashMap)2 CaseInsensitiveProperties (com.sun.identity.common.CaseInsensitiveProperties)2 ServiceNotFoundException (com.sun.identity.sm.ServiceNotFoundException)2 Iterator (java.util.Iterator)2 Properties (java.util.Properties)2 NotificationSet (com.iplanet.services.comm.share.NotificationSet)1 EntitlementException (com.sun.identity.entitlement.EntitlementException)1