use of com.iplanet.ums.UMSException in project OpenAM by OpenRock.
the class DCTreeServicesImpl method getDomainAttributes.
protected AttrSet getDomainAttributes(SSOToken token, String orgDN, String[] attrNames) throws AMException, SSOException {
String domainName = null;
try {
AttrSet domAttrSet;
domainName = getCanonicalDomain(token, orgDN);
if (domainName == null) {
debug.error("DCTree.getDomainAttributes-> " + "Domain not found for: " + orgDN);
return null;
}
DomainComponentTree dcTree = new DomainComponentTree(token, new Guid(DCTREE_START_DN));
DomainComponent dcNode = dcTree.getDomainComponent(domainName);
if (attrNames != null) {
domAttrSet = dcNode.getAttributes(attrNames);
} else {
domAttrSet = dcNode.getAttributes(dcNode.getAttributeNames());
}
AttrSet[] attrArray = splitAttrSet(null, domAttrSet);
return attrArray[1];
} catch (UMSException umse) {
debug.error("DCTree.getDomainAttributes: " + " error getting attributes for domain " + domainName);
}
return null;
}
use of com.iplanet.ums.UMSException in project OpenAM by OpenRock.
the class NamingAttributeManager method getNamingAttributeFromTemplate.
/**
* Gets the naming attribute after reading it from the corresponding
* creation template. If not found, a default value will be used
*/
private static String getNamingAttributeFromTemplate(int objectType, String orgDN) {
try {
// Intitalize TemplateManager if not already initialized
if (templateMgr == null) {
templateMgr = TemplateManager.getTemplateManager();
}
String templateName = getCreationTemplateName(objectType);
if (templateName == null) {
debug.warning("AMNamingAttrMgr.getNamingAttr(objectType, " + "orgDN): (" + objectType + "," + orgDN + ") Could not determine creation template name. " + "Returning <empty> value");
return "";
}
Guid orgGuid = ((orgDN == null) ? null : new Guid(orgDN));
CreationTemplate creationTemp = templateMgr.getCreationTemplate(templateName, orgGuid, TemplateManager.SCOPE_ANCESTORS);
// get search filter attribute
String namingAttr = creationTemp.getNamingAttribute();
if (namingAttr == null) {
debug.error("AMNamingAttrManager.getNamingAttr()" + " Naming attribute for Object Type:" + objectType + " Org DN: " + orgDN + " is null");
} else if (debug.messageEnabled()) {
debug.message("AMNamingAttrManager.getNamingAttr(): Naming " + "attribute for Object type= " + objectType + ": " + namingAttr);
}
return namingAttr;
} catch (UMSException ue) {
// The right thing would be to propagate this exception back
String defaultAttr = getDefaultNamingAttr(objectType);
debug.warning("Unable to get the naming attribute for " + objectType + " Using default " + defaultAttr);
return defaultAttr;
}
}
use of com.iplanet.ums.UMSException in project OpenAM by OpenRock.
the class SearchFilterManager method getSearchFilterFromTemplate.
static String getSearchFilterFromTemplate(int objectType, String orgDN, String searchTemplateName) {
SearchTemplate searchTemp = null;
String filter;
try {
String searchTempName = ((searchTemplateName == null) ? getSearchTemplateName(objectType) : searchTemplateName);
if (searchTempName == null) {
debug.warning("SearchFilterManager." + "getSearchFilterFromTemplate(): Search template name" + " is null. Unable to retrieve search filter. " + "Returning <empty> value.");
return "";
}
TemplateManager mgr = TemplateManager.getTemplateManager();
Guid orgGuid = ((orgDN == null) ? null : new Guid(orgDN));
searchTemp = mgr.getSearchTemplate(searchTempName, orgGuid, TemplateManager.SCOPE_TOP);
// Get the Original search filter
// Check to see if the filter starts with "(" and ends with ")"
// In which case there is no need to add opening and closing braces.
// otherwise add the opening and closing braces.
} catch (UMSException ue) {
if (debug.messageEnabled()) {
debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() Got Exception", ue);
}
}
if (searchTemp != null) {
filter = searchTemp.getSearchFilter();
} else {
// FIXME: Why do we need to make it objectclass=*, can't we send the
// default filter here?
filter = "(objectclass=*)";
}
if (!filter.startsWith("(") || !filter.endsWith(")")) {
filter = "(" + filter + ")";
}
if (debug.messageEnabled()) {
if (searchTemp != null) {
debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() SearchTemplate Name = " + searchTemp.getName() + ", objectType = " + objectType + ", orgDN = " + orgDN + ", Obtained Filter = " + searchTemp.getSearchFilter() + ", Modified Filter = " + filter);
} else {
debug.message("SearchFilterManager." + "getSearchFilterFrom" + "Template() Filter = " + filter);
}
}
return filter;
}
Aggregations