OPENDJ-1308 Migrate schema support
DITStructureRule.java, NameForm.java, CommonSchemaElements.java:
Brought these classes closer to the relevant SDK types: used UCDetector to change visibility / remove methods that are not on the SDK types.
MatchingRuleUse.java
Brought this class closer to the relevant SDK types: used UCDetector to change visibility / remove methods that are not on the SDK types.
Renamed getName() to getNameOrOID().
ConfigureWindowsService.java, MatchingRuleConfigManager.java, SchemaBackend.java, Schema.java, SearchFilter.java:
Consequence of renaming MatchingRuleUse.getName().
| | |
| | | if (mru.getAttributes().contains(removeType)) |
| | | { |
| | | LocalizableMessage message = ERR_SCHEMA_MODIFY_REMOVE_AT_IN_MR_USE.get( |
| | | removeType.getNameOrOID(), mru.getName()); |
| | | removeType.getNameOrOID(), mru.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | } |
| | |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_MR_USE.get( |
| | | matchingRuleUse.getName(), |
| | | existingMRU.getName(), |
| | | mru.getName()); |
| | | matchingRuleUse.getNameOrOID(), |
| | | existingMRU.getNameOrOID(), |
| | | mru.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | | message); |
| | | } |
| | |
| | | if ((existingMRUForRule != null) && (existingMRUForRule != existingMRU)) |
| | | { |
| | | LocalizableMessage message = ERR_SCHEMA_MODIFY_MR_CONFLICT_FOR_ADD_MR_USE. |
| | | get(matchingRuleUse.getName(), matchingRule.getNameOrOID(), |
| | | existingMRUForRule.getName()); |
| | | get(matchingRuleUse.getNameOrOID(), matchingRule.getNameOrOID(), |
| | | existingMRUForRule.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | if (matchingRule.isObsolete()) |
| | | { |
| | | LocalizableMessage message = ERR_SCHEMA_MODIFY_MRU_OBSOLETE_MR.get( |
| | | matchingRuleUse.getName(), matchingRule.getNameOrOID()); |
| | | matchingRuleUse.getNameOrOID(), matchingRule.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | |
| | | if (! schema.hasAttributeType(at.getOID())) |
| | | { |
| | | LocalizableMessage message = ERR_SCHEMA_MODIFY_MRU_UNDEFINED_ATTR.get( |
| | | matchingRuleUse.getName(), at.getNameOrOID()); |
| | | matchingRuleUse.getNameOrOID(), at.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | LocalizableMessage message = ERR_SCHEMA_MODIFY_MRU_OBSOLETE_ATTR.get( |
| | | matchingRuleUse.getName(), matchingRule.getNameOrOID()); |
| | | matchingRuleUse.getNameOrOID(), matchingRule.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | } |
| | |
| | | if ((removeMRU == null) || (! removeMRU.equals(matchingRuleUse))) |
| | | { |
| | | LocalizableMessage message = ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_MR_USE.get( |
| | | matchingRuleUse.getName()); |
| | | matchingRuleUse.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | |
| | | { |
| | | LocalizableMessage message = |
| | | WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_MRU.get( |
| | | matchingRule.getNameOrOID(), mru.getName()); |
| | | matchingRule.getNameOrOID(), mru.getNameOrOID()); |
| | | unacceptableReasons.add(message); |
| | | |
| | | configAcceptable = false; |
| | |
| | | { |
| | | LocalizableMessage message = |
| | | WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_MRU.get( |
| | | matchingRule.getNameOrOID(), mru.getName()); |
| | | matchingRule.getNameOrOID(), mru.getNameOrOID()); |
| | | unacceptableReasons.add(message); |
| | | |
| | | configAcceptable = false; |
| | |
| | | */ |
| | | |
| | | package org.opends.server.tools; |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import java.io.*; |
| | | |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.InputStreamReader; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | | |
| | | import org.opends.guitools.controlpanel.util.Utilities; |
| | | import org.opends.quicksetup.util.Utils; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.loggers.JDKLogging; |
| | |
| | | import org.opends.server.util.DynamicConstants; |
| | | import org.opends.server.util.SetupUtils; |
| | | |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.ArgumentParser; |
| | | import com.forgerock.opendj.cli.BooleanArgument; |
| | | import com.forgerock.opendj.cli.CommonArguments; |
| | | import com.forgerock.opendj.cli.StringArgument; |
| | | import com.forgerock.opendj.cli.*; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | import static com.forgerock.opendj.cli.ArgumentConstants.*; |
| | | |
| | | /** |
| | | * This class is used to configure the Windows service for this instance on |
| | |
| | | * specifies the path to the schema file from which this |
| | | * schema definition was loaded. |
| | | */ |
| | | public final void toString(StringBuilder buffer, |
| | | boolean includeFileElement) { |
| | | |
| | | private final void toString(StringBuilder buffer, boolean includeFileElement) |
| | | { |
| | | buffer.append("( "); |
| | | buffer.append(oid); |
| | | |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.schema.DITStructureRuleSyntax; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | /** |
| | | * This class defines a DIT structure rule, which is used to indicate |
| | |
| | | * @return {@code true} if this DIT structure rule has one or more |
| | | * superior rules, or {@code false} if not. |
| | | */ |
| | | public boolean hasSuperiorRules() |
| | | boolean hasSuperiorRules() |
| | | { |
| | | return ((superiorRules != null) && (! superiorRules.isEmpty())); |
| | | return superiorRules != null && !superiorRules.isEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the value of the specified "extra" property for this |
| | | * DIT structure rule. |
| | | * |
| | | * @param propertyName The name of the "extra" property for which |
| | | * to retrieve the value. |
| | | * |
| | | * @return The value of the specified "extra" property for this DIT |
| | | * structure rule, or {@code null} if no such property is |
| | | * defined. |
| | | */ |
| | | public List<String> getExtraProperty(String propertyName) |
| | | { |
| | | return extraProperties.get(propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the provided "extra" property for this DIT structure |
| | | * rule. |
| | | * |
| | |
| | | * @param value The value for the "extra" property, or |
| | | * {@code null} if the property is to be removed. |
| | | */ |
| | | public void setExtraProperty(String name, String value) |
| | | private void setExtraProperty(String name, String value) |
| | | { |
| | | ifNull(name); |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Specifies the provided "extra" property for this DIT structure |
| | | * rule. |
| | | * |
| | | * @param name The name for the "extra" property. It must not |
| | | * be {@code null}. |
| | | * @param values The set of value for the "extra" property, or |
| | | * {@code null} if the property is to be removed. |
| | | */ |
| | | public void setExtraProperty(String name, List<String> values) |
| | | { |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | | extraProperties.remove(name); |
| | | } |
| | | else |
| | | { |
| | | LinkedList<String> valuesCopy = new LinkedList<String>(values); |
| | | extraProperties.put(name, valuesCopy); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided object is equal to this DIT |
| | | * structure rule. The object will be considered equal if it is a |
| | | * DIT structure rule with the same OID as the current type. |
| | |
| | | * path to the schema file from which |
| | | * this DIT structure rule was loaded. |
| | | */ |
| | | public void toString(StringBuilder buffer, |
| | | boolean includeFileElement) |
| | | private void toString(StringBuilder buffer, boolean includeFileElement) |
| | | { |
| | | buffer.append("( "); |
| | | buffer.append(ruleID); |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.api.MatchingRule; |
| | | import org.opends.server.schema.MatchingRuleUseSyntax; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | /** |
| | | * This class defines a data structure for storing and interacting |
| | |
| | | * @return The primary name to use when referencing this matching |
| | | * rule use, or {@code null} if there is none. |
| | | */ |
| | | public String getName() |
| | | public String getNameOrOID() |
| | | { |
| | | if (names.isEmpty()) |
| | | { |
| | |
| | | * referenced by this matching rule use, or {@code false} |
| | | * if it is not. |
| | | */ |
| | | public boolean appliesToAttribute(AttributeType attributeType) |
| | | boolean appliesToAttribute(AttributeType attributeType) |
| | | { |
| | | return attributes.contains(attributeType); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the value of the specified "extra" property for this |
| | | * matching rule use. |
| | | * |
| | | * @param propertyName The name of the "extra" property for which |
| | | * to retrieve the value. |
| | | * |
| | | * @return The value of the specified "extra" property for this |
| | | * matching rule use, or {@code null} if no such property |
| | | * is defined. |
| | | */ |
| | | public List<String> getExtraProperty(String propertyName) |
| | | { |
| | | return extraProperties.get(propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the provided "extra" property for this matching rule |
| | | * use. |
| | | * |
| | |
| | | * @param value The value for the "extra" property, or |
| | | * {@code null} if the property is to be removed. |
| | | */ |
| | | public void setExtraProperty(String name, String value) |
| | | private void setExtraProperty(String name, String value) |
| | | { |
| | | ifNull(name); |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Specifies the provided "extra" property for this matching rule |
| | | * use. |
| | | * |
| | | * @param name The name for the "extra" property. It must not |
| | | * be {@code null}. |
| | | * @param values The set of value for the "extra" property, or |
| | | * {@code null} if the property is to be removed. |
| | | */ |
| | | public void setExtraProperty(String name, List<String> values) |
| | | { |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | | extraProperties.remove(name); |
| | | } |
| | | else |
| | | { |
| | | LinkedList<String> valuesCopy = new LinkedList<String>(values); |
| | | extraProperties.put(name, valuesCopy); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided object is equal to this matching |
| | | * rule use. The object will be considered equal if it is a |
| | | * matching rule use with the same matching rule. |
| | |
| | | * path to the schema file from which |
| | | * this matching rule use was loaded. |
| | | */ |
| | | public void toString(StringBuilder buffer, |
| | | boolean includeFileElement) |
| | | private void toString(StringBuilder buffer, boolean includeFileElement) |
| | | { |
| | | buffer.append("( "); |
| | | buffer.append(matchingRule.getOID()); |
| | |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.LinkedHashSet; |
| | |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.opends.server.schema.NameFormSyntax; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.forgerock.util.Reject.*; |
| | | |
| | | |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | |
| | | /** |
| | | * This class defines a data structure for storing and interacting |
| | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the value of the specified "extra" property for this |
| | | * name form. |
| | | * |
| | | * @param propertyName The name of the "extra" property for which |
| | | * to retrieve the value. |
| | | * |
| | | * @return The value of the specified "extra" property for this |
| | | * name form, or {@code null} if no such property is |
| | | * defined. |
| | | */ |
| | | public List<String> getExtraProperty(String propertyName) |
| | | { |
| | | return extraProperties.get(propertyName); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Specifies the provided "extra" property for this name form. |
| | | * |
| | | * @param name The name for the "extra" property. It must not be |
| | |
| | | * @param value The value for the "extra" property, or |
| | | * {@code null} if the property is to be removed. |
| | | */ |
| | | public void setExtraProperty(String name, String value) |
| | | private void setExtraProperty(String name, String value) |
| | | { |
| | | ifNull(name); |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Specifies the provided "extra" property for this name form. |
| | | * |
| | | * @param name The name for the "extra" property. It must not |
| | | * be {@code null}. |
| | | * @param values The set of value for the "extra" property, or |
| | | * {@code null} if the property is to be removed. |
| | | */ |
| | | public void setExtraProperty(String name, List<String> values) |
| | | { |
| | | ifNull(name); |
| | | |
| | | if ((values == null) || values.isEmpty()) |
| | | { |
| | | extraProperties.remove(name); |
| | | } |
| | | else |
| | | { |
| | | LinkedList<String> valuesCopy = new LinkedList<String>(values); |
| | | extraProperties.put(name, valuesCopy); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Indicates whether the provided object is equal to this name form. |
| | | * The object will be considered equal if it is a name form with the |
| | | * same OID as the current name form. |
| | |
| | | * path to the schema file from which |
| | | * this name form was loaded. |
| | | */ |
| | | public void toString(StringBuilder buffer, |
| | | boolean includeFileElement) |
| | | private void toString(StringBuilder buffer, boolean includeFileElement) |
| | | { |
| | | buffer.append("( "); |
| | | buffer.append(oid); |
| | |
| | | matchingRuleUses.get(matchingRule); |
| | | |
| | | LocalizableMessage message = ERR_SCHEMA_CONFLICTING_MATCHING_RULE_USE. |
| | | get(matchingRuleUse.getName(), |
| | | get(matchingRuleUse.getNameOrOID(), |
| | | matchingRule.getNameOrOID(), |
| | | conflictingUse.getName()); |
| | | conflictingUse.getNameOrOID()); |
| | | throw new DirectoryException( |
| | | ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | |
| | | "Attribute type %s is not allowed for use with " + |
| | | "matching rule %s because of matching rule use " + |
| | | "definition %s", attributeType.getNameOrOID(), |
| | | matchingRule.getNameOrOID(), mru.getName()); |
| | | matchingRule.getNameOrOID(), mru.getNameOrOID()); |
| | | } |
| | | return ConditionResult.UNDEFINED; |
| | | } |