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

jvergara
04.48.2007 90288dc278771356aa6dfa3832cb4a4bb19e9fab
This commit's design changes have been reviewed and approved by Brian Ehret.

Add a "Finish" step to the graphical upgrade, setup and uninstall.

Issue 1325: Update quicksetup to integrate common install scenario

These modifications allow to configure replication in the graphical setup.

Issue 1850: consider replication for uninstall and cancel install

These modfications allow to cancel the modifications done in remote servers during the install when the user clicks on cancel.

Issue 1863: combine Web Start upgrade and install into one tool

These modifications allow to launch an application that combines both install and upgrade.


Note: because of some problems with the total update (see Issue 1893) the administration suffix is configured with its own database so a new directory has been created in the installation (adminDb). If we consider that is not a good idea to have a separate database this will be updated in the future once 1893 is fixed. The directory must be created during installation because in some case the Administration configuration is created using LDAP and remotely when installing a new server (and in this case we have no access to the fiel system of the firstly installed server).
7 files added
24 files modified
2207 ■■■■ changed files
opends/build.xml 1 ●●●● patch | view | raw | blame | history
opends/src/ads/org/opends/admin/ads/ADSContext.java 146 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Application.java 8 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Step.java 13 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/WizardStep.java 7 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgradeUserData.java 57 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java 495 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java 259 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ConfiguredDomain.java 91 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ConfiguredReplication.java 127 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java 3 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 319 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java 165 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 26 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 35 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties 32 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/ButtonsPanel.java 14 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java 12 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/FinishedPanel.java 54 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java 45 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java 5 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java 15 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java 54 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java 2 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeWizardStep.java 90 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java 94 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java 4 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java 16 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/PlainTextProgressMessageFormatter.java 10 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/ProgressMessageFormatter.java 6 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java 2 ●●● patch | view | raw | blame | history
opends/build.xml
@@ -705,6 +705,7 @@
         location="${package.dir}/OpenDS-${VERSION_NUMBER_STRING}" />
    <mkdir dir="${pdir}"                 />
    <mkdir dir="${pdir}/adminDb"         />
    <mkdir dir="${pdir}/bak"             />
    <mkdir dir="${pdir}/bat"             />
    <mkdir dir="${pdir}/bin"             />
opends/src/ads/org/opends/admin/ads/ADSContext.java
@@ -44,7 +44,6 @@
import javax.naming.NoPermissionException;
import javax.naming.NotContextException;
import javax.naming.directory.DirContext;
import javax.naming.directory.ModificationItem;
import javax.naming.directory.SearchResult;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
@@ -52,7 +51,6 @@
import javax.naming.directory.BasicAttributes;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.InitialLdapContext;
import javax.naming.ldap.LdapContext;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
@@ -762,7 +760,7 @@
   * The call to this method assumes that OpenDS.jar has already been loaded.
   * So this should not be called by the Java Web Start before being sure that
   * this jar is loaded.
   * @param backendName the backend name which will handle admin inforamtion.
   * @param backendName the backend name which will handle admin information.
   * @throws ADSContextException if something goes wrong.
   */
  public void createAdminData(String backendName) throws ADSContextException
@@ -775,7 +773,6 @@
    createAdministratorContainerEntry();
    createContainerEntry(getServerContainerDN());
    createContainerEntry(getServerGroupContainerDN());
    //setupACIOnServer(getDirContext(), true);
  }
  /**
@@ -785,7 +782,6 @@
  public void removeAdminData() throws ADSContextException
  {
    removeAdministrationSuffix();
    //setupACIOnServer(getDirContext(), false);
  }
@@ -931,92 +927,6 @@
  }
  /**
   * Used to modify the configuration on the server that must be managed; this
   * setups the ACIs on the server so that the Administrator can access the
   * server configuration.
   * TODO: complete this.
   * @param dirCtx the DirContext to the server that must be updated.
   * @param enable whether to enable or disable the access to the server.
   * @return <CODE>true</CODE> if something modified and <CODE>false</CODE>
   * otherwise.
   * @throws ADSContextException if the ACIs could not be set up.
   */
  private boolean setupACIOnServer(LdapContext dirCtx, boolean enable)
  throws ADSContextException
  {
    boolean result;
    Attributes currentAttrs;
    Attribute currentAttr, newAttr;
    ModificationItem modItem;
    try
    {
      // Get the ACI value on the global ACI
      String accessControlDn = "cn=Access Control Handler,cn=config";
      currentAttrs = dirCtx.getAttributes(accessControlDn,
          new String[] { "ds-cfg-global-aci" });
      currentAttr = currentAttrs.get("ds-cfg-global-aci");
      // Check what ACIs values must be added or removed
      newAttr = new BasicAttribute("ds-cfg-global-aci");
      modItem = null;
      if (enable)
      {
        if ((currentAttr == null) || !currentAttr.contains(getAdminACI1()))
        {
          newAttr.add(getAdminACI1());
        }
        if ((currentAttr == null) || !currentAttr.contains(getAdminACI2()))
        {
          newAttr.add(getAdminACI2());
        }
        if (newAttr.size() >= 1)
        {
          modItem = new ModificationItem(LdapContext.ADD_ATTRIBUTE, newAttr);
        }
      }
      else
      {
        if ((currentAttr != null) && currentAttr.contains(getAdminACI1()))
        {
          newAttr.add(getAdminACI1());
        }
        if ((currentAttr != null) && currentAttr.contains(getAdminACI2()))
        {
          newAttr.add(getAdminACI2());
        }
        if (newAttr.size() >= 1)
        {
          modItem = new ModificationItem(LdapContext.REMOVE_ATTRIBUTE, newAttr);
        }
      }
      // Update the ACI values on the access control entry
      if (modItem != null)
      {
        dirCtx.modifyAttributes(accessControlDn,
            new ModificationItem[] { modItem});
        result = true;
      }
      else
      {
        result = false;
      }
    }
    catch (NoPermissionException x)
    {
      throw new ADSContextException(
          ADSContextException.ErrorType.ACCESS_PERMISSION);
    }
    catch(NamingException x)
    {
      throw new ADSContextException(
          ADSContextException.ErrorType.ERROR_UNEXPECTED, x);
    }
    return result;
  }
  /**
   * This method returns the DN of the entry that corresponds to the given host
   * name and installation path.
   * @param hostname the host name.
@@ -1733,26 +1643,13 @@
  }
  /**
   * Returns the DN of the ACI container entry.
   * @return the DN of the ACI container entry.
   */
  private static String getTopContainerACI()
  {
    return
    "(targetattr = \"*\")" +
    "(version 3.0;" +
    "acl \"Enable full access for Directory Services Managers group\";" +
    "allow (all)" +
    "(groupdn = \"ldap:///" + getAdministratorContainerDN() + "\");" +
    ")";
  }
  /**
   * Creates the Administration Suffix.
   * @param backendName TODO
   * @param backendName the backend name to be used for the Administration
   * Suffix.  If this value is null the default backendName for the
   * Administration Suffix will be used.
   * @throws ADSContextException if something goes wrong.
   */
  private void createAdministrationSuffix(String backendName)
  public void createAdministrationSuffix(String backendName)
  throws ADSContextException
  {
    ADSContextHelper helper = new ADSContextHelper();
@@ -1762,7 +1659,7 @@
      ben = getBackendName() ;
    }
    helper.createAdministrationSuffix(getDirContext(), ben,
        "db", "importAdminTemp");
        getDbName(), getImportTemp());
  }
  /**
@@ -1780,36 +1677,13 @@
    return "adminRoot";
  }
  /**
   * Returns the first ACI required to provide access to administrators.
   * @return the first ACI required to provide access to administrators.
   */
  private static String getAdminACI1()
  private static String getDbName()
  {
    return
    "(target=\"ldap:///cn=config\")"+
    "(targetattr = \"*\") " +
    "(version 3.0; " +
    "acl \"Enable full access for Global Administrators.\"; " +
    "allow (all)(userdn = \"ldap:///" +
    getAdministratorDN("*") +
    "\");)";
    return "adminDb";
  }
  /**
   * Returns the second ACI required to provide access to administrators.
   * @return the second ACI required to provide access to administrators.
   */
  private static String getAdminACI2()
  private static String getImportTemp()
  {
    return
    "(target=\"ldap:///cn=Access Control Handler,cn=config\")"+
    "(targetattr = \"ds-cfg-global-aci\") (targetscope = \"base\") " +
    "(version 3.0; " +
    "acl \"Enable global ACI modification by Global Administrators.\"; "+
    "allow (all)(userdn = \"ldap:///" +
    getAdministratorDN("*") +
    "\");)";
    return "importAdminTemp";
  }
}
opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -443,15 +443,15 @@
   * exception.
   * This method applies a margin if the applyMargin parameter is
   * <CODE>true</CODE>.
   * @param ex the exception.
   * @param t the exception.
   * @param applyMargin specifies whether we apply a margin or not to the
   * resulting formatted text.
   * @return the formatted representation of an error message for the given
   * exception.
   */
  protected String getFormattedError(Exception ex, boolean applyMargin)
  protected String getFormattedError(Throwable t, boolean applyMargin)
  {
    return formatter.getFormattedError(ex, applyMargin);
    return formatter.getFormattedError(t, applyMargin);
  }
  /**
@@ -488,7 +488,7 @@
   * Returns the installation path.
   * @return the installation path.
   */
  protected abstract String getInstallationPath();
  public abstract String getInstallationPath();
  /**
   * Gets the current step.
opends/src/quicksetup/org/opends/quicksetup/Step.java
@@ -80,7 +80,12 @@
  /**
   * Progress panel.
   */
  PROGRESS("progress-step");
  PROGRESS("progress-step"),
  /**
   * Finished panel.
   */
  FINISHED("finished-step");
  private String msgKey;
@@ -109,5 +114,11 @@
    return this == PROGRESS;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isFinishedStep() {
    return this == FINISHED;
  }
}
opends/src/quicksetup/org/opends/quicksetup/WizardStep.java
@@ -47,4 +47,11 @@
   */
  boolean isProgressStep();
  /**
   * Indicates whether this is the finished step for the application or not.
   * @return <CODE>true</CODE> if this is the finished step for the application
   * and <CODE>false</CODE> otherwise.
   */
  boolean isFinishedStep();
}
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgradeUserData.java
New file
@@ -0,0 +1,57 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.installandupgrader;
import org.opends.quicksetup.upgrader.UpgradeUserData;
/**
 * User data specific to the upgrade and install merged application.
 */
public class InstallAndUpgradeUserData extends UpgradeUserData
{
  private boolean isUpgrade;
  /**
   * Returns <CODE>true</CODE> if we are doing an upgrade and <CODE>false</CODE>
   * if not.
   * @return <CODE>true</CODE> if we are doing an upgrade and <CODE>false</CODE>
   * if not.
   */
  public boolean isUpgrade() {
    return isUpgrade;
  }
  /**
   * Sets whether we want to make an upgrade.
   * @param isUpgrade the boolean telling whether we want to do an upgrade or
   * not.
   */
  public void setUpgrade(boolean isUpgrade) {
    this.isUpgrade = isUpgrade;
  }
}
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/InstallAndUpgrader.java
New file
@@ -0,0 +1,495 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.installandupgrader;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.logging.Logger;
import org.opends.quicksetup.ButtonName;
import org.opends.quicksetup.CurrentInstallStatus;
import org.opends.quicksetup.ProgressStep;
import org.opends.quicksetup.QuickSetupLog;
import org.opends.quicksetup.Step;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.UserDataException;
import org.opends.quicksetup.WizardStep;
import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.i18n.ResourceProvider;
import org.opends.quicksetup.installandupgrader.ui.WelcomePanel;
import org.opends.quicksetup.installer.Installer;
import org.opends.quicksetup.installer.offline.OfflineInstaller;
import org.opends.quicksetup.installer.webstart.WebStartInstaller;
import org.opends.quicksetup.ui.FieldName;
import org.opends.quicksetup.ui.GuiApplication;
import org.opends.quicksetup.ui.QuickSetup;
import org.opends.quicksetup.ui.QuickSetupDialog;
import org.opends.quicksetup.ui.QuickSetupStepPanel;
import org.opends.quicksetup.upgrader.UpgradeLauncher;
import org.opends.quicksetup.upgrader.UpgradeWizardStep;
import org.opends.quicksetup.upgrader.Upgrader;
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.util.Utils;
/**
 * Application that allows to upgrade or install OpenDS.
 */
