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

jvergara
30.51.2009 ad538a4677b2acebc4b0968907c801172faa2d47
Fix for issue 4326 (Allow setup of a Server without Data suffix)

If the user does not specify the option baseDN (in the command-line setup) or leaves the base DN text field empty (in the graphical setup), no b
ase DN will be created.

Fix some issues with the installer, that on Mac OS used to make the terminal to lose focus before the confirmation of the setup.

16 files modified
572 ■■■■■ changed files
opends/build.xml 2 ●●● patch | view | raw | blame | history
opends/src/messages/messages/admin_tool.properties 16 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/quicksetup.properties 4 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/tools.properties 11 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 33 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java 26 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataOptionsPanel.java 16 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java 90 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ui/ServerSettingsPanel.java 8 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java 93 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java 21 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java 188 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/InstallDS.java 42 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java 18 ●●●● patch | view | raw | blame | history
opends/build.xml
@@ -32,7 +32,7 @@
  </description>
  <!-- Build JVM properties -->
  <property name="MEM" value="256M"/>
  <property name="MEM" value="768M"/>
  <!-- Build OpenDMK properties -->
  <property file="build.properties"/>
opends/src/messages/messages/admin_tool.properties
@@ -370,8 +370,8 @@
INFO_UNKNOWN_LABEL=--
INFO_UNINSTALLDS_DESCRIPTION_FORCE=Specifies whether the uninstall should \
 continue if there is an error updating references to this server in remote \
 server instances or not.  This argument can only be used with the %s no \
 prompt argument.
 server instances or not.  This option can only be used with the %s no \
 prompt option.
INFO_DESCRIPTION_REFERENCED_HOST=The name of this host (or IP address) as \
 it is referenced in remote servers for replication
INFO_UNINSTALLDS_DESCRIPTION_CLI=Specifies to use the command line \
@@ -470,7 +470,7 @@
INFO_DESCRIPTION_REPLICATION_BASEDNS=Base DN of \
 the data to be replicated, initialized or for which we want to disable \
 replication.  Multiple base DN's can be provided by using this option multiple \
 times
 times.  If this option is not provided no base DN will be created
INFO_DESCRIPTION_REPLICATION_ADMIN_UID=User ID of the \
 Global Administrator to use to bind to the server.  For the '%s' subcommand \
 if no Global Administrator was defined previously for none of the server the \
@@ -569,13 +569,13 @@
SEVERE_ERR_REPLICATION_VALID_SUBCOMMAND_NOT_FOUND=Could not find a valid \
 subcommand.  You must specify a subcommand when using the option %s.
SEVERE_ERR_REPLICATION_STATUS_QUIET=The '%s' subcommand is not compatible with \
 the %s argument.
 the %s option.
INFO_REPLICATION_SUCCESSFUL=The operation has been successfully completed
INFO_REPLICATION_SUCCESSFUL_NOP=The operation has been successfully completed, \
 but no action was required
MILD_ERR_REPLICATION_USER_CANCELLED=User cancelled the operation
SEVERE_ERR_REPLICATION_NO_MESSAGE=
SEVERE_ERR_UNINSTALL_FORCE_REQUIRES_NO_PROMPT=The %s argument only can be \
SEVERE_ERR_UNINSTALL_FORCE_REQUIRES_NO_PROMPT=The %s option only can be \
 used when %s has been specified
INFO_REPLICATION_ENABLE_ADMINISTRATOR_MUST_BE_CREATED=Global Administrator \
 must be created.%nYou must provide the credentials of the Global \
@@ -679,7 +679,7 @@
INFO_REPLICATION_DISABLE_ALL_SUFFIXES_KEEP_REPLICATION_SERVER=You have chosen \
 to disable replication on all the replicated base DN's of '%s'.  If you want \
 also the replication server (changelog and replication port) to be disabled \
 you must also specify the '--%s' or '--%s' argument.
 you must also specify the '--%s' or '--%s' option.
INFO_REPLICATION_DISABLE_ALL_SUFFIXES_DISABLE_REPLICATION_SERVER=You have \
 chosen to disable all the replicated base DN's on the server '%s'.  Do you \
 want to disable also the replication port '%d'?
