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);
}
}
Aggregations