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

Nicolas Capponi
02.23.2013 b54a338f5933502809578214db03147c02e48b11
OpenDJ 3 : config framework

Reducing compilation errors in org.opends.server.admin packages

* Simple changes in org.opends.server.admin.server package
and org.opends.server.api package
** use i18n classes
** use Validator class from SDK
** remove API annotation

* Add stub classes DirectoryEnvironmentConfig and Embeddedutils

* Migrate generation of DynamicConstant class from ant to maven
** add new directory src/main/java-templates to hold source template
** add maven plugins to generate revision number, timestamp and
parse version number
3 files added
30 files modified
3865 ■■■■ changed files
opendj-admin/pom.xml 123 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java-templates/org/opends/server/util/DynamicConstants.java 183 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/AbsoluteInheritedDefaultBehaviorProvider.java 158 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java 98 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/Constraint.java 134 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/DecodingException.java 29 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java 2815 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/doc/package-info.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/AbstractConfigListenerAdaptor.java 10 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigAddListenerAdaptor.java 8 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java 18 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigDeleteListenerAdaptor.java 12 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigExceptionFactory.java 10 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationAddListener.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationChangeListener.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationDeleteListener.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ConstraintViolationException.java 28 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/DelayedConfigAddListener.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObject.java 8 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListener.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListener.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDecodingException.java 16 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDeleteListener.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDeleteListenerAdaptor.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagementContext.java 8 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/server/package-info.java 2 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/api/ConfigAddListener.java 3 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/api/ConfigChangeListener.java 4 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/api/ConfigDeleteListener.java 10 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/types/DirectoryEnvironmentConfig.java 39 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/util/EmbeddedUtils.java 105 ●●●●● patch | view | raw | blame | history
opendj-admin/pom.xml
@@ -57,6 +57,16 @@
    <adminPackage>org/forgerock/opendj/admin</adminPackage>
    <generatedSourcesDir>${project.build.directory}/generated-sources/admin/${adminPackage}</generatedSourcesDir>
    <xslDir>src/main/resources/stylesheets</xslDir>
    <!-- properties used to generate DynamicConstant class -->
    <serverProductName>OpenDJ</serverProductName>
    <serverShortProductName>OpenDJ</serverShortProductName>
    <issuesFixIds></issuesFixIds>
    <isDebugBuild>false</isDebugBuild>
    <docReferenceHome>http://opendj.forgerock.org/</docReferenceHome>
    <docReferenceWiki>http://opendj.forgerock.org/docs.html</docReferenceWiki>
    <docQuickRefGuide>http://opendj.forgerock.org/doc/admin-guide/index.html</docQuickRefGuide>
    <adminGuideUrl>http://opendj.forgerock.org/doc/admin-guide/index.html</adminGuideUrl>
  </properties>
  <build>
    <plugins>
@@ -350,19 +360,124 @@
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <!-- Parse the maven version to get version parts (major, minor, ...) -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.4</version>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>parse-version</id>
            <goals>
              <goal>test-jar</goal>
              <goal>parse-version</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Retrieve the SVN revision number and the build timestamp -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>1.2</version>
        <executions>
          <execution>
            <id>generate-buildnumber</id>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
            <configuration>
              <useLastCommittedRevision>true</useLastCommittedRevision>
              <buildNumberPropertyName>buildRevision</buildNumberPropertyName>
            </configuration>
          </execution>
          <execution>
            <id>generate-timestamp</id>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
            <configuration>
              <format>{0,date,yyyyMMddHHmmss}</format>
              <items>
                <item>timestamp</item>
              </items>
              <buildNumberPropertyName>buildDateTime</buildNumberPropertyName>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Filter java sources located in src/main/java-templates -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>templating-maven-plugin</artifactId>
        <version>1.0-alpha-3</version>
        <executions>
          <execution>
            <id>filter-src</id>
            <goals>
              <goal>filter-sources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings
          only. It has no influence on the Maven build itself. -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <versionRange>[1.8,)</versionRange>
                    <goals>
                      <goal>parse-version</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>templating-maven-plugin</artifactId>
                    <versionRange>[1.0-alpha-3,)</versionRange>
                    <goals>
                      <goal>filter-sources</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>xml-maven-plugin</artifactId>
                    <versionRange>[1.0,)</versionRange>
                    <goals>
                      <goal>transform</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <reporting>
    <plugins>
opendj-admin/src/main/java-templates/org/opends/server/util/DynamicConstants.java
New file
@@ -0,0 +1,183 @@
/*
 * 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
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2013 ForgeRock AS
 */
package org.opends.server.util;
/**
 * This file contains a number of constants that are used throughout the
 * Directory Server source. It was dynamically generated as part of the
 * build process and should not be edited directly.
 */
public final class DynamicConstants {
    /**
     * The official full product name for the Directory Server.
     */
    public static String PRODUCT_NAME = "${serverProductName}";
    /**
     * The short product name for the Directory Server.
     */
    public static String SHORT_NAME = "${serverShortProductName}";
    /**
     * The major version number for the Directory Server.
     */
    public static int MAJOR_VERSION = ${parsedVersion.majorVersion};
    /**
     * The minor version number for the Directory Server.
     */
    public static int MINOR_VERSION = ${parsedVersion.minorVersion};
    /**
     * The point version number for the Directory Server.
     */
    public static int POINT_VERSION = ${parsedVersion.incrementalVersion};
    /**
     * The official build number for the Directory Server.
     */
    public static int BUILD_NUMBER = ${parsedVersion.buildNumber};
    /**
     * The version qualifier string for the Directory Server.
     */
    public static String VERSION_QUALIFIER = "${parsedVersion.qualifier}";
    /**
     * The set of bug IDs for fixes included in this build of the Directory
     * Server.
     */
    public static String FIX_IDS = "${issuesFixIds}";
    /**
     * The build ID for the generated build of the Directory Server.
     */
    public static String BUILD_ID = "${buildDateTime}";
    /**
     * The username of the user that created this build.
     */
    public static String BUILD_USER = "${user.name}";
    /**
     * The Java version used to generate this build.
     */
    public static String BUILD_JAVA_VERSION = "${java.version}";
    /**
     * The vendor for the Java version used to generate this build.
     */
    public static String BUILD_JAVA_VENDOR = "${java.vendor}";
    /**
     * The JVM version used to generate this build.
     */
    public static String BUILD_JVM_VERSION = "${java.vm.version}";
    /**
     * The vendor for the JVM used to generate this build.
     */
    public static String BUILD_JVM_VENDOR = "${java.vm.vendor}";
    /**
     * The operating system on which this build was generated.
     */
    public static String BUILD_OS = "${os.name} ${os.version} ${os.arch}";
    /**
     * Indicates whether this is a debug build of the Directory Server that may
     * include additional debugging facilities not available in standard release
     * versions.
     */
    public static boolean DEBUG_BUILD = ${isDebugBuild};
    /**
     * The Subversion revision number on which this build is based.
     */
    public static long REVISION_NUMBER = ${buildRevision};
    /**
     * The Subversion url repository location on which this build is based.
     */
    public static String URL_REPOSITORY = "${scm.url}";
    /**
     * The documentation home.
     */
    public static String DOC_REFERENCE_HOME = "${docReferenceHome}";
    /**
     * The documentation url.
     */
    public static String DOC_REFERENCE_WIKI = "${docReferenceWiki}";
    /**
     * The documentation url.
     */
    public static String DOC_QUICK_REFERENCE_GUIDE = "${docQuickRefGuide}";
    /**
     * The administration guide.
     */
    public static String ADMINISTRATION_GUIDE_URL = "${adminGuideUrl}";
    /**
     * A string representation of the version number.
     */
    public static String VERSION_NUMBER_STRING = "${project.version}";
    /**
     * A string representation of the version number.
     */
    public static String OPENDJ_NUMBER_STRING = "${project.version}";
    /**
     * A string representation of the release version.
     */
    public static String RELEASE_VERSION_STRING = OPENDJ_NUMBER_STRING;
    /**
     * A compact version string for this product, suitable for use in path names
     * and similar cases.
     */
    public static String COMPACT_VERSION_STRING = SHORT_NAME + "-" + VERSION_NUMBER_STRING;
    /**
     * A full version string for this product.
     */
    public static String FULL_VERSION_STRING = PRODUCT_NAME + " " + RELEASE_VERSION_STRING
            + (((FIX_IDS != null) && (FIX_IDS.length() > 0)) ? "+" + FIX_IDS : "");
    /**
     * A printable version string for this product.
     */
    public static final String PRINTABLE_VERSION_STRING = FULL_VERSION_STRING + System.getProperty("line.separator")
            + "Build " + BUILD_ID + System.getProperty("line.separator");
}
opendj-admin/src/main/java/org/opends/server/admin/AbsoluteInheritedDefaultBehaviorProvider.java
@@ -26,106 +26,88 @@
 */
package org.opends.server.admin;
/**
 * A default behavior provider which retrieves default values from a
 * managed object in an absolute location. It should be used by
 * properties which inherit their default value(s) from properties
 * held in an other managed object.
 * A default behavior provider which retrieves default values from a managed
 * object in an absolute location. It should be used by properties which inherit
 * their default value(s) from properties held in an other managed object.
 *
 * @param <T>
 *          The type of values represented by this provider.
 *            The type of values represented by this provider.
 */
