| | |
| | | * Portions Copyright 2006-2007 Sun Microsystems, Inc. |
| | | */ |
| | | package org.opends.server.types; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | |
| | | import java.util.TreeSet; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.api.ApproximateMatchingRule; |
| | | import org.opends.server.api.AttributeSyntax; |
| | | import org.opends.server.api.EqualityMatchingRule; |
| | |
| | | import org.opends.server.api.SubstringMatchingRule; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.SchemaConfigManager; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import org.opends.server.protocols.asn1.ASN1OctetString; |
| | | import org.opends.server.schema.CaseIgnoreEqualityMatchingRule; |
| | | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.CoreMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import static org.opends.server.loggers.ErrorLogger.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | |
| | | |
| | | |
| | | |
| | | // The matching rule that will be used to normalize schema element |
| | | // definitions. |
| | | private EqualityMatchingRule normalizationMatchingRule; |
| | | |
| | | // The set of subordinate attribute types registered within the |
| | | // server schema. |
| | | private ConcurrentHashMap<AttributeType,List<AttributeType>> |
| | |
| | | nameFormSet = new LinkedHashSet<AttributeValue>(); |
| | | objectClassSet = new LinkedHashSet<AttributeValue>(); |
| | | |
| | | normalizationMatchingRule = new CaseIgnoreEqualityMatchingRule(); |
| | | oldestModificationTime = System.currentTimeMillis(); |
| | | youngestModificationTime = oldestModificationTime; |
| | | } |
| | |
| | | // that would kill performance. |
| | | String valueString = attributeType.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | attributeTypeSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = attributeType.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | attributeTypeSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = attributeType.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = objectClass.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | objectClassSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = objectClass.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | objectClassSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = objectClass.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | objectClassSet.remove(new AttributeValue(rawValue, normValue)); |
| | | objectClassSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = syntax.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | syntaxSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = syntax.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | syntaxSet.remove(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = syntax.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | |
| | | syntaxSet.remove(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | // match) that would kill performance. |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would |
| | | // use a very expensive matching rule (OID first component |
| | | // match) that would kill performance. |
| | | try |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, normValue)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, normValue)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, normValue)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = matchingRule.toString(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, normValue)); |
| | | matchingRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = matchingRuleUse.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleUseSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = matchingRuleUse.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | matchingRuleUseSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = matchingRuleUse.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = ditContentRule.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | ditContentRuleSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = ditContentRule.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | ditContentRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = ditContentRule.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = ditStructureRule.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | ditStructureRuleSet.add(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = ditStructureRule.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | ditStructureRuleSet.remove(new AttributeValue(rawValue, |
| | | normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = ditStructureRule.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | |
| | | normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | // that would kill performance. |
| | | String valueString = nameForm.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | | new ASN1OctetString(toLowerCase(valueString)); |
| | | ByteString normValue = normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | nameFormSet.add(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | |
| | | // rather than the attribute type because otherwise it would use |
| | | // a very expensive matching rule (OID first component match) |
| | | // that would kill performance. |
| | | try |
| | | { |
| | | String valueString = nameForm.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ByteString normValue = |
| | | normalizationMatchingRule.normalizeValue( |
| | | new ASN1OctetString(valueString)); |
| | | nameFormSet.remove(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | String valueString = nameForm.getDefinition(); |
| | | ASN1OctetString rawValue = new ASN1OctetString(valueString); |
| | | ASN1OctetString normValue = |
| | |
| | | nameFormSet.remove(new AttributeValue(rawValue, normValue)); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |