use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyModelImpl method getProtectedResourceNames.
public Set getProtectedResourceNames(String realmName, String policyName) throws AMConsoleException {
Set resourceNames = new HashSet();
String policyID = cachePolicy(realmName, policyName);
CachedPolicy cachedPolicy = getCachedPolicy(policyID);
Policy policy = cachedPolicy.getPolicy();
Set ruleNames = policy.getRuleNames();
if ((ruleNames != null) && !ruleNames.isEmpty()) {
for (Iterator iter = ruleNames.iterator(); iter.hasNext(); ) {
String ruleName = (String) iter.next();
try {
Rule rule = policy.getRule(ruleName);
if (rule != null) {
String resName = rule.getResourceName();
if ((resName != null) && (resName.trim().length() > 0)) {
resourceNames.add(resName);
}
}
} catch (NameNotFoundException nnfe) {
if (debug.warningEnabled()) {
debug.warning("Cannot find the rule with name '" + ruleName + " in policy " + policy.getName(), nnfe);
}
}
}
}
return resourceNames;
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyModelImpl method getResponseProviderViewBeanURL.
/**
* Returns properties view bean URL of a response provider.
*
* @param realmName Name of realm.
* @param typeName Name of response provider Type.
* @return properties view bean URL of a response provider.
*/
public String getResponseProviderViewBeanURL(String realmName, String typeName) {
String url = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ResponseProviderTypeManager mgr = policyMgr.getResponseProviderTypeManager();
ResponseProvider provider = mgr.getResponseProvider(typeName);
url = mgr.getViewBeanURL(provider);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getResponseProviderViewBeanURL", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getResponseProviderViewBeanURL", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getResponseProviderViewBeanURL", e);
}
return url;
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyModelImpl method createResponseProvider.
/**
* Returns a response provider object.
*
* @param realmName Name of Realm.
* @param providerType Name of response provider type.
* @param values Values of the response provider.
* @return response provider object.
* @throws AMConsoleException if response provider cannot be created.
*/
public ResponseProvider createResponseProvider(String realmName, String providerType, Map values) throws AMConsoleException {
ResponseProvider provider = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ResponseProviderTypeManager mgr = policyMgr.getResponseProviderTypeManager();
provider = mgr.getResponseProvider(providerType);
provider.setProperties(values);
}
} catch (NameNotFoundException e) {
throw new AMConsoleException(getErrorString(e));
} catch (PolicyException e) {
throw new AMConsoleException(getErrorString(e));
}
return provider;
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyModelImpl method getConditionViewBeanURL.
/**
* Returns properties view bean URL of a condition.
*
* @param realmName Name of realm.
* @param conditionTypeName Name of Condition Type.
* @return properties view bean URL of a condition.
*/
public String getConditionViewBeanURL(String realmName, String conditionTypeName) {
String url = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ConditionTypeManager condTypeMgr = policyMgr.getConditionTypeManager();
Condition condition = condTypeMgr.getCondition(conditionTypeName);
url = condTypeMgr.getViewBeanURL(condition);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getConditionViewBeanURL", e);
}
return url;
}
use of com.sun.identity.policy.NameNotFoundException in project OpenAM by OpenRock.
the class PolicyModelImpl method getReferralPossibleValues.
/**
* Returns a set of possible values for a referral type.
*
* @param realmName Name of Realm.
* @param referralType Name of Referral Type.
* @param filter wildcards for filtering the results.
* @return a set of possible values for a referral type.
*/
public ValidValues getReferralPossibleValues(String realmName, String referralType, String filter) {
ValidValues values = null;
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
ReferralTypeManager referralTypeMgr = policyMgr.getReferralTypeManager();
Referral referral = referralTypeMgr.getReferral(referralType);
values = referral.getValidValues(getUserSSOToken(), filter);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
} catch (SSOException e) {
debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getReferralPossibleValues", e);
}
return values;
}
Aggregations