From 3fa56f675fdf8c49c9cb2abcfd478172e5acfe53 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 09 Sep 2016 09:45:24 +0000
Subject: [PATCH] OPENDJ-3089 Remove all remaining references to server Schema class
---
opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java
index b5dde3b..a37e3a1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/CollationMatchingRuleFactory.java
@@ -42,9 +42,10 @@
import org.forgerock.opendj.server.config.server.CollationMatchingRuleCfg;
import org.opends.server.api.MatchingRuleFactory;
import org.opends.server.core.DirectoryServer;
+import org.opends.server.core.SchemaHandler;
+import org.opends.server.core.SchemaHandler.SchemaUpdater;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
-import org.opends.server.types.Schema.SchemaUpdater;
import org.opends.server.util.CollectionUtils;
/**
@@ -83,14 +84,14 @@
{
// The core schema contains all supported collation matching rules so read it for initialization.
// The server's schemaNG may have different things configured slightly differently
- org.opends.server.types.Schema schema = DirectoryServer.getSchema();
+ SchemaHandler schemaHandler = DirectoryServer.getInstance().getServerContext().getSchemaHandler();
Schema coreSchema = CoreSchema.getInstance();
// on startup, the SDK already has existing matching rules
// remove them all before letting the server set them all up
// according to what this factory decides must be setup
final Set<MatchingRule> defaultMatchingRules = getCollationMatchingRules(coreSchema.getMatchingRules());
- unregisterMatchingRules(schema, defaultMatchingRules);
+ unregisterMatchingRules(schemaHandler, defaultMatchingRules);
matchingRules.putAll(collectConfiguredMatchingRules(configuration, coreSchema));
// Save this configuration.
@@ -100,21 +101,20 @@
currentConfig.addCollationChangeListener(this);
}
- private void unregisterMatchingRules(org.opends.server.types.Schema schema,
- final Collection<MatchingRule> matchingRules) throws ConfigException
+ private void unregisterMatchingRules(SchemaHandler schemaHandler, final Collection<MatchingRule> matchingRules)
+ throws ConfigException
{
try
{
- schema.updateSchema(new SchemaUpdater()
+ schemaHandler.updateSchema(new SchemaUpdater()
{
@Override
- public Schema update(SchemaBuilder builder)
+ public void update(SchemaBuilder builder)
{
for (final MatchingRule rule : matchingRules)
{
builder.removeMatchingRule(rule.getNameOrOID());
}
- return builder.toSchema();
}
});
}
@@ -200,8 +200,9 @@
// Since we have come here it means that this Factory is enabled
// and there is a change in the CollationMatchingRuleFactory's configuration.
- final org.opends.server.types.Schema serverSchema = DirectoryServer.getSchema();
- final Collection<MatchingRule> existingCollationRules = getCollationMatchingRules(serverSchema.getMatchingRules());
+ SchemaHandler schemaHandler = DirectoryServer.getInstance().getServerContext().getSchemaHandler();
+ final Collection<MatchingRule> existingCollationRules =
+ getCollationMatchingRules(schemaHandler.getSchema().getMatchingRules());
matchingRules.clear();
final Map<String, MatchingRule> configuredMatchingRules =
@@ -219,10 +220,10 @@
}
try
{
- serverSchema.updateSchema(new SchemaUpdater()
+ schemaHandler.updateSchema(new SchemaUpdater()
{
@Override
- public Schema update(SchemaBuilder builder)
+ public void update(SchemaBuilder builder)
{
Collection<MatchingRule> defaultMatchingRules = CoreSchema.getInstance().getMatchingRules();
for (MatchingRule rule : defaultMatchingRules)
@@ -246,7 +247,6 @@
// removed
builder.removeMatchingRule(ruleToRemove.getOID());
}
- return builder.toSchema();
}
});
}
--
Gitblit v1.10.0