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

Nicolas Capponi
26.08.2015 8b3cd28204e15e0a98ce038b355f100cd7c44e3c
opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2015 ForgeRock AS
 *      Portions Copyright 2012-2016 ForgeRock AS
 */
package org.opends.server.schema;
@@ -45,6 +45,7 @@
import org.opends.server.admin.std.server.CollationMatchingRuleCfg;
import org.opends.server.api.MatchingRuleFactory;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ServerContext;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
import org.opends.server.util.CollectionUtils;
@@ -70,6 +71,8 @@
  /** Map of OID and the Matching Rule. */
  private final Map<String, MatchingRule> matchingRules = new HashMap<>();
  private ServerContext serverContext;
  /** Creates a new instance of CollationMatchingRuleFactory. */
  public CollationMatchingRuleFactory()
@@ -77,6 +80,17 @@
    super();
  }
  /**
   * Sets the server context.
   *
   * @param serverContext
   *            The server context.
   */
  public void setServerContext(ServerContext serverContext)
  {
    this.serverContext = serverContext;
  }
  /** {@inheritDoc} */
  @Override
  public final Collection<org.forgerock.opendj.ldap.schema.MatchingRule> getMatchingRules()
@@ -196,13 +210,13 @@
    // Clear the associated matching rules.
    resetRules();
    final Schema coreSchema = CoreSchema.getInstance();
    final Schema schema = serverContext.getSchemaNG();
    for (String collation : configuration.getCollation())
    {
      // validation has already been performed in isConfigurationChangeAcceptable()
      CollationMapper mapper = new CollationMapper(collation);
      String nOID = mapper.getNumericOID();
      addMatchingRule(nOID, coreSchema.getMatchingRule(nOID));
      addMatchingRule(nOID, schema.getMatchingRule(nOID));
    }
    try