public final class AbsoluteInheritedDefaultBehaviorProvider<T> extends
    DefaultBehaviorProvider<T> {
public final class AbsoluteInheritedDefaultBehaviorProvider<T> extends DefaultBehaviorProvider<T> {
  // The absolute path to the managed object containing the property.
  private ManagedObjectPath<?, ?> path = null;
    // The absolute path to the managed object containing the property.
    private ManagedObjectPath<?, ?> path = null;
  // The string representation of the managed object path specifying
  // the absolute location of the managed object.
  private final String pathString;
    // The string representation of the managed object path specifying
    // the absolute location of the managed object.
    private final String pathString;
  // The name of the property containing the inherited default values.
  private final String propertyName;
    // The name of the property containing the inherited default values.
    private final String propertyName;
    /**
     * Create an absolute inherited default behavior provider associated with
     * the managed object at the specified absolute location.
     *
     * @param pathString
     *            The string representation of the managed object path
     *            specifying the absolute location of the managed object.
     * @param propertyName
     *            The name of the property containing the inherited default
     *            values.
     */
    public AbsoluteInheritedDefaultBehaviorProvider(String pathString, String propertyName) {
        this.pathString = pathString;
        this.propertyName = propertyName;
    }
    /**
     * {@inheritDoc}
     */
    public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
        return v.visitAbsoluteInherited(this, p);
    }
  /**
   * Create an absolute inherited default behavior provider associated
   * with the managed object at the specified absolute location.
   *
   * @param pathString
   *          The string representation of the managed object path
   *          specifying the absolute location of the managed object.
   * @param propertyName
   *          The name of the property containing the inherited
   *          default values.
   */
  public AbsoluteInheritedDefaultBehaviorProvider(String pathString,
      String propertyName) {
    this.pathString = pathString;
    this.propertyName = propertyName;
  }
    /**
     * Get the definition of the parent managed object containing the inherited
     * default values.
     *
     * @return Returns the definition of the parent managed object containing
     *         the inherited default values.
     */
    public AbstractManagedObjectDefinition<?, ?> getManagedObjectDefinition() {
        return path.getManagedObjectDefinition();
    }
    /**
     * Get the absolute path of the managed object containing the property which
     * has the default values.
     *
     * @return Returns the absolute path of the managed object containing the
     *         property which has the default values.
     */
    public ManagedObjectPath<?, ?> getManagedObjectPath() {
        return path;
    }
    /**
     * Gets the name of the property containing the inherited default values.
     *
     * @return Returns the name of the property containing the inherited default
     *         values.
     */
    public String getPropertyName() {
        return propertyName;
    }
  /**
   * {@inheritDoc}
   */
  public <R, P> R accept(DefaultBehaviorProviderVisitor<T, R, P> v, P p) {
    return v.visitAbsoluteInherited(this, p);
  }
  /**
   * Get the definition of the parent managed object containing the
   * inherited default values.
   *
   * @return Returns the definition of the parent managed object
   *         containing the inherited default values.
   */
  public AbstractManagedObjectDefinition<?, ?> getManagedObjectDefinition() {
    return path.getManagedObjectDefinition();
  }
  /**
   * Get the absolute path of the managed object containing the
   * property which has the default values.
   *
   * @return Returns the absolute path of the managed object
   *         containing the property which has the default values.
   */
  public ManagedObjectPath<?, ?> getManagedObjectPath() {
    return path;
  }
  /**
   * Gets the name of the property containing the inherited default
   * values.
   *
   * @return Returns the name of the property containing the inherited
   *         default values.
   */
  public String getPropertyName() {
    return propertyName;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  protected void initialize() throws Exception {
    // Decode the path.
    path = ManagedObjectPath.valueOf(pathString);
  }
    /**
     * {@inheritDoc}
     */
    @Override
    protected void initialize() throws Exception {
        // Decode the path.
        path = ManagedObjectPath.valueOf(pathString);
    }
}
opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java
@@ -27,74 +27,58 @@
package org.opends.server.admin;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ConcurrentModificationException;
import org.opends.server.admin.client.MissingMandatoryPropertiesException;
import org.opends.server.admin.client.OperationRejectedException;
/**
 * A common base interface for all managed object configuration
 * clients.
 * A common base interface for all managed object configuration clients.
 */
public interface ConfigurationClient {
  /**
   * Get the configuration definition associated with this
   * configuration.
   *
   * @return Returns the configuration definition associated with this
   *         configuration.
   */
  ManagedObjectDefinition<? extends ConfigurationClient,
      ? extends Configuration> definition();
    /**
     * Get the configuration definition associated with this configuration.
     *
     * @return Returns the configuration definition associated with this
     *         configuration.
     */
    ManagedObjectDefinition<? extends ConfigurationClient, ? extends Configuration> definition();
    /**
     * Get a property provider view of this configuration.
     *
     * @return Returns a property provider view of this configuration.
     */
    PropertyProvider properties();
  /**
   * Get a property provider view of this configuration.
   *
   * @return Returns a property provider view of this configuration.
   */
  PropertyProvider properties();
  /**
   * If this is a new configuration this method will attempt to add it
   * to the server, otherwise it will commit any changes made to this
   * configuration.
   *
   * @throws ManagedObjectAlreadyExistsException
   *           If this is a new configuration but it could not be
   *           added to the server because it already exists.
   * @throws MissingMandatoryPropertiesException
   *           If this configuration contains some mandatory
   *           properties which have been left undefined.
   * @throws ConcurrentModificationException
   *           If this is a new configuration which is being added to
   *           the server but its parent has been removed by another
   *           client, or if this configuration is being modified but
   *           it has been removed from the server by another client.
   * @throws OperationRejectedException
   *           If the server refuses to add or modify this
   *           configuration due to some server-side constraint which
   *           cannot be satisfied.
   * @throws AuthorizationException
   *           If the server refuses to add or modify this
   *           configuration because the client does not have the
   *           correct privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
   */
  void commit() throws ManagedObjectAlreadyExistsException,
      MissingMandatoryPropertiesException, ConcurrentModificationException,
      OperationRejectedException, AuthorizationException,
      CommunicationException;
    /**
     * If this is a new configuration this method will attempt to add it to the
     * server, otherwise it will commit any changes made to this configuration.
     *
     * @throws ManagedObjectAlreadyExistsException
     *             If this is a new configuration but it could not be added to
     *             the server because it already exists.
     * @throws MissingMandatoryPropertiesException
     *             If this configuration contains some mandatory properties
     *             which have been left undefined.
     * @throws ConcurrentModificationException
     *             If this is a new configuration which is being added to the
     *             server but its parent has been removed by another client, or
     *             if this configuration is being modified but it has been
     *             removed from the server by another client.
     * @throws OperationRejectedException
     *             If the server refuses to add or modify this configuration due
     *             to some server-side constraint which cannot be satisfied.
     * @throws AuthorizationException
     *             If the server refuses to add or modify this configuration
     *             because the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     */
    void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
            ConcurrentModificationException, OperationRejectedException, AuthorizationException, CommunicationException;
}
opendj-admin/src/main/java/org/opends/server/admin/Constraint.java
@@ -26,97 +26,79 @@
 */
package org.opends.server.admin;
import java.util.Collection;
import java.util.Collections;
import org.opends.server.admin.client.ClientConstraintHandler;
import org.opends.server.admin.server.ServerConstraintHandler;
/**
 * An interface for enforcing constraints and dependencies between
 * managed objects and their properties. Constraints express
 * relationships between managed objects and their properties, for
 * example:
 * An interface for enforcing constraints and dependencies between managed
 * objects and their properties. Constraints express relationships between
 * managed objects and their properties, for example:
 * <ul>
 * <li>referential integrity: where one managed object references
 * another a constraint can enforce referential integrity. The
 * constraint can prevent creation of references to non-existent
 * managed objects, and also prevent deletion of referenced managed
 * objects
 * <li>referential integrity: where one managed object references another a
 * constraint can enforce referential integrity. The constraint can prevent
 * creation of references to non-existent managed objects, and also prevent
 * deletion of referenced managed objects
 * <li>property dependencies: for example, when a boolean property is
 * <code>true</code>, one or more additional properties must be
 * specified. This is useful for features like SSL, which when
 * enabled, requires that various SSL related configuration options
 * are specified
 * <li>property constraints: for example, when an upper limit
 * property must not have a value which is less than the lower limit
 * property.
 * <code>true</code>, one or more additional properties must be specified. This
 * is useful for features like SSL, which when enabled, requires that various
 * SSL related configuration options are specified
 * <li>property constraints: for example, when an upper limit property must not
 * have a value which is less than the lower limit property.
 * </ul>
 * On the client-side constraints are enforced immediately before a
 * write operation is performed. That is to say, immediately before a
 * new managed object is created, changes to a managed object are
 * applied, or an existing managed object is deleted.
 * On the client-side constraints are enforced immediately before a write
 * operation is performed. That is to say, immediately before a new managed
 * object is created, changes to a managed object are applied, or an existing
 * managed object is deleted.
 */
public abstract class Constraint {
  /**
   * Creates a new constraint.
   */
  protected Constraint() {
    // No implementation required.
  }
    /**
     * Creates a new constraint.
     */
    protected Constraint() {
        // No implementation required.
    }
    /**
     * Gets the client-side constraint handlers which will be used to enforce
     * this constraint in client applications. The default implementation is to
     * return an empty set of client constraint handlers.
     *
     * @return Returns the client-side constraint handlers which will be used to
     *         enforce this constraint in client applications. The returned
     *         collection must not be <code>null</code> but maybe empty
     *         (indicating that the constraint can only be enforced on the
     *         server-side).
     */
    public Collection<ClientConstraintHandler> getClientConstraintHandlers() {
        return Collections.emptySet();
    }
    /**
     * Gets the server-side constraint handlers which will be used to enforce
     * this constraint within the server. The default implementation is to
     * return an empty set of server constraint handlers.
     *
     * @return Returns the server-side constraint handlers which will be used to
     *         enforce this constraint within the server. The returned
     *         collection must not be <code>null</code> and must not be empty,
     *         since constraints must always be enforced on the server.
     */
    public Collection<ServerConstraintHandler> getServerConstraintHandlers() {
        return Collections.emptySet();
    }
  /**
   * Gets the client-side constraint handlers which will be used to
   * enforce this constraint in client applications. The default
   * implementation is to return an empty set of client constraint
   * handlers.
   *
   * @return Returns the client-side constraint handlers which will be
   *         used to enforce this constraint in client applications.
   *         The returned collection must not be <code>null</code>
   *         but maybe empty (indicating that the constraint can only
   *         be enforced on the server-side).
   */
  public Collection<ClientConstraintHandler> getClientConstraintHandlers() {
    return Collections.emptySet();
  }
  /**
   * Gets the server-side constraint handlers which will be used to
   * enforce this constraint within the server. The default
   * implementation is to return an empty set of server constraint
   * handlers.
   *
   * @return Returns the server-side constraint handlers which will be
   *         used to enforce this constraint within the server. The
   *         returned collection must not be <code>null</code> and
   *         must not be empty, since constraints must always be
   *         enforced on the server.
   */
  public Collection<ServerConstraintHandler> getServerConstraintHandlers() {
    return Collections.emptySet();
  }
  /**
   * Initializes this constraint. The default implementation is to do
   * nothing.
   *
   * @throws Exception
   *           If this constraint could not be initialized.
   */
  protected void initialize() throws Exception {
    // Default implementation is to do nothing.
  }
    /**
     * Initializes this constraint. The default implementation is to do nothing.
     *
     * @throws Exception
     *             If this constraint could not be initialized.
     */
    protected void initialize() throws Exception {
        // Default implementation is to do nothing.
    }
}
opendj-admin/src/main/java/org/opends/server/admin/DecodingException.java
@@ -29,27 +29,24 @@
import org.forgerock.i18n.LocalizableMessage;
/**
 * The requested managed object was found but it could not be decoded.
 */
public abstract class DecodingException extends OperationsException {
  /**
   * Fake serialization ID.
   */
  private static final long serialVersionUID = 1L;
    /**
     * Fake serialization ID.
     */
    private static final long serialVersionUID = 1L;
  /**
   * Create a decoding exception with a message.
   *
   * @param message
   *          The message.
   */
  protected DecodingException(LocalizableMessage message) {
    super(message);
  }
    /**
     * Create a decoding exception with a message.
     *
     * @param message
     *            The message.
     */
    protected DecodingException(LocalizableMessage message) {
        super(message);
    }
}
opendj-admin/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java
@@ -35,1593 +35,1406 @@
import java.util.Properties;
import java.util.TreeMap;
import java.util.TreeSet;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.admin.meta.RootCfgDefn;
import org.opends.server.admin.ACIPropertyDefinition;
import org.opends.server.admin.AbsoluteInheritedDefaultBehaviorProvider;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.AdministratorAction.Type;
import org.opends.server.admin.std.meta.RootCfgDefn;
import org.opends.server.admin.*;
import org.opends.server.admin.AggregationPropertyDefinition;
import org.opends.server.admin.AliasDefaultBehaviorProvider;
import org.opends.server.admin.AttributeTypePropertyDefinition;
import org.opends.server.admin.BooleanPropertyDefinition;
import org.opends.server.admin.ClassLoaderProvider;
import org.opends.server.admin.ClassPropertyDefinition;
import org.opends.server.admin.DNPropertyDefinition;
import org.opends.server.admin.DefaultBehaviorProvider;
import org.opends.server.admin.DefinedDefaultBehaviorProvider;
import org.opends.server.admin.DurationPropertyDefinition;
import org.opends.server.admin.EnumPropertyDefinition;
import org.opends.server.admin.IPAddressMaskPropertyDefinition;
import org.opends.server.admin.IPAddressPropertyDefinition;
import org.opends.server.admin.IntegerPropertyDefinition;
import org.opends.server.admin.LDAPProfile;
import org.opends.server.admin.ManagedObjectOption;
import org.opends.server.admin.PropertyDefinition;
import org.opends.server.admin.PropertyDefinitionVisitor;
import org.opends.server.admin.PropertyOption;
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.RelationOption;
import org.opends.server.admin.RelativeInheritedDefaultBehaviorProvider;
import org.opends.server.admin.SizePropertyDefinition;
import org.opends.server.admin.StringPropertyDefinition;
import org.opends.server.admin.Tag;
import org.opends.server.admin.TopCfgDefn;
import org.opends.server.admin.UndefinedDefaultBehaviorProvider;
import org.opends.server.types.InitializationException;
import org.opends.server.util.EmbeddedUtils;
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.EmbeddedUtils;
/**
 *  This class allow Configuration Guide documentation generation (html format).
 * This class allow Configuration Guide documentation generation (html format).
 * It is based on the Admin Framework Introspection API
 *
 */
public class ConfigGuideGeneration {
  // Note : still to be done :
  // I18n support. Today all the strings are hardcoded in this file
    // Note : still to be done :
    // I18n support. Today all the strings are hardcoded in this file
  private final static String ACI_SYNTAX_REL_URL =
    "/doc/admin-guide/#about-acis";
  private final static String DURATION_SYNTAX_REL_URL =
    "duration-syntax.html";
  private final String CSS_FILE = "opendj-config.css";
    private final static String ACI_SYNTAX_REL_URL = "/doc/admin-guide/#about-acis";
    private final static String DURATION_SYNTAX_REL_URL = "duration-syntax.html";
    private final String CSS_FILE = "opendj-config.css";
  private final String MAIN_FILE = "index.html";
  private final String INHERITANCE_TREE_FILE =
    "ManagedObjectInheritanceTree.html";
  private final String RELATION_TREE_FILE = "ManagedObjectRelationTree.html";
  private final String MO_LIST_FILE = "ManagedObjectList.html";
  private final String PROPERTIES_INDEX_FILE = "PropertiesIndex.html";
  private final String WELCOME_FILE = "welcome.html";
  private final String MAINTOP_FILE = "maintop.html";
  private final String INDEX_FILE = "index.html";
  private final String FAVICON = "http://forgerock.org/favicon.ico";
    private final String MAIN_FILE = "index.html";
    private final String INHERITANCE_TREE_FILE = "ManagedObjectInheritanceTree.html";
    private final String RELATION_TREE_FILE = "ManagedObjectRelationTree.html";
    private final String MO_LIST_FILE = "ManagedObjectList.html";
    private final String PROPERTIES_INDEX_FILE = "PropertiesIndex.html";
    private final String WELCOME_FILE = "welcome.html";
    private final String MAINTOP_FILE = "maintop.html";
    private final String INDEX_FILE = "index.html";
    private final String FAVICON = "http://forgerock.org/favicon.ico";
  private static final String CONFIG_GUIDE_DIR = "opendj_config_guide";
  private final String MAIN_FRAME = "mainFrame";
    private static final String CONFIG_GUIDE_DIR = "opendj_config_guide";
    private final String MAIN_FRAME = "mainFrame";
  /**
   * Entry point for documentation generation.
   *
   * Properties:
   * GenerationDir - The directory where the doc is generated
   *              (default is /var/tmp/[CONFIG_GUIDE_DIR>])
   * LdapMapping - Presence means that the LDAP mapping section is to be
   *               generated (default is no)
   * OpenDJWiki - The URL of the OpenDJ Wiki
   *              (default is
   *              "http://wikis.forgerock.org/confluence/display/OPENDJ")
   * OpenDJHome - The URL of the OpenDJ project Home page
   *              (default is "http://opendj.forgerock.org")
   *
   * @param args none.
   */
  public static void main(String[] args) {
    Properties properties = System.getProperties();
    generationDir = properties.getProperty("GenerationDir");
    if (generationDir == null) {
      // Default dir is prefixed by the system-dependent default temporary dir
      generationDir = System.getProperty("java.io.tmpdir") + File.separator +
        CONFIG_GUIDE_DIR;
    }
    // Create new dir if necessary
    try {
      (new File(generationDir)).mkdir();
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
    System.out.println("Generation directory is : " + generationDir);
    if (properties.getProperty("LdapMapping") != null) {
      ldapMapping = true;
    }
    OpenDJWiki = properties.getProperty("OpenDJWiki");
    if (OpenDJWiki == null) {
      // Default is current wiki
      OpenDJWiki = "http://wikis.forgerock.org/confluence/display/OPENDJ";
    }
    OpenDJHome = properties.getProperty("OpenDJHome");
    if (OpenDJHome == null) {
      // Default is current OpenDJ project home
      OpenDJHome = "http://opendj.forgerock.org";
    }
    aciSyntaxPage = OpenDJHome + ACI_SYNTAX_REL_URL;
    durationSyntaxPage = DURATION_SYNTAX_REL_URL;
    ConfigGuideGeneration myGen = new ConfigGuideGeneration();
    myGen.generate();
  }
  private void generate() {
    init();
    // Generate the relation tree of all the managed objects
    genManagedObjectRelationTree(catTopRelList);
    // Generate the inheritance tree of all the managed objects
    genManagedObjectInheritanceTree(catTopMoList);
    // Generate all the managed objects and their children
    genAllManagedObject(topMoList);
    // Generate a list of managed objects
    genManagedObjectList(moList);
    // Generate an index of properties
    genPropertiesIndex();
    // Generate the Index page
    genIndexPage();
    // Generate the Main Top page
    genMainTopPage();
    // Generate the Welcome page
    genWelcomePage();
   }
  private void init() {
    // Build a list of top relations
    RootCfgDefn rootCfg = RootCfgDefn.getInstance();
    for (RelationDefinition rel : rootCfg.getAllRelationDefinitions()) {
      topRelList.put(rel.getChildDefinition().getName(), rel);
    }
    // Enable the client-side class loader to explicitly load classes
    // which are not directly reachable from the root configuration
    EmbeddedUtils.initializeForClientUse();
    // Bootstrap definition classes.
    try {
      ClassLoaderProvider.getInstance().enable();
    } catch (InitializationException e) {
      System.err.println("ERROR : Cannot enable the client-side class loader.");
      e.printStackTrace();
      System.exit(1);
    }
    // Switch off class name validation in client.
    ClassPropertyDefinition.setAllowClassValidation(false);
    // Switch off attribute type name validation in client.
    AttributeTypePropertyDefinition.setCheckSchema(false);
    // Build a sorted list of top managed objects
    TopCfgDefn topCfg = TopCfgDefn.getInstance();
    Collection<AbstractManagedObjectDefinition<?, ?>> topObjects =
      topCfg.getChildren();
    for (AbstractManagedObjectDefinition topObject : topObjects) {
      if (topObject.getName().equals("")) {
        // root
        continue;
      }
      if (topObject.hasOption(ManagedObjectOption.HIDDEN))
      {
        continue;
      }
      topMoList.put(topObject.getName(), topObject);
    }
    // Build a list of top relations by category (core, database, ...)
    for (RelationDefinition rel : topRelList.values()) {
      AbstractManagedObjectDefinition<?, ?> mo = rel.getChildDefinition();
      Collection<Tag> tags = mo.getAllTags();
      for (Tag tag : tags) {
        TreeMap<String, RelationDefinition> catMap =
          catTopRelList.get(tag.getName());
        if (catMap == null) {
          catMap = new TreeMap<String, RelationDefinition>();
          catTopRelList.put(tag.getName(), catMap);
    /**
     * Entry point for documentation generation. Properties: GenerationDir - The
     * directory where the doc is generated (default is
     * /var/tmp/[CONFIG_GUIDE_DIR>]) LdapMapping - Presence means that the LDAP
     * mapping section is to be generated (default is no) OpenDJWiki - The URL
     * of the OpenDJ Wiki (default is
     * "http://wikis.forgerock.org/confluence/display/OPENDJ") OpenDJHome - The
     * URL of the OpenDJ project Home page (default is
     * "http://opendj.forgerock.org")
     *
     * @param args
     *            none.
     */
    public static void main(String[] args) {
        Properties properties = System.getProperties();
        generationDir = properties.getProperty("GenerationDir");
        if (generationDir == null) {
            // Default dir is prefixed by the system-dependent default temporary
            // dir
            generationDir = System.getProperty("java.io.tmpdir") + File.separator + CONFIG_GUIDE_DIR;
        }
        catMap.put(mo.getName(), rel);
      }
        // Create new dir if necessary
        try {
            (new File(generationDir)).mkdir();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
        System.out.println("Generation directory is : " + generationDir);
        if (properties.getProperty("LdapMapping") != null) {
            ldapMapping = true;
        }
        OpenDJWiki = properties.getProperty("OpenDJWiki");
        if (OpenDJWiki == null) {
            // Default is current wiki
            OpenDJWiki = "http://wikis.forgerock.org/confluence/display/OPENDJ";
        }
        OpenDJHome = properties.getProperty("OpenDJHome");
        if (OpenDJHome == null) {
            // Default is current OpenDJ project home
            OpenDJHome = "http://opendj.forgerock.org";
        }
        aciSyntaxPage = OpenDJHome + ACI_SYNTAX_REL_URL;
        durationSyntaxPage = DURATION_SYNTAX_REL_URL;
        ConfigGuideGeneration myGen = new ConfigGuideGeneration();
        myGen.generate();
    }
    // Build a list of top managed objects by category (core, database, ...)
    for (AbstractManagedObjectDefinition<?, ?> topObject : topMoList.values()) {
      Collection<Tag> tags = topObject.getAllTags();
      for (Tag tag : tags) {
        TreeMap<String, AbstractManagedObjectDefinition> catMap =
          catTopMoList.get(tag.getName());
        if (catMap == null) {
          catMap = new TreeMap<String, AbstractManagedObjectDefinition>();
          catTopMoList.put(tag.getName(), catMap);
        }
        catMap.put(topObject.getName(), topObject);
      }
    private void generate() {
        init();
        // Generate the relation tree of all the managed objects
        genManagedObjectRelationTree(catTopRelList);
        // Generate the inheritance tree of all the managed objects
        genManagedObjectInheritanceTree(catTopMoList);
        // Generate all the managed objects and their children
        genAllManagedObject(topMoList);
        // Generate a list of managed objects
        genManagedObjectList(moList);
        // Generate an index of properties
        genPropertiesIndex();
        // Generate the Index page
        genIndexPage();
        // Generate the Main Top page
        genMainTopPage();
        // Generate the Welcome page
        genWelcomePage();
    }
  }
    private void init() {
  /**
   * Generate the inheritance tree of all the managed objects.
   */
  @SuppressWarnings("unchecked")
  private void genManagedObjectInheritanceTree(
    TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>> list) {
    htmlHeader(DynamicConstants.PRODUCT_NAME + " " +
            "Configuration Reference - Inheritance View");
    tabMenu(INHERITANCE_TREE_FILE);
    viewHelp("This view represents the inheritance relationships between " +
      "configuration components.");
    jumpSection();
    for (String catName : list.keySet()) {
      heading3(getFriendlyName(catName));
      // Get the list of the category
      TreeMap<String, AbstractManagedObjectDefinition> catList =
        list.get(catName);
      for (AbstractManagedObjectDefinition mo : catList.values()) {
        if ((relList.get(mo.getName()) != null) &&
          (relList.get(mo.getName()).hasOption(RelationOption.HIDDEN))) {
          continue;
        // Build a list of top relations
        RootCfgDefn rootCfg = RootCfgDefn.getInstance();
        for (RelationDefinition rel : rootCfg.getAllRelationDefinitions()) {
            topRelList.put(rel.getChildDefinition().getName(), rel);
        }
        paragraph(
          getLink(mo.getUserFriendlyName().toString(),
          mo.getName() + ".html", MAIN_FRAME));
        // Enable the client-side class loader to explicitly load classes
        // which are not directly reachable from the root configuration
        EmbeddedUtils.initializeForClientUse();
        // Bootstrap definition classes.
        try {
            ClassLoaderProvider.getInstance().enable();
        } catch (InitializationException e) {
            System.err.println("ERROR : Cannot enable the client-side class loader.");
            e.printStackTrace();
            System.exit(1);
        }
        // Switch off class name validation in client.
        ClassPropertyDefinition.setAllowClassValidation(false);
        // Switch off attribute type name validation in client.
        AttributeTypePropertyDefinition.setCheckSchema(false);
        // Build a sorted list of top managed objects
        TopCfgDefn topCfg = TopCfgDefn.getInstance();
        Collection<AbstractManagedObjectDefinition<?, ?>> topObjects = topCfg.getChildren();
        for (AbstractManagedObjectDefinition topObject : topObjects) {
            if (topObject.getName().equals("")) {
                // root
                continue;
            }
            if (topObject.hasOption(ManagedObjectOption.HIDDEN)) {
                continue;
            }
            topMoList.put(topObject.getName(), topObject);
        }
        // Build a list of top relations by category (core, database, ...)
        for (RelationDefinition rel : topRelList.values()) {
            AbstractManagedObjectDefinition<?, ?> mo = rel.getChildDefinition();
            Collection<Tag> tags = mo.getAllTags();
            for (Tag tag : tags) {
                TreeMap<String, RelationDefinition> catMap = catTopRelList.get(tag.getName());
                if (catMap == null) {
                    catMap = new TreeMap<String, RelationDefinition>();
                    catTopRelList.put(tag.getName(), catMap);
                }
                catMap.put(mo.getName(), rel);
            }
        }
        // Build a list of top managed objects by category (core, database, ...)
        for (AbstractManagedObjectDefinition<?, ?> topObject : topMoList.values()) {
            Collection<Tag> tags = topObject.getAllTags();
            for (Tag tag : tags) {
                TreeMap<String, AbstractManagedObjectDefinition> catMap = catTopMoList.get(tag.getName());
                if (catMap == null) {
                    catMap = new TreeMap<String, AbstractManagedObjectDefinition>();
                    catTopMoList.put(tag.getName(), catMap);
                }
                catMap.put(topObject.getName(), topObject);
            }
        }
    }
    /**
     * Generate the inheritance tree of all the managed objects.
     */
    @SuppressWarnings("unchecked")
    private void genManagedObjectInheritanceTree(TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>> list) {
        htmlHeader(DynamicConstants.PRODUCT_NAME + " " + "Configuration Reference - Inheritance View");
        tabMenu(INHERITANCE_TREE_FILE);
        viewHelp("This view represents the inheritance relationships between " + "configuration components.");
        jumpSection();
        for (String catName : list.keySet()) {
            heading3(getFriendlyName(catName));
            // Get the list of the category
            TreeMap<String, AbstractManagedObjectDefinition> catList = list.get(catName);
            for (AbstractManagedObjectDefinition mo : catList.values()) {
                if ((relList.get(mo.getName()) != null) && (relList.get(mo.getName()).hasOption(RelationOption.HIDDEN))) {
                    continue;
                }
                paragraph(getLink(mo.getUserFriendlyName().toString(), mo.getName() + ".html", MAIN_FRAME));
                if (mo.hasChildren()) {
                    genMoInheritanceTree(makeMOTreeMap(mo.getChildren()));
                }
            }
        }
        htmlFooter();
        generateFile(INHERITANCE_TREE_FILE);
    }
    @SuppressWarnings("unchecked")
    private void genMoInheritanceTree(TreeMap<String, AbstractManagedObjectDefinition> catList) {
        beginList();
        for (AbstractManagedObjectDefinition mo : catList.values()) {
            link(mo.getUserFriendlyName().toString(), mo.getName() + ".html", MAIN_FRAME);
            if (mo.hasChildren()) {
                genMoInheritanceTree(makeMOTreeMap(mo.getChildren()));
            }
        }
        endList();
    }
    private void jumpSection() {
        htmlBuff.append("<p class=\"category-index\">" + "<strong>Jump To:</strong><br>\n");
        String[] catNames = catTopMoList.keySet().toArray(new String[0]);
        for (int ii = 0; ii < catNames.length; ii++) {
            if (ii != 0) {
                htmlBuff.append(", ");
            }
            String catFriendlyName = getFriendlyName(catNames[ii]);
            htmlBuff.append(getLink(catFriendlyName, "#" + catFriendlyName));
        }
        htmlBuff.append("</p>\n");
    }
    /**
     * Generate the relation tree of all the managed objects.
     */
    private void genManagedObjectRelationTree(TreeMap<String, TreeMap<String, RelationDefinition>> list) {
        htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Structure View");
        tabMenu(RELATION_TREE_FILE);
        viewHelp("This view represents the structural relationships between "
                + "components and indicates how certain components can exist only within " + "container components.");
        jumpSection();
        for (String catName : list.keySet()) {
            heading3(getFriendlyName(catName));
            // Get the list of the category
            TreeMap<String, RelationDefinition> catList = list.get(catName);
            genMORelationTree(catList);
        }
        htmlFooter();
        generateFile(RELATION_TREE_FILE);
    }
    @SuppressWarnings("unchecked")
    private void genMORelationTree(TreeMap<String, RelationDefinition> list) {
        for (RelationDefinition rel : list.values()) {
            AbstractManagedObjectDefinition childMo = rel.getChildDefinition();
            AbstractManagedObjectDefinition parentMo = rel.getParentDefinition();
            // Does not generate several entry for the same relation
            if (relList.put(childMo.getName(), rel) != null) {
                continue;
            }
            if (rel.hasOption(RelationOption.HIDDEN)) {
                continue;
            }
            String linkStr = getLink(childMo.getUserFriendlyName().toString(), childMo.getName() + ".html", MAIN_FRAME);
            String fromStr = "";
            if (!parentMo.getName().equals("")) {
                fromStr = " (from "
                        + getLink(parentMo.getUserFriendlyName().toString(), parentMo.getName() + ".html", MAIN_FRAME)
                        + ")";
            }
            if (!inList) {
                paragraph(linkStr + fromStr);
            } else {
                bullet(linkStr + fromStr);
            }
            genMORelationSubTree(makeRelTreeMap(childMo.getAllRelationDefinitions()));
            if (childMo.hasChildren()) {
                for (Iterator<AbstractManagedObjectDefinition> it = childMo.getChildren().iterator(); it.hasNext();) {
                    AbstractManagedObjectDefinition mo = it.next();
                    if (mo.hasOption(ManagedObjectOption.HIDDEN)) {
                        continue;
                    }
                    genMORelationSubTree(makeRelTreeMap(mo.getAllRelationDefinitions()));
                }
            }
        }
    }
    private void genMORelationSubTree(TreeMap<String, RelationDefinition> list) {
        if (!list.values().isEmpty()) {
            beginList();
            genMORelationTree(list);
            endList();
        }
    }
    /**
     * Generate all the managed objects HTML pages.
     */
    @SuppressWarnings("unchecked")
    private void genAllManagedObject(TreeMap<String, AbstractManagedObjectDefinition> list) {
        for (AbstractManagedObjectDefinition mo : list.values()) {
            if ((relList.get(mo.getName()) != null) && (relList.get(mo.getName()).hasOption(RelationOption.HIDDEN))) {
                continue;
            }
            moList.put(mo.getName(), mo);
            genManagedObject(mo);
            if (mo.hasChildren()) {
                genAllManagedObject(makeMOTreeMap(mo.getChildren()));
            }
        }
    }
    private void genManagedObject(AbstractManagedObjectDefinition mo) {
        // ------------------------------------------------------------------------
        // Header
        // ------------------------------------------------------------------------
        homeLink();
        String title = mo.getUserFriendlyName().toString();
        htmlHeader(DynamicConstants.PRODUCT_NAME + " - " + title);
        // title
        heading2(title);
        // Abstract notice
        if (mo.hasChildren()) {
          genMoInheritanceTree(makeMOTreeMap(mo.getChildren()));
            paragraph("Note: this is an abstract component, that cannot be instantiated.", TextStyle.ITALIC);
        }
      }
    }
    htmlFooter();
    generateFile(INHERITANCE_TREE_FILE);
  }
        // description
        paragraph(mo.getSynopsis());
        paragraph(mo.getDescription());
  @SuppressWarnings("unchecked")
  private void genMoInheritanceTree(
    TreeMap<String, AbstractManagedObjectDefinition> catList) {
        // sub-components
        if (mo.hasChildren()) {
            heading3("Direct Subcomponents");
            paragraph("The following " + mo.getUserFriendlyPluralName() + " are available in the server :");
            beginList();
            @SuppressWarnings("unchecked")
            TreeMap<String, AbstractManagedObjectDefinition> children = makeMOTreeMap(mo.getChildren());
            for (AbstractManagedObjectDefinition child : children.values()) {
                link(child.getUserFriendlyName().toString(), child.getName() + ".html");
            }
            endList();
    beginList();
    for (AbstractManagedObjectDefinition mo : catList.values()) {
      link(mo.getUserFriendlyName().toString(), mo.getName() + ".html",
        MAIN_FRAME);
      if (mo.hasChildren()) {
        genMoInheritanceTree(makeMOTreeMap(mo.getChildren()));
      }
    }
    endList();
  }
   private void jumpSection() {
     htmlBuff.append("<p class=\"category-index\">" +
       "<strong>Jump To:</strong><br>\n");
     String[] catNames = catTopMoList.keySet().toArray(new String[0]);
    for (int ii=0; ii < catNames.length; ii++) {
      if (ii != 0) {
        htmlBuff.append(", ");
      }
      String catFriendlyName = getFriendlyName(catNames[ii]);
      htmlBuff.append(getLink(catFriendlyName, "#" + catFriendlyName));
    }
    htmlBuff.append("</p>\n");
   }
  /**
   * Generate the relation tree of all the managed objects.
   */
  private void genManagedObjectRelationTree(
    TreeMap <String, TreeMap<String, RelationDefinition>> list) {
    htmlHeader(DynamicConstants.PRODUCT_NAME +
            " Configuration Reference - Structure View");
    tabMenu(RELATION_TREE_FILE);
    viewHelp("This view represents the structural relationships between " +
      "components and indicates how certain components can exist only within " +
      "container components.");
    jumpSection();
    for (String catName : list.keySet()) {
      heading3(getFriendlyName(catName));
      // Get the list of the category
      TreeMap<String, RelationDefinition> catList = list.get(catName);
      genMORelationTree(catList);
    }
    htmlFooter();
    generateFile(RELATION_TREE_FILE);
  }
  @SuppressWarnings("unchecked")
  private void genMORelationTree(TreeMap<String, RelationDefinition> list) {
    for (RelationDefinition rel : list.values()) {
      AbstractManagedObjectDefinition childMo = rel.getChildDefinition();
      AbstractManagedObjectDefinition parentMo = rel.getParentDefinition();
      // Does not generate several entry for the same relation
      if (relList.put(childMo.getName(), rel) != null) {
       continue;
      }
      if (rel.hasOption(RelationOption.HIDDEN)) {
        continue;
      }
      String linkStr = getLink(childMo.getUserFriendlyName().toString(),
        childMo.getName() + ".html", MAIN_FRAME);
      String fromStr = "";
      if (!parentMo.getName().equals("")) {
        fromStr = " (from " +
          getLink(parentMo.getUserFriendlyName().toString(),
          parentMo.getName() + ".html", MAIN_FRAME) + ")";
      }
      if (!inList) {
        paragraph(linkStr + fromStr);
      } else {
        bullet(linkStr + fromStr);
      }
      genMORelationSubTree(makeRelTreeMap(childMo.getAllRelationDefinitions()));
      if (childMo.hasChildren()) {
        for (Iterator<AbstractManagedObjectDefinition> it =
          childMo.getChildren().iterator(); it.hasNext();) {
          AbstractManagedObjectDefinition mo = it.next();
          if (mo.hasOption(ManagedObjectOption.HIDDEN))
          {
            continue;
          }
          genMORelationSubTree(makeRelTreeMap(mo.getAllRelationDefinitions()));
            paragraph("These " + mo.getUserFriendlyPluralName() + " inherit from the properties described below.");
        }
      }
    }
  }
        // Parent
        if (!mo.getParent().isTop()) {
            heading3("Parent Component");
            paragraph("The " + mo.getUserFriendlyName() + " component inherits from the "
                    + getLink(mo.getParent().getUserFriendlyName().toString(), mo.getParent().getName() + ".html"));
        }
  private void genMORelationSubTree(TreeMap<String, RelationDefinition> list) {
    if (!list.values().isEmpty()) {
      beginList();
      genMORelationTree(list);
      endList();
    }
  }
        // Relations
        generateRelationsSection(mo);
        // Page links in case of LDAP mapping
        if (ldapMapping) {
            newline();
            horizontalLine();
            newline();
            paragraph("This page describes the " + mo.getUserFriendlyName() + ":");
            beginList();
            link("Properties", "#Properties");
            link("LDAP Mapping", "#LDAP Mapping");
            endList();
            newline();
        }
  /**
   * Generate all the managed objects HTML pages.
   */
  @SuppressWarnings("unchecked")
  private void genAllManagedObject(
    TreeMap<String, AbstractManagedObjectDefinition> list) {
        // ------------------------------------------------------------------------
        // Properties
        // ------------------------------------------------------------------------
    for (AbstractManagedObjectDefinition mo : list.values()) {
      if ((relList.get(mo.getName()) != null) &&
        (relList.get(mo.getName()).hasOption(RelationOption.HIDDEN))) {
        continue;
      }
      moList.put(mo.getName(), mo);
      genManagedObject(mo);
      if (mo.hasChildren()) {
        genAllManagedObject(makeMOTreeMap(mo.getChildren()));
      }
    }
  }
        heading3("Properties");
  private void genManagedObject(AbstractManagedObjectDefinition mo) {
    //------------------------------------------------------------------------
    // Header
    //------------------------------------------------------------------------
    homeLink();
    String title = mo.getUserFriendlyName().toString();
    htmlHeader(DynamicConstants.PRODUCT_NAME + " - " + title);
    // title
    heading2(title);
    // Abstract notice
    if (mo.hasChildren()) {
      paragraph(
        "Note: this is an abstract component, that cannot be instantiated.",
        TextStyle.ITALIC);
    }
    // description
    paragraph(mo.getSynopsis());
    paragraph(mo.getDescription());
    // sub-components
    if (mo.hasChildren()) {
      heading3("Direct Subcomponents");
      paragraph("The following " + mo.getUserFriendlyPluralName() +
        " are available in the server :");
      beginList();
      @SuppressWarnings("unchecked")
      TreeMap<String, AbstractManagedObjectDefinition> children =
        makeMOTreeMap(mo.getChildren());
      for ( AbstractManagedObjectDefinition child : children.values()) {
        link(child.getUserFriendlyName().toString(), child.getName() + ".html");
      }
      endList();
      paragraph("These " + mo.getUserFriendlyPluralName() +
        " inherit from the properties described below.");
    }
    // Parent
    if (!mo.getParent().isTop()) {
      heading3("Parent Component");
      paragraph("The " + mo.getUserFriendlyName() +
        " component inherits from the " +
        getLink(mo.getParent().getUserFriendlyName().toString(),
        mo.getParent().getName() + ".html"));
    }
    // Relations
    generateRelationsSection(mo);
    // Page links in case of LDAP mapping
    if (ldapMapping) {
      newline();
      horizontalLine();
      newline();
      paragraph("This page describes the " + mo.getUserFriendlyName() + ":");
      beginList();
      link("Properties", "#Properties");
      link("LDAP Mapping", "#LDAP Mapping");
      endList();
      newline();
    }
    //------------------------------------------------------------------------
    // Properties
    //------------------------------------------------------------------------
    heading3("Properties");
    paragraph("A description of each property follows.");
    newline();
    TreeMap<String, PropertyDefinition> basicProps =
      new TreeMap<String, PropertyDefinition>();
    TreeMap<String, PropertyDefinition> advancedProps =
      new TreeMap<String, PropertyDefinition>();
    // Properties actually defined in this managed object
    @SuppressWarnings("unchecked")
    Collection<PropertyDefinition> props = mo.getAllPropertyDefinitions();
    for ( PropertyDefinition prop : props) {
      if (prop.hasOption(PropertyOption.ADVANCED)) {
        advancedProps.put(prop.getName(), prop);
      } else {
        basicProps.put(prop.getName(), prop);
      }
    }
    propertiesLinkTable(basicProps, advancedProps);
    // basic properties
    if (basicProps.size() > 0) {
      heading4("Basic Properties");
      for ( PropertyDefinition prop : basicProps.values()) {
        generateProperty(mo, prop);
        paragraph("A description of each property follows.");
        newline();
      }
      newline();
    }
    // advanced properties
    if (advancedProps.size() > 0) {
      heading4("Advanced Properties");
      for ( PropertyDefinition prop : advancedProps.values()) {
        generateProperty(mo, prop);
        newline();
      }
      newline();
    }
    if (ldapMapping) {
      genLdapMapping(mo);
    }
    htmlFooter();
    generateFile(mo.getName() + ".html");
  }
  private TreeMap<String, PropertyDefinition>
    getPropertyList(AbstractManagedObjectDefinition mo) {
    @SuppressWarnings("unchecked")
    Collection<PropertyDefinition> props = mo.getAllPropertyDefinitions();
    return makePropTreeMap(props);
  }
  private void homeLink() {
    htmlBuff.append("<div style=\"font-size:11px;margin-top:-10px;" +
      "margin-bottom:-10px; text-align:right\"><a href=\"" +
      MAIN_FILE +
      "\" target=\"_top\">Configuration Reference Home</a></div>");
  }
  private void generateRelationsSection(AbstractManagedObjectDefinition mo) {
    // Composition relations
    @SuppressWarnings("unchecked")
    Collection<RelationDefinition> compRels = mo.getRelationDefinitions();
    @SuppressWarnings("unchecked")
    Collection<RelationDefinition> reverseCompRels =
      mo.getReverseRelationDefinitions();
    // Aggregation properties
    @SuppressWarnings("unchecked")
    Collection<AggregationPropertyDefinition> aggregProps =
      mo.getAggregationPropertyDefinitions();
    @SuppressWarnings("unchecked")
    Collection<AggregationPropertyDefinition> reverseAggregProps =
      mo.getReverseAggregationPropertyDefinitions();
    // Check if something to print in composition relations
    // (even if the list not empty, it may contain only hidden relations)
    boolean isCompRelsEmpty = true;
    if (!compRels.isEmpty()) {
      for (RelationDefinition rel : compRels) {
        if (rel.hasOption(RelationOption.HIDDEN)) {
          continue;
        }
        isCompRelsEmpty = false;
      }
    }
    boolean isReverseCompRelsEmpty = true;
    if (!reverseCompRels.isEmpty()) {
      for (RelationDefinition rel : reverseCompRels) {
        if (rel.hasOption(RelationOption.HIDDEN)) {
          continue;
        }
        // check if it is not root
        if (rel.getParentDefinition().getName().equals("")) {
          continue;
        }
        isReverseCompRelsEmpty = false;
      }
    }
    // Check if something to print in reverse aggregation relations
    // (even if the list not empty, it may contain only relations from
    // hidden component)
    boolean isReverseAggregPropsEmpty = true;
    if (!reverseAggregProps.isEmpty()) {
      for (AggregationPropertyDefinition agg : reverseAggregProps) {
        AbstractManagedObjectDefinition fromMo =
          agg.getManagedObjectDefinition();
        TreeMap<String, PropertyDefinition> basicProps = new TreeMap<String, PropertyDefinition>();
        TreeMap<String, PropertyDefinition> advancedProps = new TreeMap<String, PropertyDefinition>();
        // Properties actually defined in this managed object
        @SuppressWarnings("unchecked")
        Collection<RelationDefinition> rels =
          fromMo.getAllReverseRelationDefinitions();
        for (RelationDefinition rel : rels) {
          if (rel.hasOption(RelationOption.HIDDEN)) {
            continue;
          }
          isReverseAggregPropsEmpty = false;
        Collection<PropertyDefinition> props = mo.getAllPropertyDefinitions();
        for (PropertyDefinition prop : props) {
            if (prop.hasOption(PropertyOption.ADVANCED)) {
                advancedProps.put(prop.getName(), prop);
            } else {
                basicProps.put(prop.getName(), prop);
            }
        }
      }
    }
        propertiesLinkTable(basicProps, advancedProps);
    //
    // Relations FROM this component
    //
    if (!isCompRelsEmpty || !aggregProps.isEmpty()) {
        heading3("Relations From this Component");
    }
    if (!isCompRelsEmpty) {
      paragraph(
        "The following components have a direct COMPOSITION relation FROM " +
        mo.getUserFriendlyPluralName() + " :");
      for ( RelationDefinition rel : compRels) {
        if (rel.hasOption(RelationOption.HIDDEN)) {
          continue;
        // basic properties
        if (basicProps.size() > 0) {
            heading4("Basic Properties");
            for (PropertyDefinition prop : basicProps.values()) {
                generateProperty(mo, prop);
                newline();
            }
            newline();
        }
        beginList();
        AbstractManagedObjectDefinition childRel = rel.getChildDefinition();
        link(childRel.getUserFriendlyName().toString(), childRel.getName() +
          ".html");
        endList();
      }
    }
    if (!aggregProps.isEmpty()) {
      paragraph(
        "The following components have a direct AGGREGATION relation FROM " +
        mo.getUserFriendlyPluralName() + " :");
      TreeMap<String, AbstractManagedObjectDefinition> componentList =
        new TreeMap<String, AbstractManagedObjectDefinition>();
      for ( AggregationPropertyDefinition agg : aggregProps) {
        RelationDefinition rel = agg.getRelationDefinition();
        AbstractManagedObjectDefinition childRel = rel.getChildDefinition();
        componentList.put(childRel.getName(), childRel);
      }
      for (AbstractManagedObjectDefinition component : componentList.values()) {
        beginList();
        link(component.getUserFriendlyName().toString(), component.getName() +
          ".html");
        endList();
      }
    }
    //
    // Relations TO this component
    //
    if (!isReverseCompRelsEmpty || !isReverseAggregPropsEmpty) {
        heading3("Relations To this Component");
    }
    if (!mo.getReverseRelationDefinitions().isEmpty()) {
      if (!isReverseCompRelsEmpty) {
        paragraph(
          "The following components have a direct COMPOSITION relation TO " +
          mo.getUserFriendlyPluralName() + " :");
        for ( RelationDefinition rel : reverseCompRels) {
          beginList();
          AbstractManagedObjectDefinition childRel = rel.getParentDefinition();
          link(childRel.getUserFriendlyName().toString(), childRel.getName() +
            ".html");
          endList();
        // advanced properties
        if (advancedProps.size() > 0) {
            heading4("Advanced Properties");
            for (PropertyDefinition prop : advancedProps.values()) {
                generateProperty(mo, prop);
                newline();
            }
            newline();
        }
      }
    }
    if (!isReverseAggregPropsEmpty) {
      paragraph(
        "The following components have a direct AGGREGATION relation TO " +
        mo.getUserFriendlyPluralName() + " :");
      TreeMap<String, AbstractManagedObjectDefinition> componentList =
        new TreeMap<String, AbstractManagedObjectDefinition>();
      for ( AggregationPropertyDefinition agg : reverseAggregProps) {
        AbstractManagedObjectDefinition fromMo =
          agg.getManagedObjectDefinition();
        componentList.put(fromMo.getName(), fromMo);
      }
      for (AbstractManagedObjectDefinition component : componentList.values()) {
        beginList();
        link(component.getUserFriendlyName().toString(), component.getName() +
          ".html");
        endList();
      }
        if (ldapMapping) {
            genLdapMapping(mo);
        }
        htmlFooter();
        generateFile(mo.getName() + ".html");
    }
  }
    private TreeMap<String, PropertyDefinition> getPropertyList(AbstractManagedObjectDefinition mo) {
  private void generateProperty(
    AbstractManagedObjectDefinition mo, PropertyDefinition prop) {
    // Property name
    paragraph(getAnchor(prop.getName()) + prop.getName(), TextStyle.STANDARD,
      "propertyname");
    // Property table
    startTable();
    tableRow("Description",
      ((prop.getSynopsis() != null) ? prop.getSynopsis().toString()+ " " : "") +
      ((prop.getDescription() != null) ?
        prop.getDescription().toString() : ""));
    // Default value
    String defValueStr = getDefaultBehaviorString(prop);
    tableRow("Default Value", defValueStr);
    tableRow("Allowed Values", getSyntaxStr(prop));
    tableRow("Multi-valued",
      (prop.hasOption(PropertyOption.MULTI_VALUED) ? "Yes" : "No"));
    if (prop.hasOption(PropertyOption.MANDATORY)) {
      tableRow("Required", "Yes");
    } else {
      tableRow("Required", "No");
        @SuppressWarnings("unchecked")
        Collection<PropertyDefinition> props = mo.getAllPropertyDefinitions();
        return makePropTreeMap(props);
    }
    String action = "None";
    if (prop.getAdministratorAction() != null) {
      Message synopsis = prop.getAdministratorAction().getSynopsis();
      Type actionType = prop.getAdministratorAction().getType();
      String actionStr = "";
      if (actionType == Type.COMPONENT_RESTART) {
        actionStr = "The " + mo.getUserFriendlyName() +
          " must be disabled and re-enabled for changes to this setting " +
          "to take effect";
      } else if (actionType == Type.SERVER_RESTART) {
        actionStr = "Restart the server";
      } else if (actionType == Type.NONE) {
        actionStr = "None";
      }
      String dot = (actionStr.equals("") ? "" : ". ");
      action = actionStr +
        ((synopsis != null) ? dot + synopsis : "");
    }
    tableRow("Admin Action Required", action);
    if (prop.hasOption(PropertyOption.ADVANCED)) {
      tableRow("Advanced Property", "Yes");
    } else {
      tableRow("Advanced Property", "No");
    private void homeLink() {
        htmlBuff.append("<div style=\"font-size:11px;margin-top:-10px;"
                + "margin-bottom:-10px; text-align:right\"><a href=\"" + MAIN_FILE
                + "\" target=\"_top\">Configuration Reference Home</a></div>");
    }
    if (prop.hasOption(PropertyOption.READ_ONLY)) {
      tableRow("Read-only", "Yes");
    } else {
      tableRow("Read-only", "No");
    private void generateRelationsSection(AbstractManagedObjectDefinition mo) {
        // Composition relations
        @SuppressWarnings("unchecked")
        Collection<RelationDefinition> compRels = mo.getRelationDefinitions();
        @SuppressWarnings("unchecked")
        Collection<RelationDefinition> reverseCompRels = mo.getReverseRelationDefinitions();
        // Aggregation properties
        @SuppressWarnings("unchecked")
        Collection<AggregationPropertyDefinition> aggregProps = mo.getAggregationPropertyDefinitions();
        @SuppressWarnings("unchecked")
        Collection<AggregationPropertyDefinition> reverseAggregProps = mo.getReverseAggregationPropertyDefinitions();
        // Check if something to print in composition relations
        // (even if the list not empty, it may contain only hidden relations)
        boolean isCompRelsEmpty = true;
        if (!compRels.isEmpty()) {
            for (RelationDefinition rel : compRels) {
                if (rel.hasOption(RelationOption.HIDDEN)) {
                    continue;
                }
                isCompRelsEmpty = false;
            }
        }
        boolean isReverseCompRelsEmpty = true;
        if (!reverseCompRels.isEmpty()) {
            for (RelationDefinition rel : reverseCompRels) {
                if (rel.hasOption(RelationOption.HIDDEN)) {
                    continue;
                }
                // check if it is not root
                if (rel.getParentDefinition().getName().equals("")) {
                    continue;
                }
                isReverseCompRelsEmpty = false;
            }
        }
        // Check if something to print in reverse aggregation relations
        // (even if the list not empty, it may contain only relations from
        // hidden component)
        boolean isReverseAggregPropsEmpty = true;
        if (!reverseAggregProps.isEmpty()) {
            for (AggregationPropertyDefinition agg : reverseAggregProps) {
                AbstractManagedObjectDefinition fromMo = agg.getManagedObjectDefinition();
                @SuppressWarnings("unchecked")
                Collection<RelationDefinition> rels = fromMo.getAllReverseRelationDefinitions();
                for (RelationDefinition rel : rels) {
                    if (rel.hasOption(RelationOption.HIDDEN)) {
                        continue;
                    }
                    isReverseAggregPropsEmpty = false;
                }
            }
        }
        //
        // Relations FROM this component
        //
        if (!isCompRelsEmpty || !aggregProps.isEmpty()) {
            heading3("Relations From this Component");
        }
        if (!isCompRelsEmpty) {
            paragraph("The following components have a direct COMPOSITION relation FROM "
                    + mo.getUserFriendlyPluralName() + " :");
            for (RelationDefinition rel : compRels) {
                if (rel.hasOption(RelationOption.HIDDEN)) {
                    continue;
                }
                beginList();
                AbstractManagedObjectDefinition childRel = rel.getChildDefinition();
                link(childRel.getUserFriendlyName().toString(), childRel.getName() + ".html");
                endList();
            }
        }
        if (!aggregProps.isEmpty()) {
            paragraph("The following components have a direct AGGREGATION relation FROM "
                    + mo.getUserFriendlyPluralName() + " :");
            TreeMap<String, AbstractManagedObjectDefinition> componentList = new TreeMap<String, AbstractManagedObjectDefinition>();
            for (AggregationPropertyDefinition agg : aggregProps) {
                RelationDefinition rel = agg.getRelationDefinition();
                AbstractManagedObjectDefinition childRel = rel.getChildDefinition();
                componentList.put(childRel.getName(), childRel);
            }
            for (AbstractManagedObjectDefinition component : componentList.values()) {
                beginList();
                link(component.getUserFriendlyName().toString(), component.getName() + ".html");
                endList();
            }
        }
        //
        // Relations TO this component
        //
        if (!isReverseCompRelsEmpty || !isReverseAggregPropsEmpty) {
            heading3("Relations To this Component");
        }
        if (!mo.getReverseRelationDefinitions().isEmpty()) {
            if (!isReverseCompRelsEmpty) {
                paragraph("The following components have a direct COMPOSITION relation TO "
                        + mo.getUserFriendlyPluralName() + " :");
                for (RelationDefinition rel : reverseCompRels) {
                    beginList();
                    AbstractManagedObjectDefinition childRel = rel.getParentDefinition();
                    link(childRel.getUserFriendlyName().toString(), childRel.getName() + ".html");
                    endList();
                }
            }
        }
        if (!isReverseAggregPropsEmpty) {
            paragraph("The following components have a direct AGGREGATION relation TO "
                    + mo.getUserFriendlyPluralName() + " :");
            TreeMap<String, AbstractManagedObjectDefinition> componentList = new TreeMap<String, AbstractManagedObjectDefinition>();
            for (AggregationPropertyDefinition agg : reverseAggregProps) {
                AbstractManagedObjectDefinition fromMo = agg.getManagedObjectDefinition();
                componentList.put(fromMo.getName(), fromMo);
            }
            for (AbstractManagedObjectDefinition component : componentList.values()) {
                beginList();
                link(component.getUserFriendlyName().toString(), component.getName() + ".html");
                endList();
            }
        }
    }
    endTable();
    private void generateProperty(AbstractManagedObjectDefinition mo, PropertyDefinition prop) {
  }
        // Property name
        paragraph(getAnchor(prop.getName()) + prop.getName(), TextStyle.STANDARD, "propertyname");
        // Property table
        startTable();
        tableRow("Description",
                ((prop.getSynopsis() != null) ? prop.getSynopsis().toString() + " " : "")
                        + ((prop.getDescription() != null) ? prop.getDescription().toString() : ""));
  private void propertiesLinkTable(TreeMap<String,
    PropertyDefinition> basicProps,
    TreeMap<String, PropertyDefinition> advancedProps) {
    htmlBuff.append(
      "<table border=\"0\" cellspacing=\"0\" class=\"jump-table\">\n" +
      "  <tr>\n" +
      "    <th>Basic Properties:</th>\n" +
      "    <th>Advanced Properties:</th>\n" +
      "  </tr>\n");
        // Default value
        String defValueStr = getDefaultBehaviorString(prop);
        tableRow("Default Value", defValueStr);
    PropertyDefinition[] basicPropsArray =
      basicProps.values().toArray(new PropertyDefinition[0]);
    PropertyDefinition[] advancedPropsArray =
      advancedProps.values().toArray(new PropertyDefinition[0]);
        tableRow("Allowed Values", getSyntaxStr(prop));
    for (int ii=0;
        (ii < basicPropsArray.length) || (ii < advancedPropsArray.length);
        ii++) {
      String basicPropName =
        ii < basicPropsArray.length ? basicPropsArray[ii].getName() : null;
      String advancedPropName =
        ii < advancedPropsArray.length ?
          advancedPropsArray[ii].getName() : null;
        tableRow("Multi-valued", (prop.hasOption(PropertyOption.MULTI_VALUED) ? "Yes" : "No"));
      String basicHtmlCell = "";
      if (basicPropName != null) {
        basicHtmlCell = "  <td>&darr;&nbsp;<a href=\"#" + basicPropName + "\">"
          + basicPropName + "</a></td>\n";
      } else if ((basicPropsArray.length == 0) && (ii == 0)) {
        basicHtmlCell = "  <td>&nbsp;None</td>\n";
      } else if (ii >= basicPropsArray.length) {
        // Case of nb of basic props < nb of advanced props
        basicHtmlCell = "  <td></td>\n";
      }
      String advancedHtmlCell = "";
      if (advancedPropName != null) {
        advancedHtmlCell = "  <td>&darr;&nbsp;<a href=\"#" + advancedPropName +
          "\">" + advancedPropName + "</a></td>\n";
      } else if ((advancedPropsArray.length == 0) && (ii == 0)) {
        advancedHtmlCell = "  <td>&nbsp;None</td>\n";
      }
      htmlBuff.append("<tr>\n");
      htmlBuff.append(basicHtmlCell + advancedHtmlCell);
      htmlBuff.append("</tr>\n");
    }
    htmlBuff.append("</table>\n");
  }
  private void genLdapMapping(AbstractManagedObjectDefinition mo) {
    //------------------------------------------------------------------------
    // LDAP mapping
    //------------------------------------------------------------------------
    heading3("LDAP Mapping");
    paragraph(
      "Each configuration property can be mapped to a specific " +
      "LDAP attribute under the \"cn=config\" entry. " +
      "The mappings that follow are provided for information only. " +
      "In general, you should avoid changing the server configuration " +
      "by manipulating the LDAP attributes directly.");
    // Managed object table
    startTable();
    LDAPProfile ldapProfile = LDAPProfile.getInstance();
    tableRow("Base DN", getBaseDN(mo, ldapProfile));
    tableRow("objectclass name", ldapProfile.getObjectClass(mo));
    if (mo.getParent().getName() != null) {
      String superior = "";
      if (mo.getParent().getName().equals("top")) {
        superior = "top";
      } else {
        if (moList.get(mo.getParent().getName()) != null) {
          superior =
            ldapProfile.getObjectClass(moList.get(mo.getParent().getName()));
        if (prop.hasOption(PropertyOption.MANDATORY)) {
            tableRow("Required", "Yes");
        } else {
          System.err.println(
            "Error: managed object " + mo.getName() + " not found.");
            tableRow("Required", "No");
        }
      }
      tableRow("objectclass superior", superior);
    } else {
      System.err.println(
        "Error: objectclass superior not found for " + mo.getName());
    }
    endTable();
    newline();
    // Properties table
    startTable();
    tableRow("Property", "LDAP attribute");
    for ( PropertyDefinition prop : getPropertyList(mo).values()) {
      tableRow(prop.getName(), ldapProfile.getAttributeName(mo, prop));
        String action = "None";
        if (prop.getAdministratorAction() != null) {
            LocalizableMessage synopsis = prop.getAdministratorAction().getSynopsis();
            Type actionType = prop.getAdministratorAction().getType();
            String actionStr = "";
            if (actionType == Type.COMPONENT_RESTART) {
                actionStr = "The " + mo.getUserFriendlyName()
                        + " must be disabled and re-enabled for changes to this setting " + "to take effect";
            } else if (actionType == Type.SERVER_RESTART) {
                actionStr = "Restart the server";
            } else if (actionType == Type.NONE) {
                actionStr = "None";
            }
            String dot = (actionStr.equals("") ? "" : ". ");
            action = actionStr + ((synopsis != null) ? dot + synopsis : "");
        }
        tableRow("Admin Action Required", action);
        if (prop.hasOption(PropertyOption.ADVANCED)) {
            tableRow("Advanced Property", "Yes");
        } else {
            tableRow("Advanced Property", "No");
        }
        if (prop.hasOption(PropertyOption.READ_ONLY)) {
            tableRow("Read-only", "Yes");
        } else {
            tableRow("Read-only", "No");
        }
        endTable();
    }
    endTable();
    private void propertiesLinkTable(TreeMap<String, PropertyDefinition> basicProps,
            TreeMap<String, PropertyDefinition> advancedProps) {
        htmlBuff.append("<table border=\"0\" cellspacing=\"0\" class=\"jump-table\">\n" + "  <tr>\n"
                + "    <th>Basic Properties:</th>\n" + "    <th>Advanced Properties:</th>\n" + "  </tr>\n");
  }
        PropertyDefinition[] basicPropsArray = basicProps.values().toArray(new PropertyDefinition[0]);
        PropertyDefinition[] advancedPropsArray = advancedProps.values().toArray(new PropertyDefinition[0]);
  private void genManagedObjectList(
    TreeMap<String, AbstractManagedObjectDefinition> list) {
        for (int ii = 0; (ii < basicPropsArray.length) || (ii < advancedPropsArray.length); ii++) {
            String basicPropName = ii < basicPropsArray.length ? basicPropsArray[ii].getName() : null;
            String advancedPropName = ii < advancedPropsArray.length ? advancedPropsArray[ii].getName() : null;
    htmlHeader(DynamicConstants.PRODUCT_NAME
            + " Configuration Reference - Components View");
    tabMenu(MO_LIST_FILE);
    viewHelp("This view provides a list of all configuration components, " +
      "in alphabetical order.");
            String basicHtmlCell = "";
            if (basicPropName != null) {
                basicHtmlCell = "  <td>&darr;&nbsp;<a href=\"#" + basicPropName + "\">" + basicPropName + "</a></td>\n";
            } else if ((basicPropsArray.length == 0) && (ii == 0)) {
                basicHtmlCell = "  <td>&nbsp;None</td>\n";
            } else if (ii >= basicPropsArray.length) {
                // Case of nb of basic props < nb of advanced props
                basicHtmlCell = "  <td></td>\n";
            }
    newline();
    StringBuffer moPointers = new StringBuffer();
    String lettersPointers = "";
    String firstChar = ".";
    for (AbstractManagedObjectDefinition mo : list.values()) {
      if (!mo.getName().startsWith(firstChar)) {
        firstChar = mo.getName().substring(0, 1);
        String letter = firstChar.toUpperCase();
        moPointers.append(getAnchor(letter) + getHeading2(letter));
        lettersPointers += getLink(letter, "#" + letter) + " ";
      }
      moPointers.append(
        "<p> " +
        getLink(mo.getUserFriendlyName().toString(), mo.getName() + ".html",
        MAIN_FRAME) +
        "</p>\n");
    }
    paragraph(lettersPointers);
    htmlBuff.append(moPointers);
    htmlFooter();
    generateFile(MO_LIST_FILE);
  }
            String advancedHtmlCell = "";
            if (advancedPropName != null) {
                advancedHtmlCell = "  <td>&darr;&nbsp;<a href=\"#" + advancedPropName + "\">" + advancedPropName
                        + "</a></td>\n";
            } else if ((advancedPropsArray.length == 0) && (ii == 0)) {
                advancedHtmlCell = "  <td>&nbsp;None</td>\n";
            }
  private void genPropertiesIndex() {
    // Build a sorted list of (property name + its managed object name)
    TreeSet<String> propMoList = new TreeSet<String>();
    for (AbstractManagedObjectDefinition<?, ?> mo : moList.values()) {
      for (PropertyDefinition<?> prop : mo.getPropertyDefinitions()) {
        propMoList.add(
          prop.getName() + "," + prop.getManagedObjectDefinition().getName());
      }
            htmlBuff.append("<tr>\n");
            htmlBuff.append(basicHtmlCell + advancedHtmlCell);
            htmlBuff.append("</tr>\n");
        }
        htmlBuff.append("</table>\n");
    }
    String lettersPointers = "";
    String firstChar = ".";
    for (String propMoStr : propMoList) {
      String[] propMoArray = propMoStr.split(",");
      String propName = propMoArray[0];
      AbstractManagedObjectDefinition mo = moList.get(propMoArray[1]);
      if (!propName.startsWith(firstChar)) {
        firstChar = propName.substring(0, 1);
        String letter = firstChar.toUpperCase();
        htmlBuff.append(getAnchor(letter) + getHeading2(letter));
        lettersPointers += getLink(letter, "#" + letter) + " ";
      }
      String propLink = getLink(propName,
        mo.getName() + ".html" + "#" + propName, MAIN_FRAME);
      String moLink =
        getLink(mo.getUserFriendlyName().toString(), mo.getName() + ".html",
        MAIN_FRAME, "#666");
      paragraph(propLink + "  [ " + moLink + " ]");
    private void genLdapMapping(AbstractManagedObjectDefinition mo) {
        // ------------------------------------------------------------------------
        // LDAP mapping
        // ------------------------------------------------------------------------
        heading3("LDAP Mapping");
        paragraph("Each configuration property can be mapped to a specific "
                + "LDAP attribute under the \"cn=config\" entry. "
                + "The mappings that follow are provided for information only. "
                + "In general, you should avoid changing the server configuration "
                + "by manipulating the LDAP attributes directly.");
        // Managed object table
        startTable();
        LDAPProfile ldapProfile = LDAPProfile.getInstance();
        tableRow("Base DN", getBaseDN(mo, ldapProfile));
        tableRow("objectclass name", ldapProfile.getObjectClass(mo));
        if (mo.getParent().getName() != null) {
            String superior = "";
            if (mo.getParent().getName().equals("top")) {
                superior = "top";
            } else {
                if (moList.get(mo.getParent().getName()) != null) {
                    superior = ldapProfile.getObjectClass(moList.get(mo.getParent().getName()));
                } else {
                    System.err.println("Error: managed object " + mo.getName() + " not found.");
                }
            }
            tableRow("objectclass superior", superior);
        } else {
            System.err.println("Error: objectclass superior not found for " + mo.getName());
        }
        endTable();
        newline();
        // Properties table
        startTable();
        tableRow("Property", "LDAP attribute");
        for (PropertyDefinition prop : getPropertyList(mo).values()) {
            tableRow(prop.getName(), ldapProfile.getAttributeName(mo, prop));
        }
        endTable();
    }
    String indexBody = htmlBuff.toString();
    htmlBuff = new StringBuffer();
    htmlHeader(DynamicConstants.PRODUCT_NAME +
            " Configuration Reference - Properties View");
    tabMenu(PROPERTIES_INDEX_FILE);
    viewHelp("This view provides a list of all configuration properties, " +
      "in alphabetical order, and indicates the configuration component to " +
      "which each property applies.");
    private void genManagedObjectList(TreeMap<String, AbstractManagedObjectDefinition> list) {
    newline();
    paragraph(lettersPointers);
    htmlBuff.append(indexBody);
    htmlFooter();
    generateFile(PROPERTIES_INDEX_FILE);
  }
        htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Components View");
        tabMenu(MO_LIST_FILE);
        viewHelp("This view provides a list of all configuration components, " + "in alphabetical order.");
        newline();
        StringBuffer moPointers = new StringBuffer();
        String lettersPointers = "";
        String firstChar = ".";
        for (AbstractManagedObjectDefinition mo : list.values()) {
            if (!mo.getName().startsWith(firstChar)) {
                firstChar = mo.getName().substring(0, 1);
                String letter = firstChar.toUpperCase();
                moPointers.append(getAnchor(letter) + getHeading2(letter));
                lettersPointers += getLink(letter, "#" + letter) + " ";
            }
            moPointers.append("<p> " + getLink(mo.getUserFriendlyName().toString(), mo.getName() + ".html", MAIN_FRAME)
                    + "</p>\n");
        }
        paragraph(lettersPointers);
        htmlBuff.append(moPointers);
        htmlFooter();
        generateFile(MO_LIST_FILE);
    }
    private void genPropertiesIndex() {
        // Build a sorted list of (property name + its managed object name)
        TreeSet<String> propMoList = new TreeSet<String>();
        for (AbstractManagedObjectDefinition<?, ?> mo : moList.values()) {
            for (PropertyDefinition<?> prop : mo.getPropertyDefinitions()) {
                propMoList.add(prop.getName() + "," + prop.getManagedObjectDefinition().getName());
            }
        }
        String lettersPointers = "";
        String firstChar = ".";
        for (String propMoStr : propMoList) {
            String[] propMoArray = propMoStr.split(",");
            String propName = propMoArray[0];
            AbstractManagedObjectDefinition mo = moList.get(propMoArray[1]);
            if (!propName.startsWith(firstChar)) {
                firstChar = propName.substring(0, 1);
                String letter = firstChar.toUpperCase();
                htmlBuff.append(getAnchor(letter) + getHeading2(letter));
                lettersPointers += getLink(letter, "#" + letter) + " ";
            }
            String propLink = getLink(propName, mo.getName() + ".html" + "#" + propName, MAIN_FRAME);
            String moLink = getLink(mo.getUserFriendlyName().toString(), mo.getName() + ".html", MAIN_FRAME, "#666");
            paragraph(propLink + "  [ " + moLink + " ]");
        }
        String indexBody = htmlBuff.toString();
        htmlBuff = new StringBuffer();
        htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Properties View");
        tabMenu(PROPERTIES_INDEX_FILE);
        viewHelp("This view provides a list of all configuration properties, "
                + "in alphabetical order, and indicates the configuration component to "
                + "which each property applies.");
        newline();
        paragraph(lettersPointers);
        htmlBuff.append(indexBody);
        htmlFooter();
        generateFile(PROPERTIES_INDEX_FILE);
    }
    private void genWelcomePage() {
    htmlHeader(DynamicConstants.PRODUCT_NAME +
            " Configuration Reference - Welcome");
    heading2("About This Reference");
    paragraph("This reference " +
      "describes the " + DynamicConstants.PRODUCT_NAME +
      " configuration properties that can be manipulated " +
      "with the dsconfig command.");
    paragraph("Configuration components are grouped according to the area of " +
      "the server in which they are used, as follows:");
        htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Welcome");
        heading2("About This Reference");
        paragraph("This reference " + "describes the " + DynamicConstants.PRODUCT_NAME
                + " configuration properties that can be manipulated " + "with the dsconfig command.");
        paragraph("Configuration components are grouped according to the area of "
                + "the server in which they are used, as follows:");
    beginList();
    for (String catName : catTopMoList.keySet()) {
      bullet(getFriendlyName(catName));
    }
    endList();
    paragraph(
      "For ease of reference, the configuration is described on multiple " +
      "tabs. These tabs provide alternative views of the configuration " +
      "components:");
    beginList();
    bullet("The <strong>Inheritance</strong> view represents the inheritance " +
      "relationships between configuration components. A sub-component " +
      "inherits all of the properties of its parent component.");
    bullet("The <strong>Structure</strong> view represents the structural " +
      "relationships between components and indicates how certain components " +
      "can exist only within container components. When a container " +
      "component is deleted, all of the components within it are also " +
      "deleted.");
    bullet(
      "The <strong>Components</strong> view provides an alphabetical list " +
      "of all configuration components.");
    bullet(
      "The <strong>Properties</strong> view provides an alphabetical list " +
      "of all configuration properties, and indicates the configuration " +
      "component to which each property applies.");
    endList();
    newline();
    paragraph("When you set up " +
            DynamicConstants.PRODUCT_NAME +
            ", certain components are created in the " +
      "configuration by default. These components are configured with " +
      "specific values, which are not necessarily the same as the " +
      "\"default values\" of new components that you create using dsconfig. " +
      "The \"default values\" listed in this document refer to the values " +
      "of the new components that you create using dsconfig.");
    htmlFooter();
    generateFile(WELCOME_FILE);
  }
  private void genMainTopPage() {
    htmlHeader(DynamicConstants.PRODUCT_NAME +
            " Configuration Reference - Main Top");
    htmlBuff.append("<div class=\"breadcrumb\"><span class=\"pageactions\">" +
      "<a href=\"" + OpenDJHome + "\" target=\"_parent\">" +
      "<span style=\"font-size: 12px;\">&laquo;&nbsp;&nbsp;</span>" +
      "Back to " +
      DynamicConstants.PRODUCT_NAME + " Home</a></span>&nbsp;&nbsp;</div>\n");
    htmlBuff.append("<table class=\"titletable\" cellspacing=\"0\" " +
      "width=\"100%\">\n");
    htmlBuff.append("<tbody><tr>\n");
    htmlBuff.append("  <td><h2>"+
            DynamicConstants.PRODUCT_NAME +
            " Configuration Reference</h2></td>\n");
    htmlBuff.append("  <td valign=\"bottom\" width=\"10%\">" +
      "<a href=\"" + OpenDJHome + "\" target=\"_parent\">" +
      "<img src=\"opendj_logo_sm.png\" alt=\"OpenDJ Logo\" align=\"bottom\" " +
      "border=\"0\" height=\"33\" width=\"114\"></a></td>\n");
    htmlBuff.append("</tr>\n");
    htmlBuff.append("</tbody></table>\n");
    htmlFooter();
    generateFile(MAINTOP_FILE);
  }
  private void genIndexPage() {
    htmlBuff.append(getHtmlHeader(
            DynamicConstants.PRODUCT_NAME + " Configuration Reference"));
    htmlBuff.append("<frameset rows=\"80,*\" framespacing=\"1\" " +
      "frameborder=\"yes\" border=\"1\" bordercolor=\"#333333\">\n");
    htmlBuff.append("  <frame src=\"" + MAINTOP_FILE + "\" name=\"topFrame\" " +
      "id=\"topFrame\" border=\"1\" title=\"topFrame\" scrolling=\"no\">\n");
    htmlBuff.append("  <frameset cols=\"375,*\" frameborder=\"yes\" " +
      "border=\"1\" " +
      "framespacing=\"1\">\n");
    htmlBuff.append("     <frame src=\"" + INHERITANCE_TREE_FILE + "\" " +
      "name=\"leftFrame\" id=\"leftFrame\" title=\"leftFrame\" " +
      "scrolling=\"auto\">\n");
    htmlBuff.append("     <frame src=\"" + WELCOME_FILE +
      "\" name=\"mainFrame\" " +
      "id=\"mainFrame\" title=\"mainFrame\" scrolling=\"auto\">\n");
    htmlBuff.append("   </frameset>\n");
    htmlBuff.append("</frameset>\n");
    htmlBuff.append("<noframes><body>\n");
    htmlBuff.append("</body>\n");
    htmlBuff.append("</noframes>\n");
    htmlBuff.append("</html>\n");
    generateFile(INDEX_FILE);
  }
  private String getBaseDN(
    AbstractManagedObjectDefinition mo, LDAPProfile ldapProfile) {
    RelationDefinition rel = relList.get(mo.getName());
    if (rel != null) {
      String baseDn = ldapProfile.getRelationRDNSequence(rel);
      if (!baseDn.equals("")) {
        return baseDn;
      } else {
        // Check the parent relation
        return getBaseDN(rel.getParentDefinition(), ldapProfile);
      }
    } else if (moList.get(mo.getParent().getName()) != null) {
      // check its superior
      return getBaseDN(moList.get(mo.getParent().getName()), ldapProfile);
    } else {
      System.err.println("Error: Base DN not found for " + mo.getName());
    }
    return null;
  }
  @SuppressWarnings("unchecked")
  private String getSyntaxStr(PropertyDefinition prop) {
    // Create a visitor for performing syntax specific processing.
    PropertyDefinitionVisitor<String, Void> visitor =
      new PropertyDefinitionVisitor<String, Void>() {
      @Override
      public String visitACI(ACIPropertyDefinition prop, Void p) {
        return getLink("An ACI Syntax", aciSyntaxPage);
      }
      @Override
      public String visitAggregation(
        AggregationPropertyDefinition prop, Void p) {
        RelationDefinition rel = prop.getRelationDefinition();
        String linkStr = getLink(rel.getUserFriendlyName().toString(),
          rel.getName() + ".html");
      return "The DN of any " +  linkStr + ". " +
        ((prop.getSourceConstraintSynopsis() != null) ?
          prop.getSourceConstraintSynopsis().toString() : "");
      }
      @Override
      public String visitAttributeType(
        AttributeTypePropertyDefinition prop, Void p) {
        return "The name of an attribute type defined in the server schema.";
      }
      @Override
      public String visitBoolean(BooleanPropertyDefinition prop, Void p) {
        return "true" + getNewLine() + "false";
      }
      @Override
      public String visitClass(ClassPropertyDefinition prop, Void p) {
        String classStr =
          "A java class that implements or extends the class(es) :";
        for (String clazz : prop.getInstanceOfInterface()) {
          classStr += getNewLine() + clazz;
        beginList();
        for (String catName : catTopMoList.keySet()) {
            bullet(getFriendlyName(catName));
        }
        return classStr;
      }
        endList();
      @Override
      public String visitDN(DNPropertyDefinition prop, Void p) {
        String retStr = "A valid DN.";
        if (prop.getBaseDN() != null) {
          retStr += prop.getBaseDN().toString();
        paragraph("For ease of reference, the configuration is described on multiple "
                + "tabs. These tabs provide alternative views of the configuration " + "components:");
        beginList();
        bullet("The <strong>Inheritance</strong> view represents the inheritance "
                + "relationships between configuration components. A sub-component "
                + "inherits all of the properties of its parent component.");
        bullet("The <strong>Structure</strong> view represents the structural "
                + "relationships between components and indicates how certain components "
                + "can exist only within container components. When a container "
                + "component is deleted, all of the components within it are also " + "deleted.");
        bullet("The <strong>Components</strong> view provides an alphabetical list "
                + "of all configuration components.");
        bullet("The <strong>Properties</strong> view provides an alphabetical list "
                + "of all configuration properties, and indicates the configuration "
                + "component to which each property applies.");
        endList();
        newline();
        paragraph("When you set up " + DynamicConstants.PRODUCT_NAME + ", certain components are created in the "
                + "configuration by default. These components are configured with "
                + "specific values, which are not necessarily the same as the "
                + "\"default values\" of new components that you create using dsconfig. "
                + "The \"default values\" listed in this document refer to the values "
                + "of the new components that you create using dsconfig.");
        htmlFooter();
        generateFile(WELCOME_FILE);
    }
    private void genMainTopPage() {
        htmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference - Main Top");
        htmlBuff.append("<div class=\"breadcrumb\"><span class=\"pageactions\">" + "<a href=\"" + OpenDJHome
                + "\" target=\"_parent\">" + "<span style=\"font-size: 12px;\">&laquo;&nbsp;&nbsp;</span>" + "Back to "
                + DynamicConstants.PRODUCT_NAME + " Home</a></span>&nbsp;&nbsp;</div>\n");
        htmlBuff.append("<table class=\"titletable\" cellspacing=\"0\" " + "width=\"100%\">\n");
        htmlBuff.append("<tbody><tr>\n");
        htmlBuff.append("  <td><h2>" + DynamicConstants.PRODUCT_NAME + " Configuration Reference</h2></td>\n");
        htmlBuff.append("  <td valign=\"bottom\" width=\"10%\">" + "<a href=\"" + OpenDJHome + "\" target=\"_parent\">"
                + "<img src=\"opendj_logo_sm.png\" alt=\"OpenDJ Logo\" align=\"bottom\" "
                + "border=\"0\" height=\"33\" width=\"114\"></a></td>\n");
        htmlBuff.append("</tr>\n");
        htmlBuff.append("</tbody></table>\n");
        htmlFooter();
        generateFile(MAINTOP_FILE);
    }
    private void genIndexPage() {
        htmlBuff.append(getHtmlHeader(DynamicConstants.PRODUCT_NAME + " Configuration Reference"));
        htmlBuff.append("<frameset rows=\"80,*\" framespacing=\"1\" "
                + "frameborder=\"yes\" border=\"1\" bordercolor=\"#333333\">\n");
        htmlBuff.append("  <frame src=\"" + MAINTOP_FILE + "\" name=\"topFrame\" "
                + "id=\"topFrame\" border=\"1\" title=\"topFrame\" scrolling=\"no\">\n");
        htmlBuff.append("  <frameset cols=\"375,*\" frameborder=\"yes\" " + "border=\"1\" " + "framespacing=\"1\">\n");
        htmlBuff.append("     <frame src=\"" + INHERITANCE_TREE_FILE + "\" "
                + "name=\"leftFrame\" id=\"leftFrame\" title=\"leftFrame\" " + "scrolling=\"auto\">\n");
        htmlBuff.append("     <frame src=\"" + WELCOME_FILE + "\" name=\"mainFrame\" "
                + "id=\"mainFrame\" title=\"mainFrame\" scrolling=\"auto\">\n");
        htmlBuff.append("   </frameset>\n");
        htmlBuff.append("</frameset>\n");
        htmlBuff.append("<noframes><body>\n");
        htmlBuff.append("</body>\n");
        htmlBuff.append("</noframes>\n");
        htmlBuff.append("</html>\n");
        generateFile(INDEX_FILE);
    }
    private String getBaseDN(AbstractManagedObjectDefinition mo, LDAPProfile ldapProfile) {
        RelationDefinition rel = relList.get(mo.getName());
        if (rel != null) {
            String baseDn = ldapProfile.getRelationRDNSequence(rel);
            if (!baseDn.equals("")) {
                return baseDn;
            } else {
                // Check the parent relation
                return getBaseDN(rel.getParentDefinition(), ldapProfile);
            }
        } else if (moList.get(mo.getParent().getName()) != null) {
            // check its superior
            return getBaseDN(moList.get(mo.getParent().getName()), ldapProfile);
        } else {
            System.err.println("Error: Base DN not found for " + mo.getName());
        }
        return null;
    }
    @SuppressWarnings("unchecked")
    private String getSyntaxStr(PropertyDefinition prop) {
        // Create a visitor for performing syntax specific processing.
        PropertyDefinitionVisitor<String, Void> visitor = new PropertyDefinitionVisitor<String, Void>() {
            @Override
            public String visitACI(ACIPropertyDefinition prop, Void p) {
                return getLink("An ACI Syntax", aciSyntaxPage);
            }
            @Override
            public String visitAggregation(AggregationPropertyDefinition prop, Void p) {
                RelationDefinition rel = prop.getRelationDefinition();
                String linkStr = getLink(rel.getUserFriendlyName().toString(), rel.getName() + ".html");
                return "The DN of any "
                        + linkStr
                        + ". "
                        + ((prop.getSourceConstraintSynopsis() != null) ? prop.getSourceConstraintSynopsis().toString()
                                : "");
            }
            @Override
            public String visitAttributeType(AttributeTypePropertyDefinition prop, Void p) {
                return "The name of an attribute type defined in the server schema.";
            }
            @Override
            public String visitBoolean(BooleanPropertyDefinition prop, Void p) {
                return "true" + getNewLine() + "false";
            }
            @Override
            public String visitClass(ClassPropertyDefinition prop, Void p) {
                String classStr = "A java class that implements or extends the class(es) :";
                for (String clazz : prop.getInstanceOfInterface()) {
                    classStr += getNewLine() + clazz;
                }
                return classStr;
            }
            @Override
            public String visitDN(DNPropertyDefinition prop, Void p) {
                String retStr = "A valid DN.";
                if (prop.getBaseDN() != null) {
                    retStr += prop.getBaseDN().toString();
                }
                return retStr;
            }
            @Override
            public String visitDuration(DurationPropertyDefinition prop, Void p) {
                String durationStr = "";
                durationStr += getLink("A duration Syntax", durationSyntaxPage) + ". ";
                if (prop.isAllowUnlimited()) {
                    durationStr += "A value of \"-1\" or \"unlimited\" for no limit. ";
                }
                if (prop.getMaximumUnit() != null) {
                    durationStr += "Maximum unit is \"" + prop.getMaximumUnit().getLongName() + "\". ";
                }
                long lowerLimitStr = new Double(prop.getBaseUnit().fromMilliSeconds(prop.getLowerLimit())).longValue();
                durationStr += "Lower limit is " + lowerLimitStr + " " + prop.getBaseUnit().getLongName() + ". ";
                if (prop.getUpperLimit() != null) {
                    long upperLimitStr = new Double(prop.getBaseUnit().fromMilliSeconds(prop.getUpperLimit()))
                            .longValue();
                    durationStr += "Upper limit is " + upperLimitStr + " " + prop.getBaseUnit().getLongName() + ". ";
                }
                return durationStr;
            }
            @Override
            public String visitEnum(EnumPropertyDefinition prop, Void p) {
                String enumStr = "";
                Class en = prop.getEnumClass();
                for (Object cst : en.getEnumConstants()) {
                    enumStr += cst.toString();
                    if (prop.getValueSynopsis((Enum) cst) != null) {
                        enumStr += " - " + prop.getValueSynopsis((Enum) cst).toString();
                    }
                    enumStr += getNewLine() + getNewLine();
                }
                return enumStr;
            }
            @Override
            public String visitInteger(IntegerPropertyDefinition prop, Void p) {
                String intStr = "An integer value.";
                intStr += " Lower value is " + prop.getLowerLimit() + ".";
                if (prop.getUpperLimit() != null) {
                    intStr += " Upper value is " + prop.getUpperLimit() + " .";
                }
                if (prop.isAllowUnlimited()) {
                    intStr += " A value of \"-1\" or \"unlimited\" for no limit.";
                }
                if (prop.getUnitSynopsis() != null) {
                    intStr += " Unit is " + prop.getUnitSynopsis() + ".";
                }
                return intStr;
            }
            @Override
            public String visitIPAddress(IPAddressPropertyDefinition prop, Void p) {
                return "An IP address";
            }
            @Override
            public String visitIPAddressMask(IPAddressMaskPropertyDefinition prop, Void p) {
                return "An IP address mask";
            }
            @Override
            public String visitSize(SizePropertyDefinition prop, Void p) {
                String sizeStr = "A positive integer representing a size.";
                if (prop.getLowerLimit() != 0) {
                    sizeStr += " Lower value is " + prop.getLowerLimit() + ".";
                }
                if (prop.getUpperLimit() != null) {
                    sizeStr += " Upper value is " + prop.getUpperLimit() + " .";
                }
                if (prop.isAllowUnlimited()) {
                    sizeStr += " A value of \"-1\" or \"unlimited\" for no limit.";
                }
                return sizeStr;
            }
            @Override
            public String visitString(StringPropertyDefinition prop, Void p) {
                String retStr = "A String";
                if (prop.getPatternSynopsis() != null) {
                    retStr = prop.getPatternSynopsis().toString();
                }
                return retStr;
            }
            @Override
            public String visitUnknown(PropertyDefinition prop, Void p) {
                return "Unknown";
            }
        };
        // Invoke the visitor against the property definition.
        return (String) prop.accept(visitor, null);
    }
    @SuppressWarnings("unchecked")
    private String getDefaultBehaviorString(PropertyDefinition prop) {
        DefaultBehaviorProvider defaultBehav = prop.getDefaultBehaviorProvider();
        String defValueStr = "";
        if (defaultBehav instanceof UndefinedDefaultBehaviorProvider) {
            defValueStr = "None";
        } else if (defaultBehav instanceof DefinedDefaultBehaviorProvider) {
            DefinedDefaultBehaviorProvider defBehav = (DefinedDefaultBehaviorProvider) defaultBehav;
            for (Iterator<String> it = defBehav.getDefaultValues().iterator(); it.hasNext();) {
                String str = it.next();
                defValueStr += str + (it.hasNext() ? "\n" : "");
            }
        } else if (defaultBehav instanceof AliasDefaultBehaviorProvider) {
            AliasDefaultBehaviorProvider aliasBehav = (AliasDefaultBehaviorProvider) defaultBehav;
            defValueStr = aliasBehav.getSynopsis().toString();
        } else if (defaultBehav instanceof RelativeInheritedDefaultBehaviorProvider) {
            RelativeInheritedDefaultBehaviorProvider relativBehav = (RelativeInheritedDefaultBehaviorProvider) defaultBehav;
            defValueStr = getDefaultBehaviorString(relativBehav.getManagedObjectDefinition().getPropertyDefinition(
                    relativBehav.getPropertyName()));
        } else if (defaultBehav instanceof AbsoluteInheritedDefaultBehaviorProvider) {
            AbsoluteInheritedDefaultBehaviorProvider absoluteBehav = (AbsoluteInheritedDefaultBehaviorProvider) defaultBehav;
            defValueStr = getDefaultBehaviorString(absoluteBehav.getManagedObjectDefinition().getPropertyDefinition(
                    absoluteBehav.getPropertyName()));
        }
        return defValueStr;
    }
    private TreeMap<String, AbstractManagedObjectDefinition> makeMOTreeMap(
            Collection<AbstractManagedObjectDefinition> coll) {
        if (coll == null) {
            return null;
        }
        TreeMap<String, AbstractManagedObjectDefinition> map = new TreeMap<String, AbstractManagedObjectDefinition>();
        for (AbstractManagedObjectDefinition mo : coll) {
            if (mo.hasOption(ManagedObjectOption.HIDDEN)) {
                continue;
            }
            map.put(mo.getName(), mo);
        }
        return map;
    }
    private TreeMap<String, RelationDefinition> makeRelTreeMap(Collection<RelationDefinition> coll) {
        if (coll == null) {
            return null;
        }
        TreeMap<String, RelationDefinition> map = new TreeMap<String, RelationDefinition>();
        for (RelationDefinition rel : coll) {
            map.put(rel.getChildDefinition().getName(), rel);
        }
        return map;
    }
    private TreeMap<String, PropertyDefinition> makePropTreeMap(Collection<PropertyDefinition> coll) {
        if (coll == null) {
            return null;
        }
        TreeMap<String, PropertyDefinition> map = new TreeMap<String, PropertyDefinition>();
        for (PropertyDefinition prop : coll) {
            map.put(prop.getName(), prop);
        }
        return map;
    }
    private void horizontalLine() {
        htmlBuff.append("<hr style=\"width: 100%; height: 2px;\">");
    }
    private void endTable() {
        htmlBuff.append("</tbody>\n");
        htmlBuff.append("</table>\n");
    }
    private void bullet(String str) {
        htmlBuff.append("<li>" + str + "</li>\n");
    }
    private void heading2(String string) {
        heading(string, 2);
    }
    private void heading3(String string) {
        heading(string, 3);
    }
    private void heading4(String string) {
        heading(string, 4);
    }
    private void heading(String str, int level) {
        htmlBuff.append(getHeading(str, level));
    }
    private String getHeading(String str, int level) {
        String strLevel = (new Integer(level)).toString();
        return "<h" + strLevel + ">" + "<a name=\"" + str + "\"></a>" + str + "</h" + strLevel + ">\n";
    }
    private String getHeading2(String str) {
        return getHeading(str, 2);
    }
    private String getAnchor(String str) {
        return "<a name=\"" + str + "\"></a>";
    }
    private void htmlHeader(String pageTitle) {
        htmlBuff.append(getHtmlHeader(pageTitle) + "<body>\n");
    }
    private final String Now = new Date().toString();
    private String getHtmlHeader(String pageTitle) {
        return ("<html>\n" + "<head>\n" + "<meta http-equiv=\"content-type\"\n"
                + "content=\"text/html; charset=ISO-8859-1\">\n" + "<title>" + pageTitle + "</title>\n"
                + "<link rel=\"stylesheet\" type=\"text/css\"\n" + "href=\"" + CSS_FILE + "\">\n"
                + "<link rel=\"shortcut icon\" href=\"" + FAVICON + "\">\n"
                + "<meta name=\"date generated\" content=\"" + Now + "\">\n" + "</head>\n");
    }
    // Add a Tab Menu, the active tab is the one given as parameter
    private void tabMenu(String activeTab) {
        htmlBuff.append("<div class=\"tabmenu\"> " +
        "<span><a " + (activeTab.equals(INHERITANCE_TREE_FILE) ? "class=\"activetab\" " : "") + "href=\""
                + INHERITANCE_TREE_FILE + "\"" + " title=\"Inheritance View of Components\">Inheritance</a></span> " +
                "<span><a " + (activeTab.equals(RELATION_TREE_FILE) ? "class=\"activetab\" " : "") + "href=\""
                + RELATION_TREE_FILE + "\"" + " title=\"Relational View of Components\">Structure</a></span> " +
                "<span><a " + (activeTab.equals(MO_LIST_FILE) ? "class=\"activetab\" " : "") + "href=\"" + MO_LIST_FILE
                + "\"" + " title=\"Alphabetical Index of Components\">Components</a></span> " +
                "<span><a " + (activeTab.equals(PROPERTIES_INDEX_FILE) ? "class=\"activetab\" " : "") + "href=\""
                + PROPERTIES_INDEX_FILE + "\"" + " title=\"Alphabetical Index of Properties\" >Properties</a></span>" +
                "</div>" + "\n");
    }
    private String getLink(String str, String link) {
        return getLink(str, link, null, null);
    }
    private String getLink(String str, String link, String target) {
        return getLink(str, link, target, null);
    }
    private String getLink(String str, String link, String target, String color) {
        return "<a " + (color != null ? "style=\"color:" + color + "\" " : "") + "href=\"" + link + "\""
                + (target == null ? "" : " target=\"" + target + "\"") + ">" + str + "</a>";
    }
    private void link(String str, String link) {
        link(str, link, null, null);
    }
    private void link(String str, String link, String target) {
        link(str, link, target, null);
    }
    private void link(String str, String link, String target, String color) {
        String htmlStr = "";
        if (!inList && getIndentPixels() > 0) {
            htmlStr += "<div style=\"margin-left: " + getIndentPixels() + "px;\">";
        } else if (inList) {
            htmlStr += "<li>";
        }
        htmlStr += getLink(str, link, target, color);
        if (!inList && getIndentPixels() > 0) {
            htmlStr += "</div>";
        } else if (inList) {
            htmlStr += "</li>";
        }
        if (!inList) {
            htmlStr += "<br>";
        }
        htmlBuff.append(htmlStr + "\n");
    }
    private void newline() {
        htmlBuff.append(getNewLine());
    }
    private String getNewLine() {
        return "<br>\n";
    }
    private void paragraph(LocalizableMessage description) {
        if (description != null) {
            paragraph(description.toString());
        }
    }
    private void paragraph(String description) {
        paragraph(description, TextStyle.STANDARD, null);
    }
    private void paragraph(String description, TextStyle style) {
        paragraph(description, style, null);
    }
    private void paragraph(String description, TextStyle style, String pClass) {
        String indentStr = "";
        String styleStr = "";
        String classStr = "";
        if (getIndentPixels() > 0) {
            indentStr = "style=\"margin-left: " + getIndentPixels() + "px;\"";
        }
        if (style == TextStyle.BOLD) {
            styleStr = "style=\"font-weight: bold;\"";
        } else if (style == TextStyle.ITALIC) {
            styleStr = "style=\"font-style: italic;\"";
        }
        if (pClass != null) {
            classStr = "class=" + pClass;
        }
        htmlBuff.append("<p " + indentStr + " " + styleStr + " " + classStr + ">" + description + "</p>\n");
    }
    private int getIndentPixels() {
        return (ind * 40);
    }
    private void startTable() {
        htmlBuff.append("<table " + "style=\"width: 100%; text-align: left;\"" + "border=\"1\"" + "cellpadding=\"1\""
                + "cellspacing=\"0\"" + ">\n");
        htmlBuff.append("<tbody>\n");
    }
    /*
     * Generate a "friendly" name from a string : '-' and '_' replaced by space
     * first letter of a word in uppercase
     */
    private String getFriendlyName(String str) {
        String retStr = "";
        String[] words = str.split("\\p{Punct}");
        for (int ii = 0; ii < words.length; ii++) {
            if (ii > 0) {
                retStr += " ";
            }
            String word = words[ii];
            String firstChar = word.substring(0, 1).toUpperCase();
            retStr += firstChar + word.substring(1, word.length());
        }
        return retStr;
      }
    }
      @Override
      public String visitDuration(DurationPropertyDefinition prop, Void p) {
        String durationStr = "";
        durationStr += getLink("A duration Syntax", durationSyntaxPage) +
          ". ";
        if (prop.isAllowUnlimited()) {
          durationStr += "A value of \"-1\" or \"unlimited\" for no limit. ";
    private void tableRow(String... strings) {
        htmlBuff.append("<tr>\n");
        for (int ii = 0; ii < strings.length; ii++) {
            String string = strings[ii];
            htmlBuff.append("<td style=\"" + "vertical-align: top; " + ((ii == 0) ? "width: 20%;" : "") + "\">"
                    + string + "<br></td>");
        }
        if (prop.getMaximumUnit() != null) {
          durationStr += "Maximum unit is \"" +
            prop.getMaximumUnit().getLongName() + "\". ";
        htmlBuff.append("</tr>\n");
    }
    /**
     * Text style.
     */
    private enum TextStyle {
        STANDARD, BOLD, ITALIC, UNDERLINE, FIXED_WIDTH
    }
    private void beginList() {
        inList = true;
        listLevel++;
        htmlBuff.append("<ul>\n");
    }
    private void endList() {
        listLevel--;
        if (listLevel == 0) {
            inList = false;
        }
        long lowerLimitStr = new Double(prop.getBaseUnit().
          fromMilliSeconds(prop.getLowerLimit())).longValue();
        durationStr += "Lower limit is " + lowerLimitStr +
          " " + prop.getBaseUnit().getLongName() + ". ";
        if (prop.getUpperLimit() != null) {
          long upperLimitStr = new Double(prop.getBaseUnit().
            fromMilliSeconds(prop.getUpperLimit())).longValue();
          durationStr += "Upper limit is " + upperLimitStr +
            " " + prop.getBaseUnit().getLongName() + ". ";
        htmlBuff.append("</ul>\n");
    }
    private void htmlFooter() {
        htmlBuff.append("</body>\n" + "</html>\n");
    }
    private void viewHelp(String helpStr) {
        htmlBuff.append("<p class=\"view-help\" >" + helpStr + "</p>" + "\n");
    }
    private void generateFile(String fileName) {
        // Write the html buffer in a file
        try {
            PrintWriter file = new java.io.PrintWriter(
                    new java.io.FileWriter(generationDir + File.separator + fileName));
            file.write(htmlBuff.toString());
            file.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
        return durationStr;
      }
      @Override
      public String visitEnum(EnumPropertyDefinition prop, Void p) {
        String enumStr = "";
        Class en = prop.getEnumClass();
        for (Object cst : en.getEnumConstants()) {
          enumStr += cst.toString();
          if (prop.getValueSynopsis((Enum) cst) != null) {
            enumStr += " - " + prop.getValueSynopsis((Enum) cst).toString();
          }
          enumStr += getNewLine() + getNewLine();
        }
        return enumStr;
      }
      @Override
      public String visitInteger(IntegerPropertyDefinition prop, Void p) {
        String intStr = "An integer value.";
        intStr += " Lower value is " + prop.getLowerLimit() + ".";
        if (prop.getUpperLimit() != null) {
          intStr += " Upper value is " + prop.getUpperLimit() + " .";
        }
        if (prop.isAllowUnlimited()) {
          intStr += " A value of \"-1\" or \"unlimited\" for no limit.";
        }
        if (prop.getUnitSynopsis() != null) {
          intStr += " Unit is " + prop.getUnitSynopsis() + ".";
        }
        return intStr;
      }
      @Override
      public String visitIPAddress(IPAddressPropertyDefinition prop, Void p) {
        return "An IP address";
      }
      @Override
      public String visitIPAddressMask(
        IPAddressMaskPropertyDefinition prop, Void p) {
        return "An IP address mask";
      }
      @Override
      public String visitSize(SizePropertyDefinition prop, Void p) {
        String sizeStr = "A positive integer representing a size.";
        if (prop.getLowerLimit() != 0) {
          sizeStr += " Lower value is " + prop.getLowerLimit() + ".";
        }
        if (prop.getUpperLimit() != null) {
          sizeStr += " Upper value is " + prop.getUpperLimit() + " .";
        }
        if (prop.isAllowUnlimited()) {
          sizeStr += " A value of \"-1\" or \"unlimited\" for no limit.";
        }
        return sizeStr;
      }
      @Override
      public String visitString(StringPropertyDefinition prop, Void p) {
        String retStr = "A String";
        if (prop.getPatternSynopsis() != null) {
          retStr = prop.getPatternSynopsis().toString();
        }
        return retStr;
      }
      @Override
      public String visitUnknown(PropertyDefinition prop, Void p) {
        return "Unknown";
      }
    };
    // Invoke the visitor against the property definition.
    return (String) prop.accept(visitor, null);
  }
  @SuppressWarnings("unchecked")
  private String getDefaultBehaviorString(PropertyDefinition prop) {
    DefaultBehaviorProvider defaultBehav = prop.getDefaultBehaviorProvider();
    String defValueStr = "";
    if (defaultBehav instanceof UndefinedDefaultBehaviorProvider) {
      defValueStr = "None";
    } else if (defaultBehav instanceof DefinedDefaultBehaviorProvider) {
      DefinedDefaultBehaviorProvider defBehav =
        (DefinedDefaultBehaviorProvider) defaultBehav;
      for (Iterator<String> it = defBehav.getDefaultValues().iterator();
      it.hasNext();) {
        String str = it.next();
        defValueStr += str + (it.hasNext() ? "\n" : "");
      }
    } else if (defaultBehav instanceof AliasDefaultBehaviorProvider) {
      AliasDefaultBehaviorProvider aliasBehav = (
        AliasDefaultBehaviorProvider) defaultBehav;
      defValueStr = aliasBehav.getSynopsis().toString();
    } else if
      (defaultBehav instanceof RelativeInheritedDefaultBehaviorProvider) {
      RelativeInheritedDefaultBehaviorProvider relativBehav =
        (RelativeInheritedDefaultBehaviorProvider) defaultBehav;
      defValueStr = getDefaultBehaviorString(
        relativBehav.getManagedObjectDefinition().
        getPropertyDefinition(relativBehav.getPropertyName()));
    } else if
      (defaultBehav instanceof AbsoluteInheritedDefaultBehaviorProvider) {
      AbsoluteInheritedDefaultBehaviorProvider absoluteBehav =
        (AbsoluteInheritedDefaultBehaviorProvider) defaultBehav;
      defValueStr = getDefaultBehaviorString(
        absoluteBehav.getManagedObjectDefinition().
        getPropertyDefinition(absoluteBehav.getPropertyName()));
    }
    return defValueStr;
  }
  private TreeMap<String, AbstractManagedObjectDefinition> makeMOTreeMap(
    Collection<AbstractManagedObjectDefinition> coll) {
    if (coll == null) {
      return null;
    }
    TreeMap<String, AbstractManagedObjectDefinition> map =
      new TreeMap<String, AbstractManagedObjectDefinition>();
    for (AbstractManagedObjectDefinition mo : coll) {
      if (mo.hasOption(ManagedObjectOption.HIDDEN))
      {
        continue;
      }
      map.put(mo.getName(), mo);
    }
    return map;
  }
  private TreeMap<String, RelationDefinition> makeRelTreeMap(
    Collection<RelationDefinition> coll) {
    if (coll == null) {
      return null;
    }
    TreeMap<String, RelationDefinition> map =
      new TreeMap<String, RelationDefinition>();
    for (RelationDefinition rel : coll) {
      map.put(rel.getChildDefinition().getName(), rel);
    }
    return map;
  }
  private TreeMap<String, PropertyDefinition> makePropTreeMap(
    Collection<PropertyDefinition> coll) {
    if (coll == null) {
      return null;
    }
    TreeMap<String, PropertyDefinition> map =
      new TreeMap<String, PropertyDefinition>();
    for (PropertyDefinition prop : coll) {
      map.put(prop.getName(), prop);
    }
    return map;
  }
  private void horizontalLine() {
    htmlBuff.append("<hr style=\"width: 100%; height: 2px;\">");
  }
  private void endTable() {
    htmlBuff.append("</tbody>\n");
    htmlBuff.append("</table>\n");
  }
  private void bullet(String str) {
    htmlBuff.append(
      "<li>" +
      str +
      "</li>\n");
  }
  private void heading2(String string) {
    heading(string, 2);
  }
  private void heading3(String string) {
    heading(string, 3);
  }
  private void heading4(String string) {
    heading(string, 4);
  }
  private void heading(String str, int level) {
    htmlBuff.append(getHeading(str, level));
  }
  private String getHeading(String str, int level) {
    String strLevel = (new Integer(level)).toString();
    return "<h" + strLevel + ">" +
      "<a name=\"" + str + "\"></a>" +
      str +
      "</h" + strLevel + ">\n";
  }
  private String getHeading2(String str) {
    return getHeading(str, 2);
  }
  private String getAnchor(String str) {
    return "<a name=\"" + str + "\"></a>";
  }
  private void htmlHeader(String pageTitle) {
    htmlBuff.append(getHtmlHeader(pageTitle) +
      "<body>\n");
  }
  private final String Now = new Date().toString();
  private String getHtmlHeader(String pageTitle) {
    return ("<html>\n" +
      "<head>\n" +
      "<meta http-equiv=\"content-type\"\n" +
      "content=\"text/html; charset=ISO-8859-1\">\n" +
      "<title>" + pageTitle + "</title>\n" +
      "<link rel=\"stylesheet\" type=\"text/css\"\n" +
      "href=\"" + CSS_FILE + "\">\n" +
      "<link rel=\"shortcut icon\" href=\"" + FAVICON + "\">\n" +
      "<meta name=\"date generated\" content=\"" + Now + "\">\n" +
      "</head>\n");
  }
  // Add a Tab Menu, the active tab is the one given as parameter
  private void tabMenu(String activeTab) {
    htmlBuff.append(
      "<div class=\"tabmenu\"> " +
      "<span><a " +
      (activeTab.equals(INHERITANCE_TREE_FILE) ? "class=\"activetab\" " : "") +
      "href=\"" + INHERITANCE_TREE_FILE + "\"" +
      " title=\"Inheritance View of Components\">Inheritance</a></span> " +
      "<span><a " +
      (activeTab.equals(RELATION_TREE_FILE) ? "class=\"activetab\" " : "") +
      "href=\"" + RELATION_TREE_FILE + "\"" +
      " title=\"Relational View of Components\">Structure</a></span> " +
      "<span><a " +
      (activeTab.equals(MO_LIST_FILE) ? "class=\"activetab\" " : "") +
      "href=\"" + MO_LIST_FILE + "\"" +
      " title=\"Alphabetical Index of Components\">Components</a></span> " +
      "<span><a " +
      (activeTab.equals(PROPERTIES_INDEX_FILE) ? "class=\"activetab\" " : "") +
      "href=\"" + PROPERTIES_INDEX_FILE + "\"" +
      " title=\"Alphabetical Index of Properties\" >Properties</a></span>" +
      "</div>" +
      "\n"
      );
  }
  private String getLink(String str, String link) {
    return getLink(str, link, null, null);
  }
  private String getLink(String str, String link, String target) {
    return getLink(str, link, target, null);
  }
  private String getLink(String str, String link, String target, String color) {
    return "<a " +
      (color != null ? "style=\"color:" + color + "\" " : "") +
      "href=\"" + link + "\"" +
      (target == null ? "" : " target=\"" + target + "\"") +
      ">"
      + str + "</a>";
  }
  private void link(String str, String link) {
    link(str, link, null, null);
  }
  private void link(String str, String link, String target) {
    link(str, link, target, null);
  }
  private void link(String str, String link, String target, String color) {
    String htmlStr = "";
    if (!inList && getIndentPixels() > 0) {
      htmlStr += "<div style=\"margin-left: " + getIndentPixels() + "px;\">";
    } else if (inList) {
      htmlStr += "<li>";
    }
    htmlStr += getLink(str, link, target, color);
    if (!inList && getIndentPixels() > 0) {
      htmlStr += "</div>";
    } else if (inList) {
      htmlStr += "</li>";
    }
    if (!inList) {
      htmlStr += "<br>";
    }
    htmlBuff.append(htmlStr + "\n");
  }
  private void newline() {
    htmlBuff.append(
      getNewLine());
  }
  private String getNewLine() {
    return "<br>\n";
  }
  private void paragraph(Message description) {
    if (description != null) {
      paragraph(description.toString());
    }
  }
  private void paragraph(String description) {
    paragraph(description, TextStyle.STANDARD, null);
  }
  private void paragraph(String description, TextStyle style) {
    paragraph(description, style, null);
  }
  private void paragraph(String description, TextStyle style, String pClass) {
    String indentStr = "";
    String styleStr = "";
    String classStr = "";
    if (getIndentPixels() > 0) {
      indentStr = "style=\"margin-left: " + getIndentPixels() + "px;\"";
    }
    if (style == TextStyle.BOLD) {
      styleStr = "style=\"font-weight: bold;\"";
    } else if (style == TextStyle.ITALIC) {
      styleStr = "style=\"font-style: italic;\"";
    }
    if (pClass != null) {
      classStr = "class=" + pClass;
        // re-init html buffer
        htmlBuff = new StringBuffer();
    }
    htmlBuff.append(
      "<p " +
      indentStr + " " +
      styleStr + " " +
      classStr +
      ">" +
      description +
      "</p>\n");
  }
  private int getIndentPixels() {
    return (ind * 40);
  }
  private void startTable() {
    htmlBuff.append(
      "<table " +
      "style=\"width: 100%; text-align: left;\"" +
      "border=\"1\"" +
      "cellpadding=\"1\"" +
      "cellspacing=\"0\"" +
      ">\n");
    htmlBuff.append("<tbody>\n");
  }
  /*
   * Generate a "friendly" name from a string :
   * '-' and '_' replaced by space
   * first letter of a word in uppercase
   */
  private String getFriendlyName(String str) {
    String retStr = "";
    String[] words = str.split("\\p{Punct}");
    for (int ii = 0; ii < words.length; ii++) {
      if (ii>0) {
        retStr += " ";
      }
      String word = words[ii];
       String firstChar = word.substring(0, 1).toUpperCase();
       retStr += firstChar + word.substring(1, word.length());
    }
    return retStr;
  }
  private void tableRow(String... strings) {
    htmlBuff.append(
      "<tr>\n");
    for (int ii = 0; ii < strings.length; ii++) {
      String string = strings[ii];
      htmlBuff.append(
        "<td style=\"" +
        "vertical-align: top; " +
        ((ii == 0) ? "width: 20%;" : "") +
        "\">" +
        string +
        "<br></td>");
    }
    htmlBuff.append(
      "</tr>\n");
  }
  /**
   * Text style.
   */
  private enum TextStyle {
    STANDARD, BOLD, ITALIC, UNDERLINE, FIXED_WIDTH
  }
  private void beginList() {
    inList = true;
    listLevel++;
    htmlBuff.append(
      "<ul>\n");
  }
  private void endList() {
    listLevel--;
    if (listLevel == 0) {
      inList = false;
    }
    htmlBuff.append(
      "</ul>\n");
  }
  private void htmlFooter() {
    htmlBuff.append(
      "</body>\n" +
      "</html>\n");
  }
  private void viewHelp(String helpStr) {
    htmlBuff.append(
      "<p class=\"view-help\" >" +
      helpStr +
      "</p>" +
      "\n"
      );
  }
  private void generateFile(String fileName) {
    // Write the html buffer in a file
    try {
      PrintWriter file = new java.io.PrintWriter(
        new java.io.FileWriter(generationDir + File.separator + fileName));
      file.write(htmlBuff.toString());
      file.close();
    } catch (Exception e) {
      e.printStackTrace();
      System.exit(1);
    }
    // re-init html buffer
    htmlBuff = new StringBuffer();
  }
  // Relation List from RootConfiguration
  private final TreeMap<String, RelationDefinition> topRelList =
    new TreeMap<String, RelationDefinition>();
  private final TreeMap<String, RelationDefinition> relList =
    new TreeMap<String, RelationDefinition>();
  private final TreeMap<String, TreeMap<String, RelationDefinition>>
    catTopRelList = new TreeMap<String, TreeMap<String, RelationDefinition>>();
  // managed object list
  private final TreeMap<String, AbstractManagedObjectDefinition> moList =
    new TreeMap<String, AbstractManagedObjectDefinition>();
  private final TreeMap<String, AbstractManagedObjectDefinition> topMoList =
    new TreeMap<String, AbstractManagedObjectDefinition>();
  private final TreeMap<String,
                        TreeMap<String, AbstractManagedObjectDefinition>>
    catTopMoList =
      new TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>>();
  private final int ind = 0;
  private StringBuffer htmlBuff = new StringBuffer();
  private static String generationDir;
  private static boolean ldapMapping = false;
  private static String OpenDJWiki;
  private static String OpenDJHome;
  private static String aciSyntaxPage;
  private static String durationSyntaxPage;
  private boolean inList = false;
  private int listLevel = 0;
    // Relation List from RootConfiguration
    private final TreeMap<String, RelationDefinition> topRelList = new TreeMap<String, RelationDefinition>();
    private final TreeMap<String, RelationDefinition> relList = new TreeMap<String, RelationDefinition>();
    private final TreeMap<String, TreeMap<String, RelationDefinition>> catTopRelList = new TreeMap<String, TreeMap<String, RelationDefinition>>();
    // managed object list
    private final TreeMap<String, AbstractManagedObjectDefinition> moList = new TreeMap<String, AbstractManagedObjectDefinition>();
    private final TreeMap<String, AbstractManagedObjectDefinition> topMoList = new TreeMap<String, AbstractManagedObjectDefinition>();
    private final TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>> catTopMoList = new TreeMap<String, TreeMap<String, AbstractManagedObjectDefinition>>();
    private final int ind = 0;
    private StringBuffer htmlBuff = new StringBuffer();
    private static String generationDir;
    private static boolean ldapMapping = false;
    private static String OpenDJWiki;
    private static String OpenDJHome;
    private static String aciSyntaxPage;
    private static String durationSyntaxPage;
    private boolean inList = false;
    private int listLevel = 0;
}
opendj-admin/src/main/java/org/opends/server/admin/doc/package-info.java
@@ -25,14 +25,10 @@
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 */
/**
 * Administration documentation classes.
 * <p>
 * This package contains classes used to generate administration documentation.
 */
@org.opends.server.types.PublicAPI(
     stability=org.opends.server.types.StabilityLevel.PRIVATE)
package org.opends.server.admin.doc;
opendj-admin/src/main/java/org/opends/server/admin/server/AbstractConfigListenerAdaptor.java
@@ -30,8 +30,8 @@
import java.util.Collection;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -57,10 +57,10 @@
   * @param unacceptableReason
   *          The single message to which messages should be appended.
   */
  protected final void generateUnacceptableReason(Collection<Message> reasons,
      MessageBuilder unacceptableReason) {
  protected final void generateUnacceptableReason(Collection<LocalizableMessage> reasons,
      LocalizableMessageBuilder unacceptableReason) {
    boolean isFirst = true;
    for (Message reason : reasons) {
    for (LocalizableMessage reason : reasons) {
      if (isFirst) {
        isFirst = false;
      } else {
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigAddListenerAdaptor.java
@@ -33,8 +33,8 @@
import java.util.LinkedList;
import java.util.List;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.Constraint;
import org.opends.server.admin.DecodingException;
@@ -213,7 +213,7 @@
   * {@inheritDoc}
   */
  public boolean configAddIsAcceptable(ConfigEntry configEntry,
      MessageBuilder unacceptableReason) {
      LocalizableMessageBuilder unacceptableReason) {
    DN dn = configEntry.getDN();
    AttributeValue av = dn.getRDN().getAttributeValue(0);
    String name = av.getValue().toString().trim();
@@ -257,7 +257,7 @@
    }
    // Let the add listener decide.
    List<Message> reasons = new LinkedList<Message>();
    List<LocalizableMessage> reasons = new LinkedList<Message>();
    if (listener.isConfigurationAddAcceptable(cachedManagedObject, reasons)) {
      return true;
    } else {
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigChangeListenerAdaptor.java
@@ -37,8 +37,8 @@
import java.util.Set;
import org.opends.messages.AdminMessages;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.admin.AbsoluteInheritedDefaultBehaviorProvider;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.AliasDefaultBehaviorProvider;
@@ -262,7 +262,7 @@
      public boolean configChangeIsAcceptable(ConfigEntry configEntry,
          MessageBuilder unacceptableReason) {
          LocalizableMessageBuilder unacceptableReason) {
        ConfigEntry dependentConfigEntry = getConfigEntry(dn);
        if (dependentConfigEntry != null) {
          return ConfigChangeListenerAdaptor.this.configChangeIsAcceptable(
@@ -310,7 +310,7 @@
      public boolean configDeleteIsAcceptable(ConfigEntry configEntry,
          MessageBuilder unacceptableReason) {
          LocalizableMessageBuilder unacceptableReason) {
        // Always acceptable.
        return true;
      }
@@ -369,7 +369,7 @@
   * {@inheritDoc}
   */
  public boolean configChangeIsAcceptable(ConfigEntry configEntry,
      MessageBuilder unacceptableReason) {
      LocalizableMessageBuilder unacceptableReason) {
    return configChangeIsAcceptable(configEntry, unacceptableReason,
        configEntry);
  }
@@ -396,7 +396,7 @@
   *         does not.
   */
  public boolean configChangeIsAcceptable(ConfigEntry configEntry,
      MessageBuilder unacceptableReason, ConfigEntry newConfigEntry) {
      LocalizableMessageBuilder unacceptableReason, ConfigEntry newConfigEntry) {
    try {
      ServerManagementContext context = ServerManagementContext.getInstance();
      cachedManagedObject = context.decode(path, configEntry, newConfigEntry);
@@ -414,7 +414,7 @@
    }
    // Let the change listener decide.
    List<Message> reasons = new LinkedList<Message>();
    List<LocalizableMessage> reasons = new LinkedList<Message>();
    if (listener.isConfigurationChangeAcceptable(cachedManagedObject,reasons)) {
      return true;
    } else {
@@ -471,7 +471,7 @@
      if (configEntry != null) {
        return configEntry;
      } else {
        Message message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DOES_NOT_EXIST
        LocalizableMessage message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DOES_NOT_EXIST
            .get(String.valueOf(dn));
        ErrorLogger.logError(message);
      }
@@ -481,7 +481,7 @@
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }
      Message message = AdminMessages.ERR_ADMIN_CANNOT_GET_MANAGED_OBJECT.get(
      LocalizableMessage message = AdminMessages.ERR_ADMIN_CANNOT_GET_MANAGED_OBJECT.get(
          String.valueOf(dn), StaticUtils.getExceptionMessage(e));
      ErrorLogger.logError(message);
    }
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigDeleteListenerAdaptor.java
@@ -28,14 +28,14 @@
import static org.opends.messages.AdminMessages.*;
import static com.forgerock.opendj.ldap.AdminMessages.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import java.util.LinkedList;
import java.util.List;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.Constraint;
import org.opends.server.admin.DecodingException;
@@ -214,7 +214,7 @@
   * {@inheritDoc}
   */
  public boolean configDeleteIsAcceptable(ConfigEntry configEntry,
      MessageBuilder unacceptableReason) {
      LocalizableMessageBuilder unacceptableReason) {
    DN dn = configEntry.getDN();
    AttributeValue av = dn.getRDN().getAttributeValue(0);
    String name = av.getValue().toString().trim();
@@ -249,7 +249,7 @@
      return false;
    }
    List<Message> reasons = new LinkedList<Message>();
    List<LocalizableMessage> reasons = new LinkedList<Message>();
    // Enforce any constraints.
    boolean isDeleteAllowed = true;
@@ -263,7 +263,7 @@
            isDeleteAllowed = false;
          }
        } catch (ConfigException e) {
          Message message = ERR_SERVER_CONSTRAINT_EXCEPTION.get(e
          LocalizableMessage message = ERR_SERVER_CONSTRAINT_EXCEPTION.get(e
              .getMessageObject());
          reasons.add(message);
          isDeleteAllowed = false;
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigExceptionFactory.java
@@ -25,7 +25,7 @@
 *      Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
@@ -78,7 +78,7 @@
   */
  public ConfigException createDecodingExceptionAdaptor(DN dn,
      DefinitionDecodingException e) {
    Message message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM.
    LocalizableMessage message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM.
        get(String.valueOf(dn), stackTraceToSingleLineString(e));
    return new ConfigException(message, e);
  }
@@ -97,7 +97,7 @@
  public ConfigException createDecodingExceptionAdaptor(
      ServerManagedObjectDecodingException e) {
    DN dn = e.getPartialManagedObject().getDN();
    Message message =
    LocalizableMessage message =
            AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM.get(
                    String.valueOf(dn),
        stackTraceToSingleLineString(e));
@@ -117,7 +117,7 @@
  public ConfigException createDecodingExceptionAdaptor(
      ConstraintViolationException e) {
    DN dn = e.getManagedObject().getDN();
    Message message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM
    LocalizableMessage message = AdminMessages.ERR_ADMIN_MANAGED_OBJECT_DECODING_PROBLEM
        .get(String.valueOf(dn), stackTraceToSingleLineString(e));
    return new ConfigException(message, e);
  }
@@ -140,7 +140,7 @@
  public ConfigException createClassLoadingExceptionAdaptor(DN dn,
      String className, Exception e) {
    Message message = AdminMessages.ERR_ADMIN_CANNOT_INSTANTIATE_CLASS.
    LocalizableMessage message = AdminMessages.ERR_ADMIN_CANNOT_INSTANTIATE_CLASS.
        get(String.valueOf(className), String.valueOf(dn),
            stackTraceToSingleLineString(e));
    return new ConfigException(message, e);
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationAddListener.java
@@ -25,7 +25,7 @@
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
@@ -60,7 +60,7 @@
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationAddAcceptable(T configuration,
      List<Message> unacceptableReasons);
      List<LocalizableMessage> unacceptableReasons);
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationChangeListener.java
@@ -25,7 +25,7 @@
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
@@ -61,7 +61,7 @@
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationChangeAcceptable(T configuration,
      List<Message> unacceptableReasons);
      List<LocalizableMessage> unacceptableReasons);
opendj-admin/src/main/java/org/opends/server/admin/server/ConfigurationDeleteListener.java
@@ -25,7 +25,7 @@
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.admin.server;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
@@ -60,7 +60,7 @@
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationDeleteAcceptable(T configuration,
      List<Message> unacceptableReasons);
      List<LocalizableMessage> unacceptableReasons);
opendj-admin/src/main/java/org/opends/server/admin/server/ConstraintViolationException.java
@@ -29,16 +29,16 @@
import static org.opends.messages.AdminMessages.*;
import static com.forgerock.opendj.ldap.AdminMessages.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.admin.DecodingException;
import org.opends.server.util.Validator;
import static com.forgerock.opendj.util.Validator.*;
@@ -60,7 +60,7 @@
  // Gets the default message.
  private static Message getDefaultMessage(Collection<Message> messages) {
  private static LocalizableMessage getDefaultMessage(Collection<Message> messages) {
    Validator.ensureNotNull(messages);
    Validator.ensureTrue(!messages.isEmpty());
@@ -76,14 +76,14 @@
  // Merge the messages into a single message.
  private static Message getSingleMessage(Collection<Message> messages) {
  private static LocalizableMessage getSingleMessage(Collection<Message> messages) {
    if (messages.size() == 1) {
      return messages.iterator().next();
    } else {
      MessageBuilder builder = new MessageBuilder();
      LocalizableMessageBuilder builder = new MessageBuilder();
      boolean isFirst = true;
      for (Message m : messages) {
      for (LocalizableMessage m : messages) {
        if (!isFirst) {
          builder.append(";  ");
        }
@@ -96,7 +96,7 @@
  }
  // The messages describing the constraint violations that occurred.
  private final Collection<Message> messages;
  private final Collection<LocalizableMessage> messages;
@@ -113,11 +113,11 @@
   *          non-empty).
   */
  public ConstraintViolationException(ServerManagedObject<?> managedObject,
      Collection<Message> messages) {
      Collection<LocalizableMessage> messages) {
    super(getDefaultMessage(messages));
    this.managedObject = managedObject;
    this.messages = new ArrayList<Message>(messages);
    this.messages = new ArrayList<LocalizableMessage>(messages);
  }
@@ -134,7 +134,7 @@
   *          occurred.
   */
  public ConstraintViolationException(ServerManagedObject<?> managedObject,
      Message message) {
      LocalizableMessage message) {
    this(managedObject, Collections.singleton(message));
  }
@@ -147,7 +147,7 @@
   * @return Returns an unmodifiable collection view of the messages
   *         describing the constraint violations that occurred.
   */
  public Collection<Message> getMessages() {
  public Collection<LocalizableMessage> getMessages() {
    return Collections.unmodifiableCollection(messages);
  }
@@ -160,7 +160,7 @@
   * @return Returns a single message listing all the messages
   *         combined into a single list separated by semi-colons.
   */
  public Message getMessagesAsSingleMessage() {
  public LocalizableMessage getMessagesAsSingleMessage() {
    return getSingleMessage(messages);
  }
opendj-admin/src/main/java/org/opends/server/admin/server/DelayedConfigAddListener.java
@@ -40,7 +40,7 @@
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.ResultCode;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessageBuilder;
/**
@@ -155,7 +155,7 @@
   * {@inheritDoc}
   */
  public boolean configAddIsAcceptable(ConfigEntry configEntry,
      MessageBuilder unacceptableReason) {
      LocalizableMessageBuilder unacceptableReason) {
    // Always acceptable.
    return true;
  }
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObject.java
@@ -1165,7 +1165,7 @@
  void ensureIsUsable() throws ConstraintViolationException {
    // Enforce any constraints.
    boolean isUsable = true;
    List<Message> reasons = new LinkedList<Message>();
    List<LocalizableMessage> reasons = new LinkedList<Message>();
    for (Constraint constraint : definition.getAllConstraints()) {
      for (ServerConstraintHandler handler : constraint
          .getServerConstraintHandlers()) {
@@ -1174,7 +1174,7 @@
            isUsable = false;
          }
        } catch (ConfigException e) {
          Message message = ERR_SERVER_CONSTRAINT_EXCEPTION.get(e
          LocalizableMessage message = ERR_SERVER_CONSTRAINT_EXCEPTION.get(e
              .getMessageObject());
          reasons.add(message);
          isUsable = false;
@@ -1356,7 +1356,7 @@
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }
      Message message = ERR_ADMIN_CANNOT_GET_LISTENER_BASE.get(
      LocalizableMessage message = ERR_ADMIN_CANNOT_GET_LISTENER_BASE.get(
          String.valueOf(dn), stackTraceToSingleLineString(e));
      throw new ConfigException(message, e);
    }
@@ -1402,7 +1402,7 @@
    }
    // No parent entry could be found.
    Message message = ERR_ADMIN_UNABLE_TO_REGISTER_LISTENER
    LocalizableMessage message = ERR_ADMIN_UNABLE_TO_REGISTER_LISTENER
        .get(String.valueOf(baseDN));
    throw new ConfigException(message);
  }
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListener.java
@@ -28,7 +28,7 @@
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
import java.util.List;
@@ -61,7 +61,7 @@
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationAddAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons);
      ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons);
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectAddListenerAdaptor.java
@@ -30,7 +30,7 @@
import java.util.List;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
@@ -92,7 +92,7 @@
   * {@inheritDoc}
   */
  public boolean isConfigurationAddAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) {
      ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons) {
    return listener.isConfigurationAddAcceptable(mo.getConfiguration(),
        unacceptableReasons);
  }
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListener.java
@@ -28,7 +28,7 @@
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
import java.util.List;
@@ -62,7 +62,7 @@
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationChangeAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons);
      ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons);
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectChangeListenerAdaptor.java
@@ -30,7 +30,7 @@
import java.util.List;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
@@ -94,7 +94,7 @@
   * {@inheritDoc}
   */
  public boolean isConfigurationChangeAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) {
      ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons) {
    return listener.isConfigurationChangeAcceptable(mo.getConfiguration(),
        unacceptableReasons);
  }
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDecodingException.java
@@ -29,18 +29,18 @@
import static org.opends.messages.AdminMessages.*;
import static com.forgerock.opendj.ldap.AdminMessages.*;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.admin.DecodingException;
import org.opends.server.admin.ManagedObjectDefinition;
import org.opends.server.admin.PropertyException;
import org.opends.server.util.Validator;
import static com.forgerock.opendj.util.Validator.*;
@@ -58,11 +58,11 @@
  // Create the message.
  private static Message createMessage(
  private static LocalizableMessage createMessage(
      ServerManagedObject<?> partialManagedObject,
      Collection<PropertyException> causes) {
    Validator.ensureNotNull(causes);
    Validator.ensureTrue(!causes.isEmpty());
    ensureNotNull(causes);
    ensureTrue(!causes.isEmpty(), "causes should nnot be empty");
    ManagedObjectDefinition<?, ?> d = partialManagedObject
        .getManagedObjectDefinition();
@@ -70,7 +70,7 @@
      return ERR_MANAGED_OBJECT_DECODING_EXCEPTION_SINGLE.get(d
          .getUserFriendlyName(), causes.iterator().next().getMessageObject());
    } else {
      MessageBuilder builder = new MessageBuilder();
      LocalizableMessageBuilder builder = new MessageBuilder();
      boolean isFirst = true;
      for (PropertyException cause : causes) {
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDeleteListener.java
@@ -28,7 +28,7 @@
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
import java.util.List;
@@ -62,7 +62,7 @@
   *         acceptable, or <code>false</code> if it is not.
   */
  public boolean isConfigurationDeleteAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons);
      ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons);
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagedObjectDeleteListenerAdaptor.java
@@ -30,7 +30,7 @@
import java.util.List;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.Configuration;
import org.opends.server.types.ConfigChangeResult;
@@ -93,7 +93,7 @@
   * {@inheritDoc}
   */
  public boolean isConfigurationDeleteAcceptable(
      ServerManagedObject<? extends T> mo, List<Message> unacceptableReasons) {
      ServerManagedObject<? extends T> mo, List<LocalizableMessage> unacceptableReasons) {
    return listener.isConfigurationDeleteAcceptable(mo.getConfiguration(),
        unacceptableReasons);
  }
opendj-admin/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
@@ -29,7 +29,7 @@
import static org.opends.messages.AdminMessages.*;
import static com.forgerock.opendj.ldap.AdminMessages.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.StaticUtils.*;
@@ -44,7 +44,7 @@
import java.util.SortedSet;
import java.util.TreeSet;
import org.opends.messages.Message;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.AbsoluteInheritedDefaultBehaviorProvider;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.AggregationPropertyDefinition;
@@ -955,7 +955,7 @@
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }
      Message message = ERR_ADMIN_CANNOT_GET_MANAGED_OBJECT.get(
      LocalizableMessage message = ERR_ADMIN_CANNOT_GET_MANAGED_OBJECT.get(
          String.valueOf(dn), stackTraceToSingleLineString(e));
      throw new ConfigException(message, e);
    }
@@ -963,7 +963,7 @@
    // The configuration handler is free to return null indicating
    // that the entry does not exist.
    if (configEntry == null) {
      Message message = ERR_ADMIN_MANAGED_OBJECT_DOES_NOT_EXIST
      LocalizableMessage message = ERR_ADMIN_MANAGED_OBJECT_DOES_NOT_EXIST
          .get(String.valueOf(dn));
      throw new ConfigException(message);
    }
opendj-admin/src/main/java/org/opends/server/admin/server/package-info.java
@@ -35,7 +35,5 @@
 * access the server's current configuration and register
 * to be notified when the configuration changes.
 */
@org.opends.server.types.PublicAPI(
     stability=org.opends.server.types.StabilityLevel.PRIVATE)
package org.opends.server.admin.server;
opendj-admin/src/main/java/org/opends/server/api/ConfigAddListener.java
@@ -26,6 +26,7 @@
 */
package org.opends.server.api;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.server.types.ConfigChangeResult;
/**
@@ -47,7 +48,7 @@
     * @return {@code true} if the proposed entry contains an acceptable
     *         configuration, or {@code false} if it does not.
     */
    public boolean configAddIsAcceptable(ConfigEntry configEntry, MessageBuilder unacceptableReason);
    public boolean configAddIsAcceptable(ConfigEntry configEntry, LocalizableMessageBuilder unacceptableReason);
    /**
     * Attempts to apply a new configuration based on the provided added entry.
opendj-admin/src/main/java/org/opends/server/api/ConfigChangeListener.java
@@ -30,7 +30,7 @@
import org.opends.server.config.ConfigEntry;
import org.opends.server.types.ConfigChangeResult;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessageBuilder;
/**
@@ -61,7 +61,7 @@
   *          not.
   */
  public boolean configChangeIsAcceptable(ConfigEntry configEntry,
                      MessageBuilder unacceptableReason);
                      LocalizableMessageBuilder unacceptableReason);
opendj-admin/src/main/java/org/opends/server/api/ConfigDeleteListener.java
@@ -28,9 +28,8 @@
import org.opends.server.config.ConfigEntry;
import org.opends.server.types.ConfigChangeResult;
import org.opends.messages.MessageBuilder;
import org.forgerock.i18n.LocalizableMessageBuilder;
/**
@@ -38,11 +37,6 @@
 * component should implement if it wishes to be able to receive
 * notification if entries below a configuration entry are removed.
 */
@org.opends.server.types.PublicAPI(
     stability=org.opends.server.types.StabilityLevel.VOLATILE,
     mayInstantiate=false,
     mayExtend=true,
     mayInvoke=false)
public interface ConfigDeleteListener
{
  /**
@@ -60,7 +54,7 @@
   *          the configuration, or {@code false} if not.
   */
  public boolean configDeleteIsAcceptable(ConfigEntry configEntry,
                      MessageBuilder unacceptableReason);
                      LocalizableMessageBuilder unacceptableReason);
opendj-admin/src/main/java/org/opends/server/types/DirectoryEnvironmentConfig.java
New file
@@ -0,0 +1,39 @@
/*
 * 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
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2013 ForgeRock AS.
 */
package org.opends.server.types;
/**
 * This class provides a set of properties that may control various aspects of
 * the server environment. Note that these properties may only be altered before
 * the Directory Server is started. Any attempt to change an environment
 * configuration property while the server is running will be rejected.
 */
public final class DirectoryEnvironmentConfig {
    // TODO : implements
}
opendj-admin/src/main/java/org/opends/server/util/EmbeddedUtils.java
New file
@@ -0,0 +1,105 @@
/*
 * 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
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 */
package org.opends.server.util;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.config.ConfigException;
import org.opends.server.types.DirectoryEnvironmentConfig;
import org.opends.server.types.InitializationException;
/**
 * This class provides a number of utility methods for using OpenDS in an
 * embedded manner (i.e., running within the same JVM as another application and
 * controlled by that application).
 */
public final class EmbeddedUtils {
    /**
     * Indicates whether the Directory Server is currently running.
     *
     * @return {@code true} if the server is currently running, or {@code false}
     *         if not.
     */
    public static boolean isRunning() {
        throw new RuntimeException("not implemented");
    }
    /**
     * Attempts to start the Directory Server.
     *
     * @param config
     *            The environment configuration to use for the server.
     * @throws ConfigException
     *             If a configuration problem is detected during the server
     *             initialization or startup process.
     * @throws InitializationException
     *             If the Directory Server is already running, or if an error
     *             occurs during server initialization or startup.
     */
    public static void startServer(DirectoryEnvironmentConfig config) throws ConfigException, InitializationException {
        throw new RuntimeException("not implemented");
    }
    /**
     * Attempts to stop the Directory Server.
     *
     * @param className
     *            The name of the class that initiated the shutdown.
     * @param reason
     *            A message explaining the reason for the shutdown.
     */
    public static void stopServer(String className, LocalizableMessage reason) {
        throw new RuntimeException("not implemented");
    }
    /**
     * Attempts to restart the Directory Server. This will perform an in-core
     * restart in which the existing server instance will be shut down, a new
     * instance will be created, and it will be reinitialized and restarted.
     *
     * @param className
     *            The name of the class that initiated the restart.
     * @param reason
     *            A message explaining the reason for the retart.
     * @param config
     *            The environment configuration to use for the new server
     *            instance.
     */
    public static void restartServer(String className, LocalizableMessage reason, DirectoryEnvironmentConfig config) {
        throw new RuntimeException("not implemented");
    }
    /**
     * Sets up a number of internal server data structures to ensure that they
     * are properly initialized for use. This is necessary if server libraries
     * are going to be used without the server running (e.g., to facilitate use
     * in an LDAP client API, for DN processing, etc.). This will have no effect
     * if the server has already been initialized for client use.
     */
    public static void initializeForClientUse() {
        throw new RuntimeException("not implemented");
    }
}