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

matthew_swift
19.48.2007 826e7e5d70450bd954d561024a497b4887dedfcf
Fix for issue 1442.

This change introduces a new style-sheet which generates
en_US property files containing all the description elements
from the XML configuration definitions. In order to expose
these properties the admin framework APIs have been modified
as follows:

* managed object definitions
o user friendly name
o user friendly plural name
o synopsis
o description

* property definitions
o synopsis
o description
o unit description (for integer properties)
o value descriptions (for enumeration properties)
o pattern descriptions (for string properties). This is pretty
much useless at the moment since the string property
definition class does not support patterns (even though the
XML schema does): issue 1523
o alias default behavior description

* relation definitions
o synopsis
o description
o user friendly name (usually the user friendly name of the
referenced managed object)
o user friendly plural name for one-to-many relations (usually
the user friendly plural name of the referenced managed object)

Since there is currently only weak API support for required admin
actions (issue 1426), the admin action descriptions cannot be exposed
through any API at this stage.

For I18N, translators are expected to take the generated property
files and translate them into localized versions.

1 files added
31 files modified
1364 ■■■■ changed files
opends/build.xml 6 ●●●●● patch | view | raw | blame | history
opends/resource/admin/example-plugin/build.xml 8 ●●●●● patch | view | raw | blame | history
opends/resource/admin/messagesMO.xsl 203 ●●●●● patch | view | raw | blame | history
opends/resource/admin/metaMO.xsl 6 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java 127 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/AbstractPropertyDefinition.java 100 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/AliasDefaultBehaviorProvider.java 57 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java 23 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/BooleanPropertyDefinition.java 23 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java 21 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/DNPropertyDefinition.java 23 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/DurationPropertyDefinition.java 21 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/EnumPropertyDefinition.java 68 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java 21 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java 23 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/InstantiableRelationDefinition.java 33 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/IntegerPropertyDefinition.java 63 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java 133 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/PropertyDefinition.java 51 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/RelationDefinition.java 163 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/SizePropertyDefinition.java 23 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/StringPropertyDefinition.java 68 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java 4 ●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java 7 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java 26 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DNPropertyDefinitionTest.java 11 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java 7 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java 25 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java 5 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResourceTest.java 2 ●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java 6 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/PropertySetTest.java 7 ●●●●● patch | view | raw | blame | history
opends/build.xml
@@ -1373,6 +1373,12 @@
      <param name="base-dir" expression="${admin.defn.dir}" />
    </xslt>
    <!-- Generate I18N messages for core administration components. -->
    <xslt basedir="${admin.defn.dir}" destdir="${classes.dir}/admin/messages" includes="**/*Configuration.xml" style="${admin.rules.dir}/messagesMO.xsl">
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
      <param name="base-dir" expression="${admin.defn.dir}" />
    </xslt>
    <!-- Generate manifest file for core administration components. -->
    <tempfile property="admin.temp.dir" destDir="${build.dir}" prefix="tmp" />
    <mkdir dir="${admin.temp.dir}" />
opends/resource/admin/example-plugin/build.xml
@@ -213,6 +213,14 @@
      <param name="base-dir" expression="${src.dir}" />
    </xslt>
    <!-- Compile the Directory Server extension configuration I18N message files. -->
    <xslt basedir="${src.dir}" destdir="${classes.dir}/admin/messages" style="${admin.dir}/messageMO.xsl">
      <include name="**/*Configuration.xml" />
      <exclude name="org/opends/server/admin/std/*.xml" />
      <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
      <param name="base-dir" expression="${src.dir}" />
    </xslt>
    <!-- Compile the Directory Server extension configuration manifest file. -->
    <tempfile property="admin.temp.dir" destDir="${classes.dir}" />
    <mkdir dir="${admin.temp.dir}" />
opends/resource/admin/messagesMO.xsl
New file
@@ -0,0 +1,203 @@
<!--
  ! CDDL HEADER START
  !
  ! The contents of this file are subject to the terms of the
  ! Common Development and Distribution License, Version 1.0 only
  ! (the "License").  You may not use this file except in compliance
  ! with the License.
  !
  ! You can obtain a copy of the license at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! When distributing Covered Code, include this CDDL HEADER in each
  ! file and include the License file at
  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
  ! add the following below this CDDL HEADER, with the fields enclosed
  ! by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CDDL HEADER END
  !
  !
  !      Portions Copyright 2007 Sun Microsystems, Inc.
  ! -->
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:adm="http://www.opends.org/admin"
  xmlns:ldap="http://www.opends.org/admin-ldap">
  <xsl:import href="java-utilities.xsl" />
  <xsl:import href="preprocessor.xsl" />
  <xsl:import href="property-types.xsl" />
  <xsl:output method="text" encoding="us-ascii" />
  <!--
    Document parsing.
  -->
  <xsl:template match="/">
    <!--
      Generate user friendly names.
    -->
    <xsl:value-of
      select="concat('user-friendly-name=', $this-ufn, '&#xa;')" />
    <xsl:value-of
      select="concat('user-friendly-plural-name=', $this-ufpn, '&#xa;')" />
    <!--
      Pull out the managed object synopsis (mandatory).
    -->
    <xsl:if test="not($this/adm:synopsis)">
      <xsl:message terminate="yes">
        <xsl:value-of
          select="concat('No synopsis found for managed object definition ', $this-name)" />
      </xsl:message>
    </xsl:if>
    <xsl:value-of
      select="concat('synopsis=', normalize-space($this/adm:synopsis), '&#xa;')" />
    <!--
      Pull out the managed object description (optional).
    -->
    <xsl:if test="$this/adm:description">
      <xsl:value-of
        select="concat('description=', normalize-space($this/adm:description), '&#xa;')" />
    </xsl:if>
    <!--
      Process each property definition.
    -->
    <xsl:for-each select="$this-all-properties">
      <xsl:sort select="@name" />
      <!--
        Pull out the property definition synopsis (mandatory).
      -->
      <xsl:if test="not(adm:synopsis)">
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('No synopsis found for property ', @name, ' in managed object definition ', $this-name)" />
        </xsl:message>
      </xsl:if>
      <xsl:value-of
        select="concat('property.', normalize-space(@name), '.synopsis=', normalize-space(adm:synopsis), '&#xa;')" />
      <!--
        Pull out the property definition description (optional).
      -->
      <xsl:if test="adm:description">
        <xsl:value-of
          select="concat('property.', normalize-space(@name), '.description=', normalize-space(adm:description), '&#xa;')" />
      </xsl:if>
      <!--
        Process alias default behavior synopsis.
      -->
      <xsl:if test="adm:default-behavior/adm:alias">
        <xsl:if
          test="not(adm:default-behavior/adm:alias/adm:synopsis)">
          <xsl:message terminate="yes">
            <xsl:value-of
              select="concat('No alias default behavior synopsis found for property ', @name, ' in managed object definition ', $this-name)" />
          </xsl:message>
        </xsl:if>
        <xsl:value-of
          select="concat('property.', normalize-space(@name), '.default-behavior.alias.synopsis=', normalize-space(adm:default-behavior/adm:alias/adm:synopsis), '&#xa;')" />
      </xsl:if>
      <!--
        Process requires admin action (other) synopsis.
      -->
      <xsl:if test="adm:requires-admin-action/adm:other">
        <xsl:if
          test="not(adm:requires-admin-action/adm:other/adm:synopsis)">
          <xsl:message terminate="yes">
            <xsl:value-of
              select="concat('No requires admin action (other) synopsis found for property ', @name, ' in managed object definition ', $this-name)" />
          </xsl:message>
        </xsl:if>
        <xsl:value-of
          select="concat('property.', normalize-space(@name), '.requires-admin-action.other.synopsis=', normalize-space(adm:requires-admin-action/adm:other/adm:synopsis), '&#xa;')" />
      </xsl:if>
      <!--
        Process syntax related descriptions.
      -->
      <xsl:choose>
        <xsl:when test="adm:syntax/adm:integer">
          <!--
            Process integer syntax unit synopsis (optional).
          -->
          <xsl:if test="adm:syntax/adm:integer/adm:synopsis">
            <xsl:value-of
              select="concat('property.', normalize-space(@name), '.syntax.integer.unit-synopsis=', normalize-space(adm:syntax/adm:integer/adm:synopsis), '&#xa;')" />
          </xsl:if>
        </xsl:when>
        <xsl:when test="adm:syntax/adm:string/adm:pattern">
          <!--
            Process string syntax pattern synopsis (mandatory if pattern defined).
          -->
          <xsl:if
            test="not(adm:syntax/adm:string/adm:pattern/adm:synopsis)">
            <xsl:message terminate="yes">
              <xsl:value-of
                select="concat('No string pattern synopsis found for property ', @name, ' in managed object definition ', $this-name)" />
            </xsl:message>
          </xsl:if>
          <xsl:value-of
            select="concat('property.', normalize-space(@name), '.syntax.string.pattern.synopsis=', normalize-space(adm:syntax/adm:string/adm:pattern/adm:synopsis), '&#xa;')" />
        </xsl:when>
        <xsl:when test="adm:syntax/adm:enumeration">
          <!--
            Process enumeration value synopsis (mandatory).
          -->
          <xsl:for-each select="adm:syntax/adm:enumeration/adm:value">
            <xsl:sort select="@name" />
            <xsl:if test="not(adm:synopsis)">
              <xsl:message terminate="yes">
                <xsl:value-of
                  select="concat('No synopsis found for enumeration value ', @name, ' for property ', ../../../@name, ' in managed object definition ', $this-name)" />
              </xsl:message>
            </xsl:if>
            <xsl:value-of
              select="concat('property.', normalize-space(../../../@name), '.syntax.enumeration.value.', @name,'.synopsis=', normalize-space(adm:synopsis), '&#xa;')" />
          </xsl:for-each>
        </xsl:when>
      </xsl:choose>
    </xsl:for-each>
    <!--
      Process each relation definition.
    -->
    <xsl:for-each select="$this-all-relations">
      <xsl:sort select="@name" />
      <!--
        Generate user friendly names.
      -->
      <xsl:value-of
        select="concat('relation.', normalize-space(@name), '.user-friendly-name=')" />
      <xsl:call-template name="name-to-ufn">
        <xsl:with-param name="value" select="@name" />
      </xsl:call-template>
      <xsl:value-of select="'&#xa;'" />
      <xsl:if test="adm:one-to-many">
        <xsl:value-of
          select="concat('relation.', normalize-space(@name), '.user-friendly-plural-name=')" />
        <xsl:call-template name="name-to-ufn">
          <xsl:with-param name="value"
            select="adm:one-to-many/@plural-name" />
        </xsl:call-template>
        <xsl:value-of select="'&#xa;'" />
      </xsl:if>
      <!--
        Pull out the relation definition synopsis (mandatory).
      -->
      <xsl:if test="not(adm:synopsis)">
        <xsl:message terminate="yes">
          <xsl:value-of
            select="concat('No synopsis found for relation ', @name, ' in managed object definition ', $this-name)" />
        </xsl:message>
      </xsl:if>
      <xsl:value-of
        select="concat('relation.', normalize-space(@name), '.synopsis=', normalize-space(adm:synopsis), '&#xa;')" />
      <!--
        Pull out the relation definition description (optional).
      -->
      <xsl:if test="adm:description">
        <xsl:value-of
          select="concat('relation.', normalize-space(@name), '.description=', normalize-space(adm:description), '&#xa;')" />
      </xsl:if>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>
