use of com.iplanet.am.sdk.AMException in project OpenAM by OpenRock.
the class ComplianceServicesImpl method getDeletedObjectFilter.
/**
* Protected method to get the search filter to be used for searching for
* deleted objects.
*
*/
public String getDeletedObjectFilter(int objectType) throws AMException, SSOException {
Set values = new HashSet();
try {
if (gsc == null) {
ServiceSchemaManager scm = new ServiceSchemaManager(ADMINISTRATION_SERVICE, internalToken);
gsc = scm.getGlobalSchema();
}
Map attrMap = gsc.getAttributeDefaults();
if (attrMap != null)
values = (Set) attrMap.get(COMPLIANCE_SPECIAL_FILTER_ATTR);
if (debug.messageEnabled()) {
debug.message("Compliance.getDeletedObjectSearchFilter = " + values.toString());
}
} catch (SMSException ex) {
debug.error(AMSDKBundle.getString("359"), ex);
throw new AMException(AMSDKBundle.getString("359"), "359");
} catch (SSOException ex) {
debug.error(AMSDKBundle.getString("359"), ex);
throw new AMException(AMSDKBundle.getString("359"), "359");
}
String org_filter = null;
String group_filter = null;
String user_filter = null;
String def_filter = null;
String res_filter = null;
Iterator iter = values.iterator();
while (iter.hasNext()) {
String thisFilter = (String) iter.next();
if (thisFilter.startsWith("Organization=")) {
org_filter = thisFilter.substring(13);
} else if (thisFilter.startsWith("Group=")) {
group_filter = thisFilter.substring(6);
} else if (thisFilter.startsWith("User=")) {
user_filter = thisFilter.substring(5);
} else if (thisFilter.startsWith("Misc=")) {
def_filter = thisFilter.substring(5);
} else if (thisFilter.startsWith("Resource=")) {
res_filter = thisFilter.substring(9);
}
}
org_filter = (org_filter == null) ? DEFAULT_DELETED_ORG_FILTER : org_filter;
group_filter = (group_filter == null) ? DEFAULT_DELETED_GROUP_FILTER : group_filter;
user_filter = (user_filter == null) ? DEFAULT_DELETED_USER_FILTER : user_filter;
def_filter = (def_filter == null) ? DEFAULT_DELETED_OBJECT_FILTER : def_filter;
res_filter = (res_filter == null) ? DEFAULT_DELETED_RESOURCE_FILTER : res_filter;
switch(objectType) {
case AMObject.ORGANIZATION:
return (org_filter);
case AMObject.USER:
return (user_filter);
case AMObject.ASSIGNABLE_DYNAMIC_GROUP:
case AMObject.DYNAMIC_GROUP:
case AMObject.STATIC_GROUP:
case AMObject.GROUP:
return (group_filter);
case AMObject.RESOURCE:
return (res_filter);
default:
return ("(|" + org_filter + group_filter + user_filter + def_filter + res_filter + ")");
}
}
use of com.iplanet.am.sdk.AMException 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");
}
}
use of com.iplanet.am.sdk.AMException 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");
}
}
}
use of com.iplanet.am.sdk.AMException 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");
}
}
use of com.iplanet.am.sdk.AMException in project OpenAM by OpenRock.
the class DirectoryServicesImpl method getRegisteredServiceNames.
// *************************************************************************
// Service Related Functionality
// *************************************************************************
/**
* Get registered services for an organization
*
* @param token
* SSOToken
* @param entryDN
* DN of the org
* @return Set set of service names
*/
public Set getRegisteredServiceNames(SSOToken token, String entryDN) throws AMException {
try {
Set attrNames = new HashSet(1);
attrNames.add(SERVICE_STATUS_ATTRIBUTE);
// User dsame privileged user to get the registered
// services. Admins of all levels will need this access
Map attributes = getAttributes(internalToken, entryDN, attrNames, AMObject.UNDETERMINED_OBJECT_TYPE);
Set resultSet = Collections.EMPTY_SET;
if (attributes.size() == 1) {
resultSet = (Set) attributes.get(SERVICE_STATUS_ATTRIBUTE);
}
if (debug.messageEnabled()) {
debug.message("DirectoryServicesImpl." + "getRegisteredServiceNames()" + " Registered Service Names for entryDN: " + entryDN + " are: " + resultSet);
}
return resultSet;
} catch (Exception e) {
debug.error("DirectoryServicesImpl.getRegisteredService", e);
throw new AMException(token, "455");
}
}
Aggregations