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

matthew_swift
14.21.2007 25c232dabcfbaebb8295916bed92a56d9a18966f
opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java
@@ -33,10 +33,12 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.Set;
import org.opends.server.admin.DefinitionDecodingException.Reason;
@@ -81,6 +83,9 @@
  // object definition including inherited relation definitions.
  private final Map<String, RelationDefinition<?, ?>> allRelationDefinitions;
  // The set of tags associated with this managed object.
  private final Set<Tag> allTags;
  // The set of managed object definitions which inherit from this definition.
  private final Map<String,
    AbstractManagedObjectDefinition<? extends C, ? extends S>> children;
@@ -105,6 +110,7 @@
    this.allPropertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
    this.allRelationDefinitions =
      new HashMap<String, RelationDefinition<?, ?>>();
    this.allTags = new HashSet<Tag>();
    this.children = new HashMap<String,
        AbstractManagedObjectDefinition<? extends C, ? extends S>>();
@@ -119,6 +125,8 @@
      for (RelationDefinition<?, ?> rd : parent.getAllRelationDefinitions()) {
        allRelationDefinitions.put(rd.getName(), rd);
      }
      // Tag inheritance is performed during preprocessing.
    }
  }
@@ -180,6 +188,19 @@
  /**
   * Get all the tags associated with this type of managed object. The
   * returned collection will contain inherited tags.
   *
   * @return Returns an unmodifiable collection containing all the
   *         tags associated with this type of managed object.
   */
  public final Collection<Tag> getAllTags() {
    return Collections.unmodifiableCollection(allTags);
  }
  /**
   * Get the named child managed object definition which inherits from
   * this managed object definition. This method will recursively
   * search down through the inheritance hierarchy.
@@ -492,6 +513,21 @@
  /**
   * Determines whether or not this managed object definition has the
   * specified tag.
   *
   * @param t
   *          The tag definition.
   * @return Returns <code>true</code> if this managed object
   *         definition has the specified tag.
   */
  public final boolean hasTag(Tag t) {
    return allTags.contains(t);
  }
  /**
   * Determines whether or not this managed object definition is a
   * sub-type of the provided managed object definition. This managed
   * object definition is a sub-type of the provided managed object
@@ -538,42 +574,6 @@
  /**
   * Register a property definition with the managed object definition,
   * overriding any existing property definition with the same name.
   * <p>
   * This method <b>must not</b> be called by applications.
   *
   * @param d
   *          The property definition to be registered.
   */
  protected final void registerPropertyDefinition(PropertyDefinition d) {
    String name = d.getName();
    propertyDefinitions.put(name, d);
    allPropertyDefinitions.put(name, d);
  }
  /**
   * Register a relation definition with the managed object definition,
   * overriding any existing relation definition with the same name.
   * <p>
   * This method <b>must not</b> be called by applications.
   *
   * @param d
   *          The relation definition to be registered.
   */
  protected final void registerRelationDefinition(RelationDefinition d) {
    String name = d.getName();
    relationDefinitions.put(name, d);
    allRelationDefinitions.put(name, d);
  }
  /**
   * Finds a sub-type of this managed object definition which most closely
   * corresponds to the matching criteria of the provided definition resolver.
   *
@@ -632,6 +632,56 @@
  /**
   * Register a property definition with the managed object definition,
   * overriding any existing property definition with the same name.
   * <p>
   * This method <b>must not</b> be called by applications.
   *
   * @param d
   *          The property definition to be registered.
   */
  protected final void registerPropertyDefinition(PropertyDefinition d) {
    String name = d.getName();
    propertyDefinitions.put(name, d);
    allPropertyDefinitions.put(name, d);
  }
  /**
   * Register a relation definition with the managed object definition,
   * overriding any existing relation definition with the same name.
   * <p>
   * This method <b>must not</b> be called by applications.
   *
   * @param d
   *          The relation definition to be registered.
   */
  protected final void registerRelationDefinition(RelationDefinition d) {
    String name = d.getName();
    relationDefinitions.put(name, d);
    allRelationDefinitions.put(name, d);
  }
  /**
   * Register a tag with the managed object definition.
   * <p>
   * This method <b>must not</b> be called by applications.
   *
   * @param t
   *          The tag to be registered.
   */
  protected final void registerTag(Tag t) {
    allTags.add(t);
  }
  // Recursively descend definition hierarchy to find the best match definition.
  private AbstractManagedObjectDefinition<? extends C, ? extends S>
      resolveManagedObjectDefinitionAux(