opends/resource/admin/metaMO.xsl
@@ -559,11 +559,11 @@
    <xsl:choose>
      <xsl:when test="string-length($generic-type) != 0">
        <xsl:value-of
          select="concat('      ', $type, '.Builder&lt;', $generic-type, '&gt; builder = ', $type, '.createBuilder(&quot;',@name, '&quot;);&#xa;')" />
          select="concat('      ', $type, '.Builder&lt;', $generic-type, '&gt; builder = ', $type, '.createBuilder(INSTANCE, &quot;',@name, '&quot;);&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of
          select="concat('      ', $type, '.Builder builder = ', $type, '.createBuilder(&quot;',@name, '&quot;);&#xa;')" />
          select="concat('      ', $type, '.Builder builder = ', $type, '.createBuilder(INSTANCE, &quot;',@name, '&quot;);&#xa;')" />
      </xsl:otherwise>
    </xsl:choose>
    <xsl:if test="string(@multi-valued) = 'true'">
@@ -607,7 +607,7 @@
          </xsl:when>
          <xsl:when test="adm:default-behavior/adm:alias">
            <xsl:value-of
              select="concat('      builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider&lt;', $value-type,'&gt;());&#xa;')" />
              select="concat('      builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider&lt;', $value-type,'&gt;(INSTANCE, &quot;', @name, '&quot;));&#xa;')" />
          </xsl:when>
          <xsl:when test="adm:default-behavior/adm:defined">
            <xsl:value-of