@@ -946,12 +946,12 @@
INFO_REPLICATION_POST_ENABLE_INFO=Replication has been successfully enabled.  \
 Note that for replication to work you must initialize the contents of the \
 base DN's that are being replicated (use %s %s to do so).
SEVERE_ERR_REPLICATION_ERROR_MISSING_NON_INTERACTIVE_ARG=The argument \
SEVERE_ERR_REPLICATION_ERROR_MISSING_NON_INTERACTIVE_ARG=The option \
 "--%s" must be specified when this application is used non-interactively
INFO_REPLICATION_NON_INTERACTIVE=The equivalent non-interactive command-line \
 is:%n%s
INFO_REPLICATION_DESCRIPTION_DISPLAY_EQUIVALENT=Display the equivalent \
 non-interactive argument in the standard output when this command is run in \
 non-interactive option in the standard output when this command is run in \
 interactive mode
INFO_REPLICATION_DESCRIPTION_EQUIVALENT_COMMAND_FILE_PATH=The full path to \
 the file where the equivalent non-interactive commands will be written when \
opends/src/messages/messages/quicksetup.properties
@@ -58,6 +58,7 @@
INFO_BASE_DN_IS_CONFIGURATION_DN=The provided Directory Base DN is used for \
 storing the server configuration data. You must specify a different DN.
INFO_BASE_DN_LABEL=Directory Base DN:
INFO_NO_BASE_DN_INLINE_HELP=Leave empty if you do not want to create a base DN.
INFO_BASE_DN_TOOLTIP=Enter the DN of the top entry where your data will be \
 stored
INFO_BROWSE_BUTTON_LABEL=Browse...
@@ -596,6 +597,8 @@
INFO_INSTALLSTATUS_SERVERRUNNING=Is currently running on port %s
# Only translate if the color is specific to the local
INFO_INSTRUCTIONS_COLOR=000,000,000
# Only translate if the color is specific to the local
INFO_INLINE_HELP_COLOR=000,000,000
INFO_INVALID_CHAR_IN_PATH=The path contains the character "%s" which is not \
 allowed to install the server.
INFO_INVALID_NUMBER_ENTRIES_RANGE=The number of user entries to generate \
@@ -866,6 +869,7 @@
INFO_REVIEW_CREATE_BASE_ENTRY_LABEL=Only Create Base Entry (%s)
INFO_REVIEW_CREATE_SUFFIX=Create New Base DN %s.%nBase DN Data: %s
INFO_REVIEW_CREATE_SUFFIXES=Create New Base DNs:%n%s.%nBase DN Data: %s
INFO_REVIEW_CREATE_NO_SUFFIX=Do not Create a Base DN
INFO_REVIEW_IMPORT_AUTOMATICALLY_GENERATED=Import Automatically-Generated \
 Data (%s Entries)
INFO_REVIEW_IMPORT_LDIF=Import Data from LDIF File (%s)
opends/src/messages/messages/tools.properties
@@ -889,8 +889,7 @@
 in configuration file %s:  %s
SEVERE_ERR_INSTALLDS_CANNOT_PARSE_DN_503=An error occurred while attempting \
 to parse the string "%s" as a valid DN:  %s
INFO_INSTALLDS_PROMPT_BASEDN_504=What do you wish to use as the base DN for \
 the directory data?
INFO_INSTALLDS_PROMPT_BASEDN_504=Provide the base DN for the directory data:
INFO_INSTALLDS_PROMPT_IMPORT_505=Do you wish to populate the directory \
 database with information from an existing LDIF file?
INFO_INSTALLDS_PROMPT_IMPORT_FILE_506=Please specify the path to the LDIF \
@@ -2534,5 +2533,11 @@
for index scratch files during index rebuilding
SEVERE_ERR_REBUILDINDEX_REBUILD_ALL_ERROR_1699=Index "-i" option cannot be \
specified with the "--rebuildAll" option
INFO_DESCRIPTION_SUBENTRIES_1700=Use subentries control to specify that \
INFO_INSTALLDS_PROVIDE_BASE_DN_PROMPT_1700=Do you want to create base DNs in \
 the server?
SEVERE_ERR_INSTALLDS_NO_BASE_DN_AND_CONFLICTING_ARG_1701=You have specified \
 not to create a base DN.  If no base DN is to be created you cannot specify \
 argument '%s'
