use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class RealmResourceOfferingModelImpl method assignService.
/**
* Assigns service to a realm.
*
* @param realm Realm Name.
* @throws AMConsoleException if values cannot be set.
*/
public void assignService(String realm) throws AMConsoleException {
String[] params = { realm, AMAdminConstants.DISCOVERY_SERVICE };
try {
AMIdentityRepository repo = new AMIdentityRepository(getUserSSOToken(), realm);
AMIdentity realmIdentity = repo.getRealmIdentity();
Set servicesFromIdRepo = realmIdentity.getAssignableServices();
if (servicesFromIdRepo.contains(AMAdminConstants.DISCOVERY_SERVICE)) {
realmIdentity.assignService(AMAdminConstants.DISCOVERY_SERVICE, Collections.EMPTY_MAP);
} else {
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(getUserSSOToken(), realm);
orgCfgMgr.assignService(AMAdminConstants.DISCOVERY_SERVICE, Collections.EMPTY_MAP);
}
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("SSO_EXCEPTION_ASSIGN_SERVICE_TO_REALM", paramsEx);
throw new AMConsoleException(strError);
} catch (IdRepoException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("IDREPO_EXCEPTION_ASSIGN_SERVICE_TO_REALM", paramsEx);
throw new AMConsoleException(strError);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { realm, AMAdminConstants.DISCOVERY_SERVICE, strError };
logEvent("SMS_EXCEPTION_ASSIGN_SERVICE_TO_REALM", paramsEx);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class ServicesProfileModelImpl method getAttributeValues.
/**
* Returns attribute values of the service profile.
*
* @return attribute values of the service profile.
*/
public Map getAttributeValues() {
Map map = null;
String[] params = { currentRealm, serviceName, "*" };
logEvent("ATTEMPT_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", params);
try {
AMIdentityRepository repo = new AMIdentityRepository(getUserSSOToken(), currentRealm);
AMIdentity realmIdentity = repo.getRealmIdentity();
Set servicesFromIdRepo = realmIdentity.getAssignedServices();
if (servicesFromIdRepo.contains(serviceName)) {
map = realmIdentity.getServiceAttributes(serviceName);
} else {
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(getUserSSOToken(), currentRealm);
map = orgCfgMgr.getServiceAttributes(serviceName);
}
logEvent("SUCCEED_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", params);
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, serviceName, strError };
logEvent("SSO_EXCEPTION_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", paramsEx);
debug.error("ServicesProfileModelImpl.getAttributeValues", e);
} catch (IdRepoException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, serviceName, strError };
logEvent("IDREPO_EXCEPTION_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", paramsEx);
debug.error("ServicesProfileModelImpl.getAttributeValues", e);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, serviceName, strError };
logEvent("SMS_EXCEPTION_GET_ATTR_VALUE_OF_SERVICE_UNDER_REALM", paramsEx);
debug.error("ServicesProfileModelImpl.getAttributeValues", e);
}
return (map != null) ? map : Collections.EMPTY_MAP;
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class IDRepoModelImpl method createOrganizationConfig.
private ServiceConfig createOrganizationConfig(String realmName, String idRepoType) throws AMConsoleException {
try {
OrganizationConfigManager orgCfgMgr = new OrganizationConfigManager(getUserSSOToken(), realmName);
Map attrValues = getDefaultAttributeValues();
return orgCfgMgr.addServiceConfig(IdConstants.REPO_SERVICE, attrValues);
} catch (SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class RMRealmModelImpl method getPropertyXML.
private void getPropertyXML(StringBuffer buff, boolean readonly) throws AMConsoleException {
try {
OrganizationConfigManager orgMgr = new OrganizationConfigManager(adminSSOToken, "/");
Set serviceSchemas = orgMgr.getServiceSchemas();
for (Iterator iter = serviceSchemas.iterator(); iter.hasNext(); ) {
MultiServicesPropertyXMLBuilder xmlBuilder = new MultiServicesPropertyXMLBuilder((ServiceSchema) iter.next(), this);
xmlBuilder.setAllAttributeReadOnly(readonly);
buff.append(xmlBuilder.getXML(false));
}
} catch (SSOException e) {
debug.error("RMRealmModelImpl.getPropertyXML", e);
} catch (SMSException e) {
debug.error("RMRealmModelImpl.getPropertyXML", e);
}
}
use of com.sun.identity.sm.OrganizationConfigManager in project OpenAM by OpenRock.
the class RMRealmModelImpl method setAttributeValues.
/**
* Set attribute values.
*
* @param name Name of Realm.
* @param attributeValues Map of attribute name to set of values.
* @throws AMConsoleException if attribute values cannot be updated.
*/
public void setAttributeValues(String name, Map attributeValues) throws AMConsoleException {
try {
String[] param = { name };
logEvent("ATTEMPT_SET_ATTR_VALUES_OF_REALM", param);
OrganizationConfigManager orgMgr = new OrganizationConfigManager(getUserSSOToken(), name);
Map map = mapAttributeValuesToServiceName(attributeValues);
for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
String serviceName = (String) iter.next();
orgMgr.setAttributes(serviceName, (Map) map.get(serviceName));
}
logEvent("SUCCEED_SET_ATTR_VALUES_OF_REALM", param);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { name, strError };
logEvent("SMS_EXCEPTION_SET_ATTR_VALUES_OF_REALM", paramsEx);
throw new AMConsoleException(strError);
}
}
Aggregations