public class InstallAndUpgrader extends GuiApplication
{
  static private final Logger LOG =
    Logger.getLogger(InstallAndUpgrader.class.getName());
  private Installer installer;
  private Upgrader upgrader;
  private InstallAndUpgradeUserData userData;
  /**
   * Creates a default instance.
   */
  public InstallAndUpgrader() {
    // Initialize the logs if necessary
    try {
      if (!QuickSetupLog.isInitialized())
        QuickSetupLog.initLogFileHandler(
                File.createTempFile(
                        UpgradeLauncher.LOG_FILE_PREFIX,
                        UpgradeLauncher.LOG_FILE_SUFFIX));
    } catch (IOException e) {
      System.err.println(
              ResourceProvider.getInstance().getMsg("error-initializing-log"));
      e.printStackTrace();
    }
    if (Utils.isWebStart())
    {
      installer = new WebStartInstaller();
    }
    else
    {
      installer = new OfflineInstaller();
    }
    upgrader = new Upgrader();
  }
  /**
   * {@inheritDoc}
   */
  public void setProgressMessageFormatter(ProgressMessageFormatter formatter) {
    super.setProgressMessageFormatter(formatter);
    installer.setProgressMessageFormatter(formatter);
    upgrader.setProgressMessageFormatter(formatter);
  }
  /**
   * {@inheritDoc}
   */
  public void setCurrentInstallStatus(CurrentInstallStatus installStatus) {
    super.setCurrentInstallStatus(installStatus);
    installer.setCurrentInstallStatus(installStatus);
    upgrader.setCurrentInstallStatus(installStatus);
  }
  /**
   * {@inheritDoc}
   */
  public UserData getUserData()
  {
    if (userData == null) {
      userData = (InstallAndUpgradeUserData)createUserData();
    }
    return userData;
  }
  /**
   * {@inheritDoc}
   */
  public UserData createUserData() {
    return new InstallAndUpgradeUserData();
  }
  /**
   * {@inheritDoc}
   */
  public String getFrameTitle() {
    return getMsg("frame-install-title");
  }
  /**
   * {@inheritDoc}
   */
  public WizardStep getFirstWizardStep() {
    return Step.WELCOME;
  }
  /**
   * {@inheritDoc}
   */
  public WizardStep getFinishedStep() {
    return getDelegateApplication().getFinishedStep();
  }
  /**
   * {@inheritDoc}
   */
  public void run()
  {
    getDelegateApplication().run();
  }
  /**
   * {@inheritDoc}
   */
  public void addProgressUpdateListener(ProgressUpdateListener l)
  {
    installer.addProgressUpdateListener(l);
    upgrader.addProgressUpdateListener(l);
  }
  /**
   * {@inheritDoc}
   */
  public void removeProgressUpdateListener(ProgressUpdateListener l)
  {
    installer.removeProgressUpdateListener(l);
    upgrader.removeProgressUpdateListener(l);
  }
  /**
   * {@inheritDoc}
   */
  public boolean isCancellable()
  {
    return getDelegateApplication().isCancellable();
  }
  /**
   * {@inheritDoc}
   */
  public void setWizardDialogState(QuickSetupDialog dlg,
                                      UserData userData,
                                      WizardStep step) {
    if ((getDelegateApplication() == upgrader) &&
        (step == Step.WELCOME))
    {
      step = UpgradeWizardStep.WELCOME;
    }
    getDelegateApplication().setWizardDialogState(dlg, userData, step);
  }
  /**
   * {@inheritDoc}
   */
  public WizardStep getNextWizardStep(WizardStep step) {
    if ((getDelegateApplication() == upgrader) &&
        (step == Step.WELCOME))
    {
      step = UpgradeWizardStep.WELCOME;
    }
    return getDelegateApplication().getNextWizardStep(step);
  }
  /**
   * {@inheritDoc}
   */
  public QuickSetupStepPanel createWizardStepPanel(WizardStep step) {
    QuickSetupStepPanel p = null;
    if (step == Step.WELCOME) {
      p = new WelcomePanel(this);
    }
    if (p == null)
    {
      p = upgrader.createWizardStepPanel(step);
    }
    if (p == null)
    {
      p = installer.createWizardStepPanel(step);
    }
    return p;
  }
  /**
   * {@inheritDoc}
   */
  public WizardStep getPreviousWizardStep(WizardStep step) {
    WizardStep s = getDelegateApplication().getPreviousWizardStep(step);
    if (s == UpgradeWizardStep.WELCOME)
    {
      s = Step.WELCOME;
    }
    return s;
  }
  /**
   * {@inheritDoc}
   */
  public LinkedHashSet<WizardStep> getOrderedSteps()
  {
    LinkedHashSet<WizardStep> set = new LinkedHashSet<WizardStep>();
    set.addAll(installer.getOrderedSteps());
    set.addAll(upgrader.getOrderedSteps());
    set.remove(UpgradeWizardStep.WELCOME);
    return set;
  }
  /**
   * {@inheritDoc}
   */
  public ProgressStep getCurrentProgressStep() {
    return getDelegateApplication().getCurrentProgressStep();
  }
  /**
   * {@inheritDoc}
   */
  public Integer getRatio(ProgressStep step) {
    return getDelegateApplication().getRatio(step);
  }
  /**
   * {@inheritDoc}
   */
  public String getSummary(ProgressStep step) {
    return getDelegateApplication().getSummary(step);
  }
  /**
   * {@inheritDoc}
   */
  public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) {
    getDelegateApplication().windowClosing(dlg, evt);
  }
  /**
   * {@inheritDoc}
   */
  public ButtonName getInitialFocusButtonName() {
    return getDelegateApplication().getInitialFocusButtonName();
  }
  /**
   * {@inheritDoc}
   */
  public Set<? extends WizardStep> getWizardSteps() {
    Set<WizardStep> set = new HashSet<WizardStep>();
    set.addAll(installer.getWizardSteps());
    set.addAll(upgrader.getWizardSteps());
    set.remove(UpgradeWizardStep.WELCOME);
    return set;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isVisible(WizardStep step)
  {
    boolean isVisible;
    if (step == Step.WELCOME)
    {
      isVisible = true;
    }
    else
    {
      isVisible = getDelegateApplication().isVisible(step) &&
      getDelegateApplication().getWizardSteps().contains(step);
    }
    return isVisible;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isSubStep(WizardStep step)
  {
    boolean isSubStep;
    if (step == Step.WELCOME)
    {
      isSubStep = false;
    }
    else
    {
      isSubStep = getDelegateApplication().isSubStep(step);
    }
    return isSubStep;
  }
  /**
   * {@inheritDoc}
   */
  public boolean canGoBack(WizardStep step) {
    boolean canGoBack;
    if (step == Step.WELCOME)
    {
      canGoBack = false;
    }
    else
    {
      canGoBack = getDelegateApplication().canGoBack(step);
    }
    return canGoBack;
  }
  /**
   * {@inheritDoc}
   */
  public boolean canGoForward(WizardStep step) {
    boolean canGoForward;
    if (step == Step.WELCOME)
    {
      canGoForward = true;
    }
    else
    {
      canGoForward = getDelegateApplication().canGoForward(step);
    }
    return canGoForward;
  }
  /**
   * {@inheritDoc}
   */
  public boolean canFinish(WizardStep step) {
    return getDelegateApplication().canFinish(step);
  }
  /**
   * {@inheritDoc}
   */
  public boolean canQuit(WizardStep step) {
    return getDelegateApplication().canQuit(step);
  }
  /**
   * {@inheritDoc}
   */
  public void previousClicked(WizardStep cStep, QuickSetup qs)
  {
    getDelegateApplication().previousClicked(cStep, qs);
  }
  /**
   * {@inheritDoc}
   */
  public void nextClicked(WizardStep cStep, QuickSetup qs)
  {
    getDelegateApplication().nextClicked(cStep, qs);
  }
  /**
   * {@inheritDoc}
   */
  public boolean finishClicked(WizardStep cStep, QuickSetup qs)
  {
    return getDelegateApplication().finishClicked(cStep, qs);
  }
  /**
   * {@inheritDoc}
   */
  public void closeClicked(WizardStep cStep, QuickSetup qs)
  {
    getDelegateApplication().closeClicked(cStep, qs);
  }
  /**
   * {@inheritDoc}
   */
  public void quitClicked(WizardStep cStep, QuickSetup qs)
  {
    getDelegateApplication().quitClicked(cStep, qs);
  }
  /**
   * {@inheritDoc}
   */
  public void updateUserData(WizardStep cStep, QuickSetup qs)
  throws UserDataException
  {
    if (cStep == Step.WELCOME)
    {
      Boolean isUpgrade = (Boolean)qs.getFieldValue(FieldName.IS_UPGRADE);
      ((InstallAndUpgradeUserData)getUserData()).setUpgrade(isUpgrade);
      if (isUpgrade)
      {
        upgrader.updateUserData(UpgradeWizardStep.WELCOME, qs);
        getUserData().setServerLocation(
            upgrader.getUserData().getServerLocation());
      }
      else
      {
        installer.updateUserData(cStep, qs);
      }
    }
    else
    {
      getDelegateApplication().updateUserData(cStep, qs);
    }
  }
  /**
   * {@inheritDoc}
   */
  public void cancel()
  {
    getDelegateApplication().cancel();
  }
  /**
   * {@inheritDoc}
   */
  public boolean isFinished()
  {
    return getDelegateApplication().isFinished();
  }
  /**
   * {@inheritDoc}
   */
  public String getInstallationPath()
  {
    return getDelegateApplication().getInstallationPath();
  }
  private GuiApplication getDelegateApplication()
  {
    GuiApplication application;
    if (((InstallAndUpgradeUserData)getUserData()).isUpgrade())
    {
      application = upgrader;
    }
    else
    {
      application = installer;
    }
    return application;
  }
}
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java
New file
@@ -0,0 +1,259 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.installandupgrader.ui;
import org.opends.quicksetup.ui.*;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.event.BrowseActionListener;
import org.opends.quicksetup.installandupgrader.InstallAndUpgradeUserData;
import org.opends.quicksetup.installandupgrader.InstallAndUpgrader;
import org.opends.server.util.DynamicConstants;
import javax.swing.*;
import javax.swing.text.JTextComponent;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
 * This panel is used to show a welcome message asking the user whether to
 * install a new instance or upgrade an existing instance.
 */
public class WelcomePanel extends QuickSetupStepPanel {
  private static final long serialVersionUID = 8696606861642491768L;
  private JLabel lblServerLocation;
  private JTextComponent tcServerLocation;
  private JRadioButton rbInstall;
  private JRadioButton rbUpgrade;
  private JButton butBrowse;
  /**
   * Default constructor.
   * @param application Upgrader application
   */
  public WelcomePanel(InstallAndUpgrader application) {
    super(application);
  }
  /**
   * {@inheritDoc}
   */
  public void beginDisplay(UserData data) {
    super.beginDisplay(data);
    tcServerLocation.setText(data.getServerLocation());
    boolean isUpgrade = ((InstallAndUpgradeUserData)data).isUpgrade();
    rbInstall.setSelected(!isUpgrade);
    rbUpgrade.setSelected(isUpgrade);
    checkEnablingState();
  }
  /**
   * {@inheritDoc}
   */
  public Object getFieldValue(FieldName fieldName) {
    Object v = null;
    if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
      v = tcServerLocation.getText();
    }
    else if (FieldName.IS_UPGRADE.equals(fieldName))
    {
      v = rbUpgrade.isSelected() ? Boolean.TRUE : Boolean.FALSE;
    }
    return v;
  }
  /**
   * {@inheritDoc}
   */
  public void displayFieldInvalid(FieldName fieldName, boolean invalid) {
    UIFactory.TextStyle style;
    if (invalid) {
      style = UIFactory.TextStyle.PRIMARY_FIELD_INVALID;
    } else {
      style = UIFactory.TextStyle.PRIMARY_FIELD_VALID;
    }
    if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
      UIFactory.setTextStyle(lblServerLocation, style);
    }
  }
  /**
   * {@inheritDoc}
   */
  protected String getTitle() {
    return getMsg("installandupgrade-welcome-panel-title");
  }
  /**
   * {@inheritDoc}
   */
  protected String getInstructions() {
    /*
     * We can use org.opends.server.util.DynamicConstants without problems as it
     * has been added to quicksetup.jar during build time.
     */
    return getMsg("installandupgrade-welcome-panel-instructions",
            new String[] {
                    DynamicConstants.COMPACT_VERSION_STRING,
                    DynamicConstants.BUILD_ID});
  }
  /**
   * {@inheritDoc}
   */
  protected Component createInputPanel()
  {
    JPanel p = UIFactory.makeJPanel();
    p.setLayout(new GridBagLayout());
    rbInstall = UIFactory.makeJRadioButton(
        getMsg("installandupgrader-rbinstall-label"),
        getMsg("installandupgrader-rbinstall-tooltip"),
        UIFactory.TextStyle.PRIMARY_FIELD_VALID);
    rbUpgrade = UIFactory.makeJRadioButton(
        getMsg("installandupgrader-rbupgrade-label"),
        getMsg("installandupgrader-rbupgrade-tooltip"),
        UIFactory.TextStyle.PRIMARY_FIELD_VALID);
    ButtonGroup group = new ButtonGroup();
    group.add(rbInstall);
    group.add(rbUpgrade);
    ActionListener l = new ActionListener()
    {
      public void actionPerformed(ActionEvent ev)
      {
        checkEnablingState();
      }
    };
    rbInstall.addActionListener(l);
    rbUpgrade.addActionListener(l);
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = UIFactory.getEmptyInsets();
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    p.add(rbInstall, gbc);
    gbc.insets.top = UIFactory.TOP_INSET_SECONDARY_FIELD;
    p.add(rbUpgrade, gbc);
    gbc.insets.left = UIFactory.LEFT_INSET_RADIO_SUBORDINATE;
    p.add(createUpgraderPanel(), gbc);
    gbc.insets.top = 0;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.VERTICAL;
    p.add(Box.createVerticalGlue(), gbc);
    return p;
  }
  /**
   * Updates the state of the widgets in the panel depending on the radio button
   * that has been chosen.
   *
   */
  private void checkEnablingState()
  {
    boolean enable = rbUpgrade.isSelected();
    lblServerLocation.setEnabled(enable);
    tcServerLocation.setEnabled(enable);
    butBrowse.setEnabled(enable);
  }
  /**
   * Creates the panel containing the fields specific to the upgrader.
   * @return the panel containing the fields specific to the upgrader.
   */
  private Component createUpgraderPanel() {
    Component c;
    LabelFieldDescriptor serverLocationDescriptor =
            new LabelFieldDescriptor(getMsg("upgrade-location-label"),
                    getMsg("upgrade-location-tooltip"),
                    LabelFieldDescriptor.FieldType.TEXTFIELD,
                    LabelFieldDescriptor.LabelType.PRIMARY,
                    UIFactory.PATH_FIELD_SIZE);
    JPanel pnlBuildInfo = UIFactory.makeJPanel();
    pnlBuildInfo.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    UserData userData = getApplication().getUserData();
    lblServerLocation = UIFactory.makeJLabel(serverLocationDescriptor);
    tcServerLocation =
      UIFactory.makeJTextComponent(serverLocationDescriptor,
          userData.getServerLocation());
    butBrowse =
      UIFactory.makeJButton(getMsg("browse-button-label"),
          getMsg("browse-button-tooltip"));
    BrowseActionListener l =
      new BrowseActionListener(tcServerLocation,
          BrowseActionListener.BrowseType.LOCATION_DIRECTORY,
          getMainWindow());
    butBrowse.addActionListener(l);
    JPanel pnlBrowser = Utilities.createBrowseButtonPanel(
        lblServerLocation,
        tcServerLocation,
        butBrowse);
    pnlBrowser.setOpaque(false);
    gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD;
    gbc.anchor = GridBagConstraints.FIRST_LINE_START;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    pnlBuildInfo.add(pnlBrowser, gbc);
    gbc.gridy = 1;
    gbc.weighty = 1.0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.LINE_START;
    JPanel fill = UIFactory.makeJPanel();
    // fill.setBorder(BorderFactory.createLineBorder(Color.BLUE));
    pnlBuildInfo.add(fill, gbc);
    c = pnlBuildInfo;
    return c;
  }
}
opends/src/quicksetup/org/opends/quicksetup/installer/ConfiguredDomain.java
New file
@@ -0,0 +1,91 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.installer;
import java.util.HashSet;
import java.util.Set;
/**
 * Class used to know what has been modified in the configuration of a
 * replication domain.
 * This class provides a read only view of what has been configured.
 *
 */
