/** * Removes all the SMS cached entries. This method should be called to clear the cache for * example, if ACIs for the SMS entries are changed in the directory. Also, this clears the SMS * entries only in this JVM instance. If multiple instances (of JVM) are running this method must * be called within each instance. * * @supported.api */ public synchronized void clearCache() { // Clear the local caches serviceNameAndOCs = new CaseInsensitiveHashMap(); serviceVersions = new CaseInsensitiveHashMap(); serviceNameDefaultVersion = new CaseInsensitiveHashMap(); accessManagerServers = null; amsdkChecked = false; // Call respective Impl classes CachedSMSEntry.clearCache(); CachedSubEntries.clearCache(); ServiceSchemaManagerImpl.clearCache(); PluginSchemaImpl.clearCache(); ServiceInstanceImpl.clearCache(); ServiceConfigImpl.clearCache(); ServiceConfigManagerImpl.clearCache(); OrganizationConfigManagerImpl.clearCache(); OrgConfigViaAMSDK.clearCache(); // Re-initialize the flags try { checkFlags(token); OrganizationConfigManager.initializeFlags(); DNMapper.clearCache(); } catch (Exception e) { debug.error("ServiceManager::clearCache unable to " + "re-initialize global flags", e); } }
static void checkFlags(SSOToken token) throws SMSException, SSOException { try { CachedSMSEntry entry = CachedSMSEntry.getInstance(token, REALM_ENTRY); if (entry.isDirty()) { entry.refresh(); } if (!entry.isNewEntry()) { ditUpgradedCache = true; ServiceConfigManagerImpl ssm = ServiceConfigManagerImpl.getInstance(token, REALM_SERVICE, SERVICE_VERSION); ServiceConfigImpl sc = null; Map map = null; if (ssm == null || (sc = ssm.getGlobalConfig(token, null)) == null || (map = sc.getAttributes()) == null) { return; } Set coexistEntry = (Set) map.get(COEXISTENCE_ATTR_NAME); if (coexistEntry != null && coexistEntry.contains("false")) { coexistenceCache = false; } Set realmEntry = (Set) map.get(REALM_ATTR_NAME); if (realmEntry != null && realmEntry.contains("true")) { realmCache = true; } // Get the default services to be loaded requiredServices = (Set) map.get(DEFAULT_SERVICES_FOR_REALMS); defaultServicesToLoad = new HashSet(); defaultServicesToLoad.addAll(requiredServices); // Make this flag false, for always the union of // auto assignment services from idRepoService.xml and // auth services from AMAuthenticationManager code // should be returned for deep copy for a newly created // sub realm. loadedAuthServices = false; } if (debug.messageEnabled()) { debug.message("ServiceManager::checkFlags:realmEnabled=" + realmCache); debug.message("ServiceManager::checkFlags:coexistenceMode=" + coexistenceCache); } } catch (SMSException e) { debug.error("ServiceManager::unable to check " + "if Realm is enabled: ", e); throw (e); } }
/** * Deletes only the schema for the given service name. This is provided only for backward * compatibility for DSAME 5.0 and will be deprecated in the future release. Alternative is to use * <code>ServiceSchemaManager.replaceSchema()</code>. * * @param serviceName Name of service to be deleted. * @throws SMSException if an error occurred while performing the operation * @throws SSOException if the user's single sign on token is invalid or expired */ public void deleteService(String serviceName) throws SMSException, SSOException { if (serviceName.equalsIgnoreCase(IdConstants.REPO_SERVICE) || serviceName.equalsIgnoreCase(ISAuthConstants.AUTH_SERVICE_NAME)) { Object args[] = {serviceName}; throw (new SMSException( IUMSConstants.UMS_BUNDLE_NAME, "sms-SERVICE_CORE_CANNOT_DELETE", args)); } Iterator versions = getServiceVersions(serviceName).iterator(); while (versions.hasNext()) { String version = (String) versions.next(); CachedSMSEntry ce = CachedSMSEntry.getInstance(token, getServiceNameDN(serviceName, version)); if (ce.isDirty()) { ce.refresh(); } SMSEntry e = ce.getClonedSMSEntry(); String[] values = {SMSSchema.getDummyXML(serviceName, version)}; e.setAttribute(SMSEntry.ATTR_SCHEMA, values); e.save(token); ce.refresh(e); } }
/** * Removes the service schema and configuration for the given service name. * * @param serviceName the name of the service * @param version the version of the service * @throws SMSException if an error occurred while performing the operation * @throws SSOException if the user's single sign on token is invalid or expired * @supported.api */ public void removeService(String serviceName, String version) throws SMSException, SSOException { // Find all service entries that have the DN // Search for (&(ou=<serviceName>)(objectclass=top)) // construct the rdn with the given version, look for the entry // in iDS and if entry exists(service with that version), delete. if (serviceName.equalsIgnoreCase(IdConstants.REPO_SERVICE) || serviceName.equalsIgnoreCase(ISAuthConstants.AUTH_SERVICE_NAME)) { Object args[] = {serviceName}; throw (new SMSException( IUMSConstants.UMS_BUNDLE_NAME, "sms-SERVICE_CORE_CANNOT_DELETE", args)); } SMSEntry.validateToken(token); String[] objs = {serviceName}; Iterator results = SMSEntry.search( token, SMSEntry.baseDN, MessageFormat.format(SMSEntry.FILTER_PATTERN, (Object[]) objs), 0, 0, false, false) .iterator(); while (results.hasNext()) { String dn = (String) results.next(); String configdn = SMSEntry.PLACEHOLDER_RDN + SMSEntry.EQUALS + version + SMSEntry.COMMA + dn; CachedSMSEntry configsmse = CachedSMSEntry.getInstance(token, configdn); if (configsmse.isDirty()) { configsmse.refresh(); } SMSEntry confige = configsmse.getClonedSMSEntry(); if (!confige.isNewEntry()) { confige.delete(token); configsmse.refresh(confige); } // If there are no other service version nodes for that service, // delete that node(schema). CachedSMSEntry smse = CachedSMSEntry.getInstance(token, dn); if (smse.isDirty()) { smse.refresh(); } SMSEntry e = smse.getSMSEntry(); Iterator versions = e.subEntries(token, "*", 0, false, false).iterator(); if (!versions.hasNext()) { e.delete(token); smse.refresh(e); } } }