Пример #1
0
  /**
   * 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);
    }
  }
Пример #2
0
  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);
    }
  }