use of com.iplanet.ums.dctree.InvalidDCRootException in project OpenAM by OpenRock.
the class DCTreeServicesImpl method createDomain.
/**
* Method which creates a <Code>Domain Component Tree </Code> for the given
* organization, if the <code>sunPreferredDomain</code> attribute is
* present and has a fully qualified domain name as value.
*
* @param token
* SSO Token
* @param orgGuid
* identifiication of organization entry to be mapped from
* <Code>dctree</Code> to organization DIT organization
* @param attrSet
* the attributes to be set on creation of domain.
*
* @exception AMException
* if unsuccessful in creating a dc tree for the organization
* or unsuccessful in setting the mapping between dc tree and
* the organization
*/
protected void createDomain(SSOToken token, Guid orgGuid, AttrSet attrSet) throws AMException, SSOException {
if (DCTREE_START_DN == null) {
throw new AMException(AMSDKBundle.getString("355"), "355");
}
// Create a DC tree is value is specified for
// sunPreferredDomain attribute
String domainName = attrSet.getValue(IPLANET_DOMAIN_NAME_ATTR);
// remove the attribute from the attribute set.
attrSet.remove(IPLANET_DOMAIN_NAME_ATTR);
if ((domainName != null) && (!domainName.equals(""))) {
try {
DomainComponentTree dcTree = new DomainComponentTree(token, new Guid(DCTREE_START_DN));
dcTree.addDomain(domainName);
// Set the domain mapping
dcTree.setDomainMapping(domainName, orgGuid);
String status = attrSet.getValue(INET_DOMAIN_STATUS_ATTR);
if (status != null) {
dcTree.setDomainStatus(domainName, status);
}
AttrSet[] attrSetArray = splitAttrSet(orgGuid.getDn(), attrSet);
if (attrSetArray[1] != null) {
setDomainAttributes(token, orgGuid.getDn(), attrSetArray[1]);
}
} catch (InvalidDCRootException ie) {
debug.error("DCTree.createDomain(): ", ie);
throw new AMException(AMSDKBundle.getString("343"), "343");
} catch (UMSException ue) {
debug.error("DCTree.createDomain(): ", ue);
throw new AMException(AMSDKBundle.getString("344"), "344");
}
}
}
use of com.iplanet.ums.dctree.InvalidDCRootException in project OpenAM by OpenRock.
the class DCTreeServicesImpl method getDCNodeDN.
protected String getDCNodeDN(SSOToken token, String orgDN) throws AMException {
try {
String domainName = getCanonicalDomain(token, orgDN);
if (domainName != null) {
DomainComponentTree dcTree = new DomainComponentTree(token, new Guid(DCTREE_START_DN));
String dcNodeDN = dcTree.mapDomainToDN(domainName);
return LDAPUtils.formatToRFC(dcNodeDN);
} else {
return null;
}
} catch (InvalidDCRootException e) {
debug.error("DCTree.getDCNodeDN(): Invalid DC root ", e);
throw new AMException(AMSDKBundle.getString("343"), "343");
} catch (UMSException e) {
debug.error("DCTree.getDCNodeDN(): Unable to get dc node dn " + "for: " + orgDN, e);
throw new AMException(AMSDKBundle.getString("344"), "344");
}
}
use of com.iplanet.ums.dctree.InvalidDCRootException in project OpenAM by OpenRock.
the class DCTreeServicesImpl method createDomain.
/**
* Method which creates a DC Tree for the given org, if the
* <code>sunPreferredDomain</code> attribute is present and has a fully
* qualified domain name as value.
*
* @param token
* SSOToken
* @param orgGuid
* identifiication of Organization entry to be mapped from dctree
* to organization DIT organization
* @param domainName
* set the domain this organization belongs to.
* @param attrSet
* the AttrSet of the organization
*
* @exception AMException
* if unsuccessful in creating a dc tree for the organization
* or unsuccessful in setting the mapping between dc tree and
* the organization
*/
protected void createDomain(SSOToken token, Guid orgGuid, String domainName, AttrSet attrSet) throws AMException {
if (DCTREE_START_DN == null) {
throw new AMException(AMSDKBundle.getString("355"), "355");
}
// Create a DC tree for specified domain.
if ((domainName != null) && (!domainName.equals(""))) {
try {
DomainComponentTree dcTree = new DomainComponentTree(token, new Guid(DCTREE_START_DN));
dcTree.addDomain(domainName);
// Set the domain mapping
dcTree.setDomainMapping(domainName, orgGuid);
String status = attrSet.getValue(INET_DOMAIN_STATUS_ATTR);
if (status != null) {
dcTree.setDomainStatus(domainName, status);
}
} catch (InvalidDCRootException ie) {
debug.error("DCTree.createDomain(): ", ie);
throw new AMException(AMSDKBundle.getString("343"), "343");
} catch (UMSException ue) {
debug.error("DCTree.createDomain(): ", ue);
throw new AMException(AMSDKBundle.getString("344"), "344");
}
}
}
Aggregations