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

jvergara
03.51.2007 7d508e62432faaf1e529d83dbc6aa5ec4bf284d0
Add some log messages in the initialization code.

Fix a bug in that made the progress bar to go back.

Use LinkedHashSets instead of HashSets in SuffixesToReplicateOptions and return a copy of these Sets. This is done to be sure that the ADS is the last suffix to be initialized.

Use a customized message when we are initializing the ADS suffix instead of displaying the suffix (the user might be surprised by the fact that a base DN (s)he never chose is being initialized).
4 files modified
90 ■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 46 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java 20 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java 12 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java 12 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -1757,9 +1757,18 @@
      ServerDescriptor server = replica.getServer();
      String hostPort = server.getHostPort(true);
      boolean isADS = areDnsEqual(dn, ADSContext.getAdministrationSuffixDN());
      if(!isADS)
      {
      notifyListeners(getFormattedProgress(
        INFO_PROGRESS_INITIALIZING_SUFFIX.get(dn, hostPort)));
      notifyListeners(getLineBreak());
      }
      else
      {
        notifyListeners(getFormattedWithPoints(
            INFO_PROGRESS_INITIALIZING_ADS.get()));
      }
      try
      {
        int replicationId = replica.getReplicationId();
@@ -1811,7 +1820,11 @@
        {
          try
          {
            initializeSuffix(ctx, replicationId, dn, true, hostPort);
            LOG.log(Level.INFO, "Calling initializeSuffix with base DN: "+dn);
            LOG.log(Level.INFO, "Try number: "+(6 - nTries));
            LOG.log(Level.INFO, "replicationId of source replica: "+
                replicationId);
            initializeSuffix(ctx, replicationId, dn, !isADS, hostPort);
            initDone = true;
          }
          catch (PeerNotFoundException pnfe)
@@ -1848,6 +1861,10 @@
        }
        throw ae;
      }
      if (isADS)
      {
        notifyListeners(getFormattedDone());
      }
      notifyListeners(getLineBreak());
      checkAbort();
    }
