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

jvergara
03.06.2008 394f9db3f8d0258fcff62f01321ae7aad59fb371
Fix for issue 3118 (No error reported by the setup (GUI) if imported ldif file doesn't match the specified base DN)

When we are in non verbose mode (or in graphical setup) at the end of the import display how many entries have been added, rejected and skipped.
3 files modified
84 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/Application.java 13 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 42 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java 29 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Application.java
@@ -842,6 +842,16 @@
  }
  /**
   * Method that is invoked by the printstreams with the messages received
   * on operations such as start or import.  This is done so that the
   * application can parse this messages and display them.
   * @param message the message that has been received
   */
  protected void applicationPrintStreamReceived(String message)
  {
  }
  /**
   * This class is used to notify the ProgressUpdateListeners of events
   * that are written to the standard error.  It is used in WebStartInstaller
   * and in OfflineInstaller.  These classes just create a ErrorPrintStream and
@@ -947,7 +957,8 @@
      }
      notifyListeners(mb.toMessage());
      LOG.log(Level.INFO, "server: " + msg);
      applicationPrintStreamReceived(msg);
      LOG.log(Level.INFO, msg);
      isFirstLine = false;
    }
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -161,6 +161,7 @@
  private boolean registeredNewServerOnRemote;
  private boolean createdAdministrator;
  private boolean createdRemoteAds;
  private String lastImportProgress;
  /**
   * An static String that contains the class name of ConfigFileHandler.
@@ -1282,10 +1283,34 @@
        // TODO: implement the abort
      }
    };
    invokeLongOperation(thread);
    try
    {
      invokeLongOperation(thread);
    } catch (ApplicationException ae)
    {
      if (!isVerbose())
      {
        if (lastImportProgress != null)
        {
          notifyListeners(
              getFormattedProgress(Message.raw(lastImportProgress)));
          notifyListeners(getLineBreak());
        }
      }
      throw ae;
    }
    if (!isVerbose())
    {
      notifyListeners(getFormattedDoneWithLineBreak());
      if (lastImportProgress == null)
      {
        notifyListeners(getFormattedDoneWithLineBreak());
      }
      else
      {
        notifyListeners(
            getFormattedProgress(Message.raw(lastImportProgress)));
        notifyListeners(getLineBreak());
      }
    }
  }
@@ -4701,6 +4726,19 @@
    }
    return hostPort;
  }
  /**
   * {@inheritDoc}
   */
  protected void applicationPrintStreamReceived(String message)
  {
    InstallerHelper helper = new InstallerHelper();
    String parsedMessage = helper.getImportProgressMessage(message);
    if (parsedMessage != null)
    {
      lastImportProgress = parsedMessage;
    }
  }
}
/**
opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -63,6 +63,7 @@
import org.opends.server.admin.std.meta.*;
import org.opends.server.backends.task.TaskState;
import org.opends.messages.CoreMessages;
import org.opends.messages.JebMessages;
import org.opends.messages.ReplicationMessages;
import org.opends.messages.Message;
import static org.opends.messages.QuickSetupMessages.*;
@@ -828,6 +829,34 @@
  }
  /**
   * If the log message is of type "[03/Apr/2008:21:25:43 +0200] category=JEB
   * severity=NOTICE msgID=8847454 Processed 1 entries, imported 0, skipped 1,
   * rejected 0 and migrated 0 in 1 seconds (average rate 0.0/sec)" returns
   * the message part.  Returns <CODE>null</CODE> otherwise.
   * @param msg the message to be parsed.
   * @return the parsed import message.
   */
  public String getImportProgressMessage(String msg)
  {
    String parsedMsg = null;
    if (msg != null)
    {
      if ((msg.indexOf(
          "msgID="+JebMessages.NOTE_JEB_IMPORT_FINAL_STATUS.getId()) != -1) ||
          (msg.indexOf(
          "msgID="+JebMessages.NOTE_JEB_IMPORT_PROGRESS_REPORT.getId()) != -1))
      {
        int index = msg.indexOf("msg=");
        if (index != -1)
        {
          parsedMsg = msg.substring(index + 4);
        }
      }
    }
    return parsedMsg;
  }
  /**
   * Tells whether the provided java installation supports the server option
   * or not.
   * @param javaHome the java installation path.