opends/src/server/org/opends/server/admin/AbstractManagedObjectDefinition.java
@@ -32,7 +32,9 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import org.opends.server.admin.DefinitionDecodingException.Reason;
@@ -154,6 +156,41 @@
  /**
   * Gets the optional description of this managed object definition
   * in the default locale.
   *
   * @return Returns the description of this managed object definition
   *         in the default locale, or <code>null</code> if there is
   *         no description.
   */
  public final String getDescription() {
    return getDescription(Locale.getDefault());
  }
  /**
   * Gets the optional description of this managed object definition
   * in the specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the description of this managed object definition
   *         in the specified locale, or <code>null</code> if there
   *         is no description.
   */
  public final String getDescription(Locale locale) {
    try {
      return ManagedObjectDefinitionI18NResource.getInstance()
          .getMessage(this, "description", locale);
    } catch (MissingResourceException e) {
      return null;
    }
  }
  /**
   * Get the name of the definition.
   *
   * @return Returns the name of the definition.
@@ -168,7 +205,8 @@
   * Get the parent managed object definition, if applicable.
   *
   * @return Returns the parent of this managed object definition, or
   *         <code>null</code> if this definition does not have a parent.
   *         <code>null</code> if this definition does not have a
   *         parent.
   */
  public final AbstractManagedObjectDefinition<? super C,
      ? super S> getParent() {
@@ -266,6 +304,93 @@
  /**
   * Gets the synopsis of this managed object definition in the
   * default locale.
   *
   * @return Returns the synopsis of this managed object definition in
   *         the default locale.
   */
  public final String getSynopsis() {
    return getSynopsis(Locale.getDefault());
  }
  /**
   * Gets the synopsis of this managed object definition in the
   * specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the synopsis of this managed object definition in
   *         the specified locale.
   */
  public final String getSynopsis(Locale locale) {
    return ManagedObjectDefinitionI18NResource.getInstance()
        .getMessage(this, "synopsis", locale);
  }
  /**
   * Gets the user friendly name of this managed object definition in
   * the default locale.
   *
   * @return Returns the user friendly name of this managed object
   *         definition in the default locale.
   */
  public final String getUserFriendlyName() {
    return getUserFriendlyName(Locale.getDefault());
  }
  /**
   * Gets the user friendly name of this managed object definition in
   * the specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the user friendly name of this managed object
   *         definition in the specified locale.
   */
  public final String getUserFriendlyName(Locale locale) {
    return ManagedObjectDefinitionI18NResource.getInstance()
        .getMessage(this, "user-friendly-name", locale);
  }
  /**
   * Gets the user friendly plural name of this managed object
   * definition in the default locale.
   *
   * @return Returns the user friendly plural name of this managed
   *         object definition in the default locale.
   */
  public final String getUserFriendlyPluralName() {
    return getUserFriendlyPluralName(Locale.getDefault());
  }
  /**
   * Gets the user friendly plural name of this managed object
   * definition in the specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the user friendly plural name of this managed
   *         object definition in the specified locale.
   */
  public final String getUserFriendlyPluralName(Locale locale) {
    return ManagedObjectDefinitionI18NResource.getInstance()
        .getMessage(this, "user-friendly-plural-name", locale);
  }
  /**
   * Determine whether there are any child managed object definitions which
   * inherit from this managed object definition.
   *
opends/src/server/org/opends/server/admin/AbstractPropertyDefinition.java
@@ -32,6 +32,8 @@
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import java.util.Locale;
import java.util.MissingResourceException;
import java.util.Set;
@@ -56,6 +58,9 @@
  protected abstract static class AbstractBuilder<T,
      D extends PropertyDefinition<T>> {
    //  The abstract managed object
    private final AbstractManagedObjectDefinition<?, ?> definition;
    // The name of this property definition.
    private final String propertyName;
@@ -70,10 +75,15 @@
    /**
     * Create a property definition builder.
     *
     * @param d
     *          The managed object definition associated with this
     *          property definition.
     * @param propertyName
     *          The property name.
     */
    protected AbstractBuilder(String propertyName) {
    protected AbstractBuilder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      this.definition = d;
      this.propertyName = propertyName;
      this.options = EnumSet.noneOf(PropertyOption.class);
      this.defaultBehavior = new UndefinedDefaultBehaviorProvider<T>();
@@ -87,7 +97,7 @@
     * @return The new property definition.
     */
    public final D getInstance() {
      return buildInstance(propertyName, options, defaultBehavior);
      return buildInstance(definition, propertyName, options, defaultBehavior);
    }
@@ -120,8 +130,12 @@
    /**
     * Build a property definition based on the properties of this builder.
     * Build a property definition based on the properties of this
     * builder.
     *
     * @param d
     *          The managed object definition associated with this
     *          property definition.
     * @param propertyName
     *          The property name.
     * @param options
@@ -130,7 +144,8 @@
     *          The default behavior provider.
     * @return The new property definition.
     */
    protected abstract D buildInstance(String propertyName,
    protected abstract D buildInstance(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<T> defaultBehavior);
  }
@@ -147,11 +162,17 @@
  // The default behavior provider.
  private final DefaultBehaviorProvider<T> defaultBehavior;
  // The abstract managed object
  private final AbstractManagedObjectDefinition<?, ?> definition;
  /**
   * Create a property definition.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param theClass
   *          The property value class.
   * @param propertyName
@@ -161,11 +182,14 @@
   * @param defaultBehavior
   *          The default behavior provider.
   */
  protected AbstractPropertyDefinition(Class<T> theClass, String propertyName,
  protected AbstractPropertyDefinition(AbstractManagedObjectDefinition<?,?> d,
      Class<T> theClass, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<T> defaultBehavior) {
    ensureNotNull(theClass, propertyName, options, defaultBehavior);
    ensureNotNull(d, theClass, propertyName);
    ensureNotNull(options, defaultBehavior);
    this.definition = d;
    this.theClass = theClass;
    this.propertyName = propertyName;
    this.options = EnumSet.copyOf(options);
@@ -280,6 +304,45 @@
  /**
   * {@inheritDoc}
   */
  public final String getDescription() {
    return getDescription(Locale.getDefault());
  }
  /**
   * {@inheritDoc}
   */
  public final String getDescription(Locale locale) {
    ManagedObjectDefinitionI18NResource resource =
      ManagedObjectDefinitionI18NResource.getInstance();
    String property = "property." + propertyName + ".description";
    try {
      return resource.getMessage(definition, property, locale);
    } catch (MissingResourceException e) {
      return null;
    }
  }
  /**
   * Gets the managed object definition associated with this property
   * definition.
   *
   * @return Returns the managed object definition associated with
   *         this property definition.
   */
  public final AbstractManagedObjectDefinition<?, ?>
      getManagedObjectDefinition() {
    return definition;
  }
  /**
   * {@inheritDoc}
   */
  public final String getName() {
    return propertyName;
  }
@@ -289,6 +352,31 @@
  /**
   * {@inheritDoc}
   */
  public final String getSynopsis() {
    return getSynopsis(Locale.getDefault());
  }
  /**
   * {@inheritDoc}
   */
  public final String getSynopsis(Locale locale) {
    ManagedObjectDefinitionI18NResource resource =
      ManagedObjectDefinitionI18NResource.getInstance();
    String property = "property." + propertyName + ".synopsis";
    try {
      return resource.getMessage(definition, property, locale);
    } catch (MissingResourceException e) {
      return null;
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
  public int hashCode() {
    // TODO: see comment in equals().
opends/src/server/org/opends/server/admin/AliasDefaultBehaviorProvider.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.admin;
import java.util.Locale;
/**
@@ -42,11 +44,30 @@
public final class AliasDefaultBehaviorProvider<T> implements
    DefaultBehaviorProvider<T> {
  // The managed object definition associated with this default
  // behavior.
  private final AbstractManagedObjectDefinition<?, ?> definition;
  // The name of the property definition associated with this default
  // behavior.
  private final String propertyName;
  /**
   * Create an alias default behavior provider.
   *
   * @param d
   *          The managed object definition associated with this
   *          default behavior.
   * @param propertyName
   *          The name of the property definition associated with this
   *          default behavior.
   */
  public AliasDefaultBehaviorProvider() {
    // No implementation required.
  public AliasDefaultBehaviorProvider(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    this.definition = d;
    this.propertyName = propertyName;
  }
@@ -58,4 +79,36 @@
    return v.visitAlias(this, p);
  }
  /**
   * Gets the synopsis of this alias default behavior in the
   * default locale.
   *
   * @return Returns the synopsis of this alias default behavior in
   *         the default locale.
   */
  public final String getSynopsis() {
    return getSynopsis(Locale.getDefault());
  }
  /**
   * Gets the synopsis of this alias default behavior in the specified
   * locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the synopsis of this alias default behavior in
   *         the specified locale.
   */
  public final String getSynopsis(Locale locale) {
    ManagedObjectDefinitionI18NResource resource =
      ManagedObjectDefinitionI18NResource.getInstance();
    String property = "property." + propertyName
        + ".default-behavior.alias.synopsis";
    return resource.getMessage(definition, property, locale);
  }
}
opends/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java
@@ -52,8 +52,9 @@
      AbstractBuilder<AttributeType, AttributeTypePropertyDefinition> {
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(AbstractManagedObjectDefinition<?, ?> d,
        String propertyName) {
      super(d, propertyName);
    }
@@ -63,9 +64,10 @@
     */
    @Override
    protected AttributeTypePropertyDefinition buildInstance(
        String propertyName, EnumSet<PropertyOption> options,
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<AttributeType> defaultBehavior) {
      return new AttributeTypePropertyDefinition(propertyName,
      return new AttributeTypePropertyDefinition(d, propertyName,
          options, defaultBehavior);
    }
  }
@@ -84,13 +86,17 @@
  /**
   * Create a attribute type property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new attribute type property definition
   *         builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
@@ -125,10 +131,11 @@
  // Private constructor.
  private AttributeTypePropertyDefinition(String propertyName,
  private AttributeTypePropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<AttributeType> defaultBehavior) {
    super(AttributeType.class, propertyName, options,
    super(d, AttributeType.class, propertyName, options,
        defaultBehavior);
  }
opends/src/server/org/opends/server/admin/BooleanPropertyDefinition.java
@@ -81,8 +81,9 @@
      AbstractBuilder<Boolean, BooleanPropertyDefinition> {
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
    }
@@ -91,10 +92,11 @@
     * {@inheritDoc}
     */
    @Override
    protected BooleanPropertyDefinition buildInstance(String propertyName,
    protected BooleanPropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<Boolean> defaultBehavior) {
      return new BooleanPropertyDefinition(propertyName, options,
      return new BooleanPropertyDefinition(d, propertyName, options,
          defaultBehavior);
    }
@@ -105,21 +107,26 @@
  /**
   * Create a boolean property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new boolean property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
  // Private constructor.
  private BooleanPropertyDefinition(String propertyName,
  private BooleanPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<Boolean> defaultBehavior) {
    super(Boolean.class, propertyName, options, defaultBehavior);
    super(d, Boolean.class, propertyName, options, defaultBehavior);
  }
opends/src/server/org/opends/server/admin/ClassPropertyDefinition.java
@@ -68,8 +68,9 @@
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
      this.instanceOfInterfaces = new LinkedList<String>();
    }
@@ -119,9 +120,10 @@
     */
    @Override
    protected ClassPropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d,
        String propertyName, EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<String> defaultBehavior) {
      return new ClassPropertyDefinition(propertyName, options,
      return new ClassPropertyDefinition(d, propertyName, options,
          defaultBehavior, instanceOfInterfaces);
    }
@@ -146,12 +148,16 @@
  /**
   * Create a class property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new class property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
@@ -201,11 +207,12 @@
  // Private constructor.
  private ClassPropertyDefinition(String propertyName,
  private ClassPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<String> defaultBehavior,
      List<String> instanceOfInterfaces) {
    super(String.class, propertyName, options, defaultBehavior);
    super(d, String.class, propertyName, options, defaultBehavior);
    this.instanceOfInterfaces = Collections
        .unmodifiableList(new LinkedList<String>(instanceOfInterfaces));
opends/src/server/org/opends/server/admin/DNPropertyDefinition.java
@@ -69,8 +69,9 @@
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
    }
@@ -117,10 +118,11 @@
     * {@inheritDoc}
     */
    @Override
    protected DNPropertyDefinition buildInstance(String propertyName,
    protected DNPropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<DN> defaultBehavior) {
      return new DNPropertyDefinition(propertyName, options,
      return new DNPropertyDefinition(d, propertyName, options,
          defaultBehavior, baseDN);
    }
  }
@@ -130,21 +132,26 @@
  /**
   * Create a DN property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new boolean property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
  // Private constructor.
  private DNPropertyDefinition(String propertyName,
  private DNPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<DN> defaultBehavior, DN baseDN) {
    super(DN.class, propertyName, options, defaultBehavior);
    super(d, DN.class, propertyName, options, defaultBehavior);
    this.baseDN = baseDN;
  }
opends/src/server/org/opends/server/admin/DurationPropertyDefinition.java
@@ -124,8 +124,9 @@
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
    }
@@ -319,9 +320,10 @@
     */
    @Override
    protected DurationPropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d,
        String propertyName, EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<Long> defaultBehavior) {
      return new DurationPropertyDefinition(propertyName, options,
      return new DurationPropertyDefinition(d, propertyName, options,
          defaultBehavior, baseUnit, maximumUnit, lowerLimit,
          upperLimit, allowUnlimited);
    }
@@ -332,23 +334,28 @@
  /**
   * Create a duration property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new integer property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
  // Private constructor.
  private DurationPropertyDefinition(String propertyName,
  private DurationPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<Long> defaultBehavior,
      DurationUnit baseUnit, DurationUnit maximumUnit,
      Long lowerLimit, Long upperLimit, boolean allowUnlimited) {
    super(Long.class, propertyName, options, defaultBehavior);
    super(d, Long.class, propertyName, options, defaultBehavior);
    this.baseUnit = baseUnit;
    this.maximumUnit = maximumUnit;
    this.lowerLimit = lowerLimit;
opends/src/server/org/opends/server/admin/EnumPropertyDefinition.java
@@ -33,7 +33,9 @@
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
@@ -64,8 +66,9 @@
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
      this.enumClass = null;
    }
@@ -90,14 +93,15 @@
     */
    @Override
    protected EnumPropertyDefinition<E> buildInstance(
        String propertyName, EnumSet<PropertyOption> options,
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<E> defaultBehavior) {
      // Make sure that the enumeration class has been defined.
      if (enumClass == null) {
        throw new IllegalStateException("Enumeration class undefined");
      }
      return new EnumPropertyDefinition<E>(propertyName, options,
      return new EnumPropertyDefinition<E>(d, propertyName, options,
          defaultBehavior, enumClass);
    }
  }
@@ -115,13 +119,16 @@
   * @param <E>
   *          The enumeration that should be used for values of this
   *          property definition.
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new enumeration property definition builder.
   */
  public static <E extends Enum<E>> Builder<E> createBuilder(
      String propertyName) {
    return new Builder<E>(propertyName);
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder<E>(d, propertyName);
  }
  // The enumeration class.
@@ -133,10 +140,11 @@
  // Private constructor.
  private EnumPropertyDefinition(String propertyName,
  private EnumPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<E> defaultBehavior, Class<E> enumClass) {
    super(enumClass, propertyName, options, defaultBehavior);
    super(d, enumClass, propertyName, options, defaultBehavior);
    this.enumClass = enumClass;
    // Initialize the decoding map.
@@ -191,6 +199,50 @@
  /**
   * Gets the synopsis of the specified enumeration value of this
   * enumeration property definition in the default locale.
   *
   * @param value
   *          The enumeration value.
   * @return Returns the synopsis of the specified enumeration value
   *         of this enumeration property definition in the default
   *         locale.
   */
  public final String getValueSynopsis(E value) {
    return getValueSynopsis(Locale.getDefault(), value);
  }
  /**
   * Gets the synopsis of the specified enumeration value of this
   * enumeration property definition in the specified locale.
   *
   * @param value
   *          The enumeration value.
   * @param locale
   *          The locale.
   * @return Returns the synopsis of the specified enumeration value
   *         of this enumeration property definition in the specified
   *         locale.
   */
  public final String getValueSynopsis(Locale locale, E value) {
    ManagedObjectDefinitionI18NResource resource =
      ManagedObjectDefinitionI18NResource.getInstance();
    String property = "property." + getName()
        + ".syntax.enumeration.value." + value.toString()
        + ".synopsis";
    try {
      return resource.getMessage(getManagedObjectDefinition(),
          property, locale);
    } catch (MissingResourceException e) {
      return null;
    }
  }
  /**
   * {@inheritDoc}
   */
  @Override
opends/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
@@ -59,8 +59,9 @@
      AbstractBuilder<AddressMask, IPAddressMaskPropertyDefinition> {
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
    }
@@ -70,9 +71,10 @@
     */
    @Override
    protected IPAddressMaskPropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d,
        String propertyName, EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<AddressMask> defaultBehavior) {
      return new IPAddressMaskPropertyDefinition(propertyName, options,
      return new IPAddressMaskPropertyDefinition(d, propertyName, options,
          defaultBehavior);
    }
@@ -83,21 +85,26 @@
  /**
   * Create a IP address mask property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new IP address mask property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
  // Private constructor.
  private IPAddressMaskPropertyDefinition(String propertyName,
  private IPAddressMaskPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<AddressMask> defaultBehavior) {
    super(AddressMask.class, propertyName, options, defaultBehavior);
    super(d, AddressMask.class, propertyName, options, defaultBehavior);
  }
opends/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java
@@ -58,8 +58,9 @@
      AbstractBuilder<InetAddress, IPAddressPropertyDefinition> {
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
    }
@@ -68,10 +69,11 @@
     * {@inheritDoc}
     */
    @Override
    protected IPAddressPropertyDefinition buildInstance(String propertyName,
    protected IPAddressPropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<InetAddress> defaultBehavior) {
      return new IPAddressPropertyDefinition(propertyName, options,
      return new IPAddressPropertyDefinition(d, propertyName, options,
          defaultBehavior);
    }
@@ -82,21 +84,26 @@
  /**
   * Create a IP address property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new IP address property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
  // Private constructor.
  private IPAddressPropertyDefinition(String propertyName,
  private IPAddressPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<InetAddress> defaultBehavior) {
    super(InetAddress.class, propertyName, options, defaultBehavior);
    super(d, InetAddress.class, propertyName, options, defaultBehavior);
  }
opends/src/server/org/opends/server/admin/InstantiableRelationDefinition.java
@@ -27,6 +27,8 @@
package org.opends.server.admin;
import java.util.Locale;
/**
@@ -82,6 +84,37 @@
  /**
   * Gets the user friendly plural name of this relation definition in
   * the default locale.
   *
   * @return Returns the user friendly plural name of this relation
   *         definition in the default locale.
   */
  public final String getUserFriendlyPluralName() {
    return getUserFriendlyPluralName(Locale.getDefault());
  }
  /**
   * Gets the user friendly plural name of this relation definition in
   * the specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the user friendly plural name of this relation
   *         definition in the specified locale.
   */
  public final String getUserFriendlyPluralName(Locale locale) {
    String property = "relation." + getName()
        + ".user-friendly-plural-name";
    return ManagedObjectDefinitionI18NResource.getInstance()
        .getMessage(getParentDefinition(), property, locale);
  }
  /**
   * {@inheritDoc}
   */
  @Override
opends/src/server/org/opends/server/admin/IntegerPropertyDefinition.java
@@ -32,6 +32,8 @@
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import java.util.Locale;
import java.util.MissingResourceException;
@@ -84,8 +86,9 @@
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
    }
@@ -153,10 +156,11 @@
     * {@inheritDoc}
     */
    @Override
    protected IntegerPropertyDefinition buildInstance(String propertyName,
    protected IntegerPropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<Integer> defaultBehavior) {
      return new IntegerPropertyDefinition(propertyName, options,
      return new IntegerPropertyDefinition(d, propertyName, options,
          defaultBehavior, lowerLimit, upperLimit, allowUnlimited);
    }
@@ -167,22 +171,27 @@
  /**
   * Create an integer property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new integer property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
  // Private constructor.
  private IntegerPropertyDefinition(String propertyName,
  private IntegerPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<Integer> defaultBehavior, int lowerLimit,
      Integer upperLimit, boolean allowUnlimited) {
    super(Integer.class, propertyName, options, defaultBehavior);
    super(d, Integer.class, propertyName, options, defaultBehavior);
    this.lowerLimit = lowerLimit;
    this.upperLimit = upperLimit;
    this.allowUnlimited = allowUnlimited;
@@ -214,6 +223,44 @@
  /**
   * Gets the optional unit synopsis of this integer property
   * definition in the default locale.
   *
   * @return Returns the unit synopsis of this integer property
   *         definition in the default locale, or <code>null</code>
   *         if there is no unit synopsis.
   */
  public String getUnitSynopsis() {
    return getUnitSynopsis(Locale.getDefault());
  }
  /**
   * Gets the optional unit synopsis of this integer property
   * definition in the specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the unit synopsis of this integer property
   *         definition in the specified locale, or <code>null</code>
   *         if there is no unit synopsis.
   */
  public String getUnitSynopsis(Locale locale) {
    ManagedObjectDefinitionI18NResource resource =
      ManagedObjectDefinitionI18NResource.getInstance();
    String property = "property." + getName() + ".syntax.integer.unit-synopsis";
    try {
      return resource.getMessage(getManagedObjectDefinition(),
          property, locale);
    } catch (MissingResourceException e) {
      return null;
    }
  }
  /**
   * Determine whether this property allows unlimited values.
   *
   * @return Returns <code>true</code> if this this property allows unlimited
opends/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResource.java
@@ -44,47 +44,71 @@
 */
public final class ManagedObjectDefinitionI18NResource {
  // Mapping from definition to resource bundle.
  private final Map<AbstractManagedObjectDefinition, ResourceBundle> resources;
  // The resource name prefix.
  private final String prefix;
  // Application-wide set of instances.
  private static final Map<String, ManagedObjectDefinitionI18NResource>
    INSTANCES = new HashMap<String, ManagedObjectDefinitionI18NResource>();
  /**
   * Creates a new internationalized resource instance which can be
   * used to retrieve the localized descriptions for the managed
   * objects and their associated properties and relations.
   * Gets the internationalized resource instance which can be used to
   * retrieve the localized descriptions for the managed objects and
   * their associated properties and relations.
   *
   * @return Returns the I18N resource instance.
   */
  public static ManagedObjectDefinitionI18NResource create() {
    return new ManagedObjectDefinitionI18NResource("admin.messages");
  public static ManagedObjectDefinitionI18NResource getInstance() {
    return getInstance("admin.messages");
  }
  /**
   * Creates a new internationalized resource instance for the named
   * Gets the internationalized resource instance for the named
   * profile.
   *
   * @param profile
   *          The name of the profile.
   * @return Returns the I18N resource instance for the named profile.
   */
  public static ManagedObjectDefinitionI18NResource createForProfile(
  public static ManagedObjectDefinitionI18NResource getInstanceForProfile(
      String profile) {
    return new ManagedObjectDefinitionI18NResource("admin.profiles."
        + profile);
    return getInstance("admin.profiles." + profile);
  }
  // Get a resource instance creating it if necessary.
  private synchronized static ManagedObjectDefinitionI18NResource getInstance(
      String prefix) {
    ManagedObjectDefinitionI18NResource instance = INSTANCES
        .get(prefix);
    if (instance == null) {
      instance = new ManagedObjectDefinitionI18NResource(prefix);
      INSTANCES.put(prefix, instance);
    }
    return instance;
  }
  // Mapping from definition to locale-based resource bundle.
  private final Map<AbstractManagedObjectDefinition,
    Map<Locale, ResourceBundle>> resources;
  // The resource name prefix.
  private final String prefix;
  // Private constructor.
  private ManagedObjectDefinitionI18NResource(String prefix) {
    this.resources =
      new HashMap<AbstractManagedObjectDefinition, ResourceBundle>();
    this.resources = new HashMap<AbstractManagedObjectDefinition,
      Map<Locale, ResourceBundle>>();
    this.prefix = prefix;
  }
@@ -111,29 +135,6 @@
  /**
   * Get the parameterized internationalized message associated with
   * the specified key in the default locale.
   *
   * @param d
   *          The managed object definition.
   * @param key
   *          The resource key.
   * @param args
   *          Arguments that should be inserted into the retrieved
   *          message.
   * @return Returns the internationalized message associated with the
   *         specified key in the default locale.
   * @throws MissingResourceException
   *           If the key was not found.
   */
  public String getMessage(AbstractManagedObjectDefinition d,
      String key, String... args) throws MissingResourceException {
    return getMessage(d, key, Locale.getDefault(), args);
  }
  /**
   * Get the internationalized message associated with the specified
   * key and locale.
   *
@@ -188,24 +189,52 @@
  /**
   * Get the parameterized internationalized message associated with
   * the specified key in the default locale.
   *
   * @param d
   *          The managed object definition.
   * @param key
   *          The resource key.
   * @param args
   *          Arguments that should be inserted into the retrieved
   *          message.
   * @return Returns the internationalized message associated with the
   *         specified key in the default locale.
   * @throws MissingResourceException
   *           If the key was not found.
   */
  public String getMessage(AbstractManagedObjectDefinition d,
      String key, String... args) throws MissingResourceException {
    return getMessage(d, key, Locale.getDefault(), args);
  }
  // Retrieve the resource bundle associated with a managed object and
  // locale,
  // lazily loading it if necessary.
  // locale, lazily loading it if necessary.
  private synchronized ResourceBundle getResourceBundle(
      AbstractManagedObjectDefinition d, Locale locale)
      throws MissingResourceException {
    ResourceBundle r = resources.get(d);
    if (r == null) {
      // Load the resource file.
      String baseName = prefix + "." + d.getClass().getName();
      r = ResourceBundle.getBundle(baseName, locale,
          ClassLoaderProvider.getInstance().getClassLoader());
      // Cache the resource.
      resources.put(d, r);
    // First get the locale-resource mapping, creating it if
    // necessary.
    Map<Locale, ResourceBundle> map = resources.get(d);
    if (map == null) {
      map = new HashMap<Locale, ResourceBundle>();
      resources.put(d, map);
    }
    return r;
    // Now get the resource based on the locale, loading it if
    // necessary.
    ResourceBundle resourceBundle = map.get(locale);
    if (resourceBundle == null) {
      String baseName = prefix + "." + d.getClass().getName();
      resourceBundle = ResourceBundle.getBundle(baseName, locale,
          ClassLoaderProvider.getInstance().getClassLoader());
      map.put(locale, resourceBundle);
    }
    return resourceBundle;
  }
}
opends/src/server/org/opends/server/admin/PropertyDefinition.java
@@ -31,6 +31,7 @@
import java.io.Serializable;
import java.util.Comparator;
import java.util.Locale;
@@ -178,6 +179,32 @@
  /**
   * Gets the optional description of this property definition in the
   * default locale.
   *
   * @return Returns the description of this property definition in
   *         the default locale, or <code>null</code> if there is no
   *         description.
   */
  String getDescription();
  /**
   * Gets the optional description of this property definition in the
   * specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the description of this property definition in
   *         the specified locale, or <code>null</code> if there is
   *         no description.
   */
  String getDescription(Locale locale);
  /**
   * Get the name of the property.
   *
   * @return Returns the name of the property.
@@ -187,6 +214,30 @@
  /**
   * Gets the synopsis of this property definition in the default
   * locale.
   *
   * @return Returns the synopsis of this property definition in the
   *         default locale.
   */
  String getSynopsis();
  /**
   * Gets the synopsis of this property definition in the specified
   * locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the synopsis of this property definition in the
   *         specified locale.
   */
  String getSynopsis(Locale locale);
  /**
   * Returns a hash code value for this property definition. The hash code
   * should be derived from the property name.
   *
opends/src/server/org/opends/server/admin/RelationDefinition.java
@@ -29,6 +29,11 @@
import java.util.Locale;
import java.util.MissingResourceException;
/**
 * Relation definitions define relationships between types of managed
 * objects. In addition they define the ownership model:
@@ -86,8 +91,8 @@
  /**
   * Create a new managed object relation definition with the specified name and
   * referenced managed object definition.
   * Create a new managed object relation definition with the
   * specified name and referenced managed object definition.
   *
   * @param pd
   *          The parent managed object definition.
@@ -96,8 +101,9 @@
   * @param cd
   *          The child managed object definition.
   */
  protected RelationDefinition(AbstractManagedObjectDefinition<?, ?> pd,
      String name, AbstractManagedObjectDefinition<C, S> cd) {
  protected RelationDefinition(
      AbstractManagedObjectDefinition<?, ?> pd, String name,
      AbstractManagedObjectDefinition<C, S> cd) {
    this.name = name;
    this.pd = pd;
    this.cd = cd;
@@ -106,6 +112,71 @@
  /**
   * Apply a visitor to this relation definition.
   *
   * @param <R>
   *          The return type of the visitor's methods.
   * @param <P>
   *          The type of the additional parameters to the visitor's
   *          methods.
   * @param v
   *          The relation definition visitor.
   * @param p
   *          Optional additional visitor parameter.
   * @return Returns a result as specified by the visitor.
   */
  public abstract <R, P> R accept(RelationDefinitionVisitor<R, P> v, P p);
  /**
   * Get the definition of the child managed object.
   *
   * @return Returns the definition of the child managed object.
   */
  public final AbstractManagedObjectDefinition<C, S> getChildDefinition() {
    return cd;
  }
  /**
   * Gets the optional description of this relation definition in the
   * default locale.
   *
   * @return Returns the description of this relation definition in
   *         the default locale, or <code>null</code> if there is no
   *         description.
   */
  public final String getDescription() {
    return getDescription(Locale.getDefault());
  }
  /**
   * Gets the optional description of this relation definition in the
   * specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the description of this relation definition in
   *         the specified locale, or <code>null</code> if there is
   *         no description.
   */
  public final String getDescription(Locale locale) {
    try {
      String property = "relation." + name + ".description";
      return ManagedObjectDefinitionI18NResource.getInstance()
          .getMessage(getParentDefinition(), property, locale);
    } catch (MissingResourceException e) {
      return null;
    }
  }
  /**
   * Get the name of the relation.
   *
   * @return Returns the name of the relation.
@@ -128,12 +199,61 @@
  /**
   * Get the definition of the child managed object.
   * Gets the synopsis of this relation definition in the default
   * locale.
   *
   * @return Returns the definition of the child managed object.
   * @return Returns the synopsis of this relation definition in the
   *         default locale.
   */
  public final AbstractManagedObjectDefinition<C, S> getChildDefinition() {
    return cd;
  public final String getSynopsis() {
    return getSynopsis(Locale.getDefault());
  }
  /**
   * Gets the synopsis of this relation definition in the specified
   * locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the synopsis of this relation definition in the
   *         specified locale.
   */
  public final String getSynopsis(Locale locale) {
    String property = "relation." + name + ".synopsis";
    return ManagedObjectDefinitionI18NResource.getInstance()
        .getMessage(getParentDefinition(), property, locale);
  }
  /**
   * Gets the user friendly name of this relation definition in the
   * default locale.
   *
   * @return Returns the user friendly name of this relation
   *         definition in the default locale.
   */
  public final String getUserFriendlyName() {
    return getUserFriendlyName(Locale.getDefault());
  }
  /**
   * Gets the user friendly name of this relation definition in the
   * specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the user friendly name of this relation
   *         definition in the specified locale.
   */
  public final String getUserFriendlyName(Locale locale) {
    String property = "relation." + name + ".user-friendly-name";
    return ManagedObjectDefinitionI18NResource.getInstance()
        .getMessage(getParentDefinition(), property, locale);
  }
@@ -151,31 +271,12 @@
  /**
   * Append a string representation of the managed object relation to the
   * provided string builder.
   * Append a string representation of the managed object relation to
   * the provided string builder.
   *
   * @param builder
   *          The string builder where the string representation should be
   *          appended.
   *          The string builder where the string representation
   *          should be appended.
   */
  public abstract void toString(StringBuilder builder);
  /**
   * Apply a visitor to this relation definition.
   *
   * @param <R>
   *          The return type of the visitor's methods.
   * @param <P>
   *          The type of the additional parameters to the visitor's
   *          methods.
   * @param v
   *          The relation definition visitor.
   * @param p
   *          Optional additional visitor parameter.
   * @return Returns a result as specified by the visitor.
   */
  public abstract <R, P> R accept(RelationDefinitionVisitor<R, P> v,
      P p);
}
opends/src/server/org/opends/server/admin/SizePropertyDefinition.java
@@ -88,8 +88,9 @@
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
    }
@@ -198,10 +199,11 @@
     * {@inheritDoc}
     */
    @Override
    protected SizePropertyDefinition buildInstance(String propertyName,
    protected SizePropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<Long> defaultBehavior) {
      return new SizePropertyDefinition(propertyName, options,
      return new SizePropertyDefinition(d, propertyName, options,
          defaultBehavior, lowerLimit, upperLimit, allowUnlimited);
    }
@@ -212,22 +214,27 @@
  /**
   * Create an memory size property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new integer property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
  // Private constructor.
  private SizePropertyDefinition(String propertyName,
  private SizePropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<Long> defaultBehavior, Long lowerLimit,
      Long upperLimit, boolean allowUnlimited) {
    super(Long.class, propertyName, options, defaultBehavior);
    super(d, Long.class, propertyName, options, defaultBehavior);
    this.lowerLimit = lowerLimit;
    this.upperLimit = upperLimit;
    this.allowUnlimited = allowUnlimited;
opends/src/server/org/opends/server/admin/StringPropertyDefinition.java
@@ -32,6 +32,8 @@
import static org.opends.server.util.Validator.ensureNotNull;
import java.util.EnumSet;
import java.util.Locale;
import java.util.MissingResourceException;
@@ -67,8 +69,9 @@
    // Private constructor
    private Builder(String propertyName) {
      super(propertyName);
    private Builder(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
      super(d, propertyName);
    }
@@ -91,10 +94,11 @@
     * {@inheritDoc}
     */
    @Override
    protected StringPropertyDefinition buildInstance(String propertyName,
    protected StringPropertyDefinition buildInstance(
        AbstractManagedObjectDefinition<?, ?> d, String propertyName,
        EnumSet<PropertyOption> options,
        DefaultBehaviorProvider<String> defaultBehavior) {
      return new StringPropertyDefinition(propertyName, options,
      return new StringPropertyDefinition(d, propertyName, options,
          defaultBehavior, isCaseInsensitive);
    }
@@ -105,28 +109,76 @@
  /**
   * Create a string property definition builder.
   *
   * @param d
   *          The managed object definition associated with this
   *          property definition.
   * @param propertyName
   *          The property name.
   * @return Returns the new string property definition builder.
   */
  public static Builder createBuilder(String propertyName) {
    return new Builder(propertyName);
  public static Builder createBuilder(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName) {
    return new Builder(d, propertyName);
  }
  // Private constructor.
  private StringPropertyDefinition(String propertyName,
  private StringPropertyDefinition(
      AbstractManagedObjectDefinition<?, ?> d, String propertyName,
      EnumSet<PropertyOption> options,
      DefaultBehaviorProvider<String> defaultBehavior,
      boolean isCaseInsensitive) {
    super(String.class, propertyName, options, defaultBehavior);
    super(d, String.class, propertyName, options, defaultBehavior);
    this.isCaseInsensitive = isCaseInsensitive;
  }
  /**
   * Gets the pattern synopsis of this string property definition in
   * the default locale.
   *
   * @return Returns the pattern synopsis of this string property
   *         definition in the default locale, or <code>null</code>
   *         if there is no pattern synopsis (which is the case when
   *         there is no pattern matching defined for this string
   *         property definition).
   */
  public String getPatternSynopsis() {
    return getPatternSynopsis(Locale.getDefault());
  }
  /**
   * Gets the optional pattern synopsis of this string property
   * definition in the specified locale.
   *
   * @param locale
   *          The locale.
   * @return Returns the pattern synopsis of this string property
   *         definition in the specified locale, or <code>null</code>
   *         if there is no pattern synopsis (which is the case when
   *         there is no pattern matching defined for this string
   *         property definition).
   */
  public String getPatternSynopsis(Locale locale) {
    ManagedObjectDefinitionI18NResource resource =
      ManagedObjectDefinitionI18NResource.getInstance();
    String property = "property." + getName()
        + ".syntax.string.pattern.synopsis";
    try {
      return resource.getMessage(getManagedObjectDefinition(),
          property, locale);
    } catch (MissingResourceException e) {
      return null;
    }
  }
  /**
   * Query whether values of this property are case-insensitive.
   *
   * @return Returns <code>true</code> if values are case-insensitive, or
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java
@@ -32,6 +32,8 @@
import static org.testng.Assert.assertEquals;
import org.opends.server.TestCaseUtils;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.backends.jeb.RootContainer;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
import org.testng.annotations.BeforeClass;
@@ -146,7 +148,7 @@
  // Create a new definition.
  private AttributeTypePropertyDefinition createPropertyDefinition() {
    AttributeTypePropertyDefinition.Builder builder = AttributeTypePropertyDefinition
        .createBuilder("test-property");
        .createBuilder(RootCfgDefn.getInstance(), "test-property");
    return builder.getInstance();
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java
@@ -28,6 +28,8 @@
package org.opends.server.admin;
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.*;
import java.util.EnumSet;
@@ -44,7 +46,8 @@
   */
  @BeforeClass
  public void setUp() {
    builder = BooleanPropertyDefinition.createBuilder("test-property");
    builder = BooleanPropertyDefinition.createBuilder(
        RootCfgDefn.getInstance(), "test-property");
  }
  /**
@@ -119,7 +122,7 @@
  }
  private BooleanPropertyDefinition createPropertyDefinition() {
    return builder.buildInstance("test-property",
    return builder.buildInstance(RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<Boolean>());
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ClassPropertyDefinitionTest.java
@@ -28,6 +28,8 @@
package org.opends.server.admin;
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.*;
import java.util.EnumSet;
@@ -74,9 +76,11 @@
  @Test(dataProvider = "testBuilderAddInstanceOf")
  public void testBuilderAddInstanceOf(String className) {
    ClassPropertyDefinition.Builder localBuilder =
            ClassPropertyDefinition.createBuilder("test-property");
            ClassPropertyDefinition.createBuilder(RootCfgDefn.getInstance(),
                "test-property");
    localBuilder.addInstanceOf(className);
    ClassPropertyDefinition cpd = localBuilder.buildInstance("test-property",
    ClassPropertyDefinition cpd = localBuilder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<String>());
    List<String> instances = cpd.getInstanceOfInterface();
@@ -104,9 +108,11 @@
          expectedExceptions = {IllegalArgumentException.class})
  public void testBuilderAddInstanceOf2(String className) {
    ClassPropertyDefinition.Builder localBuilder =
            ClassPropertyDefinition.createBuilder("test-property");
            ClassPropertyDefinition.createBuilder(
                RootCfgDefn.getInstance(), "test-property");
    localBuilder.addInstanceOf(className);
    ClassPropertyDefinition cpd = localBuilder.buildInstance("test-property",
    ClassPropertyDefinition cpd = localBuilder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<String>());
    List<String> instances = cpd.getInstanceOfInterface();
@@ -138,9 +144,11 @@
  public <T> void testLoadClass(String interfaceName, String loadClassName,
                            Class<T> instanceOfClass, Class expectedClass) {
    ClassPropertyDefinition.Builder localBuilder =
            ClassPropertyDefinition.createBuilder("test-property");
            ClassPropertyDefinition.createBuilder(
                RootCfgDefn.getInstance(), "test-property");
    localBuilder.addInstanceOf(interfaceName);
    ClassPropertyDefinition cpd = localBuilder.buildInstance("test-property",
    ClassPropertyDefinition cpd = localBuilder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<String>());
    Class clazz = cpd.loadClass(loadClassName, instanceOfClass);
@@ -173,9 +181,11 @@
  public <T> void testLoadClass2(String interfaceName, String loadClassName,
                            Class<T> instanceOfClass, Class expectedClass) {
    ClassPropertyDefinition.Builder localBuilder =
            ClassPropertyDefinition.createBuilder("test-property");
            ClassPropertyDefinition.createBuilder(
                RootCfgDefn.getInstance(), "test-property");
    localBuilder.addInstanceOf(interfaceName);
    ClassPropertyDefinition cpd = localBuilder.buildInstance("test-property",
    ClassPropertyDefinition cpd = localBuilder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<String>());
    Class clazz = cpd.loadClass(loadClassName, instanceOfClass);
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DNPropertyDefinitionTest.java
@@ -32,6 +32,7 @@
import static org.testng.Assert.assertEquals;
import org.opends.server.TestCaseUtils;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.testng.annotations.BeforeClass;
@@ -83,7 +84,7 @@
  public void testBuilderSetBaseDN(String baseDN)
      throws DirectoryException {
    DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition
        .createBuilder("test-property");
        .createBuilder(RootCfgDefn.getInstance(), "test-property");
    localBuilder.setBaseDN(baseDN);
    DNPropertyDefinition pd = localBuilder.getInstance();
@@ -151,7 +152,7 @@
  public void testValidateLegalValues(String baseDN, String value)
      throws DirectoryException {
    DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition
        .createBuilder("test-property");
        .createBuilder(RootCfgDefn.getInstance(), "test-property");
    localBuilder.setBaseDN(baseDN);
    DNPropertyDefinition pd = localBuilder.getInstance();
    pd.validateValue(DN.decode(value));
@@ -173,7 +174,7 @@
  public void testValidateIllegalValues(String baseDN, String value)
      throws DirectoryException {
    DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition
        .createBuilder("test-property");
        .createBuilder(RootCfgDefn.getInstance(), "test-property");
    localBuilder.setBaseDN(baseDN);
    DNPropertyDefinition pd = localBuilder.getInstance();
    pd.validateValue(DN.decode(value));
@@ -192,7 +193,7 @@
  @Test(dataProvider = "testLegalValues")
  public void testDecodeLegalValues(String baseDN, String value) {
    DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition
        .createBuilder("test-property");
        .createBuilder(RootCfgDefn.getInstance(), "test-property");
    localBuilder.setBaseDN(baseDN);
    DNPropertyDefinition pd = localBuilder.getInstance();
    pd.decodeValue(value);
@@ -211,7 +212,7 @@
  @Test(dataProvider = "testIllegalValues", expectedExceptions = IllegalPropertyValueStringException.class)
  public void testDecodeIllegalValues(String baseDN, String value) {
    DNPropertyDefinition.Builder localBuilder = DNPropertyDefinition
        .createBuilder("test-property");
        .createBuilder(RootCfgDefn.getInstance(), "test-property");
    localBuilder.setBaseDN(baseDN);
    DNPropertyDefinition pd = localBuilder.getInstance();
    pd.decodeValue(value);
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/DurationPropertyDefinitionTest.java
@@ -28,6 +28,8 @@
package org.opends.server.admin;
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.*;
import java.util.EnumSet;
@@ -438,11 +440,12 @@
  }
  private DurationPropertyDefinition.Builder createTestBuilder() {
    return DurationPropertyDefinition.createBuilder("test-property-name");
    return DurationPropertyDefinition.createBuilder(
        RootCfgDefn.getInstance(), "test-property-name");
  }
  private DurationPropertyDefinition buildTestDefinition(DurationPropertyDefinition.Builder builder) {
    return builder.buildInstance("test-prop",
    return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop",
            EnumSet.noneOf(PropertyOption.class),
            new DefinedDefaultBehaviorProvider<Long>("0"));
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java
@@ -28,6 +28,8 @@
package org.opends.server.admin;
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.*;
import java.util.EnumSet;
@@ -43,7 +45,8 @@
  @BeforeClass
  public void setUp() {
    builder = EnumPropertyDefinition.createBuilder("test-property");
    builder = EnumPropertyDefinition.createBuilder(
        RootCfgDefn.getInstance(), "test-property");
    builder.setEnumClass(TestEnum.class);
  }
@@ -58,7 +61,8 @@
   */
  @Test
  public void testBuildInstance() {
    EnumPropertyDefinition epd = builder.buildInstance("test-property",
    EnumPropertyDefinition epd = builder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<TestEnum>());
    assertEquals(epd.getEnumClass(), TestEnum.class);
@@ -71,8 +75,9 @@
  @Test(expectedExceptions = {IllegalStateException.class})
  public void testBuildInstance2() {
    EnumPropertyDefinition.Builder<TestEnum> localBuilder =
            EnumPropertyDefinition.createBuilder("test-property");
    localBuilder.buildInstance("test-property",
            EnumPropertyDefinition.createBuilder(
                RootCfgDefn.getInstance(), "test-property");
    localBuilder.buildInstance(RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<TestEnum>());
  }
@@ -95,7 +100,8 @@
   */
  @Test(dataProvider = "decodeValueData")
  public void testDecodeValue(String value, TestEnum expectedValue) {
    EnumPropertyDefinition epd = builder.buildInstance("test-property",
    EnumPropertyDefinition epd = builder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<TestEnum>());
    assertEquals(epd.decodeValue(value), expectedValue);
@@ -121,7 +127,8 @@
          expectedExceptions = {AssertionError.class,
                  IllegalPropertyValueStringException.class} )
  public void testDecodeValue2(String value) {
    EnumPropertyDefinition epd = builder.buildInstance("test-property",
    EnumPropertyDefinition epd = builder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<TestEnum>());
    epd.decodeValue(value);
@@ -132,7 +139,8 @@
   */
  @Test
  public void testNormalizeValue() {
    EnumPropertyDefinition<TestEnum> epd = builder.buildInstance("test-property",
    EnumPropertyDefinition<TestEnum> epd = builder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<TestEnum>());
    assertEquals(epd.normalizeValue(TestEnum.ONE), "one");
@@ -143,7 +151,8 @@
   */
  @Test
  public void testValidateValue() {
    EnumPropertyDefinition<TestEnum> epd = builder.buildInstance("test-property",
    EnumPropertyDefinition<TestEnum> epd = builder.buildInstance(
        RootCfgDefn.getInstance(), "test-property",
            EnumSet.noneOf(PropertyOption.class),
            new UndefinedDefaultBehaviorProvider<TestEnum>());
    epd.validateValue(TestEnum.ONE);
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/IntegerPropertyDefinitionTest.java
@@ -29,6 +29,7 @@
import static org.testng.Assert.*;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.*;
import java.util.EnumSet;
@@ -324,11 +325,11 @@
  }
  private IntegerPropertyDefinition.Builder createTestBuilder() {
    return IntegerPropertyDefinition.createBuilder("test-property-name");
    return IntegerPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-property-name");
  }
  private IntegerPropertyDefinition buildTestDefinition(IntegerPropertyDefinition.Builder builder) {
    return builder.buildInstance("test-prop",
    return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop",
            EnumSet.noneOf(PropertyOption.class),
            new DefinedDefaultBehaviorProvider<Integer>("0"));
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/ManagedObjectDefinitionI18NResourceTest.java
@@ -44,7 +44,7 @@
   */
  @BeforeClass
  public void setUp() {
    modr = ManagedObjectDefinitionI18NResource.createForProfile("ldap");
    modr = ManagedObjectDefinitionI18NResource.getInstanceForProfile("ldap");
  }
  /**
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/SizePropertyDefinitionTest.java
@@ -29,6 +29,8 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -337,11 +339,11 @@
  }
  private SizePropertyDefinition.Builder createTestBuilder() {
    return SizePropertyDefinition.createBuilder("test-property-name");
    return SizePropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-property-name");
  }
  private SizePropertyDefinition buildTestDefinition(SizePropertyDefinition.Builder builder) {
    return builder.buildInstance("test-prop",
    return builder.buildInstance(RootCfgDefn.getInstance(), "test-prop",
            EnumSet.noneOf(PropertyOption.class),
            new DefinedDefaultBehaviorProvider<Long>("0"));
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/admin/client/PropertySetTest.java
@@ -32,6 +32,7 @@
import org.opends.server.admin.*;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.admin.std.meta.RootCfgDefn;
import java.util.*;
@@ -68,21 +69,21 @@
  @BeforeClass
  public void setUp() {
    BooleanPropertyDefinition.Builder builder =
            BooleanPropertyDefinition.createBuilder("test-bool-prop");
            BooleanPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-bool-prop");
    DefinedDefaultBehaviorProvider<Boolean> dbp =
            new DefinedDefaultBehaviorProvider<Boolean>(BOOL_DEFAULT.toString());
    builder.setDefaultBehaviorProvider(dbp);
    testBoolPropertyDefinition = builder.getInstance();
    StringPropertyDefinition.Builder builder2 =
            StringPropertyDefinition.createBuilder("test-sv-str-prop");
            StringPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-sv-str-prop");
    DefinedDefaultBehaviorProvider<String> dbp2 =
            new DefinedDefaultBehaviorProvider<String>(STR_DEFAULT);
    builder2.setDefaultBehaviorProvider(dbp2);
    testSvStringPropertyDefinition = builder2.getInstance();
    StringPropertyDefinition.Builder builder3 =
            StringPropertyDefinition.createBuilder("test-mv-str-prop");
            StringPropertyDefinition.createBuilder(RootCfgDefn.getInstance(), "test-mv-str-prop");
    DefinedDefaultBehaviorProvider<String> dbp3 =
            new DefinedDefaultBehaviorProvider<String>(STR_DEFAULT);
    builder3.setDefaultBehaviorProvider(dbp3);