@@ -3666,6 +3683,7 @@
      }
      catch (NameAlreadyBoundException x)
      {
        LOG.log(Level.WARNING, "A task with dn: "+dn+" already existed.");
      }
      catch (NamingException ne)
      {
@@ -3694,6 +3712,7 @@
    Message lastDisplayedMsg = null;
    String lastLogMsg = null;
    long lastTimeMsgDisplayed = -1;
    long lastTimeMsgLogged = -1;
    int totalEntries = 0;
    while (!isOver)
    {
@@ -3708,9 +3727,8 @@
      {
        NamingEnumeration res = ctx.search(dn, filter, searchControls);
        SearchResult sr = (SearchResult)res.next();
        if (displayProgress)
        {
          // Display the number of entries that have been handled and
        // Get the number of entries that have been handled and
          // a percentage...
          Message msg;
          String sProcessed = getFirstValue(sr,
@@ -3777,9 +3795,16 @@
            {
              minRefreshPeriod = 10000;
            }
          if (((currentTime - minRefreshPeriod) > lastTimeMsgLogged))
          {
            lastTimeMsgLogged = currentTime;
            LOG.log(Level.INFO, "Progress msg: "+msg);
          }
          if (displayProgress)
          {
            if (!msg.equals(lastDisplayedMsg) &&
            ((currentTime - minRefreshPeriod) > lastTimeMsgDisplayed))
            if (!msg.equals(lastDisplayedMsg))
                ((currentTime - minRefreshPeriod) > lastTimeMsgDisplayed) &&
                !msg.equals(lastDisplayedMsg))
            {
              notifyListeners(getFormattedProgress(msg));
              lastDisplayedMsg = msg;
@@ -3788,6 +3813,7 @@
            }
          }
        }
        String logMsg = getFirstValue(sr, "ds-task-log-message");
        if (logMsg != null)
        {
@@ -3816,10 +3842,14 @@
                    sourceServerDisplay);
          }
          LOG.log(Level.WARNING, "Processed errorMsg: "+errorMsg);
          if (helper.isCompletedWithErrors(state))
          {
            if (displayProgress)
            {
            notifyListeners(getFormattedWarning(errorMsg));
          }
          }
          else if (!helper.isSuccessful(state) ||
              helper.isStoppedByError(state))
          {
@@ -3829,16 +3859,20 @@
            if ((lastLogMsg == null) ||
                helper.isPeersNotFoundError(lastLogMsg))
            {
              LOG.log(Level.WARNING, "Throwing peer not found error.  "+
                  "Last Log Msg: "+lastLogMsg);
              // Assume that this is a peer not found error.
              throw new PeerNotFoundException(errorMsg);
            }
            else
            {
              LOG.log(Level.SEVERE, "Throwing ApplicationException.");
              throw ae;
            }
          }
          else if (displayProgress)
          {
            LOG.log(Level.INFO, "Initialization completed successfully.");
            notifyListeners(getFormattedProgress(
                INFO_SUFFIX_INITIALIZED_SUCCESSFULLY.get()));
          }
opends/src/quicksetup/org/opends/quicksetup/installer/SuffixesToReplicateOptions.java
@@ -28,7 +28,7 @@
package org.opends.quicksetup.installer;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import org.opends.admin.ads.SuffixDescriptor;
@@ -86,13 +86,13 @@
    {
    case REPLICATE_WITH_EXISTING_SUFFIXES:
      Set s = (Set)args[0];
      availableSuffixes = new HashSet<SuffixDescriptor>();
      availableSuffixes = new LinkedHashSet<SuffixDescriptor>();
      for (Object o: s)
      {
        availableSuffixes.add((SuffixDescriptor)o);
      }
      s = (Set)args[1];
      suffixesToReplicate = new HashSet<SuffixDescriptor>();
      suffixesToReplicate = new LinkedHashSet<SuffixDescriptor>();
      for (Object o: s)
      {
        suffixesToReplicate.add((SuffixDescriptor)o);
@@ -104,13 +104,13 @@
      if ((args != null) && (args.length > 0))
      {
        s = (Set)args[0];
        availableSuffixes = new HashSet<SuffixDescriptor>();
        availableSuffixes = new LinkedHashSet<SuffixDescriptor>();
        for (Object o: s)
        {
          availableSuffixes.add((SuffixDescriptor)o);
        }
        s = (Set)args[1];
        suffixesToReplicate = new HashSet<SuffixDescriptor>();
        suffixesToReplicate = new LinkedHashSet<SuffixDescriptor>();
        for (Object o: s)
        {
          suffixesToReplicate.add((SuffixDescriptor)o);
@@ -138,7 +138,10 @@
   */
  public Set<SuffixDescriptor> getAvailableSuffixes()
  {
    return availableSuffixes;
    LinkedHashSet<SuffixDescriptor> copy =
      new LinkedHashSet<SuffixDescriptor>();
    copy.addAll(availableSuffixes);
    return copy;
  }
  /**
@@ -149,7 +152,10 @@
   */
  public Set<SuffixDescriptor> getSuffixes()
  {
    return suffixesToReplicate;
    LinkedHashSet<SuffixDescriptor> copy =
      new LinkedHashSet<SuffixDescriptor>();
    copy.addAll(suffixesToReplicate);
    return copy;
  }
}
opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -375,18 +375,18 @@
      steps.add(InstallProgressStep.STARTING_SERVER);
    }
    if (mustConfigureReplication())
    {
      steps.add(InstallProgressStep.CONFIGURING_REPLICATION);
      totalTime += hmTime.get(InstallProgressStep.CONFIGURING_REPLICATION);
    }
    if (mustCreateAds())
    {
      totalTime += hmTime.get(InstallProgressStep.CONFIGURING_ADS);
      steps.add(InstallProgressStep.CONFIGURING_ADS);
    }
    if (mustConfigureReplication())
    {
      steps.add(InstallProgressStep.CONFIGURING_REPLICATION);
      totalTime += hmTime.get(InstallProgressStep.CONFIGURING_REPLICATION);
    }
    if (mustInitializeSuffixes())
    {
      totalTime += hmTime.get(
opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -352,18 +352,18 @@
      steps.add(InstallProgressStep.STARTING_SERVER);
    }
    if (mustConfigureReplication())
    {
      steps.add(InstallProgressStep.CONFIGURING_REPLICATION);
      totalTime += hmTime.get(InstallProgressStep.CONFIGURING_REPLICATION);
    }
    if (mustCreateAds())
    {
      totalTime += hmTime.get(InstallProgressStep.CONFIGURING_ADS);
      steps.add(InstallProgressStep.CONFIGURING_ADS);
    }
    if (mustConfigureReplication())
    {
      steps.add(InstallProgressStep.CONFIGURING_REPLICATION);
      totalTime += hmTime.get(InstallProgressStep.CONFIGURING_REPLICATION);
    }
    if (mustInitializeSuffixes())
    {
      totalTime += hmTime.get(