use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class AgentsModelImpl method createAgentGroup.
/**
* Creates agent group.
*
* @param realmName Realm where agent group resides.
* @param name Name of agent group.
* @param type Type of agent group.
* @throws AMConsoleException if agent group cannot be created.
*/
public void createAgentGroup(String realmName, String name, String type) throws AMConsoleException {
String[] params = { realmName, name, type };
try {
logEvent("ATTEMPT_CREATE_AGENT_GROUP", params);
AgentConfiguration.createAgentGroup(getUserSSOToken(), realmName, name, type, AgentConfiguration.getDefaultValues(type, true));
logEvent("SUCCEED_CREATE_AGENT_GROUP", params);
} catch (ConfigurationException e) {
String[] paramsEx = { realmName, name, type, getErrorString(e) };
logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
debug.warning("AgentsModelImpl.createAgentGroup", e);
throw new AMConsoleException(getErrorString(e));
} catch (SSOException e) {
String[] paramsEx = { realmName, name, type, getErrorString(e) };
logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
debug.warning("AgentsModelImpl.createAgentGroup", e);
throw new AMConsoleException(getErrorString(e));
} catch (IdRepoException e) {
String[] paramsEx = { realmName, name, type, getErrorString(e) };
logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
debug.warning("AgentsModelImpl.createAgentGroup", e);
throw new AMConsoleException(getErrorString(e));
} catch (SMSException e) {
String[] paramsEx = { realmName, name, type, getErrorString(e) };
logEvent("EXCEPTION_CREATE_AGENT_GROUP", paramsEx);
debug.warning("AgentsModelImpl.createAgentGroup", e);
throw new AMConsoleException(getErrorString(e));
}
}
use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class WSFedGeneralViewBean method setDisplayName.
private void setDisplayName(String entityName, String realm) {
WSFedPropertiesModel model = (WSFedPropertiesModel) getModel();
Map spmap = new HashMap();
Map idpmap = new HashMap();
try {
// retrieve role of entity
List roleList = getWSFedRoles(entityName, realm);
Iterator rIt = roleList.listIterator();
// to display idp and sp display names in case of a dual entity
if (roleList.size() > 1) {
spmap = model.getServiceProviderAttributes(realm, entityName);
idpmap = model.getIdentityProviderAttributes(realm, entityName);
setDisplayFieldValue(WSFedPropertiesModel.TF_DISPNAME, getDisplayName(spmap));
setDisplayFieldValue(WSFedPropertiesModel.TFIDPDISP_NAME, getDisplayName(idpmap));
} else {
// to show display name for an entity with single role
while (rIt.hasNext()) {
String role = (String) rIt.next();
if (role.equals(EntityModel.SERVICE_PROVIDER)) {
spmap = model.getServiceProviderAttributes(realm, entityName);
setDisplayFieldValue(WSFedPropertiesModel.TF_DISPNAME, getDisplayName(spmap));
} else if (role.equals(EntityModel.IDENTITY_PROVIDER)) {
idpmap = model.getIdentityProviderAttributes(realm, entityName);
setDisplayFieldValue(WSFedPropertiesModel.TF_DISPNAME, getDisplayName(idpmap));
}
}
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "error in setting Display Name ");
}
}
use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class PolicyCache method getPolicy.
/**
* Returns cached policy object
*
* @param token single sign on token
* @param cacheID Key for retrieve this policy
* @return policy Policy object.
* @throws AMConsoleException if policy object cannot be located.
*/
public CachedPolicy getPolicy(SSOToken token, String cacheID) throws AMConsoleException {
CachedPolicy policy = null;
String key = token.getTokenID().toString();
Map map = (Map) mapTokenIDs.get(key);
if (map != null) {
policy = (CachedPolicy) map.get(cacheID);
}
if (policy == null) {
throw new AMConsoleException("Cannot locate cached policy " + cacheID);
}
return policy;
}
use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class PolicyModelImpl method getDisplayNameForSubjectValues.
/**
* Returns a map of values to localized label.
*
* @param realmName Name of realm.
* @param subjectTypeName Name of Subject Type.
* @param values Valid values.
* @return a map of values to localized label.
*/
public Map getDisplayNameForSubjectValues(String realmName, String subjectTypeName, Set values) {
Map map = null;
if ((values != null) && !values.isEmpty()) {
map = new HashMap(values.size() * 2);
Locale locale = getUserLocale();
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
SubjectTypeManager subjectTypeMgr = policyMgr.getSubjectTypeManager();
Subject subject = subjectTypeMgr.getSubject(subjectTypeName);
for (Iterator i = values.iterator(); i.hasNext(); ) {
String v = (String) i.next();
map.put(v, subject.getDisplayNameForValue(v, locale));
}
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getDisplayNameForSubjectValues", e);
}
}
return (map == null) ? Collections.EMPTY_MAP : map;
}
use of com.sun.identity.console.base.model.AMConsoleException in project OpenAM by OpenRock.
the class IdentitySubjectModelImpl method getEntityNames.
/**
* Returns entity names.
*
* @param pattern Search Pattern.
* @param strType Entity Type.
* @param realmName Name of Realm.
*/
public IdSearchResults getEntityNames(String realmName, String strType, String pattern) throws AMConsoleException {
if (realmName == null) {
realmName = "/";
}
if ((pattern == null) || (pattern.trim().length() == 0)) {
pattern = "*";
}
int sizeLimit = getSearchResultLimit();
int timeLimit = getSearchTimeOutLimit();
String[] params = { realmName, strType, pattern, Integer.toString(sizeLimit), Integer.toString(timeLimit) };
try {
AMIdentityRepository repo = new AMIdentityRepository(getUserSSOToken(), realmName);
IdType type = IdUtils.getType(strType);
IdSearchControl idsc = new IdSearchControl();
idsc.setRecursive(true);
idsc.setMaxResults(sizeLimit);
idsc.setTimeOut(timeLimit);
logEvent("ATTEMPT_SEARCH_IDENTITY", params);
IdSearchResults results = repo.searchIdentities(type, pattern, idsc);
logEvent("SUCCEED_SEARCH_IDENTITY", params);
return results;
} catch (IdRepoException e) {
String strError = getErrorString(e);
String[] paramsEx = { realmName, strType, pattern, Integer.toString(sizeLimit), Integer.toString(timeLimit), strError };
logEvent("IDM_EXCEPTION_SEARCH_IDENTITY", paramsEx);
throw new AMConsoleException(strError);
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { realmName, strType, pattern, Integer.toString(sizeLimit), Integer.toString(timeLimit), strError };
logEvent("SSO_EXCEPTION_SEARCH_IDENTITY", paramsEx);
throw new AMConsoleException(strError);
}
}
Aggregations