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

Nicolas Capponi
26.31.2013 efa949b25f472d7e4c39733678d8f0e5229f8201
opendj-sdk/opendj-admin/src/main/java/org/opends/server/admin/AbstractManagedObjectDefinition.java
@@ -23,7 +23,6 @@
 *
 *      Copyright 2007-2010 Sun Microsystems, Inc.
 */
package org.opends.server.admin;
import java.util.ArrayList;
@@ -121,7 +120,8 @@
     *            <code>null</code> parent, unless the definition is being used
     *            for testing).
     */
    protected AbstractManagedObjectDefinition(String name, AbstractManagedObjectDefinition<? super C, ? super S> parent) {
    protected AbstractManagedObjectDefinition(String name,
        AbstractManagedObjectDefinition<? super C, ? super S> parent) {
        this.name = name;
        this.parent = parent;
        this.constraints = new LinkedList<Constraint>();
@@ -168,8 +168,8 @@
     *         definition.
     */
    public final Collection<AbstractManagedObjectDefinition<? extends C, ? extends S>> getAllChildren() {
        List<AbstractManagedObjectDefinition<? extends C, ? extends S>> list = new ArrayList<AbstractManagedObjectDefinition<? extends C, ? extends S>>(
                children.values());
        List<AbstractManagedObjectDefinition<? extends C, ? extends S>> list =
            new ArrayList<AbstractManagedObjectDefinition<? extends C, ? extends S>>(children.values());
        for (AbstractManagedObjectDefinition<? extends C, ? extends S> child : children.values()) {
            list.addAll(child.getAllChildren());
@@ -237,7 +237,8 @@
        // 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>>();
        List<RelationDefinition<? super C, ? super S>> rdlist =
            new LinkedList<RelationDefinition<? super C, ? super S>>();
        if (parent != null) {
            rdlist.addAll(parent.getAllReverseRelationDefinitions());
@@ -310,8 +311,7 @@
     *             empty or if the requested subordinate managed object
     *             definition was not found.
     */
    public final AbstractManagedObjectDefinition<? extends C, ? extends S> getChild(String name)
            throws IllegalArgumentException {
    public final AbstractManagedObjectDefinition<? extends C, ? extends S> getChild(String name) {
        if ((name == null) || (name.length() == 0)) {
            throw new IllegalArgumentException("null or empty managed object name");
        }
@@ -369,7 +369,7 @@
     * @throws UnsupportedOperationException
     *             If this managed object definition is the {@link TopCfgDefn}.
     */
    public final LocalizableMessage getDescription() throws UnsupportedOperationException {
    public final LocalizableMessage getDescription() {
        return getDescription(Locale.getDefault());
    }
@@ -385,7 +385,7 @@
     * @throws UnsupportedOperationException
     *             If this managed object definition is the {@link TopCfgDefn}.
     */
    public final LocalizableMessage getDescription(Locale locale) throws UnsupportedOperationException {
    public final LocalizableMessage getDescription(Locale locale) {
        try {
            return ManagedObjectDefinitionI18NResource.getInstance().getMessage(this, "description", locale);
        } catch (MissingResourceException e) {
@@ -425,7 +425,7 @@
     *             If the specified property name was null or empty or if the
     *             requested property definition was not found.
     */
    public final PropertyDefinition<?> getPropertyDefinition(String name) throws IllegalArgumentException {
    public final PropertyDefinition<?> getPropertyDefinition(String name) {
        if ((name == null) || (name.length() == 0)) {
            throw new IllegalArgumentException("null or empty property name");
        }
@@ -462,7 +462,7 @@
     *             If the specified relation name was null or empty or if the
     *             requested relation definition was not found.
     */
    public final RelationDefinition<?, ?> getRelationDefinition(String name) throws IllegalArgumentException {
    public final RelationDefinition<?, ?> getRelationDefinition(String name) {
        if ((name == null) || (name.length() == 0)) {
            throw new IllegalArgumentException("null or empty relation name");
        }
@@ -514,8 +514,7 @@
     *             or if the requested aggregation property definition was not
     *             found.
     */
    public final AggregationPropertyDefinition<?, ?> getAggregationPropertyDefinition(String name)
            throws IllegalArgumentException {
    public final AggregationPropertyDefinition<?, ?> getAggregationPropertyDefinition(String name) {
        if ((name == null) || (name.length() == 0)) {
            throw new IllegalArgumentException("null or empty aggregation property name");
        }
@@ -563,7 +562,7 @@
     * @throws UnsupportedOperationException
     *             If this managed object definition is the {@link TopCfgDefn}.
     */
    public final LocalizableMessage getSynopsis() throws UnsupportedOperationException {
    public final LocalizableMessage getSynopsis() {
        return getSynopsis(Locale.getDefault());
    }
@@ -578,7 +577,7 @@
     * @throws UnsupportedOperationException
     *             If this managed object definition is the {@link TopCfgDefn}.
     */
    public final LocalizableMessage getSynopsis(Locale locale) throws UnsupportedOperationException {
    public final LocalizableMessage getSynopsis(Locale locale) {
        return ManagedObjectDefinitionI18NResource.getInstance().getMessage(this, "synopsis", locale);
    }
@@ -591,7 +590,7 @@
     * @throws UnsupportedOperationException
     *             If this managed object definition is the {@link TopCfgDefn}.
     */
    public final LocalizableMessage getUserFriendlyName() throws UnsupportedOperationException {
    public final LocalizableMessage getUserFriendlyName() {
        return getUserFriendlyName(Locale.getDefault());
    }
@@ -606,9 +605,9 @@
     * @throws UnsupportedOperationException
     *             If this managed object definition is the {@link TopCfgDefn}.
     */
    public final LocalizableMessage getUserFriendlyName(Locale locale) throws UnsupportedOperationException {
    public final LocalizableMessage getUserFriendlyName(Locale locale) {
        return LocalizableMessage.raw(ManagedObjectDefinitionI18NResource.getInstance().getMessage(this,
                "user-friendly-name", locale));
            "user-friendly-name", locale));
    }
    /**
@@ -620,7 +619,7 @@
     * @throws UnsupportedOperationException
     *             If this managed object definition is the {@link TopCfgDefn}.
     */
    public final LocalizableMessage getUserFriendlyPluralName() throws UnsupportedOperationException {
    public final LocalizableMessage getUserFriendlyPluralName() {
        return getUserFriendlyPluralName(Locale.getDefault());
    }
@@ -635,9 +634,9 @@
     * @throws UnsupportedOperationException
     *             If this managed object definition is the {@link TopCfgDefn}.
     */
    public final LocalizableMessage getUserFriendlyPluralName(Locale locale) throws UnsupportedOperationException {
        return ManagedObjectDefinitionI18NResource.getInstance().getMessage(this,
                "user-friendly-plural-name", locale);
    public final LocalizableMessage getUserFriendlyPluralName(Locale locale) {
        return ManagedObjectDefinitionI18NResource.getInstance()
            .getMessage(this, "user-friendly-plural-name", locale);
    }
    /**
@@ -941,8 +940,8 @@
    // 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) {
    private <C1 extends ConfigurationClient, S1 extends Configuration> void registerReverseRelationDefinition(
        RelationDefinition<C1, S1> rd) {
        rd.getChildDefinition().reverseRelationDefinitions.add(rd);
    }
@@ -957,13 +956,14 @@
    // Recursively descend definition hierarchy to find the best match
    // definition.
    private AbstractManagedObjectDefinition<? extends C, ? extends S> resolveManagedObjectDefinitionAux(
            AbstractManagedObjectDefinition<? extends C, ? extends S> d, DefinitionResolver r) {
        AbstractManagedObjectDefinition<? extends C, ? extends S> d, DefinitionResolver r) {
        if (!r.matches(d)) {
            return null;
        }
        for (AbstractManagedObjectDefinition<? extends C, ? extends S> child : d.getChildren()) {
            AbstractManagedObjectDefinition<? extends C, ? extends S> rd = resolveManagedObjectDefinitionAux(child, r);
            AbstractManagedObjectDefinition<? extends C, ? extends S> rd =
                resolveManagedObjectDefinitionAux(child, r);
            if (rd != null) {
                return rd;
            }