Search in sources :

Example 6 with DomainComponentTree

use of com.iplanet.ums.dctree.DomainComponentTree in project OpenAM by OpenRock.

the class DCTreeServicesImpl method getOrganizationDN.

/**
     * Returns the organization DN matching the domain name
     * 
     * @param token
     *            SSOToken
     * @param domainName
     *            String representing domin name
     * @return
     *            the organization dn
     * @throws AMException
     */
public String getOrganizationDN(SSOToken token, String domainName) throws AMException {
    try {
        DomainComponentTree dcTree = new DomainComponentTree(token, new Guid(DCTREE_START_DN));
        Hashtable domainToOrgTable = dcTree.getChildDomainIDs();
        if (debug.messageEnabled()) {
            debug.message("DCTree:getOrgDN-> domain=" + domainName);
        }
        return ((String) domainToOrgTable.get(domainName));
    } catch (UMSException umse) {
        // Deepa: Is there a localized property for 1000?
        debug.error("DCTree:getOrganizationDN: " + "UMS Exception: ", umse);
        throw new AMException(AMSDKBundle.getString("1000"), "1000");
    }
}
Also used : UMSException(com.iplanet.ums.UMSException) Hashtable(java.util.Hashtable) AMException(com.iplanet.am.sdk.AMException) DomainComponentTree(com.iplanet.ums.dctree.DomainComponentTree) Guid(com.iplanet.ums.Guid)

Example 7 with DomainComponentTree

use of com.iplanet.ums.dctree.DomainComponentTree 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");
        }
    }
}
Also used : UMSException(com.iplanet.ums.UMSException) AMException(com.iplanet.am.sdk.AMException) DomainComponentTree(com.iplanet.ums.dctree.DomainComponentTree) Guid(com.iplanet.ums.Guid) InvalidDCRootException(com.iplanet.ums.dctree.InvalidDCRootException)

Example 8 with DomainComponentTree

use of com.iplanet.ums.dctree.DomainComponentTree in project OpenAM by OpenRock.

the class DCTreeServicesImpl method updateDomainStatus.

/**
     * Method which update attribute inetdomainstatus of the DC Tree
     * corresponding to the Org
     * 
     * @param token
     *            SSOToken
     * @param orgDN
     *            String representing the DN correponding to the organization
     * @param status
     *            inetdomainstatus value
     * 
     * @exception AMException
     *                if error occured in accessing the org corresponding to
     *                orgDN or during the attribute change of the dc tree
     *                corresponding to the orgDN
     */
protected void updateDomainStatus(SSOToken token, String orgDN, String status) throws AMException {
    try {
        String domainName = getCanonicalDomain(token, orgDN);
        if ((domainName != null) && (domainName.length() > 0)) {
            DomainComponentTree dcTree = new DomainComponentTree(token, new Guid(DCTREE_START_DN));
            dcTree.setDomainStatus(domainName, status);
        } else {
            debug.warning("DCTree.updateDomainStatus(): value for " + IPLANET_DOMAIN_NAME_ATTR + " attribute " + "null or empty");
        }
    // }
    } catch (UMSException ue) {
        debug.error("DCTree.removeDomain(): ", ue);
        throw new AMException(AMSDKBundle.getString("356"), "356");
    }
}
Also used : UMSException(com.iplanet.ums.UMSException) AMException(com.iplanet.am.sdk.AMException) DomainComponentTree(com.iplanet.ums.dctree.DomainComponentTree) Guid(com.iplanet.ums.Guid)

Example 9 with DomainComponentTree

use of com.iplanet.ums.dctree.DomainComponentTree 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;
}
Also used : DomainComponent(com.iplanet.ums.dctree.DomainComponent) UMSException(com.iplanet.ums.UMSException) DomainComponentTree(com.iplanet.ums.dctree.DomainComponentTree) Guid(com.iplanet.ums.Guid) AttrSet(com.iplanet.services.ldap.AttrSet)

Aggregations

Guid (com.iplanet.ums.Guid)9 UMSException (com.iplanet.ums.UMSException)9 DomainComponentTree (com.iplanet.ums.dctree.DomainComponentTree)9 AMException (com.iplanet.am.sdk.AMException)5 DomainComponent (com.iplanet.ums.dctree.DomainComponent)3 InvalidDCRootException (com.iplanet.ums.dctree.InvalidDCRootException)3 Attr (com.iplanet.services.ldap.Attr)2 AttrSet (com.iplanet.services.ldap.AttrSet)2 PersistentObject (com.iplanet.ums.PersistentObject)2 SearchControl (com.iplanet.ums.SearchControl)1 SearchResults (com.iplanet.ums.SearchResults)1 Hashtable (java.util.Hashtable)1