class ConfiguredDomain
{
  private String domainName;
  private boolean isCreated;
  Set<String> addedReplicationServers;
  /**
   * Constructor of the ConfiguredDomain object.
   * @param domainName the name of the domain.
   * @param isCreated whether the domain has been created or not.
   * @param addedReplicationServers the set of replication servers added to
   * the replication server configuration.
   */
  ConfiguredDomain(String domainName, boolean isCreated,
      Set<String> addedReplicationServers)
  {
    this.domainName = domainName;
    this.isCreated = isCreated;
    this.addedReplicationServers = new HashSet<String>();
    this.addedReplicationServers.addAll(addedReplicationServers);
  }
  /**
   * Returns a set of replication servers added to the replication domain
   * configuration.
   * @return a set of replication servers added to the replication domain
   * configuration.
   */
  Set<String> getAddedReplicationServers()
  {
    return addedReplicationServers;
  }
  /**
   * Returns the domain name.
   * @return the domain name.
   */
  String getDomainName()
  {
    return domainName;
  }
  /**
   * Returns <CODE>true</CODE> if the Replication domain was created and
   * <CODE>false</CODE> otherwise.
   * @return <CODE>true</CODE> if the Replication domain was created and
   * <CODE>false</CODE> otherwise.
   */
  boolean isCreated()
  {
    return isCreated;
  }
}
opends/src/quicksetup/org/opends/quicksetup/installer/ConfiguredReplication.java
New file
@@ -0,0 +1,127 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.installer;
import java.util.HashSet;
import java.util.Set;
/**
 * Class used to know what has been configured in terms of replication on
 * a server.  This class provides a read only view of what has been configured.
 *
 */
class ConfiguredReplication
{
  private boolean synchProviderCreated;
  private boolean synchProviderEnabled;
  private boolean replicationServerCreated;
  private Set<String> newReplicationServers;
  private Set<ConfiguredDomain> domainsConf;
  /**
   * Constructor of the ConfiguredReplication object.
   * @param synchProviderCreated whether the synchronization provider was
   * created or not.
   * @param synchProviderEnabled whether the synchronization provider was
   * enabled or not.
   * @param replicationServerCreated whether the replication server was
   * created or not.
   * @param newReplicationServers the set of replication servers added to
   * the replication server configuration.
   * @param domainsConf the set of ConfiguredDomain objects representing the
   * replication domains that were modified.
   */
  ConfiguredReplication(boolean synchProviderCreated,
      boolean synchProviderEnabled, boolean replicationServerCreated,
      Set<String> newReplicationServers, Set<ConfiguredDomain> domainsConf)
  {
    this.synchProviderCreated = synchProviderCreated;
    this.synchProviderEnabled = synchProviderEnabled;
    this.replicationServerCreated = replicationServerCreated;
    this.newReplicationServers = new HashSet<String>();
    this.newReplicationServers.addAll(newReplicationServers);
    this.domainsConf = new HashSet<ConfiguredDomain>();
    this.domainsConf.addAll(domainsConf);
  }
  /**
   * Returns a set of ConfiguredDomain objects representing the replication
   * domains that were modified.
   * @return a set of ConfiguredDomain objects representing the replication
   * domains that were modified.
   */
  public Set<ConfiguredDomain> getDomainsConf()
  {
    return domainsConf;
  }
  /**
   * Returns a set of replication servers added to the replication server
   * configuration.
   * @return a set of replication servers added to the replication server
   * configuration.
   */
  Set<String> getNewReplicationServers()
  {
    return newReplicationServers;
  }
  /**
   * Returns <CODE>true</CODE> if the Replication Server was created and
   * <CODE>false</CODE> otherwise.
   * @return <CODE>true</CODE> if the Replication Server was created and
   * <CODE>false</CODE> otherwise.
   */
  boolean isReplicationServerCreated()
  {
    return replicationServerCreated;
  }
  /**
   * Returns <CODE>true</CODE> if the Synchronization Provider was created and
   * <CODE>false</CODE> otherwise.
   * @return <CODE>true</CODE> if the Synchronization Provider was created and
   * <CODE>false</CODE> otherwise.
   */
  boolean isSynchProviderCreated()
  {
    return synchProviderCreated;
  }
  /**
   * Returns <CODE>true</CODE> if the Synchronization Provider was enabled and
   * <CODE>false</CODE> otherwise.
   * @return <CODE>true</CODE> if the Synchronization Provider was enabled and
   * <CODE>false</CODE> otherwise.
   */
  boolean isSynchProviderEnabled()
  {
    return synchProviderEnabled;
  }
}
opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
@@ -138,9 +138,6 @@
    System.out.println(getMsg("setup-launcher-launching-gui"));
    System.setProperty("org.opends.quicksetup.Application.class",
            "org.opends.quicksetup.installer.offline.OfflineInstaller");
    // TO DELETE
    System.setProperty("org.opends.quicksetup.Application.class",
    "org.opends.quicksetup.installandupgrader.InstallAndUpgrader");
  }
  /**
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -106,6 +106,10 @@
  /** When true indicates that the user has canceled this operation. */
  protected boolean canceled = false;
  /** Map containing information about what has been configured remotely. */
  Map<ServerDescriptor, ConfiguredReplication> hmConfiguredRemoteReplication =
    new HashMap<ServerDescriptor, ConfiguredReplication>();
  // Constants used to do checks
  private static final int MIN_DIRECTORY_MANAGER_PWD = 1;
@@ -135,9 +139,7 @@
  {
    SUBSTEPS.add(Step.CREATE_GLOBAL_ADMINISTRATOR);
    SUBSTEPS.add(Step.SUFFIXES_OPTIONS);
    // TODO: remove this comment once we want to display the replication options
    // in setup.
    //SUBSTEPS.add(Step.NEW_SUFFIX_OPTIONS);
    SUBSTEPS.add(Step.NEW_SUFFIX_OPTIONS);
    SUBSTEPS.add(Step.REMOTE_REPLICATION_PORTS);
  }
@@ -146,6 +148,10 @@
  private char[] selfSignedCertPw = null;
  private boolean registeredNewServerOnRemote;
  private boolean createdAdministrator;
  private boolean createdRemoteAds;
  /**
   * An static String that contains the class name of ConfigFileHandler.
   */
