| | |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | | import org.opends.messages.Message; |
| | | |
| | | |
| | | |
| | |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | import java.util.Map; |
| | | import java.util.MissingResourceException; |
| | | import java.util.Set; |
| | | |
| | | import org.opends.messages.Message; |
| | | import org.opends.server.admin.DefinitionDecodingException.Reason; |
| | | |
| | | |
| | |
| | | // The parent managed object definition if applicable. |
| | | private final AbstractManagedObjectDefinition<? super C, ? super S> parent; |
| | | |
| | | // The set of constraints associated with this managed object |
| | | // definition. |
| | | private final Collection<Constraint> constraints; |
| | | |
| | | // The set of property definitions applicable to this managed object |
| | | // definition. |
| | | private final Map<String, PropertyDefinition<?>> propertyDefinitions; |
| | |
| | | // definition. |
| | | private final Map<String, RelationDefinition<?, ?>> relationDefinitions; |
| | | |
| | | // The set of all constraints associated with this managed object |
| | | // definition including inherited constraints. |
| | | private final Collection<Constraint> allConstraints; |
| | | |
| | | // The set of all property definitions associated with this managed |
| | | // object definition including inherited property definitions. |
| | | private final Map<String, PropertyDefinition<?>> allPropertyDefinitions; |
| | |
| | | AbstractManagedObjectDefinition<? super C, ? super S> parent) { |
| | | this.name = name; |
| | | this.parent = parent; |
| | | this.constraints = new LinkedList<Constraint>(); |
| | | this.propertyDefinitions = new HashMap<String, PropertyDefinition<?>>(); |
| | | this.relationDefinitions = new HashMap<String, RelationDefinition<?,?>>(); |
| | | this.allConstraints = new LinkedList<Constraint>(); |
| | | this.allPropertyDefinitions = new HashMap<String, PropertyDefinition<?>>(); |
| | | this.allRelationDefinitions = |
| | | new HashMap<String, RelationDefinition<?, ?>>(); |
| | |
| | | if (parent != null) { |
| | | parent.children.put(name, this); |
| | | |
| | | allConstraints.addAll(parent.getAllConstraints()); |
| | | |
| | | for (PropertyDefinition<?> pd : parent.getAllPropertyDefinitions()) { |
| | | allPropertyDefinitions.put(pd.getName(), pd); |
| | | } |
| | |
| | | |
| | | |
| | | /** |
| | | * Get all the constraints associated with this type of managed |
| | | * object. The returned collection will contain inherited |
| | | * constraints. |
| | | * |
| | | * @return Returns an unmodifiable collection containing all the |
| | | * constraints associated with this type of managed object. |
| | | */ |
| | | public final Collection<Constraint> getAllConstraints() { |
| | | return Collections.unmodifiableCollection(allConstraints); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get all the property definitions associated with this type of |
| | | * managed object. The returned collection will contain inherited |
| | | * property definitions. |
| | |
| | | |
| | | |
| | | /** |
| | | * Get the constraints defined by this managed object definition. |
| | | * The returned collection will not contain inherited constraints. |
| | | * |
| | | * @return Returns an unmodifiable collection containing the |
| | | * constraints defined by this managed object definition. |
| | | */ |
| | | public final Collection<Constraint> getConstraints() { |
| | | return Collections.unmodifiableCollection(constraints); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the optional description of this managed object definition |
| | | * in the default locale. |
| | | * |
| | |
| | | |
| | | |
| | | /** |
| | | * Deregister a constraint from the managed object definition. |
| | | * <p> |
| | | * This method <b>must not</b> be called by applications and is |
| | | * only intended for internal testing. |
| | | * |
| | | * @param constraint |
| | | * The constraint to be deregistered. |
| | | */ |
| | | protected final void deregisterConstraint(Constraint constraint) { |
| | | constraints.remove(constraint); |
| | | allConstraints.remove(constraint); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Deregister a relation definition from the managed object |
| | | * definition. |
| | | * <p> |
| | |
| | | |
| | | |
| | | /** |
| | | * Register a constraint with the managed object definition. |
| | | * <p> |
| | | * This method <b>must not</b> be called by applications. |
| | | * |
| | | * @param constraint |
| | | * The constraint to be registered. |
| | | */ |
| | | protected final void registerConstraint(Constraint constraint) { |
| | | constraints.add(constraint); |
| | | allConstraints.add(constraint); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Register a property definition with the managed object definition, |
| | | * overriding any existing property definition with the same name. |
| | | * <p> |