From c547f51f9588c126cdd0fb0d2c918da7e8c653ec Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 01 Jun 2016 13:07:48 +0000
Subject: [PATCH] OPENDJ-3037 Inline several methods from DirectoryServer
---
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 113 ------------
opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java | 6
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java | 2
opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java | 213 -----------------------
opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java | 123 +++++--------
opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java | 2
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java | 37 ---
7 files changed, 58 insertions(+), 438 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
index ddd9108..533f4a6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/NullBackend.java
@@ -148,7 +148,7 @@
String nulOCName = "nullbackendobject";
ObjectClass nulOC = DirectoryServer.getObjectClass(nulOCName);
try {
- DirectoryServer.registerObjectClass(nulOC, false);
+ DirectoryServer.getSchema().registerObjectClass(nulOC, false);
} catch (DirectoryException de) {
logger.traceException(de);
throw new InitializationException(de.getMessageObject());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index 12c1465..82a9b38 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -2334,7 +2334,7 @@
private Set<ByteString> getLdapSyntaxDescValuesForSchemaFile(Schema schema, String schemaFile)
{
Set<ByteString> values = new LinkedHashSet<>();
- for (LDAPSyntaxDescription ldapSyntax : schema.getLdapSyntaxDescriptions().values())
+ for (LDAPSyntaxDescription ldapSyntax : schema.getLdapSyntaxDescriptions())
{
if (schemaFile.equals(getSchemaFile(ldapSyntax)))
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index a58ca89..6970a68 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -72,7 +72,6 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.DITContentRule;
-import org.forgerock.opendj.ldap.schema.DITStructureRule;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
import org.forgerock.opendj.ldap.schema.NameForm;
@@ -200,7 +199,7 @@
private static boolean serverLocked;
/** The message to be displayed on the command-line when the user asks for the usage. */
- private static LocalizableMessage toolDescription = INFO_DSCORE_TOOL_DESCRIPTION.get();
+ private static final LocalizableMessage toolDescription = INFO_DSCORE_TOOL_DESCRIPTION.get();
/**
* Return codes used when the hidden option --checkStartability is used.
@@ -2284,16 +2283,6 @@
}
/**
- * Retrieves the set of matching rules registered with the Directory Server.
- *
- * @return The set of matching rules registered with the Directory Server.
- */
- public static Collection<MatchingRule> getMatchingRules()
- {
- return directoryServer.schema.getMatchingRules();
- }
-
- /**
* Retrieves the matching rule with the specified name or OID.
*
* @param lowerName The lowercase name or OID for the matching rule to
@@ -2308,39 +2297,6 @@
}
/**
- * Registers the provided matching rule with the Directory Server.
- *
- * @param matchingRule The matching rule to register with the server.
- * @param overwriteExisting Indicates whether to overwrite an existing
- * mapping if there are any conflicts (i.e.,
- * another matching rule with the same OID or
- * name).
- *
- * @throws DirectoryException If a conflict is encountered and the
- * <CODE>overwriteExisting</CODE> flag is set to
- * <CODE>false</CODE>
- */
- public static void registerMatchingRule(MatchingRule matchingRule,
- boolean overwriteExisting)
- throws DirectoryException
- {
- directoryServer.schema.registerMatchingRule(matchingRule,
- overwriteExisting);
- }
-
- /**
- * Deregisters the provided matching rule with the Directory Server.
- *
- * @param matchingRule The matching rule to deregister with the server.
- * @throws DirectoryException
- * If the matching rule is referenced by another schema element.
- */
- public static void deregisterMatchingRule(MatchingRule matchingRule) throws DirectoryException
- {
- directoryServer.schema.deregisterMatchingRule(matchingRule);
- }
-
- /**
* Retrieves the objectclass for the provided name or OID. It can optionally return a generated
* "default" version if the requested objectclass is not defined in the schema.
*
@@ -2355,27 +2311,6 @@
}
/**
- * Registers the provided objectclass with the Directory Server.
- *
- * @param objectClass The objectclass instance to register with the
- * server.
- * @param overwriteExisting Indicates whether to overwrite an existing
- * mapping if there are any conflicts (i.e.,
- * another objectclass with the same OID or
- * name).
- *
- * @throws DirectoryException If a conflict is encountered and the
- * <CODE>overwriteExisting</CODE> flag is set to
- * <CODE>false</CODE>
- */
- public static void registerObjectClass(ObjectClass objectClass,
- boolean overwriteExisting)
- throws DirectoryException
- {
- directoryServer.schema.registerObjectClass(objectClass, overwriteExisting);
- }
-
- /**
* Retrieves the "top" objectClass, which should be the topmost objectclass in
* the inheritance chain for most other objectclasses. If no such objectclass
* could be found, then one will be constructed.
@@ -2441,26 +2376,6 @@
}
/**
- * Retrieves the set of attribute syntaxes defined in the Directory Server.
- *
- * @return The set of attribute syntaxes defined in the Directory Server.
- */
- public static Collection<Syntax> getAttributeSyntaxes()
- {
- return directoryServer.schema.getSyntaxes();
- }
-
- /**
- * Retrieves the set of matching rule uses defined in the Directory Server.
- *
- * @return The set of matching rule uses defined in the Directory Server.
- */
- public static Collection<MatchingRuleUse> getMatchingRuleUses()
- {
- return directoryServer.schema.getMatchingRuleUses();
- }
-
- /**
* Retrieves the matching rule use associated with the provided matching rule.
*
* @param matchingRule The matching rule for which to retrieve the matching
@@ -2496,20 +2411,6 @@
}
/**
- * Retrieves the DIT structure rule associated with the provided rule ID.
- *
- * @param ruleID The rule ID for which to retrieve the associated DIT
- * structure rule.
- *
- * @return The requested DIT structure rule, or {@code null} if no such
- * rule is defined.
- */
- public static DITStructureRule getDITStructureRule(int ruleID)
- {
- return directoryServer.schema.getDITStructureRule(ruleID);
- }
-
- /**
* Retrieves the name forms associated with the specified objectclass.
*
* @param objectClass The objectclass for which to retrieve the associated
@@ -2524,18 +2425,6 @@
}
/**
- * Deregisters the provided name form with the Directory Server.
- *
- * @param nameForm The name form to deregister with the server.
- * @throws DirectoryException
- * If an error occurs.
- */
- public static void deregisterNameForm(NameForm nameForm) throws DirectoryException
- {
- directoryServer.schema.deregisterNameForm(nameForm);
- }
-
- /**
* Retrieves the set of virtual attribute rules registered with the Directory
* Server.
*
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java
index 2399771..ffb45b8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java
@@ -32,17 +32,17 @@
import org.forgerock.opendj.config.server.ConfigurationAddListener;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.config.server.ConfigurationDeleteListener;
+import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
+import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
import org.forgerock.opendj.server.config.meta.MatchingRuleCfgDefn;
import org.forgerock.opendj.server.config.server.MatchingRuleCfg;
import org.forgerock.opendj.server.config.server.RootCfg;
import org.forgerock.util.Utils;
import org.opends.server.api.MatchingRuleFactory;
-import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
-import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
/**
* This class defines a utility that will be used to manage the set of matching
@@ -104,21 +104,12 @@
String className = mrConfiguration.getJavaClass();
try
{
- MatchingRuleFactory<?> factory = loadMatchingRuleFactory(className, mrConfiguration, true);
-
- try
- {
- for(MatchingRule matchingRule: factory.getMatchingRules())
- {
- DirectoryServer.registerMatchingRule(matchingRule, false);
- }
- matchingRuleFactories.put(mrConfiguration.dn(), factory);
- }
- catch (DirectoryException de)
- {
- logger.warn(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR, mrConfiguration.dn(), de.getMessageObject());
- continue;
- }
+ registerMatchingRules(mrConfiguration, className);
+ }
+ catch (DirectoryException de)
+ {
+ logger.warn(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR, mrConfiguration.dn(), de.getMessageObject());
+ continue;
}
catch (InitializationException ie)
{
@@ -165,34 +156,41 @@
return ccr;
}
- MatchingRuleFactory<?> factory = null;
// Get the name of the class and make sure we can instantiate it as a
// matching rule Factory.
String className = configuration.getJavaClass();
+ registerMatchingRules(configuration, className, ccr);
+ return ccr;
+ }
+
+ private void registerMatchingRules(MatchingRuleCfg configuration, String className, final ConfigChangeResult ccr)
+ {
try
{
- factory = loadMatchingRuleFactory(className, configuration, true);
-
- for (MatchingRule matchingRule: factory.getMatchingRules())
- {
- DirectoryServer.registerMatchingRule(matchingRule, false);
- }
- matchingRuleFactories.put(configuration.dn(),factory);
+ registerMatchingRules(configuration, className);
}
catch (DirectoryException de)
{
ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode());
- ccr.addMessage(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get(
- configuration.dn(), de.getMessageObject()));
+ ccr.addMessage(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get(configuration.dn(), de.getMessageObject()));
}
catch (InitializationException ie)
{
ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode());
ccr.addMessage(ie.getMessageObject());
}
+ }
- return ccr;
+ private void registerMatchingRules(MatchingRuleCfg configuration, String className)
+ throws InitializationException, DirectoryException
+ {
+ MatchingRuleFactory<?> factory = loadMatchingRuleFactory(className, configuration, true);
+ for (MatchingRule matchingRule: factory.getMatchingRules())
+ {
+ DirectoryServer.getSchema().registerMatchingRule(matchingRule, false);
+ }
+ matchingRuleFactories.put(configuration.dn(),factory);
}
@Override
@@ -222,7 +220,7 @@
}
final String oid = matchingRule.getOID();
- for (MatchingRuleUse mru : DirectoryServer.getMatchingRuleUses())
+ for (MatchingRuleUse mru : DirectoryServer.getSchema().getMatchingRuleUses())
{
if (oid.equals(mru.getMatchingRule().getOID()))
{
@@ -260,18 +258,7 @@
MatchingRuleFactory<?> factory = matchingRuleFactories.remove(configuration.dn());
if (factory != null)
{
- for(MatchingRule matchingRule: factory.getMatchingRules())
- {
- try
- {
- DirectoryServer.deregisterMatchingRule(matchingRule);
- }
- catch (DirectoryException e)
- {
- ccr.addMessage(e.getMessageObject());
- ccr.setResultCodeIfSuccess(e.getResultCode());
- }
- }
+ deregisterMatchingRules(factory, ccr);
factory.finalizeMatchingRule();
}
@@ -326,7 +313,7 @@
}
final String oid = matchingRule.getOID();
- for (MatchingRuleUse mru : DirectoryServer.getMatchingRuleUses())
+ for (MatchingRuleUse mru : DirectoryServer.getSchema().getMatchingRuleUses())
{
if (oid.equals(mru.getMatchingRule().getOID()))
{
@@ -373,18 +360,7 @@
{
if (existingFactory != null)
{
- for(MatchingRule existingRule: existingFactory.getMatchingRules())
- {
- try
- {
- DirectoryServer.deregisterMatchingRule(existingRule);
- }
- catch (DirectoryException e)
- {
- ccr.addMessage(e.getMessageObject());
- ccr.setResultCodeIfSuccess(e.getResultCode());
- }
- }
+ deregisterMatchingRules(existingFactory, ccr);
matchingRuleFactories.remove(configuration.dn());
existingFactory.finalizeMatchingRule();
}
@@ -407,31 +383,26 @@
return ccr;
}
- MatchingRuleFactory<?> factory = null;
- try
- {
- factory = loadMatchingRuleFactory(className, configuration, true);
-
- for (MatchingRule matchingRule: factory.getMatchingRules())
- {
- DirectoryServer.registerMatchingRule(matchingRule, false);
- }
- matchingRuleFactories.put(configuration.dn(), factory);
- }
- catch (DirectoryException de)
- {
- ccr.addMessage(WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get(configuration.dn(), de.getMessageObject()));
- ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode());
- }
- catch (InitializationException ie)
- {
- ccr.setResultCodeIfSuccess(DirectoryServer.getServerErrorResultCode());
- ccr.addMessage(ie.getMessageObject());
- }
-
+ registerMatchingRules(configuration, className, ccr);
return ccr;
}
+ private void deregisterMatchingRules(MatchingRuleFactory<?> factory, final ConfigChangeResult ccr)
+ {
+ for (MatchingRule matchingRule : factory.getMatchingRules())
+ {
+ try
+ {
+ DirectoryServer.getSchema().deregisterMatchingRule(matchingRule);
+ }
+ catch (DirectoryException e)
+ {
+ ccr.addMessage(e.getMessageObject());
+ ccr.setResultCodeIfSuccess(e.getResultCode());
+ }
+ }
+ }
+
/**
* Loads the specified class, instantiates it as an attribute syntax, and
* optionally initializes that instance.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java b/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java
index 3da36d5..f255a39 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/DirectoryConfig.java
@@ -16,20 +16,11 @@
*/
package org.opends.server.types;
-import java.util.Collection;
import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.forgerock.opendj.ldap.schema.DITContentRule;
-import org.forgerock.opendj.ldap.schema.DITStructureRule;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
-import org.forgerock.opendj.ldap.schema.NameForm;
-import org.forgerock.opendj.ldap.schema.ObjectClass;
-import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.ExtendedOperationHandler;
import org.opends.server.api.SASLMechanismHandler;
@@ -124,210 +115,6 @@
}
/**
- * Retrieves the set of matching rules registered with the Directory
- * Server.
- *
- * @return The set of matching rules registered with the Directory
- * Server.
- */
- public static Collection<MatchingRule> getMatchingRules()
- {
- return DirectoryServer.getMatchingRules();
- }
-
- /**
- * Retrieves the matching rule with the specified name or OID.
- *
- * @param lowerName The lowercase name or OID for the matching
- * rule to retrieve.
- *
- * @return The requested matching rule, or <CODE>null</CODE> if no
- * such matching rule has been defined in the server.
- */
- public static MatchingRule getMatchingRule(String lowerName)
- {
- return DirectoryServer.getMatchingRule(lowerName);
- }
-
- /**
- * Retrieves the approximate matching rule with the specified name
- * or OID.
- *
- * @param lowerName The lowercase name or OID for the approximate
- * matching rule to retrieve.
- *
- * @return The requested approximate matching rule, or
- * <CODE>null</CODE> if no such matching rule has been
- * defined in the server.
- */
- public static MatchingRule
- getApproximateMatchingRule(String lowerName)
- {
- return DirectoryServer.getMatchingRule(lowerName);
- }
-
- /**
- * Retrieves the equality matching rule with the specified name or
- * OID.
- *
- * @param lowerName The lowercase name or OID for the equality
- * matching rule to retrieve.
- *
- * @return The requested equality matching rule, or
- * <CODE>null</CODE> if no such matching rule has been
- * defined in the server.
- */
- public static MatchingRule
- getEqualityMatchingRule(String lowerName)
- {
- return DirectoryServer.getMatchingRule(lowerName);
- }
-
- /**
- * Retrieves the ordering matching rule with the specified name or
- * OID.
- *
- * @param lowerName The lowercase name or OID for the ordering
- * matching rule to retrieve.
- *
- * @return The requested ordering matching rule, or
- * <CODE>null</CODE> if no such matching rule has been
- * defined in the server.
- */
- public static MatchingRule
- getOrderingMatchingRule(String lowerName)
- {
- return DirectoryServer.getMatchingRule(lowerName);
- }
-
- /**
- * Retrieves the substring matching rule with the specified name or
- * OID.
- *
- * @param lowerName The lowercase name or OID for the substring
- * matching rule to retrieve.
- *
- * @return The requested substring matching rule, or
- * <CODE>null</CODE> if no such matching rule has been
- * defined in the server.
- */
- public static MatchingRule
- getSubstringMatchingRule(String lowerName)
- {
- return DirectoryServer.getMatchingRule(lowerName);
- }
-
- /**
- * Retrieves the "top" objectClass, which should be the topmost
- * objectclass in the inheritance chain for most other
- * objectclasses.
- *
- * @return The "top" objectClass.
- */
- public static ObjectClass getTopObjectClass()
- {
- return DirectoryServer.getTopObjectClass();
- }
-
- /**
- * Retrieves the set of attribute type definitions that have been
- * defined in the Directory Server. The mapping will be between the
- * lowercase name or OID for each attribute type and the attribute
- * type implementation. The same attribute type may be included
- * multiple times with different keys. The returned map must not be
- * altered by the caller.
- *
- * @return The set of attribute type definitions that have been
- * defined in the Directory Server.
- */
- public static Collection<AttributeType> getAttributeTypes()
- {
- return DirectoryServer.getAttributeTypes();
- }
-
- /**
- * Retrieves the attribute type for the "objectClass" attribute.
- *
- * @return The attribute type for the "objectClass" attribute.
- */
- public static AttributeType getObjectClassAttributeType()
- {
- return DirectoryServer.getObjectClassAttributeType();
- }
-
- /**
- * Retrieves the set of attribute syntaxes defined in the Directory
- * Server.
- *
- * @return The set of attribute syntaxes defined in the Directory
- * Server.
- */
- public static Collection<Syntax> getAttributeSyntaxes()
- {
- return DirectoryServer.getAttributeSyntaxes();
- }
-
- /**
- * Retrieves the set of matching rule uses defined in the Directory
- * Server. The mapping will be between the matching rule and its
- * corresponding matching rule use. The returned map must not be
- * altered by the caller.
- *
- * @return The set of matching rule uses defined in the Directory
- * Server.
- */
- public static Collection<MatchingRuleUse> getMatchingRuleUses()
- {
- return DirectoryServer.getMatchingRuleUses();
- }
-
- /**
- * Retrieves the DIT content rule associated with the specified
- * objectclass.
- *
- * @param objectClass The objectclass for which to retrieve the
- * associated DIT content rule.
- *
- * @return The requested DIT content rule, or <CODE>null</CODE> if
- * no such rule is defined in the schema.
- */
- public static DITContentRule
- getDITContentRule(ObjectClass objectClass)
- {
- return DirectoryServer.getDITContentRule(objectClass);
- }
-
- /**
- * Retrieves the DIT structure rule associated with the provided
- * rule ID.
- *
- * @param ruleID The rule ID for which to retrieve the associated
- * DIT structure rule.
- *
- * @return The requested DIT structure rule, or <CODE>null</CODE>
- * if no such rule is defined.
- */
- public static DITStructureRule getDITStructureRule(int ruleID)
- {
- return DirectoryServer.getDITStructureRule(ruleID);
- }
-
- /**
- * Retrieves the collection of name forms associated with the specified
- * structural objectclass.
- *
- * @param objectClass The structural objectclass for which to
- * retrieve the associated name form.
- *
- * @return The collection of requested name forms, or <CODE>null</CODE>
- * if no such name form is defined in the schema.
- */
- public static Collection<NameForm> getNameForm(ObjectClass objectClass)
- {
- return DirectoryServer.getNameForm(objectClass);
- }
-
- /**
* Registers the provided alert generator with the Directory Server.
*
* @param alertGenerator The alert generator to register.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
index 434291b..545ab64 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -22,7 +22,6 @@
import static org.opends.messages.CoreMessages.*;
import static org.opends.messages.SchemaMessages.*;
import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.types.CommonSchemaElements.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -602,16 +601,7 @@
}
}
- /**
- * Retrieves the OID of the provided object class definition.
- *
- * @param definition
- * Definition of an object class.
- * @return the OID of the object class
- * @throws DirectoryException
- * If the definition couldn't be parsed.
- */
- public String parseObjectClassOID(String definition) throws DirectoryException
+ private String parseObjectClassOID(String definition) throws DirectoryException
{
return parseOID(definition, ERR_PARSING_OBJECTCLASS_OID);
}
@@ -1124,17 +1114,13 @@
/**
- * Retrieves the ldap syntax definitions for this schema, as a
- * mapping between the OID for the syntax and the ldap syntax
- * definition itself. Each ldap syntax should only be present once,
- * since its only key is its OID. The contents of the returned
- * mapping must not be altered.
+ * Retrieves the ldap syntax definitions for this schema.
*
- * @return The ldap syntax definitions for this schema.
+ * @return The ldap syntax definitions for this schema.
*/
- public ConcurrentHashMap<String,LDAPSyntaxDescription> getLdapSyntaxDescriptions()
+ public Collection<LDAPSyntaxDescription> getLdapSyntaxDescriptions()
{
- return ldapSyntaxDescriptions;
+ return Collections.unmodifiableCollection(ldapSyntaxDescriptions.values());
}
/**
@@ -1253,19 +1239,6 @@
}
/**
- * Indicates whether this schema definition includes a matching rule use
- * with the provided name or OID.
- *
- * @param nameOrOid The name or OID for which to make the determination, ignoring case considerations
- * @return {@code true} if this schema contains a matching rule use
- * with the provided name or OID, or {@code false} if not.
- */
- public boolean hasMatchingRuleUse(String nameOrOid)
- {
- return schemaNG.hasMatchingRuleUse(nameOrOid);
- }
-
- /**
* Retrieves the matching rule definition with the specified name or OID.
*
* @param nameOrOid The name or OID of the matching rule to retrieve, ignoring case considerations
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
index 3620c06..c29cfd7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/tasks/AddSchemaFileTaskTestCase.java
@@ -86,7 +86,7 @@
MatchingRule matchingRule = getMatchingRule("testAddValidSchemaFileMatch", "1.3.6.1.4.1.26027.1.999.23", false);
- DirectoryServer.registerMatchingRule(matchingRule, false);
+ DirectoryServer.getSchema().registerMatchingRule(matchingRule, false);
String schemaDirectory = SchemaConfigManager.getSchemaDirectoryPath();
@@ -160,7 +160,7 @@
MatchingRule matchingRule1 =
getMatchingRule("testAddMultipleValidSchemaFiles1Match", "1.3.6.1.4.1.26027.1.999.24", false);
- DirectoryServer.registerMatchingRule(matchingRule1, false);
+ DirectoryServer.getSchema().registerMatchingRule(matchingRule1, false);
String[] fileLines1 =
{
@@ -193,7 +193,7 @@
MatchingRule matchingRule2 =
getMatchingRule("testAddMultipleValidSchemaFiles2Match", "1.3.6.1.4.1.26027.1.999.25", false);
- DirectoryServer.registerMatchingRule(matchingRule2, false);
+ DirectoryServer.getSchema().registerMatchingRule(matchingRule2, false);
String[] fileLines2 =
{
--
Gitblit v1.10.0