From ab8845f3c17fd0313ac8a705a71b28a3ed21a2c4 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 06 Jun 2016 18:40:37 +0000
Subject: [PATCH] OPENDJ-3037 Remove LDAPSyntaxDescription class
---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java | 30 ++++++++++++++++++------------
1 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
index fc56b84..8cf8166 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/RemoteSchemaLoader.java
@@ -16,6 +16,8 @@
*/
package org.opends.guitools.controlpanel.util;
+import static org.forgerock.opendj.ldap.schema.Schema.*;
+
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -59,9 +61,10 @@
{
matchingRulesToKeep.clear();
syntaxesToKeep.clear();
- matchingRulesToKeep.addAll(org.forgerock.opendj.ldap.schema.Schema.getCoreSchema().getMatchingRules());
- syntaxesToKeep.addAll(org.forgerock.opendj.ldap.schema.Schema.getCoreSchema().getSyntaxes());
+ matchingRulesToKeep.addAll(getCoreSchema().getMatchingRules());
+ syntaxesToKeep.addAll(getCoreSchema().getSyntaxes());
}
+
/**
* Reads the schema.
*
@@ -154,7 +157,7 @@
final Set<Object> remainingAttrs = new HashSet<>(csr.getAttributeValues(schemaAttr));
if (schemaAttr.equals(ConfigConstants.ATTR_LDAP_SYNTAXES_LC))
{
- registerSchemaLdapSyntaxDefinitions(remainingAttrs);
+ registerSyntaxDefinitions(remainingAttrs);
return;
}
@@ -164,17 +167,16 @@
final Set<Object> registered = new HashSet<>();
for (final Object definition : remainingAttrs)
{
- final ByteStringBuilder sb = new ByteStringBuilder();
- sb.appendObject(definition);
+ final String definitionStr = toString(definition);
try
{
switch (schemaAttr)
{
case ConfigConstants.ATTR_ATTRIBUTE_TYPES_LC:
- schema.registerAttributeType(sb.toString(), null, true);
+ schema.registerAttributeType(definitionStr, null, true);
break;
case ConfigConstants.ATTR_OBJECTCLASSES_LC:
- schema.registerObjectClass(sb.toString(), null, true);
+ schema.registerObjectClass(definitionStr, null, true);
break;
}
registered.add(definition);
@@ -192,17 +194,16 @@
}
}
- private void registerSchemaLdapSyntaxDefinitions(Set<Object> remainingAttrs) throws DirectoryException
+ private void registerSyntaxDefinitions(Set<Object> definitions) throws DirectoryException
{
- for (final Object definition : remainingAttrs)
+ for (final Object definition : definitions)
{
- final ByteStringBuilder sb = new ByteStringBuilder();
- sb.appendObject(definition);
+ final String definitionStr = toString(definition);
if (definition.toString().contains(SchemaConstants.OID_OPENDS_SERVER_BASE))
{
try
{
- schema.registerLdapSyntaxDescription(sb.toString(), true);
+ schema.registerSyntax(definitionStr, true);
}
catch (DirectoryException e)
{
@@ -216,6 +217,11 @@
}
}
+ private String toString(final Object definition)
+ {
+ return new ByteStringBuilder().appendObject(definition).toString();
+ }
+
/**
* Returns the schema that was read.
*
--
Gitblit v1.10.0