@@ -161,17 +167,14 @@
  public Installer() {
    lstSteps.add(WELCOME);
    lstSteps.add(SERVER_SETTINGS);
    // TODO: remove this comment once we want to display the replication options
    // in setup.
    /*
    lstSteps.add(REPLICATION_OPTIONS);
    lstSteps.add(CREATE_GLOBAL_ADMINISTRATOR);
    lstSteps.add(SUFFIXES_OPTIONS);
    lstSteps.add(REMOTE_REPLICATION_PORTS);
    */
    lstSteps.add(NEW_SUFFIX_OPTIONS);
    lstSteps.add(REVIEW);
    lstSteps.add(PROGRESS);
    lstSteps.add(FINISHED);
    try {
      if (!QuickSetupLog.isInitialized())
        QuickSetupLog.initLogFileHandler(
@@ -211,7 +214,8 @@
   */
  public boolean canGoBack(WizardStep step) {
    return step != WELCOME &&
            step != PROGRESS;
            step != PROGRESS &&
            step != FINISHED;
  }
  /**
@@ -219,7 +223,8 @@
   */
  public boolean canGoForward(WizardStep step) {
    return step != REVIEW &&
            step != PROGRESS;
            step != PROGRESS &&
            step != FINISHED;
  }
  /**
@@ -233,7 +238,8 @@
   * {@inheritDoc}
   */
  public boolean canQuit(WizardStep step) {
    return step != PROGRESS;
    return step != PROGRESS &&
    step != FINISHED;
  }
  /**
@@ -294,9 +300,6 @@
    {
      isVisible = true;
    }
    // TODO: remove this line once we want to display the replication options
    // in setup.
    isVisible = true;
    return isVisible;
  }
@@ -325,6 +328,9 @@
          "Cannot click on next from progress step");
    } else if (cStep == REVIEW) {
      throw new IllegalStateException("Cannot click on next from review step");
    } else if (cStep == FINISHED) {
      throw new IllegalStateException(
          "Cannot click on next from finished step");
    }
  }
@@ -338,6 +344,10 @@
              getMsg("confirm-close-install-title"))) {
        qs.quit();
      }
    }
    else if (cStep == FINISHED)
    {
      qs.quit();
    } else {
      throw new IllegalStateException(
              "Close only can be clicked on PROGRESS step");
@@ -358,7 +368,7 @@
   * {@inheritDoc}
   */
  public void cancel() {
    setStatus(InstallProgressStep.WAITING_TO_CANCEL);
    setCurrentProgressStep(InstallProgressStep.WAITING_TO_CANCEL);
    notifyListeners(null);
    this.canceled = true;
  }
@@ -367,7 +377,11 @@
   * {@inheritDoc}
   */
  public void quitClicked(WizardStep cStep, QuickSetup qs) {
    if (cStep == PROGRESS) {
    if (cStep == FINISHED)
    {
      qs.quit();
    }
    else if (cStep == PROGRESS) {
      throw new IllegalStateException(
              "Cannot click on quit from progress step");
    } else if (installStatus.isInstalled()) {
@@ -443,6 +457,8 @@
        p = new InstallReviewPanel(this);
    } else if (step == PROGRESS) {
        p = new ProgressPanel(this);
    } else if (step == FINISHED) {
        p = new FinishedPanel(this);
    }
    return p;
  }
@@ -504,6 +520,9 @@
    } else if (cStep == PROGRESS) {
      throw new IllegalStateException(
          "Cannot click on previous from progress step");
    } else if (cStep == FINISHED) {
      throw new IllegalStateException(
          "Cannot click on previous from finished step");
    }
  }
@@ -515,13 +534,13 @@
  }
  /** Indicates the current progress step. */
  private InstallProgressStep status =
  private InstallProgressStep currentProgressStep =
          InstallProgressStep.NOT_STARTED;
  /**
   * {@inheritDoc}
   */
  protected void setWizardDialogState(QuickSetupDialog dlg,
  public void setWizardDialogState(QuickSetupDialog dlg,
                                      UserData userData,
                                      WizardStep step) {
    if (!installStatus.isInstalled() || forceToDisplaySetup) {
@@ -532,8 +551,9 @@
      } else if (step == WELCOME) {
        dlg.setDefaultButton(ButtonName.NEXT);
        dlg.setFocusOnButton(ButtonName.NEXT);
      } else if (step == REVIEW) {
        dlg.setDefaultButton(ButtonName.NEXT);
      } else if ((step == PROGRESS) || (step == FINISHED)) {
        dlg.setDefaultButton(ButtonName.CLOSE);
        dlg.setFocusOnButton(ButtonName.CLOSE);
      } else {
        dlg.setDefaultButton(ButtonName.NEXT);
      }
@@ -545,7 +565,7 @@
   */
  public ProgressStep getCurrentProgressStep()
  {
    return status;
    return currentProgressStep;
  }
  /**
@@ -627,17 +647,14 @@
    LinkedHashSet<WizardStep> orderedSteps = new LinkedHashSet<WizardStep>();
    orderedSteps.add(WELCOME);
    orderedSteps.add(SERVER_SETTINGS);
    // TODO: remove this comment once we want to display the replication options
    // in setup.
    /*
    orderedSteps.add(REPLICATION_OPTIONS);
    orderedSteps.add(CREATE_GLOBAL_ADMINISTRATOR);
    orderedSteps.add(SUFFIXES_OPTIONS);
    orderedSteps.add(REMOTE_REPLICATION_PORTS);
    */
    orderedSteps.add(NEW_SUFFIX_OPTIONS);
    orderedSteps.add(REVIEW);
    orderedSteps.add(PROGRESS);
    orderedSteps.add(FINISHED);
    return orderedSteps;
  }
@@ -659,6 +676,13 @@
  }
  /**
   * {@inheritDoc}
   */
  public WizardStep getFinishedStep() {
    return Step.FINISHED;
  }
  /**
   * Uninstalls installed services.  This is to be used when the user
   * has elected to cancel an installation.
   */
@@ -672,10 +696,7 @@
      }
    }
    if (completedProgress.contains(
            InstallProgressStep.CONFIGURING_REPLICATION)) {
      // TODO:  undo replication
    }
    unconfigureRemote();
  }
  /**
@@ -1085,6 +1106,112 @@
  }
  /**
   * This method undoes the modifications made in other servers in terms of
   * replication.  This method assumes that we are aborting the Installer and
   * that is why it does not call checkAbort.
   */
  private void unconfigureRemote()
  {
    InitialLdapContext ctx = null;
    if (registeredNewServerOnRemote || createdAdministrator ||
    createdRemoteAds)
    {
      // Try to connect
      DataReplicationOptions repl = getUserData().getReplicationOptions();
      AuthenticationData auth = repl.getAuthenticationData();
      String ldapUrl = getLdapUrl(auth);
      String dn = auth.getDn();
      String pwd = auth.getPwd();
      notifyListeners(getFormattedWithPoints(
          getMsg("progress-unconfiguring-ads-on-remote",
              getHostDisplay(auth))));
      try
      {
        if (auth.useSecureConnection())
        {
          ApplicationTrustManager trustManager = getTrustManager();
          trustManager.setHost(auth.getHostName());
          ctx = Utils.createLdapsContext(ldapUrl, dn, pwd,
              Utils.getDefaultLDAPTimeout(), null, trustManager);
        }
        else
        {
          ctx = Utils.createLdapContext(ldapUrl, dn, pwd,
              Utils.getDefaultLDAPTimeout(), null);
        }
        ADSContext adsContext = new ADSContext(ctx);
        if (createdRemoteAds)
        {
          adsContext.removeAdminData();
        }
        else
        {
          if (registeredNewServerOnRemote)
          {
            adsContext.unregisterServer(getNewServerAdsProperties());
          }
          if (createdAdministrator)
          {
            adsContext.deleteAdministrator(getAdministratorProperties());
          }
        }
        notifyListeners(getFormattedDone());
        notifyListeners(getLineBreak());
      }
      catch (Throwable t)
      {
        String html = getFormattedError(t, true);
        notifyListeners(html);
      }
      finally
      {
        if (ctx != null)
        {
          try
          {
            ctx.close();
          }
          catch (Throwable t)
          {
          }
        }
      }
    }
    InstallerHelper helper = new InstallerHelper();
    for (ServerDescriptor server : hmConfiguredRemoteReplication.keySet())
    {
      notifyListeners(getFormattedWithPoints(
          getMsg("progress-unconfiguring-replication-remote",
              server.getHostPort(true))));
      try
      {
        ctx = getRemoteConnection(server, getTrustManager());
        helper.unconfigureReplication(ctx,
            hmConfiguredRemoteReplication.get(server),
            server.getHostPort(true));
      }
      catch (ApplicationException ae)
      {
        String html = getFormattedError(ae, true);
        notifyListeners(html);
      }
      if (ctx != null)
      {
        try
        {
          ctx.close();
        }
        catch (Throwable t)
        {
        }
      }
      notifyListeners(getFormattedDone());
      notifyListeners(getLineBreak());
    }
  }
  /**
   * This method creates the replication configuration for the suffixes on the
   * the local server (and eventually in the remote servers) to synchronize
   * things.
@@ -1208,6 +1335,8 @@
      }
    }
    notifyListeners(getFormattedDone());
    notifyListeners(getLineBreak());
    checkAbort();
    if (rep.getType() == DataReplicationOptions.Type.IN_EXISTING_TOPOLOGY)
    {
@@ -1229,7 +1358,6 @@
      }
      for (ServerDescriptor server : hm.keySet())
      {
        notifyListeners(getLineBreak());
        notifyListeners(getFormattedWithPoints(
            getMsg("progress-configuring-replication-remote",
                server.getHostPort(true))));
@@ -1252,9 +1380,11 @@
        }
        ctx = getRemoteConnection(server, getTrustManager());
        helper.configureReplication(ctx, dns, replicationServers,
            replicationPort, server.getHostPort(true),
            knownReplicationServerIds, knownServerIds);
        ConfiguredReplication repl =
          helper.configureReplication(ctx, dns, replicationServers,
              replicationPort, server.getHostPort(true),
              knownReplicationServerIds, knownServerIds);
        hmConfiguredRemoteReplication.put(server, repl);
        try
        {
@@ -1264,6 +1394,8 @@
        {
        }
        notifyListeners(getFormattedDone());
        notifyListeners(getLineBreak());
        checkAbort();
      }
    }
  }
@@ -1344,7 +1476,7 @@
   */
  protected void checkAbort() throws ApplicationException {
    if (canceled) {
      setStatus(InstallProgressStep.CANCELING);
      setCurrentProgressStep(InstallProgressStep.CANCELING);
      notifyListeners(null);
      throw new ApplicationException(
            ApplicationException.Type.CANCEL,
@@ -1422,15 +1554,16 @@
  }
  /**
   * Sets the current status of the installation process.
   * @param status the current status of the installation process.
   * Sets the current progress step of the installation process.
   * @param currentProgressStep the current progress step of the installation
   * process.
   */
  protected void setStatus(InstallProgressStep status)
  protected void setCurrentProgressStep(InstallProgressStep currentProgressStep)
  {
    if (status != null) {
      this.completedProgress.add(status);
    if (currentProgressStep != null) {
      this.completedProgress.add(currentProgressStep);
    }
    this.status = status;
    this.currentProgressStep = currentProgressStep;
  }
  /**
@@ -1445,17 +1578,18 @@
      switch (getUserData().getNewSuffixOptions().getType())
      {
      case CREATE_BASE_ENTRY:
        status = InstallProgressStep.CREATING_BASE_ENTRY;
        currentProgressStep = InstallProgressStep.CREATING_BASE_ENTRY;
        notifyListeners(getTaskSeparator());
        createBaseEntry();
        break;
      case IMPORT_FROM_LDIF_FILE:
        status = InstallProgressStep.IMPORTING_LDIF;
        currentProgressStep = InstallProgressStep.IMPORTING_LDIF;
        notifyListeners(getTaskSeparator());
        importLDIF();
        break;
      case IMPORT_AUTOMATICALLY_GENERATED_DATA:
        status = InstallProgressStep.IMPORTING_AUTOMATICALLY_GENERATED;
        currentProgressStep =
          InstallProgressStep.IMPORTING_AUTOMATICALLY_GENERATED;
        notifyListeners(getTaskSeparator());
        importAutomaticallyGenerated();
        break;
@@ -1545,6 +1679,11 @@
            }
          }
        }
        try
        {
          Thread.sleep(3000);
        }
        catch (Throwable t) {}
        int nTries = 4;
        boolean initDone = false;
        while (!initDone)
@@ -1593,6 +1732,7 @@
        notifyListeners(getLineBreak());
      }
      i++;
      checkAbort();
    }
  }
@@ -1648,8 +1788,10 @@
              notifyListeners(getFormattedWithPoints(
                  getMsg("progress-creating-administrator", arg)));
              adsContext.createAdministrator(getAdministratorProperties());
              createdAdministrator = true;
              notifyListeners(getFormattedDone());
              notifyListeners(getLineBreak());
              checkAbort();
            }
            catch (ADSContextException ade)
            {
@@ -1676,9 +1818,10 @@
          adsContext.registerServer(
              getRemoteServerProperties(auth.getHostName(),
                  adsContext.getDirContext()));
          createdRemoteAds = true;
          notifyListeners(getFormattedDone());
          notifyListeners(getLineBreak());
          checkAbort();
        }
        /* Configure local server to have an ADS */
        notifyListeners(getFormattedWithPoints(
@@ -1694,9 +1837,10 @@
          throw new ApplicationException(
              ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t);
        }
        createLocalAds(localCtx);
        createLocalAds(localCtx, false);
        notifyListeners(getFormattedDone());
        notifyListeners(getLineBreak());
        checkAbort();
        lastLoadedCache = new TopologyCache(adsContext, getTrustManager());
        lastLoadedCache.reloadTopology();
@@ -1771,12 +1915,15 @@
        try
        {
          adsContext.registerServer(getNewServerAdsProperties());
          registeredNewServerOnRemote = true;
        }
        catch (ADSContextException adse)
        {
          if (adse.getError() ==
            ADSContextException.ErrorType.ALREADY_REGISTERED)
          {
            LOG.log(Level.WARNING, "Server already registered. Unregistering "+
                "and registering server");
            /* This might occur after registering and unregistering a server */
            adsContext.unregisterServer(getNewServerAdsProperties());
            adsContext.registerServer(getNewServerAdsProperties());
@@ -1803,52 +1950,15 @@
                getMsg("progress-initializing-ads")));
            int replicationId = replica.getReplicationId();
            if (replicationId == -1)
            {
              /**
               * This occurs if the remote server had not replication
               * configured.
               */
              InitialLdapContext rCtx = null;
              try
              {
                rCtx = getRemoteConnection(server, getTrustManager());
                ServerDescriptor s = ServerDescriptor.createStandalone(rCtx);
                for (ReplicaDescriptor r : s.getReplicas())
                {
                  if (Utils.areDnsEqual(r.getSuffix().getDN(), dn))
                  {
                    replicationId = r.getReplicationId();
                  }
                }
              }
              catch (NamingException ne)
              {
                String[] arg = {server.getHostPort(true)};
                throw new ApplicationException(
                    ApplicationException.Type.CONFIGURATION_ERROR,
                    getMsg("cannot-connect-to-remote-generic", arg), ne);
              }
              finally
              {
                try
                {
                  rCtx.close();
                }
                catch (Throwable t)
                {
                }
              }
            }
            int nTries = 4;
            int nTries = 1;
            boolean initDone = false;
            while (!initDone)
            {
              try
              {
                initializeSuffix(localCtx, replica.getReplicationId(),
                initializeSuffix(localCtx, replicationId,
                    ADSContext.getAdministrationSuffixDN(),
                    true, server.getHostPort(true));
                    false, server.getHostPort(true));
                initDone = true;
              }
              catch (PeerNotFoundException pnfe)
@@ -1872,6 +1982,7 @@
            }
            notifyListeners(getFormattedDone());
            notifyListeners(getLineBreak());
            checkAbort();
            break;
          }
        }
@@ -1947,7 +2058,7 @@
          throw new ApplicationException(
              ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t);
        }
        createLocalAds(localCtx);
        createLocalAds(localCtx, true);
        int replicationPort =
          getUserData().getReplicationOptions().getReplicationPort();
        Set<String> dns = new HashSet<String>();
@@ -2688,6 +2799,7 @@
    trustManager.resetLastRefusedItems();
    try
    {
      effectiveDn[0] = dn;
      try
      {
        if (isSecure)
@@ -2707,6 +2819,7 @@
        {
          // Try using a global administrator
          dn = ADSContext.getAdministratorDN(dn);
          effectiveDn[0] = dn;
          if (isSecure)
          {
            ctx = Utils.createLdapsContext(ldapUrl, dn, pwd,
@@ -2753,8 +2866,11 @@
                isCertificateException(e.getCause()))
            {
              UserDataCertificateException.Type excType;
              ApplicationTrustManager.Cause cause =
                trustManager.getLastRefusedCause();
              ApplicationTrustManager.Cause cause = null;
              if (e.getTrustManager() != null)
              {
                cause = e.getTrustManager().getLastRefusedCause();
              }
              LOG.log(Level.INFO, "Certificate exception cause: "+cause);
              if (cause == ApplicationTrustManager.Cause.NOT_TRUSTED)
              {
@@ -2790,7 +2906,7 @@
                    getMsg("certificate-exception", h, String.valueOf(p)),
                    e.getCause(), h, p,
                    e.getTrustManager().getLastRefusedChain(),
                    trustManager.getLastRefusedAuthType(), excType);
                    e.getTrustManager().getLastRefusedAuthType(), excType);
              }
            }
          }
@@ -2900,7 +3016,6 @@
        }
      }
    }
    effectiveDn[0] = dn;
  }
  /**
@@ -3607,24 +3722,32 @@
  private InitialLdapContext createLocalContext() throws NamingException
  {
    String ldapUrl = "ldap://"+getUserData().getHostName()+":"+
    String ldapUrl = "ldap://"+
    Utils.getHostNameForLdapUrl(getUserData().getHostName())+":"+
    getUserData().getServerPort();
    String dn = getUserData().getDirectoryManagerDn();
    String pwd = getUserData().getDirectoryManagerPwd();
    return Utils.createLdapContext(ldapUrl, dn, pwd,
        Utils.getDefaultLDAPTimeout(), null);
  }
  private void createLocalAds(InitialLdapContext ctx)
  private void createLocalAds(InitialLdapContext ctx, boolean addData)
  throws ApplicationException, ADSContextException
  {
    try
    {
      ADSContext adsContext = new ADSContext(ctx);
      adsContext.createAdminData(null);
      adsContext.registerServer(getNewServerAdsProperties());
      if (getUserData().mustCreateAdministrator())
      if (addData)
      {
        adsContext.createAdministrator(getAdministratorProperties());
        adsContext.createAdminData(null);
        adsContext.registerServer(getNewServerAdsProperties());
        if (getUserData().mustCreateAdministrator())
        {
          adsContext.createAdministrator(getAdministratorProperties());
        }
      }
      else
      {
        adsContext.createAdministrationSuffix(null);
      }
    }
    catch (ADSContextException ace)
@@ -3686,9 +3809,6 @@
    }
    catch (NamingException ne)
    {
      System.out.println("dn: "+auth.getDn());
      System.out.println("dn: "+auth.getDn());
      String errorMessage = getMsg("cannot-connect-to-remote-generic",
          server.getHostPort(true), ne.toString(true));
      throw new ApplicationException(
@@ -3840,7 +3960,8 @@
              minRefreshPeriod = 10000;
            }
            if (!msg.equals(lastDisplayedMsg) &&
                ((currentTime - minRefreshPeriod) > lastTimeMsgDisplayed))
            ((currentTime - minRefreshPeriod) > lastTimeMsgDisplayed))
            if (!msg.equals(lastDisplayedMsg))
            {
              notifyListeners(getFormattedProgress(msg));
              lastDisplayedMsg = msg;
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -37,6 +37,7 @@
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
import java.util.logging.Logger;
import javax.naming.ldap.InitialLdapContext;
@@ -238,13 +239,18 @@
   * @param usedServerIds the list of server ids (domain ids) that
   * are already used.
   * @throws ApplicationException if something goes wrong.
   * @return a ConfiguredReplication object describing what has been configured.
   */
  public void configureReplication(InitialLdapContext remoteCtx,
      Set<String> dns, Map<String,Set<String>> replicationServers,
  public ConfiguredReplication configureReplication(
      InitialLdapContext remoteCtx, Set<String> dns,
      Map<String,Set<String>> replicationServers,
      int replicationPort, String serverDisplay,
      Set<Integer> usedReplicationServerIds, Set<Integer> usedServerIds)
  throws ApplicationException
  {
    boolean synchProviderCreated;
    boolean synchProviderEnabled;
    boolean replicationServerCreated;
    try
    {
      ManagementContext mCtx = LDAPManagementContext.createFromContext(
@@ -273,8 +279,23 @@
            new ArrayList<DefaultBehaviorException>());
        sync.setJavaImplementationClass(
            "org.opends.server.replication.plugin.MultimasterReplication");
        sync.setEnabled(Boolean.TRUE);
        synchProviderCreated = true;
        synchProviderEnabled = false;
      }
      sync.setEnabled(Boolean.TRUE);
      else
      {
        synchProviderCreated = false;
        if (!sync.isEnabled())
        {
          sync.setEnabled(Boolean.TRUE);
          synchProviderEnabled = true;
        }
        else
        {
          synchProviderEnabled = false;
        }
      }
      sync.commit();
      /*
@@ -291,12 +312,14 @@
            new ArrayList<DefaultBehaviorException>());
        replicationServer.setReplicationServerId(id);
        replicationServer.setReplicationPort(replicationPort);
        replicationServerCreated = true;
      }
      else
      {
        replicationServer = sync.getReplicationServer();
        usedReplicationServerIds.add(
            replicationServer.getReplicationServerId());
        replicationServerCreated = false;
      }
      Set<String> servers = replicationServer.getReplicationServer();
@@ -304,15 +327,20 @@
      {
        servers = new HashSet<String>();
      }
      Set<String> oldServers = new HashSet<String>();
      oldServers.addAll(servers);
      for (Set<String> rs : replicationServers.values())
      {
        servers.addAll(rs);
      }
      replicationServer.setReplicationServer(servers);
      replicationServer.commit();
      Set<String> newReplicationServers = new HashSet<String>();
      newReplicationServers.addAll(servers);
      newReplicationServers.removeAll(oldServers);
      /*
       * Create the domains
       */
@@ -321,6 +349,7 @@
      {
        domainNames = new String[]{};
      }
      Set<ConfiguredDomain> domainsConf = new HashSet<ConfiguredDomain>();
      MultimasterDomainCfgClient[] domains =
        new MultimasterDomainCfgClient[domainNames.length];
      for (int i=0; i<domains.length; i++)
@@ -330,29 +359,152 @@
      for (String dn : dns)
      {
        MultimasterDomainCfgClient domain = null;
        boolean isCreated;
        String domainName = null;
        for (int i=0; i<domains.length && (domain == null); i++)
        {
          if (Utils.areDnsEqual(dn,
              domains[i].getReplicationDN().toString()))
          {
            domain = domains[i];
            domainName = domainNames[i];
          }
        }
        if (domain == null)
        {
          int domainId = getReplicationId(usedServerIds);
          usedServerIds.add(domainId);
          String domainName = getDomainName(domainNames, domainId);
          domainName = getDomainName(domainNames, domainId);
          domain = sync.createMultimasterDomain(
              MultimasterDomainCfgDefn.getInstance(), domainName,
              new ArrayList<DefaultBehaviorException>());
          domain.setServerId(domainId);
          domain.setReplicationDN(DN.decode(dn));
          isCreated = true;
        }
        domain.setReplicationServer(replicationServers.get(dn));
        else
        {
          isCreated = false;
        }
        oldServers = domain.getReplicationServer();
        if (oldServers == null)
        {
          oldServers = new TreeSet<String>();
        }
        servers = replicationServers.get(dn);
        domain.setReplicationServer(servers);
        usedServerIds.add(domain.getServerId());
        domain.commit();
        servers.removeAll(oldServers);
        ConfiguredDomain domainConf = new ConfiguredDomain(domainName,
            isCreated, servers);
        domainsConf.add(domainConf);
      }
      return new ConfiguredReplication(synchProviderCreated,
          synchProviderEnabled, replicationServerCreated, newReplicationServers,
          domainsConf);
    }
    catch (Throwable t)
    {
      String errorMessage = getMsg("error-configuring-remote-generic",
          serverDisplay, t.toString());
      throw new ApplicationException(
          ApplicationException.Type.CONFIGURATION_ERROR, errorMessage, t);
    }
  }
  /**
   * Configures the replication on a given server.
   * @param remoteCtx the conection to the server where we want to configure
   * the replication.
   * @param replConf the object describing what was configured.
   * @param serverDisplay the server display.
   * @throws ApplicationException if something goes wrong.
   */
  public void unconfigureReplication(
      InitialLdapContext remoteCtx, ConfiguredReplication replConf,
      String serverDisplay)
  throws ApplicationException
  {
    try
    {
      ManagementContext mCtx = LDAPManagementContext.createFromContext(
          JNDIDirContextAdaptor.adapt(remoteCtx));
      RootCfgClient root = mCtx.getRootConfiguration();
      /*
       * Unconfigure Synchronization plugin.
       */
      if (replConf.isSynchProviderCreated())
      {
        MultimasterSynchronizationProviderCfgClient sync = null;
        try
        {
          root.removeSynchronizationProvider("Multimaster Synchronization");
        }
        catch (ManagedObjectNotFoundException monfe)
        {
          // It does not exist.
        }
      }
      else
      {
        try
        {
          MultimasterSynchronizationProviderCfgClient sync =
            (MultimasterSynchronizationProviderCfgClient)
            root.getSynchronizationProvider("Multimaster Synchronization");
          if (replConf.isSynchProviderEnabled())
          {
            sync.setEnabled(Boolean.FALSE);
          }
          if (replConf.isReplicationServerCreated())
          {
            sync.removeReplicationServer();
          }
          else if (sync.hasReplicationServer())
          {
            ReplicationServerCfgClient replicationServer =
              sync.getReplicationServer();
            Set<String> replServers = replicationServer.getReplicationServer();
            if (replServers != null)
            {
              replServers.removeAll(replConf.getNewReplicationServers());
              replicationServer.commit();
            }
          }
          for (ConfiguredDomain domain : replConf.getDomainsConf())
          {
            if (domain.isCreated())
            {
              sync.removeMultimasterDomain(domain.getDomainName());
            }
            else
            {
              try
              {
                MultimasterDomainCfgClient d =
                  sync.getMultimasterDomain(domain.getDomainName());
                Set<String> replServers = d.getReplicationServer();
                if (replServers != null)
                {
                  replServers.removeAll(domain.getAddedReplicationServers());
                  d.commit();
                }
              }
              catch (ManagedObjectNotFoundException monfe)
              {
                // It does not exist.
              }
            }
          }
          sync.commit();
        }
        catch (ManagedObjectNotFoundException monfe)
        {
          // It does not exist.
        }
      }
    }
    catch (Throwable t)
@@ -574,4 +726,3 @@
    return replicationServers;
  }
}
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -91,7 +91,7 @@
      checkAbort();
      setStatus(InstallProgressStep.CONFIGURING_SERVER);
      setCurrentProgressStep(InstallProgressStep.CONFIGURING_SERVER);
      configureServer();
      checkAbort();