INFO_DESCRIPTION_SUBENTRIES_1702=Use subentries control to specify that \
 subentries are visible and normal entries are not
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -973,6 +973,13 @@
                ReturnCode.CONFIGURATION_ERROR,
                INFO_ERROR_CONFIGURING.get(), null);
          }
          else
          {
            if (getUserData().getNewSuffixOptions().getBaseDns().isEmpty())
            {
              helper.deleteBackend(getBackendName());
            }
          }
        } catch (ApplicationException aex)
        {
          ae = aex;
@@ -1582,8 +1589,16 @@
   * NOTE: this method assumes that the server is running.
   * @throws ApplicationException if something goes wrong.
   */
  protected void createReplicatedBackends() throws ApplicationException
  protected void createReplicatedBackendsIfRequired()
  throws ApplicationException
  {
    if (getUserData().getReplicationOptions().getType()
        == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY &&
        getUserData().getNewSuffixOptions().getBaseDns().isEmpty())
    {
      // There is nothing to do.
      return;
    }
    notifyListeners(getFormattedWithPoints(
        INFO_PROGRESS_CREATING_REPLICATED_BACKENDS.get()));
    // The keys are the backend IDs and the values the list of base DNs.
@@ -3902,8 +3917,8 @@
    String baseDn = qs.getFieldStringValue(FieldName.DIRECTORY_BASE_DN);
    if ((baseDn == null) || (baseDn.trim().length() == 0))
    {
      errorMsgs.add(INFO_EMPTY_BASE_DN.get());
      qs.displayFieldInvalid(FieldName.DIRECTORY_BASE_DN, true);
      // Do nothing, the user does not want to provide a base DN.
      baseDn = "";
    } else if (!isDn(baseDn))
    {
      errorMsgs.add(INFO_NOT_A_BASE_DN.get());
@@ -3918,6 +3933,13 @@
      validBaseDn = true;
    }
    if (baseDn.equals(""))
    {
      LinkedList<String> baseDns = new LinkedList<String>();
      dataOptions = NewSuffixOptions.createEmpty(baseDns);
    }
    else
    {
    // Check the data options
    NewSuffixOptions.Type type =
        (NewSuffixOptions.Type) qs.getFieldValue(FieldName.DATA_OPTIONS);
@@ -3941,8 +3963,8 @@
        LinkedList<String> ldifPaths = new LinkedList<String>();
        ldifPaths.add(ldifPath);
        dataOptions = NewSuffixOptions.createImportFromLDIF(baseDns, ldifPaths,
            null, null);
          dataOptions = NewSuffixOptions.createImportFromLDIF(
              baseDns, ldifPaths, null, null);
        qs.displayFieldInvalid(FieldName.LDIF_PATH, false);
      }
      break;
@@ -4008,6 +4030,7 @@
        }
      }
    }
    }
    if (dataOptions != null)
    {
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -63,6 +63,8 @@
import org.opends.server.admin.std.client.*;
import org.opends.server.admin.std.meta.*;
import org.opends.server.backends.task.TaskState;
import org.opends.server.core.DirectoryServer;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.messages.CoreMessages;
import org.opends.messages.JebMessages;
import org.opends.messages.ReplicationMessages;
@@ -77,6 +79,7 @@
import org.opends.server.types.Entry;
import org.opends.server.types.ExistingFileBehavior;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.OpenDsException;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFWriter;
import org.opends.server.util.SetupUtils;
@@ -337,6 +340,29 @@
    }
  }
  /**
   * Deletes a backend on the server.  It assumes the server is stopped.
   * @param backendName the name of the backend to be deleted.
   * @throws ApplicationException if something goes wrong.
   */
  public void deleteBackend(String backendName)
  throws ApplicationException
  {
    try
    {
      // Read the configuration file.
      String dn = Utilities.getRDNString("ds-cfg-backend-id",
          backendName)+",cn=Backends,cn=config";
      Utilities.deleteConfigSubtree(
          DirectoryServer.getConfigHandler(), DN.decode(dn));
    }
    catch (OpenDsException ode)
    {
      throw new ApplicationException(
          ReturnCode.CONFIGURATION_ERROR, ode.getMessageObject(), ode);
    }
  }
  /**
   * Creates a local database backend on the server.
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -181,7 +181,7 @@
          notifyListeners(getTaskSeparator());
        }
        setCurrentProgressStep(InstallProgressStep.CONFIGURING_REPLICATION);
        createReplicatedBackends();
        createReplicatedBackendsIfRequired();
        configureReplication();
        checkAbort();
      }
opends/src/quicksetup/org/opends/quicksetup/installer/ui/DataOptionsPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.installer.ui;
@@ -200,6 +200,20 @@
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    panel.add(auxPanel, gbc);
    gbc.gridwidth = GridBagConstraints.RELATIVE;
    gbc.weightx = 0.0;
    gbc.insets.top = 0;
    gbc.insets.left = 0;
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(Box.createHorizontalGlue(), gbc);
    gbc.insets.top = 3;
    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    panel.add(UIFactory.makeJLabel(UIFactory.IconType.NO_ICON,
        INFO_NO_BASE_DN_INLINE_HELP.get(),
        UIFactory.TextStyle.INLINE_HELP), gbc);
    int h1 = getLabel(FieldName.DATA_OPTIONS).getPreferredSize().height;
    int h2 = getRadioButton(NewSuffixOptions.Type.CREATE_BASE_ENTRY).
    getPreferredSize().height;
opends/src/quicksetup/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
@@ -32,12 +32,9 @@
import static org.opends.messages.QuickSetupMessages.*;
import org.opends.admin.ads.ServerDescriptor;
import org.opends.admin.ads.SuffixDescriptor;
import org.opends.quicksetup.Constants;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.installer.AuthenticationData;
import org.opends.quicksetup.installer.DataReplicationOptions;
import org.opends.quicksetup.installer.NewSuffixOptions;
import org.opends.quicksetup.installer.SuffixesToReplicateOptions;
import org.opends.quicksetup.ui.*;
import org.opends.quicksetup.util.Utils;
@@ -49,7 +46,6 @@
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
/**
@@ -100,10 +96,10 @@
    setFieldValue(FieldName.ADMIN_CONNECTOR_PORT,
        String.valueOf(userData.getAdminConnectorPort()));
    setFieldValue(FieldName.SECURITY_OPTIONS,
        getSecurityOptionsString(userData.getSecurityOptions(), false));
        Utils.getSecurityOptionsString(userData.getSecurityOptions(), false));
    setFieldValue(FieldName.DIRECTORY_MANAGER_DN, userData
        .getDirectoryManagerDn());
    setFieldValue(FieldName.DATA_OPTIONS, getDataDisplayString(userData));
    setFieldValue(FieldName.DATA_OPTIONS, Utils.getDataDisplayString(userData));
    if (userData.mustCreateAdministrator())
    {
      setFieldValue(FieldName.GLOBAL_ADMINISTRATOR_UID,
@@ -276,88 +272,6 @@
  }
  /**
   * Returns the localized string describing the DataOptions chosen by the user.
   * @param userInstallData the DataOptions of the user.
   * @return the localized string describing the DataOptions chosen by the user.
   */
  public static String getDataDisplayString(UserData userInstallData)
  {
    Message msg;
    boolean createSuffix = false;
    DataReplicationOptions repl =
      userInstallData.getReplicationOptions();
    SuffixesToReplicateOptions suf =
      userInstallData.getSuffixesToReplicateOptions();
    createSuffix =
      repl.getType() == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY ||
      repl.getType() == DataReplicationOptions.Type.STANDALONE ||
      suf.getType() == SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY;
    if (createSuffix)
    {
      Message arg2;
      NewSuffixOptions options = userInstallData.getNewSuffixOptions();
      switch (options.getType())
      {
      case CREATE_BASE_ENTRY:
        arg2 = INFO_REVIEW_CREATE_BASE_ENTRY_LABEL.get(
            options.getBaseDns().getFirst());
        break;
      case LEAVE_DATABASE_EMPTY:
        arg2 = INFO_REVIEW_LEAVE_DATABASE_EMPTY_LABEL.get();
        break;
      case IMPORT_FROM_LDIF_FILE:
        arg2 = INFO_REVIEW_IMPORT_LDIF.get(options.getLDIFPaths().getFirst());
        break;
      case IMPORT_AUTOMATICALLY_GENERATED_DATA:
        arg2 = INFO_REVIEW_IMPORT_AUTOMATICALLY_GENERATED.get(
                String.valueOf(options.getNumberEntries()));
        break;
      default:
        throw new IllegalArgumentException("Unknown type: "+options.getType());
      }
      if (options.getBaseDns().size() > 1)
      {
        msg = INFO_REVIEW_CREATE_SUFFIX.get(
            Utils.listToString(options.getBaseDns(), Constants.LINE_SEPARATOR),
            arg2);
      }
      else
      {
        msg = INFO_REVIEW_CREATE_SUFFIX.get(options.getBaseDns().getFirst(),
          arg2);
      }
    }
    else
    {
      StringBuilder buf = new StringBuilder();
      Set<SuffixDescriptor> suffixes = suf.getSuffixes();
      for (SuffixDescriptor suffix : suffixes)
      {
        if (buf.length() > 0)
        {
          buf.append("\n");
        }
        buf.append(suffix.getDN());
      }
      msg = INFO_REVIEW_REPLICATE_SUFFIX.get(buf.toString());
    }
    return msg.toString();
  }
   /**
    * Returns the String representing the replication port configuration.
    * @param userInstallData the DataOptions of the user.
    * @return the localized string describing the Replication Ports chosen by
opends/src/quicksetup/org/opends/quicksetup/installer/ui/ServerSettingsPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.installer.ui;
@@ -433,7 +433,8 @@
      break;
    case SECURITY_OPTIONS:
      value = getSecurityOptionsString(defaultUserData.getSecurityOptions(),
      value = Utils.getSecurityOptionsString(
          defaultUserData.getSecurityOptions(),
          true);
      break;
@@ -597,7 +598,8 @@
          {
            securityOptions =
              getConfigureSecureAccessDialog().getSecurityOptions();
            lSecurity.setText(getSecurityOptionsString(securityOptions, true));
            lSecurity.setText(
                Utils.getSecurityOptionsString(securityOptions, true));
          }
        }
      });
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -224,7 +224,7 @@
          notifyListeners(getTaskSeparator());
        }
        setCurrentProgressStep(InstallProgressStep.CONFIGURING_REPLICATION);
        createReplicatedBackends();
        createReplicatedBackendsIfRequired();
        configureReplication();
        checkAbort();
      }
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetupStepPanel.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.ui;
@@ -44,9 +44,7 @@
import org.opends.quicksetup.event.ButtonActionListener;
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.ProgressDescriptor;
import org.opends.quicksetup.SecurityOptions;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.Constants;
import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.util.URLWorker;
@@ -442,95 +440,6 @@
  }
  /**
   * Returns a localized String representation of the provided SecurityOptions
   * object.
   * @param ops the SecurityOptions object from which we want to obtain the
   * String representation.
   * @param html whether the resulting String must be in HTML or not.
   * @return a localized String representation of the provided SecurityOptions
   * object.
   */
  public static String getSecurityOptionsString(SecurityOptions ops,
      boolean html)
  {
    StringBuilder buf = new StringBuilder();
    if (ops.getCertificateType() ==
      SecurityOptions.CertificateType.NO_CERTIFICATE)
    {
      buf.append(INFO_NO_SECURITY.get());
    }
    else
    {
      if (ops.getEnableStartTLS())
      {
        buf.append(INFO_ENABLE_STARTTLS.get());
      }
      if (ops.getEnableSSL())
      {
        if (buf.length() > 0)
        {
          if (html)
          {
            buf.append(Constants.HTML_LINE_BREAK);
          }
          else
          {
            buf.append("\n");
          }
        }
        buf.append(INFO_ENABLE_SSL.get(String.valueOf(ops.getSslPort())));
      }
      if (html)
      {
        buf.append(Constants.HTML_LINE_BREAK);
      }
      else
      {
        buf.append("\n");
      }
      Message certMsg;
      switch (ops.getCertificateType())
      {
      case SELF_SIGNED_CERTIFICATE:
        certMsg = INFO_SELF_SIGNED_CERTIFICATE.get();
        break;
      case JKS:
        certMsg = INFO_JKS_CERTIFICATE.get();
        break;
      case JCEKS:
        certMsg = INFO_JCEKS_CERTIFICATE.get();
        break;
      case PKCS11:
        certMsg = INFO_PKCS11_CERTIFICATE.get();
        break;
      case PKCS12:
        certMsg = INFO_PKCS12_CERTIFICATE.get();
        break;
      default:
        throw new IllegalStateException("Unknown certificate options type: "+
            ops.getCertificateType());
      }
      buf.append(certMsg);
    }
    if (html)
    {
      return "<html>"+UIFactory.applyFontToHtml(buf.toString(),
          UIFactory.SECONDARY_FIELD_VALID_FONT);
    }
    else
    {
      return buf.toString();
    }
  }
  /**
   * Creates and returns the title panel.
   * @return the title panel.
   */
