| | |
| | | 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; |
| | | |
| | |
| | | // 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; |
| | |
| | | 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>>(); |
| | | |
| | |
| | | for (RelationDefinition<?, ?> rd : parent.getAllRelationDefinitions()) { |
| | | allRelationDefinitions.put(rd.getName(), rd); |
| | | } |
| | | |
| | | // Tag inheritance is performed during preprocessing. |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * 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. |
| | |
| | | |
| | | |
| | | /** |
| | | * 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 |
| | |
| | | |
| | | |
| | | /** |
| | | * 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. |
| | | * |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 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( |