@@ -105,7 +105,7 @@
      if (Utils.isWindows() && getUserData().getEnableWindowsService())
      {
          notifyListeners(getTaskSeparator());
          setStatus(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
          setCurrentProgressStep(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
          enableWindowsService();
          checkAbort();
      }
@@ -113,14 +113,14 @@
      if (mustStart())
      {
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.STARTING_SERVER);
        setCurrentProgressStep(InstallProgressStep.STARTING_SERVER);
        new ServerController(this).startServer();
        checkAbort();
      }
      if (mustConfigureReplication())
      {
        setStatus(InstallProgressStep.CONFIGURING_REPLICATION);
        setCurrentProgressStep(InstallProgressStep.CONFIGURING_REPLICATION);
        notifyListeners(getTaskSeparator());
        configureReplication();
@@ -130,7 +130,8 @@
      if (mustInitializeSuffixes())
      {
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES);
        setCurrentProgressStep(
            InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES);
        initializeSuffixes();
        checkAbort();
      }
@@ -138,7 +139,7 @@
      if (mustCreateAds())
      {
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.CONFIGURING_ADS);
        setCurrentProgressStep(InstallProgressStep.CONFIGURING_ADS);
        updateADS();
        checkAbort();
      }
@@ -146,24 +147,24 @@
      if (mustStop())
      {
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.STOPPING_SERVER);
        setCurrentProgressStep(InstallProgressStep.STOPPING_SERVER);
        new ServerController(this).stopServer();
      }
      checkAbort();
      setStatus(InstallProgressStep.FINISHED_SUCCESSFULLY);
      setCurrentProgressStep(InstallProgressStep.FINISHED_SUCCESSFULLY);
      notifyListeners(null);
    } catch (ApplicationException ex)
    {
      if (ApplicationException.Type.CANCEL.equals(ex.getType())) {
        uninstall();
        setStatus(InstallProgressStep.FINISHED_CANCELED);
        setCurrentProgressStep(InstallProgressStep.FINISHED_CANCELED);
        notifyListeners(null);
      } else {
        notifyListeners(getLineBreak());
        notifyListenersOfLog();
        setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
        setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR);
        String html = getFormattedError(ex, true);
        notifyListeners(html);
        LOG.log(Level.SEVERE, "Error installing.", ex);
@@ -173,7 +174,7 @@
    {
      notifyListeners(getLineBreak());
      notifyListenersOfLog();
      setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
      setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR);
      ApplicationException ex = new ApplicationException(
          ApplicationException.Type.BUG, getThrowableMsg("bug-msg", t), t);
      String msg = getFormattedError(ex, true);
@@ -205,6 +206,7 @@
   */
  protected void uninstall() {
    notifyListeners(getTaskSeparator());
    Installation installation = getInstallation();
    FileManager fm = new FileManager(this);
@@ -393,7 +395,7 @@
  /**
   * {@inheritDoc}
   */
  protected String getInstallationPath()
  public String getInstallationPath()
  {
    return Utils.getInstallPathFromClasspath();
  }
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -89,7 +89,7 @@
  public WebStartInstaller()
  {
    initLoader();
    setStatus(InstallProgressStep.NOT_STARTED);
    setCurrentProgressStep(InstallProgressStep.NOT_STARTED);
  }
  /**
@@ -108,14 +108,14 @@
      System.setErr(err);
      System.setOut(out);
      setStatus(InstallProgressStep.DOWNLOADING);
      setCurrentProgressStep(InstallProgressStep.DOWNLOADING);
      checkAbort();
      InputStream in =
          getZipInputStream(getRatio(InstallProgressStep.EXTRACTING));
      setStatus(InstallProgressStep.EXTRACTING);
      setCurrentProgressStep(InstallProgressStep.EXTRACTING);
      notifyListeners(getTaskSeparator());
      checkAbort();
@@ -135,7 +135,7 @@
      checkAbort();
      setStatus(InstallProgressStep.CONFIGURING_SERVER);
      setCurrentProgressStep(InstallProgressStep.CONFIGURING_SERVER);
      notifyListeners(getTaskSeparator());
      // Write java home before calling Installation class.  The installation
@@ -145,7 +145,7 @@
      checkAbort();
      setStatus(InstallProgressStep.CONFIGURING_SERVER);
      setCurrentProgressStep(InstallProgressStep.CONFIGURING_SERVER);
      configureServer();
      checkAbort();
@@ -157,7 +157,7 @@
      if (Utils.isWindows() && getUserData().getEnableWindowsService())
      {
          notifyListeners(getTaskSeparator());
          setStatus(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
          setCurrentProgressStep(InstallProgressStep.ENABLING_WINDOWS_SERVICE);
          enableWindowsService();
          checkAbort();
@@ -166,7 +166,7 @@
      if (mustStart())
      {
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.STARTING_SERVER);
        setCurrentProgressStep(InstallProgressStep.STARTING_SERVER);
        new ServerController(this).startServer();
        checkAbort();
@@ -174,7 +174,7 @@
      if (mustConfigureReplication())
      {
        setStatus(InstallProgressStep.CONFIGURING_REPLICATION);
        setCurrentProgressStep(InstallProgressStep.CONFIGURING_REPLICATION);
        notifyListeners(getTaskSeparator());
        configureReplication();
@@ -185,7 +185,8 @@
      if (mustInitializeSuffixes())
      {
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES);
        setCurrentProgressStep(
            InstallProgressStep.INITIALIZE_REPLICATED_SUFFIXES);
        initializeSuffixes();
        checkAbort();
@@ -194,7 +195,7 @@
      if (mustCreateAds())
      {
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.CONFIGURING_ADS);
        setCurrentProgressStep(InstallProgressStep.CONFIGURING_ADS);
        updateADS();
        checkAbort();
@@ -203,24 +204,24 @@
      if (mustStop())
      {
        notifyListeners(getTaskSeparator());
        setStatus(InstallProgressStep.STOPPING_SERVER);
        setCurrentProgressStep(InstallProgressStep.STOPPING_SERVER);
        new ServerController(this).stopServer();
      }
      checkAbort();
      setStatus(InstallProgressStep.FINISHED_SUCCESSFULLY);
      setCurrentProgressStep(InstallProgressStep.FINISHED_SUCCESSFULLY);
      notifyListeners(null);
    } catch (ApplicationException ex)
    {
      if (ApplicationException.Type.CANCEL.equals(ex.getType())) {
        uninstall();
        setStatus(InstallProgressStep.FINISHED_CANCELED);
        setCurrentProgressStep(InstallProgressStep.FINISHED_CANCELED);
        notifyListeners(null);
      } else {
        notifyListeners(getLineBreak());
        notifyListenersOfLog();
        setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
        setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR);
        String html = getFormattedError(ex, true);
        notifyListeners(html);
        LOG.log(Level.SEVERE, "Error installing.", ex);
@@ -230,7 +231,7 @@
    {
      notifyListeners(getLineBreak());
      notifyListenersOfLog();
      setStatus(InstallProgressStep.FINISHED_WITH_ERROR);
      setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR);
      ApplicationException ex = new ApplicationException(
          ApplicationException.Type.BUG, getThrowableMsg("bug-msg", t), t);
      String msg = getFormattedError(ex, true);
@@ -498,6 +499,8 @@
   * Uninstall what has already been installed.
   */
  private void uninstall() {
    notifyListeners(getTaskSeparator());
    Installation installation = getInstallation();
    FileManager fm = new FileManager(this);
@@ -523,7 +526,7 @@
  /**
   * {@inheritDoc}
   */
  protected String getInstallationPath()
  public String getInstallationPath()
  {
    return getUserData().getServerLocation();
  }
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -343,6 +343,7 @@
data-options-step=Directory Data
review-step=Review
progress-step=Progress
finished-step=Finished
confirm-uninstall-step=Uninstall Options
step-upgrade-choose-version=Choose Version
@@ -556,7 +557,8 @@
certificate-not-trusted-text=The Certificate presented by the server {0}:{1} \
could not be trusted.<br><br>Possible reasons for this error:\
<br>&nbsp;&nbsp;&nbsp;&nbsp;-The Certificate Authority that issued the \
certificate is not recognized.<br>&nbsp;&nbsp;&nbsp;&nbsp;-The server''s \
certificate is not recognized (this is the case of the self-signed \
certificates).<br>&nbsp;&nbsp;&nbsp;&nbsp;-The server''s \
certificate is incomplete due to a misconfiguration.\
<br>&nbsp;&nbsp;&nbsp;&nbsp;-The server''s certificate has expired.<br>Before \
accepting this certificate, you should examine the server''s certificate \
@@ -769,6 +771,11 @@
progressbar-tooltip=Progress Bar
#
# Finished Panel specific labels
#
finished-panel-title=Finished
#
# Confirm Uninstall Panel specific labels
#
confirm-uninstall-panel-title=Uninstall Options
@@ -948,6 +955,7 @@
progress-cancel=Waiting to cancel operation.
progress-configuring-replication-remote=Configuring Replication on {0}
progress-unconfiguring-replication-remote=Unconfiguring Replication on {0}
progress-import-automatically-generated=Importing Automatically-Generated Data \
({0} Entries):
progress-starting=Starting Directory Server:
@@ -972,6 +980,7 @@
administrator-already-registered=Administrator already registered.
progress-creating-ads=Creating Registration Configuration
progress-creating-ads-on-remote=Creating Registration Configuration on {0}
progress-unconfiguring-ads-on-remote=Reverting Registration Configuration on {0}
progress-initializing-ads=Initializing Registration information
progress-initializing-suffix=Initializing suffix {0} with the contents from \
{1}:
@@ -1240,6 +1249,27 @@
upgrade-log-status-failure=Failure
upgrade-log-status-cancel=Canceled
#
# Install and Upgrade merged welcome panel.
#
installandupgrade-welcome-panel-title=Welcome
installandupgrade-welcome-panel-instructions=The OpenDS QuickSetup tool can \
either install and configure a new server instance or upgrade an existing \
server instance. In either case, QuickSetup will use the latest weekly build, \
which in this case is: {0} (Build ID: {1}) <br><br> \
You can also use QuickSetup to set up a weekly build you have downloaded \
manually. To run QuickSetup in this case, use the setup command at the top \
level of the OpenDS directory.<br><br> \
OpenDS requires a Java SE 5.0 or higher runtime.<br><br> \
Additional information on QuickSetup is available on the <a \
href="https://www.opends.org/wiki/page/OverviewOfTheQuickSetupTool"> \
OpenDS documentation wiki</a>.
installandupgrader-rbinstall-label=Install New Server Instance
installandupgrader-rbinstall-tooltip=Select to install a new server instance.
installandupgrader-rbupgrade-label=Upgrade Existing Server Instance
installandupgrader-rbupgrade-tooltip=Select to upgrade an existing server \
instance.
general-loading=Loading...
general-see-for-details=See {0} for a detailed log of this operation.
not-available-label=<not available>
opends/src/quicksetup/org/opends/quicksetup/ui/ButtonsPanel.java
@@ -29,11 +29,8 @@
import org.opends.quicksetup.ButtonName;
import org.opends.quicksetup.WizardStep;
import org.opends.quicksetup.upgrader.Upgrader;
import org.opends.quicksetup.event.ButtonActionListener;
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.installer.Installer;
import org.opends.quicksetup.uninstaller.Uninstaller;
import javax.swing.*;
import java.awt.*;
@@ -115,11 +112,11 @@
    // The quit button appears on all the panels leading up
    // to the progress panel
    quitButton.setVisible(!step.isProgressStep());
    quitButton.setVisible(!step.isProgressStep() && !step.isFinishedStep());
    // The close button is only used on the progress panel and
    // is only enabled once progress has finished or cancelled.
    closeButton.setVisible(step.isProgressStep());
    closeButton.setVisible(step.isProgressStep() || step.isFinishedStep());
    closeButton.setEnabled(application.getCurrentProgressStep().isLast());
  }
@@ -227,9 +224,7 @@
    nextFinishPanel.setOpaque(false);
    nextFinishPanel.add(nextButton, gbcAux);
    // TODO: remove this hack
    if (getApplication() instanceof Installer ||
            getApplication() instanceof Upgrader) {
    if (getApplication().finishOnLeft()) {
      nextFinishPanel.add(finishButton, gbcAux);
    }
    width =
@@ -249,8 +244,7 @@
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets.left = UIFactory.HORIZONTAL_INSET_BETWEEN_BUTTONS;
    // TODO: remove this hack
    if (getApplication() instanceof Uninstaller) {
    if (!getApplication().finishOnLeft()) {
      gbc.insets.right = UIFactory.HORIZONTAL_INSET_BETWEEN_BUTTONS;
      add(finishButton, gbc);
      gbc.insets.right = 0;
opends/src/quicksetup/org/opends/quicksetup/ui/FieldName.java
@@ -40,10 +40,22 @@
public enum FieldName
{
  /**
   * The value associated with this is a Boolean.
   * It is used by the merged installer and upgrader to know whether an upgrade
   * or an install must be performed.
   */
  IS_UPGRADE,
  /**
   * The value associated with this is a String.
   * The upgrader uses this field to indicate the
   * location of the server to upgrade.
   */
  SERVER_TO_UPGRADE_LOCATION,
  /**
   * The value associated with this is a String.
   * The web start installer uses this field to indicate the
   * location to install the server.
   */
  SERVER_LOCATION,
  /**
   * The value associated with this is a String.
opends/src/quicksetup/org/opends/quicksetup/ui/FinishedPanel.java
New file
@@ -0,0 +1,54 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.ui;
/**
 * This panel is used to show the application is finished.
 *
 */
public class FinishedPanel extends ProgressPanel
{
  private static final long serialVersionUID = 8129325068133356170L;
  /**
   * FinishedPanel constructor.
   * @param application Application this panel represents
   */
  public FinishedPanel(GuiApplication application)
  {
    super(application);
  }
  /**
   * {@inheritDoc}
   */
  protected String getTitle()
  {
    return getMsg("finished-panel-title");
  }
}
opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -110,7 +110,7 @@
   * @param userData UserData representing the data specified by the user
   * @param step Step indicating the new current step
   */
  protected abstract void setWizardDialogState(QuickSetupDialog dlg,
  public abstract void setWizardDialogState(QuickSetupDialog dlg,
                                               UserData userData,
                                               WizardStep step);
@@ -202,6 +202,12 @@
  abstract public WizardStep getPreviousWizardStep(WizardStep step);
  /**
   * Gets the finished step in the wizard.
   * @return Step the finished step
   */
  abstract public WizardStep getFinishedStep();
  /**
   * Gets the currently displayed wizard step.
   * @return WizardStep being displayed.
   */
@@ -210,8 +216,16 @@
  }
  /**
   * Indicates whether or not the provided <code>step</code> is a sub step or
   * not.
   * Returns the QuickSetupDialog in control.
   * @return the QuickSetupDialog in control.
   */
  protected QuickSetupDialog getQuickSetupDialog()
  {
    return qs;
  }
  /**
   * Indicates whether the provided <code>step</code> is a sub step or not.
   * @param step WizardStep for which the return value indicates whether
   * or not is a sub step.
   * @return boolean where true indicates the provided <code>step</code> is a
@@ -223,8 +237,7 @@
  }
  /**
   * Indicates whether or not the provided <code>step</code> is visible or
   * not.
   * Indicates whether the provided <code>step</code> is visible or not.
   * @param step WizardStep for which the return value indicates whether
   * or not is visible.
   * @return boolean where true indicates the provided <code>step</code> is
@@ -232,7 +245,7 @@
   */
  public boolean isVisible(WizardStep step)
  {
    return false;
    return true;
  }
  /**
@@ -280,18 +293,16 @@
  }
  /**
   * Inidicates whether or not the user is allowed to finish the wizard from
   * Indicates whether or not the user is allowed to finish the wizard from
   * <code>step</code>.
   * @param step WizardStep for which the the return value indicates whether
   * or not the user can finish the wizard
   * @return boolean where true indicates the user can finish the wizard
   */
  public boolean canFinish(WizardStep step) {
    return getNextWizardStep(step) != null;
  }
  public abstract boolean canFinish(WizardStep step);
  /**
   * Inidicates whether or not the user is allowed to quit the wizard from
   * Indicates whether or not the user is allowed to quit the wizard from
   * <code>step</code>.
   * @param step WizardStep for which the the return value indicates whether
   * or not the user can quit the wizard
@@ -389,6 +400,17 @@
  }
  /**
   * Indicates whether the finish button must be placed on the left (close to
   * "Next" button) or on the right (close to "Quit" button).
   * @return <CODE>true</CODE> if the finish button must be placed on the left
   * and <CODE>false</CODE> otherwise.
   */
  public boolean finishOnLeft()
  {
    return true;
  }
  /**
   * Updates the list of certificates accepted by the user in the trust manager
   * based on the information stored in the UserDataCertificateException we got
   * when trying to connect in secure mode.
@@ -403,6 +425,7 @@
    if ((chain != null) && (authType != null) && (host != null))
    {
      LOG.log(Level.INFO, "Accepting certificate presented by host "+host);
      getTrustManager().acceptCertificate(chain, authType, host);
    }
    else
opends/src/quicksetup/org/opends/quicksetup/ui/QuickSetup.java
@@ -230,6 +230,11 @@
            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                if (application.isFinished() &&
                    !getCurrentStep().isFinishedStep())
                {
                  setCurrentStep(application.getFinishedStep());
                }
                getDialog().displayProgress(desc);
              }
            });
opends/src/quicksetup/org/opends/quicksetup/ui/StepsPanel.java
@@ -96,11 +96,7 @@
              UIFactory.TextStyle.NOT_CURRENT_STEP);
        }
      }
      if (getApplication().isSubStep(s))
      {
        setStepVisible(s, getApplication().isVisible(s));
      }
      setStepVisible(s, getApplication().isVisible(s));
    }
  }
@@ -143,14 +139,7 @@
      JLabel iconLabel =
          UIFactory.makeJLabel(UIFactory.IconType.CURRENT_STEP, null,
              UIFactory.TextStyle.NO_STYLE);
      if (getApplication().isSubStep(s))
      {
        gbcAux.insets.left = UIFactory.LEFT_INSET_SUBSTEP;
      }
      else
      {
        gbcAux.insets.left = 0;
      }
      gbcAux.insets.left = 0;
      auxPanel.add(iconLabel, gbcAux);
      int width = (int) iconLabel.getPreferredSize().getWidth();
opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
@@ -28,6 +28,8 @@
package org.opends.quicksetup.uninstaller;
import org.opends.quicksetup.*;
import static org.opends.quicksetup.Step.FINISHED;
import static org.opends.quicksetup.Step.PROGRESS;
import static org.opends.quicksetup.Step.REVIEW;
import org.opends.quicksetup.ui.*;
@@ -93,6 +95,10 @@
    if (step != null && step.equals(Step.CONFIRM_UNINSTALL)) {
      nextStep = Step.PROGRESS;
    }
    else if (Step.PROGRESS.equals(step))
    {
      nextStep = Step.FINISHED;
    }
    return nextStep;
  }
@@ -104,12 +110,31 @@
    if (step != null && step.equals(Step.PROGRESS)) {
      prevStep = Step.CONFIRM_UNINSTALL;
    }
    else if (Step.FINISHED.equals(step))
    {
      prevStep = Step.PROGRESS;
    }
    return prevStep;
  }
  /**
   * {@inheritDoc}
   */
  public WizardStep getFinishedStep() {
    return Step.FINISHED;
  }
  /**
   * {@inheritDoc}
   */
  public boolean finishOnLeft()
  {
    return false;
  }
  /**
   * {@inheritDoc}
   */
  public boolean canGoBack(WizardStep step) {
    return false;
  }
@@ -144,6 +169,9 @@
          "Cannot click on next from progress step");
    } else if (cStep == REVIEW) {
      throw new IllegalStateException("Cannot click on next from review step");
    } else if (cStep == FINISHED) {
      throw new IllegalStateException(
          "Cannot click on next from finished step");
    }
  }
@@ -158,6 +186,10 @@
        {
          qs.quit();
        }
    }
    else if (cStep == FINISHED)
    {
      qs.quit();
    } else {
      throw new IllegalStateException(
          "Close only can be clicked on PROGRESS step");
@@ -222,6 +254,10 @@
      throw new IllegalStateException(
              "Cannot click on quit from progress step");
    }
    else if (step == Step.FINISHED) {
      throw new IllegalStateException(
      "Cannot click on quit from finished step");
    }
    qs.quit();
  }
@@ -250,10 +286,14 @@
   * {@inheritDoc}
   */
  public void previousClicked(WizardStep cStep, QuickSetup qs) {
    if (cStep == Step.PROGRESS) {
    if (cStep == PROGRESS) {
      throw new IllegalStateException(
              "Cannot click on previous from progress step");
    }
    else if (cStep == FINISHED) {
      throw new IllegalStateException(
      "Cannot click on previous from finished step");
    }
  }
  /**
@@ -333,13 +373,13 @@
  /**
   * {@inheritDoc}
   */
  protected void setWizardDialogState(QuickSetupDialog dlg,
  public void setWizardDialogState(QuickSetupDialog dlg,
                                      UserData userData,
                                      WizardStep step) {
    if (step == Step.CONFIRM_UNINSTALL) {
      dlg.setDefaultButton(ButtonName.FINISH);
      dlg.setFocusOnButton(ButtonName.FINISH);
    } else if (step == Step.PROGRESS) {
    } else if ((step == PROGRESS) || (step == FINISHED)) {
      dlg.setDefaultButton(ButtonName.CLOSE);
      dlg.setFocusOnButton(ButtonName.CLOSE);
      dlg.setButtonEnabled(ButtonName.CLOSE, false);
@@ -357,7 +397,7 @@
  /**
   * {@inheritDoc}
   */
  protected String getInstallationPath() {
  public String getInstallationPath() {
    return Utils.getInstallPathFromClasspath();
  }
@@ -634,7 +674,8 @@
   * {@inheritDoc}
   */
  public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) {
    if (dlg.getDisplayedStep() == Step.PROGRESS) {
    if ((dlg.getDisplayedStep() == PROGRESS) ||
        (dlg.getDisplayedStep() == FINISHED)) {
      // Simulate a close button event
      dlg.notifyButtonEvent(ButtonName.CLOSE);
    } else {
@@ -657,6 +698,7 @@
    Set<WizardStep> setSteps = new HashSet<WizardStep>();
    setSteps.add(Step.CONFIRM_UNINSTALL);
    setSteps.add(Step.PROGRESS);
    setSteps.add(Step.FINISHED);
    return Collections.unmodifiableSet(setSteps);
  }
@@ -669,6 +711,8 @@
      p = new ConfirmUninstallPanel(this, installStatus);
    } else if (step == Step.PROGRESS) {
      p = new ProgressPanel(this);
    } else if (step == Step.FINISHED) {
      p = new FinishedPanel(this);
    }
    return p;
  }
opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
@@ -158,7 +158,7 @@
  /**
   * {@inheritDoc}
   */
  protected String getInstallationPath() {
  public String getInstallationPath() {
    return Utils.getInstallPathFromClasspath();
  }
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeWizardStep.java
New file
@@ -0,0 +1,90 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, with the fields enclosed
 * by brackets "[]" replaced with your own identifying information:
 *      Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.upgrader;
import org.opends.quicksetup.WizardStep;
/**
 * Steps in the Upgrade wizard.
 */
public enum UpgradeWizardStep implements WizardStep {
  /**
   * The welcome step.
   */
  WELCOME("welcome-step"),
  /**
   * The welcome step.
   */
  REVIEW("review-step"),
  /**
   * The progress step.
   */
  PROGRESS("progress-step"),
  /**
   * The finished step.
   */
  FINISHED("finished-step");
  private String msgKey;
  private UpgradeWizardStep(String msgKey) {
    this.msgKey = msgKey;
  }
  /**
   * {@inheritDoc}
   */
  public String getMessageKey() {
    return msgKey;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isProgressStep() {
    return this == PROGRESS;
  }
  /**
   * {@inheritDoc}
   */
  public boolean isFinishedStep() {
    return this == FINISHED;
  }
  /**
   * Returns an String representation of this object.
   * @return an String representation of this object.  This method is
   * overwritten in order to be able to use this objects as keys in Maps and
   * make them different to the Steps defined in the Step class.
   */
  public String toString() {
    return "UpgradWizardStep"+super.toString();
  }
}
opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -29,6 +29,7 @@
import org.opends.quicksetup.CliApplication;
import static org.opends.quicksetup.Installation.*;
import org.opends.quicksetup.WizardStep;
import org.opends.quicksetup.ProgressStep;
import org.opends.quicksetup.ApplicationException;
@@ -37,7 +38,6 @@
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.ButtonName;
import org.opends.quicksetup.UserDataException;
import org.opends.quicksetup.Step;
import org.opends.quicksetup.BuildInformation;
import org.opends.quicksetup.CurrentInstallStatus;
import org.opends.quicksetup.UserInteraction;
@@ -53,6 +53,7 @@
import org.opends.quicksetup.util.ExternalTools;
import org.opends.quicksetup.util.OperationOutput;
import org.opends.quicksetup.ui.FinishedPanel;
import org.opends.quicksetup.ui.GuiApplication;
import org.opends.quicksetup.ui.QuickSetupDialog;
import org.opends.quicksetup.ui.ProgressPanel;
@@ -80,46 +81,11 @@
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 * QuickSetup application of ugrading the bits of an installation of
 * QuickSetup application of upgrading the bits of an installation of
 * OpenDS.
 */
public class Upgrader extends GuiApplication implements CliApplication {
  /**
   * Steps in the Upgrade wizard.
   */
  enum UpgradeWizardStep implements WizardStep {
    WELCOME("welcome-step"),
    REVIEW("review-step"),
    PROGRESS("progress-step");
    private String msgKey;
    private UpgradeWizardStep(String msgKey) {
      this.msgKey = msgKey;
    }
    /**
     * {@inheritDoc}
     */
    public String getMessageKey() {
      return msgKey;
    }
    /**
     * {@inheritDoc}
     */
    public boolean isProgressStep() {
      return this == PROGRESS;
    }
  }
  /**
   * Steps during the upgrade process.
   */
@@ -357,10 +323,21 @@
  /**
   * {@inheritDoc}
   */
  protected void setWizardDialogState(QuickSetupDialog dlg,
  public void setWizardDialogState(QuickSetupDialog dlg,
                                      UserData userData,
                                      WizardStep step) {
    // TODO
    //  Set the default button for the frame
    if (step == UpgradeWizardStep.REVIEW) {
      dlg.setFocusOnButton(ButtonName.FINISH);
      dlg.setDefaultButton(ButtonName.FINISH);
    } else if (step == UpgradeWizardStep.WELCOME) {
      dlg.setDefaultButton(ButtonName.NEXT);
      dlg.setFocusOnButton(ButtonName.NEXT);
    } else if ((step == UpgradeWizardStep.PROGRESS) ||
        (step == UpgradeWizardStep.FINISHED)) {
      dlg.setDefaultButton(ButtonName.CLOSE);
      dlg.setFocusOnButton(ButtonName.CLOSE);
    }
  }
  /**
@@ -412,7 +389,7 @@
  /**
   * {@inheritDoc}
   */
  protected String getInstallationPath() {
  public String getInstallationPath() {
    // The upgrader runs from the bits extracted by BuildExtractor
    // in the staging directory.  So 'stagePath' below will point
    // to the staging directory [installroot]/tmp/upgrade.  However
@@ -473,7 +450,14 @@
   * {@inheritDoc}
   */
  public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) {
    // TODO
    if ((dlg.getDisplayedStep() == UpgradeWizardStep.PROGRESS) ||
        (dlg.getDisplayedStep() == UpgradeWizardStep.FINISHED)) {
      // Simulate a close button event
      dlg.notifyButtonEvent(ButtonName.CLOSE);
    } else {
      // Simulate a quit button event
      dlg.notifyButtonEvent(ButtonName.QUIT);
    }
  }
  /**
@@ -502,6 +486,8 @@
      pnl = new UpgraderReviewPanel(this);
    } else if (UpgradeWizardStep.PROGRESS.equals(step)) {
      pnl = new ProgressPanel(this);
    } else if (UpgradeWizardStep.FINISHED.equals(step)) {
      pnl = new FinishedPanel(this);
    }
    return pnl;
  }
@@ -515,6 +501,8 @@
      next = UpgradeWizardStep.REVIEW;
    } else if (UpgradeWizardStep.REVIEW.equals(step)) {
      next = UpgradeWizardStep.PROGRESS;
    } else if (UpgradeWizardStep.PROGRESS.equals(step)) {
      next = UpgradeWizardStep.FINISHED;
    }
    return next;
  }
@@ -524,7 +512,9 @@
   */
  public WizardStep getPreviousWizardStep(WizardStep step) {
    WizardStep prev = null;
    if (UpgradeWizardStep.PROGRESS.equals(step)) {
    if (UpgradeWizardStep.FINISHED.equals(step)) {
      prev = UpgradeWizardStep.PROGRESS;
    } else if (UpgradeWizardStep.PROGRESS.equals(step)) {
      prev = UpgradeWizardStep.REVIEW;
    } else if (UpgradeWizardStep.REVIEW.equals(step)) {
      prev = UpgradeWizardStep.WELCOME;
@@ -535,6 +525,13 @@
  /**
   * {@inheritDoc}
   */
  public WizardStep getFinishedStep() {
    return UpgradeWizardStep.FINISHED;
  }
  /**
   * {@inheritDoc}
   */
  public boolean canQuit(WizardStep step) {
    return UpgradeWizardStep.WELCOME == step ||
            UpgradeWizardStep.REVIEW == step;
@@ -626,11 +623,11 @@
      // the fields are readonly.
      if (Utils.isWebStart()) {
        String serverLocationString =
                qs.getFieldStringValue(FieldName.SERVER_LOCATION);
                qs.getFieldStringValue(FieldName.SERVER_TO_UPGRADE_LOCATION);
        if ((serverLocationString == null) ||
                ("".equals(serverLocationString.trim()))) {
          errorMsgs.add(getMsg("empty-server-location"));
          qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true);
          qs.displayFieldInvalid(FieldName.SERVER_TO_UPGRADE_LOCATION, true);
        } else {
          try {
            File serverLocation = new File(serverLocationString);
@@ -652,13 +649,13 @@
            }
            uud.setServerLocation(serverLocationString);
            qs.displayFieldInvalid(FieldName.SERVER_LOCATION, false);
            qs.displayFieldInvalid(FieldName.SERVER_TO_UPGRADE_LOCATION, false);
          } catch (IllegalArgumentException iae) {
            LOG.log(Level.INFO,
                    "illegal OpenDS installation directory selected", iae);
            errorMsgs.add(getMsg("error-invalid-server-location",
                    serverLocationString));
            qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true);
            qs.displayFieldInvalid(FieldName.SERVER_TO_UPGRADE_LOCATION, true);
          }
        }
      } else {
@@ -672,7 +669,7 @@
    }
    if (errorMsgs.size() > 0) {
      throw new UserDataException(Step.SERVER_SETTINGS,
      throw new UserDataException(UpgradeWizardStep.WELCOME,
              Utils.getStringFromCollection(errorMsgs, "\n"));
    }
@@ -708,7 +705,8 @@
   * {@inheritDoc}
   */
  public boolean canGoBack(WizardStep step) {
    return super.canGoBack(step) && !step.equals(UpgradeWizardStep.PROGRESS);
    return super.canGoBack(step) && !step.equals(UpgradeWizardStep.PROGRESS)
    && !step.equals(UpgradeWizardStep.FINISHED);
  }
  /**
opends/src/quicksetup/org/opends/quicksetup/upgrader/ui/WelcomePanel.java
@@ -75,7 +75,7 @@
   */
  public Object getFieldValue(FieldName fieldName) {
    Object v = null;
    if (FieldName.SERVER_LOCATION.equals(fieldName)) {
    if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
      v = tcServerLocation.getText();
    }
    return v;
@@ -91,7 +91,7 @@
    } else {
      style = UIFactory.TextStyle.PRIMARY_FIELD_VALID;
    }
    if (FieldName.SERVER_LOCATION.equals(fieldName)) {
    if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
      UIFactory.setTextStyle(lblServerLocation, style);
    }
  }
opends/src/quicksetup/org/opends/quicksetup/util/HtmlProgressMessageFormatter.java
@@ -259,16 +259,16 @@
  }
  /**
   * Returns the HTML representation of an error message for a given exception.
   * Returns the HTML representation of an error message for a given throwable.
   * This method applies a margin if the applyMargin parameter is
   * <CODE>true</CODE>.
   * @param ex the exception.
   * @param t the throwable.
   * @param applyMargin specifies whether we apply a margin or not to the
   * resulting HTML.
   * @return the HTML representation of an error message for the given
   * exception.
   */
  public String getFormattedError(Exception ex, boolean applyMargin)
  public String getFormattedError(Throwable t, boolean applyMargin)
  {
    String openDiv = "<div style=\"margin-left:5px; margin-top:10px\">";
    String hideText =
@@ -280,8 +280,8 @@
    String closeDiv = "</div>";
    StringBuilder stackBuf = new StringBuilder();
    stackBuf.append(getHtmlStack(ex));
    Throwable root = ex.getCause();
    stackBuf.append(getHtmlStack(t));
    Throwable root = t.getCause();
    while (root != null)
    {
      stackBuf.append(getHtml(getMsg("exception-root-cause")))
@@ -294,14 +294,14 @@
    StringBuilder buf = new StringBuilder();
    String msg = ex.getMessage();
    String msg = t.getMessage();
    if (msg != null)
    {
      buf.append(UIFactory.applyFontToHtml(getHtml(ex.getMessage()),
      buf.append(UIFactory.applyFontToHtml(getHtml(t.getMessage()),
              UIFactory.PROGRESS_ERROR_FONT)).append(Constants.HTML_LINE_BREAK);
    } else
    {
      buf.append(ex.toString()).append(Constants.HTML_LINE_BREAK);
      buf.append(t.toString()).append(Constants.HTML_LINE_BREAK);
    }
    buf.append(getErrorWithStackHtml(openDiv, hideText, showText, stackText,
        closeDiv, false));
opends/src/quicksetup/org/opends/quicksetup/util/PlainTextProgressMessageFormatter.java
@@ -203,21 +203,21 @@
  /**
   * Returns the plain text representation of an error message for a given
   * exception.
   * throwable.
   * This method applies a margin if the applyMargin parameter is
   * <CODE>true</CODE>.
   * @param ex the exception.
   * @param t the exception.
   * @param applyMargin specifies whether we apply a margin or not to the
   * resulting plain text.
   * @return the plain text representation of an error message for the given
   * exception.
   */
  public String getFormattedError(Exception ex, boolean applyMargin)
  public String getFormattedError(Throwable t, boolean applyMargin)
  {
    String msg = ex.getMessage();
    String msg = t.getMessage();
    if (msg == null)
    {
      msg = ex.toString();
      msg = t.toString();
    }
    String result;
    if (applyMargin)
opends/src/quicksetup/org/opends/quicksetup/util/ProgressMessageFormatter.java
@@ -138,16 +138,16 @@
  /**
   * Returns the formatted representation of an error message for a given
   * exception.
   * throwable.
   * This method applies a margin if the applyMargin parameter is
   * <CODE>true</CODE>.
   * @param ex the exception.
   * @param t the throwable.
   * @param applyMargin specifies whether we apply a margin or not to the
   * resulting formatted text.
   * @return the formatted representation of an error message for the given
   * exception.
   */
  public String getFormattedError(Exception ex, boolean applyMargin);
  public String getFormattedError(Throwable t, boolean applyMargin);
  /**
   * Returns the line break formatted.
opends/tests/unit-tests-testng/src/server/org/opends/server/TestCaseUtils.java
@@ -178,7 +178,7 @@
    //db_rebuild is the third jeb backend used by the jeb rebuild test cases
    //db_unindexed is the forth backend used by the unindexed search privilege
    //test cases
    String[] subDirectories = { "bak", "bin", "changelogDb", "classes",
    String[] subDirectories = { "adminDb", "bak", "bin", "changelogDb", "classes",
                                "config", "db", "db_verify", "ldif", "lib",
                                "locks", "logs", "db_rebuild", "db_unindexed",
                                "db_index_test", "db_import_test"};