| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2007 Sun Microsystems, Inc. |
| | | * Portions Copyright 2007-2008 Sun Microsystems, Inc. |
| | | */ |
| | | |
| | | package org.opends.server.admin; |
| | |
| | | // definition. |
| | | private final Map<String, RelationDefinition<?, ?>> relationDefinitions; |
| | | |
| | | // The set of relation definitions directly referencing this managed |
| | | // object definition. |
| | | private final Set<RelationDefinition<C, S>> reverseRelationDefinitions; |
| | | |
| | | // The set of all property definitions associated with this managed |
| | | // object definition including inherited property definitions. |
| | | private final Map<String, PropertyDefinition<?>> allPropertyDefinitions; |
| | |
| | | this.constraints = new LinkedList<Constraint>(); |
| | | this.propertyDefinitions = new HashMap<String, PropertyDefinition<?>>(); |
| | | this.relationDefinitions = new HashMap<String, RelationDefinition<?,?>>(); |
| | | this.reverseRelationDefinitions = new HashSet<RelationDefinition<C,S>>(); |
| | | this.allPropertyDefinitions = new HashMap<String, PropertyDefinition<?>>(); |
| | | this.allRelationDefinitions = |
| | | new HashMap<String, RelationDefinition<?, ?>>(); |
| | |
| | | */ |
| | | public final Collection<Constraint> getAllConstraints() { |
| | | // This method does not used a cached set of constraints because |
| | | // constraints may be updated after child definitions haved been |
| | | // constraints may be updated after child definitions have been |
| | | // defined. |
| | | List<Constraint> allConstraints = new LinkedList<Constraint>(); |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Get all the relation definitions which refer to this managed |
| | | * object definition. The returned collection will contain relation |
| | | * definitions which refer to parents of this managed object |
| | | * definition. |
| | | * |
| | | * @return Returns a collection containing all the relation |
| | | * definitions which refer to this managed object |
| | | * definition. The caller is free to modify the collection |
| | | * if required. |
| | | */ |
| | | public final Collection<RelationDefinition<? super C, ? super S>> |
| | | getAllReverseRelationDefinitions() { |
| | | // This method does not used a cached set of relations because |
| | | // relations may be updated after child definitions have been |
| | | // defined. |
| | | List<RelationDefinition<? super C, ? super S>> rdlist = |
| | | new LinkedList<RelationDefinition<? super C, ? super S>>(); |
| | | |
| | | if (parent != null) { |
| | | rdlist.addAll(parent.getAllReverseRelationDefinitions()); |
| | | } |
| | | rdlist.addAll(reverseRelationDefinitions); |
| | | |
| | | return rdlist; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Get all the tags associated with this type of managed object. The |
| | | * returned collection will contain inherited tags. |
| | | * |
| | |
| | | |
| | | |
| | | /** |
| | | * Get the relation definitions which refer directly to this managed |
| | | * object definition. The returned collection will not contain |
| | | * relation definitions which refer to parents of this managed |
| | | * object definition. |
| | | * |
| | | * @return Returns an unmodifiable collection containing the |
| | | * relation definitions which refer directly to this managed |
| | | * object definition. |
| | | */ |
| | | public final Collection<RelationDefinition<C, S>> |
| | | getReverseRelationDefinitions() { |
| | | return Collections.unmodifiableCollection(reverseRelationDefinitions); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Gets the synopsis of this managed object definition in the |
| | | * default locale. |
| | | * |
| | |
| | | * The relation definition to be registered. |
| | | */ |
| | | protected final void registerRelationDefinition(RelationDefinition<?, ?> d) { |
| | | // Register the relation in this managed object definition. |
| | | String name = d.getName(); |
| | | |
| | | relationDefinitions.put(name, d); |
| | | allRelationDefinitions.put(name, d); |
| | | |
| | | // Now register the relation in the referenced managed object |
| | | // definition for reverse lookups. |
| | | registerReverseRelationDefinition(d); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | final void deregisterRelationDefinition( |
| | | RelationDefinition<?, ?> d) { |
| | | // Deregister the relation from this managed object definition. |
| | | String name = d.getName(); |
| | | relationDefinitions.remove(name); |
| | | allRelationDefinitions.remove(name); |
| | | |
| | | // Now deregister the relation from the referenced managed object |
| | | // definition for reverse lookups. |
| | | d.getChildDefinition().reverseRelationDefinitions.remove(d); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | // Register a relation definition in the referenced managed object |
| | | // definition's reverse lookup table. |
| | | private <CC extends ConfigurationClient, SS extends Configuration> |
| | | void registerReverseRelationDefinition(RelationDefinition<CC, SS> rd) { |
| | | rd.getChildDefinition().reverseRelationDefinitions.add(rd); |
| | | } |
| | | |
| | | |
| | | |
| | | // Recursively descend definition hierarchy to find the best match definition. |
| | | private AbstractManagedObjectDefinition<? extends C, ? extends S> |
| | | resolveManagedObjectDefinitionAux( |