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

Jean-Noel Rouvignac
13.41.2014 5fe8d27253bdca43734b850caaaff574ccc15066
Follow up on r10720.

ImportLDIFPanel.java, ServerController.java, WebStartDownloader.java:
Removed unused imports.
3 files modified
218 ■■■■■ changed files
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java 126 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ServerController.java 62 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java 30 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
@@ -24,7 +24,6 @@
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 */
package org.opends.guitools.controlpanel.ui;
import static org.opends.messages.AdminToolMessages.*;
@@ -76,7 +75,6 @@
/**
 * The panel where the user can import the contents of an LDIF file to the
 * server.
 *
 */
public class ImportLDIFPanel extends InclusionExclusionPanel
{
@@ -125,25 +123,22 @@
    createLayout();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public LocalizableMessage getTitle()
  {
    return INFO_CTRL_PANEL_IMPORT_LDIF_TITLE.get();
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public Component getPreferredFocusComponent()
  {
    return file;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void toBeDisplayed(boolean visible)
  {
    if (visible)
@@ -199,25 +194,22 @@
    lFile.setLabelFor(file);
    documentListener = new DocumentListener()
    {
      /**
       * {@inheritDoc}
       */
      /** {@inheritDoc} */
      @Override
      public void changedUpdate(DocumentEvent ev)
      {
        String text = file.getText().trim();
        setEnabledOK((text != null) && (text.length() > 0) &&
            !errorPane.isVisible());
      }
      /**
       * {@inheritDoc}
       */
      /** {@inheritDoc} */
      @Override
      public void removeUpdate(DocumentEvent ev)
      {
        changedUpdate(ev);
      }
      /**
       * {@inheritDoc}
       */
      /** {@inheritDoc} */
      @Override
      public void insertUpdate(DocumentEvent ev)
      {
        changedUpdate(ev);
@@ -288,9 +280,8 @@
    add(append, gbc);
    append.addChangeListener(new ChangeListener()
    {
      /**
       * {@inheritDoc}
       */
      /** {@inheritDoc} */
      @Override
      public void stateChanged(ChangeEvent ev)
      {
        replaceEntries.setEnabled(append.isSelected());
@@ -417,9 +408,8 @@
    ChangeListener changeListener = new ChangeListener()
    {
      /**
       * {@inheritDoc}
       */
      /** {@inheritDoc} */
      @Override
      public void stateChanged(ChangeEvent ev)
      {
        rejectsFile.setEnabled(writeRejects.isSelected());
@@ -489,9 +479,8 @@
    changeListener = new ChangeListener()
    {
      /**
       * {@inheritDoc}
       */
      /** {@inheritDoc} */
      @Override
      public void stateChanged(ChangeEvent ev)
      {
        skipsFile.setEnabled(writeSkips.isSelected());
@@ -505,9 +494,8 @@
    changeListener = new ChangeListener()
    {
      /**
       * {@inheritDoc}
       */
      /** {@inheritDoc} */
      @Override
      public void stateChanged(ChangeEvent ev)
      {
        if (ev.getSource() == overwriteSkipsFile)
@@ -537,9 +525,8 @@
    addBottomGlue(gbc);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void configurationChanged(ConfigurationChangeEvent ev)
  {
    ServerDescriptor desc = ev.getNewDescriptor();
@@ -549,6 +536,7 @@
      INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(desc.getHostname()));
    SwingUtilities.invokeLater(new Runnable()
    {
      @Override
      public void run()
      {
        lRemoteFileHelp.setVisible(!isLocal());
@@ -561,17 +549,15 @@
    });
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  protected void checkOKButtonEnable()
  {
    documentListener.changedUpdate(null);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void okClicked()
  {
    setPrimaryValid(lBackend);
@@ -589,7 +575,7 @@
    }
    String ldifPath = file.getText();
    if ((ldifPath == null) || (ldifPath.trim().equals("")))
    if (ldifPath == null || "".equals(ldifPath.trim()))
    {
      errors.add(INFO_NO_LDIF_PATH.get());
      setPrimaryInvalid(lFile);
@@ -621,7 +607,7 @@
    if (writeRejects.isSelected())
    {
      String rejectPath = rejectsFile.getText();
      if ((rejectPath == null) || (rejectPath.trim().equals("")))
      if (rejectPath == null || "".equals(rejectPath.trim()))
      {
        errors.add(ERR_CTRL_PANEL_REJECTS_FILE_REQUIRED.get());
        setPrimaryInvalid(lRejectsFile);
@@ -640,7 +626,7 @@
    if (writeSkips.isSelected())
    {
      String skipPath = skipsFile.getText();
      if ((skipPath == null) || (skipPath.trim().equals("")))
      if (skipPath == null || "".equals(skipPath.trim()))
      {
        errors.add(ERR_CTRL_PANEL_SKIPS_FILE_REQUIRED.get());
        setPrimaryInvalid(lSkipsFile);
@@ -720,7 +706,7 @@
          }
        }
      }
      if ((errors.isEmpty()) && confirmed)
      if (errors.isEmpty() && confirmed)
      {
        newTask.setInitializeAll(initializeAll);
        launchOperation(newTask,
@@ -741,9 +727,8 @@
    }
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void cancelClicked()
  {
    setPrimaryValid(lBackend);
@@ -811,27 +796,24 @@
      this.initializeAll = initializeAll;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public Type getType()
    {
      return Type.IMPORT_LDIF;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public LocalizableMessage getTaskDescription()
    {
      return INFO_CTRL_PANEL_IMPORT_TASK_DESCRIPTION.get(fileName,
          backendSet.iterator().next());
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public boolean canLaunch(Task taskToBeLaunched,
        Collection<LocalizableMessage> incompatibilityReasons)
    {
@@ -853,9 +835,8 @@
      return canLaunch;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    protected ArrayList<String> getCommandLineArguments()
    {
      ArrayList<String> args = new ArrayList<String>();
@@ -925,17 +906,15 @@
      return args;
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    protected String getCommandLinePath()
    {
      return getCommandLinePath("import-ldif");
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public void runTask()
    {
      state = State.RUNNING;
@@ -997,9 +976,8 @@
      }
    }
    /**
     * {@inheritDoc}
     */
    /** {@inheritDoc} */
    @Override
    public Set<String> getBackends()
    {
      return backendSet;
@@ -1007,8 +985,7 @@
    private void initializeAll() throws ReplicationCliException
    {
      ReplicationCliMain repl = new ReplicationCliMain(outPrintStream,
          errorPrintStream, System.in);
      ReplicationCliMain repl = new ReplicationCliMain(outPrintStream, errorPrintStream);
      getProgressDialog().appendProgressHtml(
          UIFactory.HTML_SEPARATOR+"<br><br>");
@@ -1024,9 +1001,8 @@
        LocalizableMessage msg = INFO_PROGRESS_INITIALIZING_SUFFIX.get(baseDN,
            ConnectionUtils.getHostPort(getInfo().getDirContext()));
        getProgressDialog().appendProgressHtml(Utilities.applyFont(
            msg.toString()+"<br>", ColorAndFontConstants.progressFont));
        repl.initializeAllSuffix(baseDN.toString(), getInfo().getDirContext(),
            true);
            msg + "<br>", ColorAndFontConstants.progressFont));
        repl.initializeAllSuffix(baseDN.toString(), getInfo().getDirContext(), true);
      }
    }
@@ -1055,5 +1031,5 @@
      return Task.getEquivalentCommandLine(cmdLineName, args);
    }
  };
  }
}
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -27,7 +27,6 @@
package org.opends.quicksetup.util;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.quicksetup.util.Utils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import static com.forgerock.opendj.cli.Utils.getThrowableMsg;
@@ -133,7 +132,7 @@
      StandardOutputSuppressor.suppress();
    }
    if (suppressOutput && (application != null))
    if (suppressOutput && application != null)
    {
      application.setNotifyListeners(false);
    }
@@ -201,8 +200,8 @@
          int clientSideError =
            org.opends.server.protocols.ldap.
            LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR;
          if ((returnValue == clientSideError) || (returnValue == 0)) {
            if (isWindows()) {
          if (isWindows()
              && (returnValue == clientSideError || returnValue == 0)) {
              /*
               * Sometimes the server keeps some locks on the files.
               * TODO: remove this code once stop-ds returns properly when
@@ -210,7 +209,6 @@
               */
              int nTries = 10;
              boolean stopped = false;
              for (int i = 0; i < nTries && !stopped; i++) {
                logger.trace("waiting for server to stop");
                try {
@@ -223,8 +221,9 @@
                stopped = !installation.getStatus().isServerRunning();
                logger.info(LocalizableMessage.raw(
                    "After calling stop-ds.  Is server running? "+!stopped));
                if (!stopped) {
              if (stopped) {
                break;
              }
                  if (application != null) {
                    LocalizableMessageBuilder mb = new LocalizableMessageBuilder();
                    mb.append(application.getFormattedLog(
@@ -232,15 +231,11 @@
                    mb.append(application.getLineBreak());
                    application.notifyListeners(mb.toMessage());
                  }
                } else {
                  break;
                }
              }
              if (!stopped) {
                returnValue = -1;
              }
            }
          }
          if (returnValue == clientSideError) {
            if (application != null) {
@@ -282,15 +277,19 @@
      }
    }
    finally {
      if (suppressOutput && StandardOutputSuppressor.isSuppressed()) {
      if (suppressOutput)
      {
        if (StandardOutputSuppressor.isSuppressed())
        {
        StandardOutputSuppressor.unsuppress();
      }
      if (suppressOutput && (application != null))
        if (application != null)
      {
        application.setNotifyListeners(true);
      }
    }
  }
  }
  /**
   * This methods starts the server.
@@ -328,7 +327,7 @@
      StandardOutputSuppressor.suppress();
    }
    if (suppressOutput && (application != null))
    if (suppressOutput && application != null)
    {
      application.setNotifyListeners(false);
    }
@@ -454,14 +453,14 @@
            int dig = i % 10;
            if (((dig == 3) || (dig == 4)) && !"localhost".equals(hostName))
            if ((dig == 3 || dig == 4) && !"localhost".equals(hostName))
            {
              // Try with local host. This might be necessary in certain
              // network configurations.
              hostName = "localhost";
            }
            if (((dig == 5) || (dig == 6)))
            if (dig == 5 || dig == 6)
            {
              // Try with 0.0.0.0. This might be necessary in certain
              // network configurations.
@@ -473,13 +472,10 @@
            try
            {
              int timeout = CliConstants.DEFAULT_LDAP_CONNECT_TIMEOUT;
              if (application != null)
              {
                if (application.getUserData() != null)
              if (application != null && application.getUserData() != null)
                {
                  timeout = application.getUserData().getConnectTimeout();
                }
              }
              ctx = Utils.createLdapsContext(
                  ldapUrl,
                  userDn, userPw, timeout,
@@ -508,20 +504,10 @@
          }
          if (!connected)
          {
            if (isWindows())
            {
              throw new ApplicationException(
                  ReturnCode.START_ERROR,
                  INFO_ERROR_STARTING_SERVER_IN_WINDOWS.get(port),
                  null);
            }
            else
            {
              throw new ApplicationException(
                  ReturnCode.START_ERROR,
                  INFO_ERROR_STARTING_SERVER_IN_UNIX.get(port),
                  null);
            }
            final LocalizableMessage msg = isWindows()
                ? INFO_ERROR_STARTING_SERVER_IN_WINDOWS.get(port)
                : INFO_ERROR_STARTING_SERVER_IN_UNIX.get(port);
            throw new ApplicationException(ReturnCode.START_ERROR, msg, null);
          }
        }
      } catch (IOException ioe)
@@ -536,15 +522,19 @@
            getThrowableMsg(INFO_ERROR_STARTING_SERVER.get(), ie), ie);
      }
    } finally {
      if (suppressOutput && StandardOutputSuppressor.isSuppressed()) {
      if (suppressOutput)
      {
        if (StandardOutputSuppressor.isSuppressed())
        {
        StandardOutputSuppressor.unsuppress();
      }
      if (suppressOutput && (application != null))
        if (application != null)
      {
        application.setNotifyListeners(true);
      }
    }
  }
  }
  /**
   * This class is used to read the standard error and standard output of the
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
@@ -24,14 +24,13 @@
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2013-2014 ForgeRock AS.
 */
package org.opends.quicksetup.webstart;
import org.forgerock.i18n.LocalizableMessage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import javax.jnlp.DownloadService;
@@ -39,14 +38,12 @@
import javax.jnlp.ServiceManager;
import javax.jnlp.UnavailableServiceException;
import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.ReturnCode;
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.SetupUtils;
import static org.opends.quicksetup.util.Utils.*;
import static org.opends.messages.QuickSetupMessages.*;
import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import static com.forgerock.opendj.cli.Utils.getThrowableMsg;
@@ -124,6 +121,7 @@
    isFinished = false;
    Thread t = new Thread(new Runnable()
    {
      @Override
      public void run()
      {
        try
@@ -299,7 +297,7 @@
      }
      else
      {
        ratio = (100 / urls.length);
        ratio = 100 / urls.length;
      }
      ratios[i] = ratio;
      totalRatios += ratio;
@@ -316,7 +314,7 @@
    }
    for (int i = 0; i < urls.length && (getException() == null); i++)
    for (int i = 0; i < urls.length && getException() == null; i++)
    {
      if (i == 0)
      {
@@ -366,9 +364,8 @@
    return ex;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void downloadFailed(URL url, String version)
  {
    ex =
@@ -377,9 +374,8 @@
                INFO_DOWNLOADING_ERROR.get(url), null);
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void progress(URL url, String version, long readSoFar, long total,
      int overallPercent)
  {
@@ -390,9 +386,8 @@
    status = Status.DOWNLOADING;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void upgradingArchive(URL url, String version, int patchPercent,
      int overallPercent)
  {
@@ -400,9 +395,8 @@
    status = Status.UPGRADING;
  }
  /**
   * {@inheritDoc}
   */
  /** {@inheritDoc} */
  @Override
  public void validating(URL url, String version, long entry, long total,
      int overallPercent)
  {