opends/src/quicksetup/org/opends/quicksetup/ui/UIFactory.java
@@ -336,6 +336,12 @@
          getColor(INFO_PASSWORDFIELD_COLOR.get());
  /**
   * Specifies the in-line help text color.
   */
  public static final Color INLINE_HELP_COLOR =
          getColor(INFO_INLINE_HELP_COLOR.get());
  /**
   * Specifies the panel border color.
   */
  public static final Color PANEL_BORDER_COLOR =
@@ -504,6 +510,12 @@
   */
  public static final Font ERROR_DIALOG_FONT = defaultFont;
  /**
   * Specifies the font for the text in the in-line help.
   */
  public static final Font INLINE_HELP_FONT = defaultFont.deriveFont(
      (float)(defaultFont.getSize() - 2));
  private static final String SPAN_CLOSE = "</span>";
  private static final String DIV_CLOSE = "</div>";
@@ -709,6 +721,10 @@
     */
    INSTRUCTIONS,
    /**
     * In-line help style.
     */
    INLINE_HELP,
    /**
     * No text style.
     */
    NO_STYLE
@@ -1076,6 +1092,11 @@
      l.setForeground(PASSWORDFIELD_COLOR);
      break;
    case INLINE_HELP:
      l.setFont(INLINE_HELP_FONT);
      l.setForeground(INLINE_HELP_COLOR);
      break;
    case NO_STYLE:
      // Do nothing
      break;
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -61,9 +61,14 @@
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.TrustManager;
import org.opends.admin.ads.SuffixDescriptor;
import org.opends.admin.ads.TopologyCacheException;
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.quicksetup.*;
import org.opends.quicksetup.installer.DataReplicationOptions;
import org.opends.quicksetup.installer.NewSuffixOptions;
import org.opends.quicksetup.installer.SuffixesToReplicateOptions;
import org.opends.quicksetup.ui.UIFactory;
import org.opends.server.util.SetupUtils;
import org.opends.messages.MessageBuilder;
@@ -1746,7 +1751,7 @@
    try
    {
      LdapName jndiName = new LdapName("cn=monitor");
      NamingEnumeration listeners = ctx.search(jndiName, filter, ctls);
      NamingEnumeration<?> listeners = ctx.search(jndiName, filter, ctls);
      while(listeners.hasMore())
      {
@@ -1919,7 +1924,7 @@
    {
      try
      {
        Class c = Class.forName(Utils.CUSTOMIZATION_CLASS_NAME);
        Class<?> c = Class.forName(Utils.CUSTOMIZATION_CLASS_NAME);
        Object obj = c.newInstance();
        value = valueClass.cast(c.getField(fieldName).get(obj));
@@ -1969,6 +1974,185 @@
    }
    return sb.toString();
  }
  /**
   * Returns the localized string describing the DataOptions chosen by the user.
   * @param userInstallData the DataOptions of the user.
   * @return the localized string describing the DataOptions chosen by the user.
   */
  public static String getDataDisplayString(UserData userInstallData)
  {
    Message msg;
    boolean createSuffix = false;
    DataReplicationOptions repl =
      userInstallData.getReplicationOptions();
    SuffixesToReplicateOptions suf =
      userInstallData.getSuffixesToReplicateOptions();
    createSuffix =
      repl.getType() == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY ||
      repl.getType() == DataReplicationOptions.Type.STANDALONE ||
      suf.getType() == SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY;
    if (createSuffix)
    {
      Message arg2;
      NewSuffixOptions options = userInstallData.getNewSuffixOptions();
      switch (options.getType())
      {
      case CREATE_BASE_ENTRY:
        arg2 = INFO_REVIEW_CREATE_BASE_ENTRY_LABEL.get(
            options.getBaseDns().getFirst());
        break;
      case LEAVE_DATABASE_EMPTY:
        arg2 = INFO_REVIEW_LEAVE_DATABASE_EMPTY_LABEL.get();
        break;
      case IMPORT_FROM_LDIF_FILE:
        arg2 = INFO_REVIEW_IMPORT_LDIF.get(options.getLDIFPaths().getFirst());
        break;
      case IMPORT_AUTOMATICALLY_GENERATED_DATA:
        arg2 = INFO_REVIEW_IMPORT_AUTOMATICALLY_GENERATED.get(
                String.valueOf(options.getNumberEntries()));
        break;
      default:
        throw new IllegalArgumentException("Unknown type: "+options.getType());
      }
      if (options.getBaseDns().isEmpty())
      {
        msg = INFO_REVIEW_CREATE_NO_SUFFIX.get();
      }
      else if (options.getBaseDns().size() > 1)
      {
        msg = INFO_REVIEW_CREATE_SUFFIX.get(
            Utils.listToString(options.getBaseDns(), Constants.LINE_SEPARATOR),
            arg2);
      }
      else
      {
        msg = INFO_REVIEW_CREATE_SUFFIX.get(options.getBaseDns().getFirst(),
          arg2);
      }
    }
    else
    {
      StringBuilder buf = new StringBuilder();
      Set<SuffixDescriptor> suffixes = suf.getSuffixes();
      for (SuffixDescriptor suffix : suffixes)
      {
        if (buf.length() > 0)
        {
          buf.append("\n");
        }
        buf.append(suffix.getDN());
      }
      msg = INFO_REVIEW_REPLICATE_SUFFIX.get(buf.toString());
    }
    return msg.toString();
  }
  /**
   * Returns a localized String representation of the provided SecurityOptions
   * object.
   * @param ops the SecurityOptions object from which we want to obtain the
   * String representation.
   * @param html whether the resulting String must be in HTML or not.
   * @return a localized String representation of the provided SecurityOptions
   * object.
   */
  public static String getSecurityOptionsString(SecurityOptions ops,
      boolean html)
  {
    StringBuilder buf = new StringBuilder();
    if (ops.getCertificateType() ==
      SecurityOptions.CertificateType.NO_CERTIFICATE)
    {
      buf.append(INFO_NO_SECURITY.get());
    }
    else
    {
      if (ops.getEnableStartTLS())
      {
        buf.append(INFO_ENABLE_STARTTLS.get());
      }
      if (ops.getEnableSSL())
      {
        if (buf.length() > 0)
        {
          if (html)
          {
            buf.append(Constants.HTML_LINE_BREAK);
          }
          else
          {
            buf.append("\n");
          }
        }
        buf.append(INFO_ENABLE_SSL.get(String.valueOf(ops.getSslPort())));
      }
      if (html)
      {
        buf.append(Constants.HTML_LINE_BREAK);
      }
      else
      {
        buf.append("\n");
      }
      Message certMsg;
      switch (ops.getCertificateType())
      {
      case SELF_SIGNED_CERTIFICATE:
        certMsg = INFO_SELF_SIGNED_CERTIFICATE.get();
        break;
      case JKS:
        certMsg = INFO_JKS_CERTIFICATE.get();
        break;
      case JCEKS:
        certMsg = INFO_JCEKS_CERTIFICATE.get();
        break;
      case PKCS11:
        certMsg = INFO_PKCS11_CERTIFICATE.get();
        break;
      case PKCS12:
        certMsg = INFO_PKCS12_CERTIFICATE.get();
        break;
      default:
        throw new IllegalStateException("Unknown certificate options type: "+
            ops.getCertificateType());
      }
      buf.append(certMsg);
    }
    if (html)
    {
      return "<html>"+UIFactory.applyFontToHtml(buf.toString(),
          UIFactory.SECONDARY_FIELD_VALID_FONT);
    }
    else
    {
      return buf.toString();
    }
  }
}
/**
opends/src/server/org/opends/server/tools/InstallDS.java
@@ -59,8 +59,6 @@
import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.installer.NewSuffixOptions;
import org.opends.quicksetup.installer.offline.OfflineInstaller;
import org.opends.quicksetup.installer.ui.InstallReviewPanel;
import org.opends.quicksetup.ui.QuickSetupStepPanel;
import org.opends.quicksetup.util.IncompatibleVersionException;
import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
import org.opends.quicksetup.util.Utils;
@@ -771,10 +769,6 @@
    // Check the validity of the base DNs
    LinkedList<String> baseDNs = argParser.baseDNArg.getValues();
    if (baseDNs.isEmpty())
    {
      baseDNs.add(argParser.baseDNArg.getDefaultValue());
    }
    for (String baseDN : baseDNs)
    {
      try
@@ -1338,10 +1332,39 @@
  private void promptIfRequiredForImportData(UserData uData)
  throws UserDataException
  {
    boolean prompt = true;
    if (!argParser.baseDNArg.isPresent())
    {
      try
      {
        prompt = confirmAction(INFO_INSTALLDS_PROVIDE_BASE_DN_PROMPT.get(),
            true);
      }
      catch (CLIException ce)
      {
        prompt = true;
        LOG.log(Level.WARNING, "Error reading input: "+ce, ce);
      }
    }
    NewSuffixOptions dataOptions;
    if (!prompt)
    {
      LinkedList<String> baseDNs = new LinkedList<String>();
      dataOptions = NewSuffixOptions.createEmpty(baseDNs);
    }
    else
    {
    // Check the validity of the base DNs
    LinkedList<String> baseDNs = promptIfRequiredForDNs(
        argParser.baseDNArg, INFO_INSTALLDS_PROMPT_BASEDN.get(), true);
      dataOptions = promptIfRequiredForDataOptions(baseDNs);
    }
    uData.setNewSuffixOptions(dataOptions);
  }
  private NewSuffixOptions promptIfRequiredForDataOptions(
      LinkedList<String> baseDNs)
  {
    NewSuffixOptions dataOptions;
    if (argParser.importLDIFArg.isPresent())
    {
@@ -1629,7 +1652,7 @@
            populateType);
      }
    }
    uData.setNewSuffixOptions(dataOptions);
    return dataOptions;
  }
  /**
@@ -2509,10 +2532,9 @@
        Message.raw(String.valueOf(uData.getAdminConnectorPort())),
        Message.raw(jmxPort != -1 ? String.valueOf(jmxPort) : null),
        Message.raw(
            QuickSetupStepPanel.getSecurityOptionsString(
                uData.getSecurityOptions(), false)),
            Utils.getSecurityOptionsString(uData.getSecurityOptions(), false)),
        Message.raw(uData.getDirectoryManagerDn()),
        Message.raw(InstallReviewPanel.getDataDisplayString(uData)),
        Message.raw(Utils.getDataDisplayString(uData)),
    };
    int maxWidth = 0;
    for (Message l : labels)
opends/src/server/org/opends/server/tools/InstallDSArgumentParser.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 */
package org.opends.server.tools;
@@ -43,6 +43,7 @@
import org.opends.quicksetup.util.Utils;
import org.opends.server.extensions.ConfigFileHandler;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.args.Argument;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.ArgumentParser;
import org.opends.server.util.args.BooleanArgument;
@@ -203,7 +204,7 @@
        OPTION_LONG_BASEDN.toLowerCase(), OPTION_SHORT_BASEDN,
        OPTION_LONG_BASEDN, false, true, true,
        INFO_BASEDN_PLACEHOLDER.get(),
        "dc=example,dc=com", OPTION_LONG_BASEDN,
        null, OPTION_LONG_BASEDN,
        INFO_INSTALLDS_DESCRIPTION_BASEDN.get());
    addArgument(baseDNArg);
@@ -659,6 +660,19 @@
          sampleDataArg.getLongIdentifier());
      errorMessages.add(message);
    }
    if (noPromptArg.isPresent() && !baseDNArg.isPresent())
    {
      Argument[] args = {importLDIFArg, addBaseEntryArg, sampleDataArg};
      for (Argument arg : args)
      {
        if (arg.isPresent())
        {
          errorMessages.add(ERR_INSTALLDS_NO_BASE_DN_AND_CONFLICTING_ARG.get(
              "--"+arg.getLongIdentifier()));
        }
      }
    }
  }
  /**