mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
13.22.2007 668f7fde4d1c81242b7b5a3646daacc82607de21
Make a couple of changes to speed up schema interaction.
3 files modified
39 ■■■■ changed files
opends/src/server/org/opends/server/types/AttributeType.java 13 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/CommonSchemaElements.java 7 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/ObjectClass.java 19 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/AttributeType.java
@@ -101,6 +101,9 @@
  // Indicates whether this attribute type is the objectclass type.
  private final boolean isObjectClassType;
  // Indicates whether this attribute type is operational.
  private final boolean isOperational;
  // Indicates whether this attribute type is declared "single-value".
  private final boolean isSingleValue;
@@ -120,6 +123,9 @@
  // The definition string used to create this attribute type.
  private final String definition;
  // The OID for the associated syntax.
  private final String syntaxOID;
  // The substring matching rule for this attribute type.
  private final SubstringMatchingRule substringMatchingRule;
@@ -324,6 +330,7 @@
    {
      this.syntax = syntax;
    }
    syntaxOID = this.syntax.getOID();
    if (approximateMatchingRule == null)
@@ -386,6 +393,8 @@
    {
      isObjectClassType = hasName(OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
    }
    isOperational = this.attributeUsage.isOperational();
  }
@@ -504,7 +513,7 @@
   */
  public String getSyntaxOID()
  {
    return syntax.getOID();
    return syntaxOID;
  }
@@ -588,7 +597,7 @@
   */
  public boolean isOperational()
  {
    return attributeUsage.isOperational();
    return isOperational;
  }
opends/src/server/org/opends/server/types/CommonSchemaElements.java
@@ -74,6 +74,9 @@
  // Indicates whether this definition is declared "obsolete".
  private final boolean isObsolete;
  // The hash code for this definition.
  private final int hashCode;
  // The set of additional name-value pairs associated with this
  // definition.
  private final Map<String, List<String>> extraProperties;
@@ -141,6 +144,8 @@
    this.description = description;
    this.isObsolete = isObsolete;
    hashCode = oid.hashCode();
    // Make sure we have a primary name if possible.
    if (primaryName == null) {
      if (names != null && !names.isEmpty()) {
@@ -497,7 +502,7 @@
   */
  public final int hashCode() {
    return oid.hashCode();
    return hashCode;
  }
opends/src/server/org/opends/server/types/ObjectClass.java
@@ -89,6 +89,10 @@
  // superclasses.
  private final Set<AttributeType> requiredAttributesChain;
  // The set of required and optional attributes for this objectclass
  // and its superclasses.
  private final Set<AttributeType> requiredAndOptionalChain;
  // The reference to the superior objectclass.
  private final ObjectClass superiorClass;
@@ -238,6 +242,16 @@
      this.optionalAttributesChain = Collections.unmodifiableSet(tmp);
    }
    // Construct unmodifiable views of the required and optional
    // attribute chains.
    HashSet<AttributeType> reqAndOptSet =
         new HashSet<AttributeType>(requiredAttributesChain.size() +
                                    optionalAttributesChain.size());
    reqAndOptSet.addAll(requiredAttributesChain);
    reqAndOptSet.addAll(optionalAttributesChain);
    requiredAndOptionalChain =
         Collections.<AttributeType>unmodifiableSet(reqAndOptSet);
    // Object class type defaults to structural.
    if (objectClassType != null) {
      this.objectClassType = objectClassType;
@@ -447,7 +461,10 @@
   */
  public boolean isRequiredOrOptional(AttributeType attributeType) {
    return (isRequired(attributeType) || isOptional(attributeType));
    // FIXME -- Do we need to do any other checks here, like whether
    // the attribute type is actually defined in the schema?
    return (isExtensibleObject ||
            requiredAndOptionalChain.contains(attributeType));
  }