mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
03.09.2016 e6edbcc813d2c8f040497e9e809cf8e63c3222ad
OPENDJ-3417 Update retrieval of controls and features to use backends methods
5 files modified
57 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/LocalBackend.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java 14 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java 10 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java 20 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
@@ -112,13 +112,6 @@
  public abstract boolean isDefaultRoute();
  /**
   * Retrieves the password storage schemes defined for this backend.
   *
   * @return the set of supported password storage schemes
   */
  public abstract Set<PasswordStorageScheme<?>> getSupportedPasswordStorageSchemes();
  /**
   * Retrieves the OIDs of the controls that may be supported by this
   * backend.
   *
opendj-server-legacy/src/main/java/org/opends/server/api/LocalBackend.java
@@ -21,7 +21,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Queue;
import java.util.Set;
@@ -707,11 +706,6 @@
    return persistentSearches;
  }
  @Override
  public Set<PasswordStorageScheme<?>> getSupportedPasswordStorageSchemes() {
    return new HashSet<PasswordStorageScheme<?>>(DirectoryServer.getPasswordStorageSchemes());
  }
  /**
   * Retrieves the total number of entries contained in this backend,
   * if that information is available.
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
@@ -335,7 +335,7 @@
    addAttribute(privateNamingContextAttr, dseUserAttrs, dseOperationalAttrs);
    // Add the "supportedControl" attribute.
    Attribute supportedControlAttr = createAttribute(ATTR_SUPPORTED_CONTROL, getAllControls());
    Attribute supportedControlAttr = createAttribute(ATTR_SUPPORTED_CONTROL, DirectoryServer.getSupportedControls());
    addAttribute(supportedControlAttr, dseUserAttrs, dseOperationalAttrs);
    // Add the "supportedExtension" attribute.
@@ -414,18 +414,6 @@
    return e;
  }
  private Set<String> getAllControls()
  {
    // TODO: this duplicates what is done in DirectoryServer (see DirectoryServer.getSupportedControls())
    // How should this be handled ?
    final Set<String> controls = new HashSet<>();
    for (Backend<?> backend : serverContext.getBackendConfigManager().getAllBackends())
    {
      controls.addAll(backend.getSupportedControls());
    }
    return controls;
  }
  private Set<DN> getAllPublicNamingContexts()
  {
    Set<DN> namingContexts = new HashSet<>();
opendj-server-legacy/src/main/java/org/opends/server/core/BackendConfigManager.java
@@ -533,16 +533,6 @@
      }
      localBackends.put(backendID, backend);
      for (String oid : backend.getSupportedControls())
      {
        registerSupportedControl(oid);
      }
      for (String oid : backend.getSupportedFeatures())
      {
        registerSupportedFeature(oid);
      }
      LocalBackendMonitor monitor = new LocalBackendMonitor(backend);
      monitor.initializeMonitorProvider(null);
      backend.setBackendMonitor(monitor);
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -83,6 +83,7 @@
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.AlertHandler;
import org.opends.server.api.AuthenticationPolicy;
import org.opends.server.api.Backend;
import org.opends.server.api.LocalBackend;
import org.opends.server.api.BackupTaskListener;
import org.opends.server.api.CertificateMapper;
@@ -3627,8 +3628,14 @@
   */
  public static TreeSet<String> getSupportedControls()
  {
    return directoryServer.supportedControls;
    TreeSet<String> controls = new TreeSet<>(directoryServer.supportedControls);
    for (Backend<?> backend : directoryServer.backendConfigManager.getAllBackends())
    {
      controls.addAll(backend.getSupportedControls());
  }
    return controls;
  }
  /**
   * Indicates whether the specified OID is registered with the Directory Server
@@ -3642,7 +3649,7 @@
   */
  public static boolean isSupportedControl(String controlOID)
  {
    return directoryServer.supportedControls.contains(controlOID);
    return getSupportedControls().contains(controlOID);
  }
  /**
@@ -3686,7 +3693,12 @@
   */
  public static TreeSet<String> getSupportedFeatures()
  {
    return directoryServer.supportedFeatures;
    TreeSet<String> features = new TreeSet<>(directoryServer.supportedFeatures);
    for (Backend<?> backend : directoryServer.backendConfigManager.getAllBackends())
    {
      features.addAll(backend.getSupportedFeatures());
    }
    return features;
  }
  /**
@@ -3701,7 +3713,7 @@
   */
  public static boolean isSupportedFeature(String featureOID)
  {
    return directoryServer.supportedFeatures.contains(featureOID);
    return getSupportedFeatures().contains(featureOID);
  }
  /**