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

Gaetan Boismal
22.34.2015 d0d27dbc1cd64b2ef276a3b280b21d9d6e1081db
OPENDJ-2017 Code cleanup

* org/opends/quicksetup/installer/Installer.java
** Autorefactor'ed file + Reformat and some minor manual cleanup
** Extracted a couple of methods to help code readability of createReplicatedBackendsIfRequired()

* org/opends/quicksetup/Application.java
** Consequences of changes done in Installer.java

* org/opends/quicksetup/installer/InstallerHelper.java
** Minor cleanup in createLocalDBBackend(...)
3 files modified
2261 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/quicksetup/Application.java 14 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java 2210 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java 37 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/quicksetup/Application.java
@@ -22,16 +22,20 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2014 ForgeRock AS.
 *      Portions Copyright 2012-2015 ForgeRock AS.
 */
package org.opends.quicksetup;
import static org.opends.messages.QuickSetupMessages.*;
import static com.forgerock.opendj.cli.Utils.*;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.PrintStream;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
@@ -53,10 +57,6 @@
import org.opends.quicksetup.util.UIKeyStore;
import org.opends.quicksetup.util.Utils;
import static com.forgerock.opendj.cli.Utils.*;
import static org.opends.messages.QuickSetupMessages.*;
/**
 * This class represents an application that can be run in the context of
 * QuickSetup.  Examples of applications might be 'installer' and 'uninstaller'.
@@ -640,7 +640,7 @@
  protected InitialLdapContext getRemoteConnection(ServerDescriptor server,
      String dn, String pwd, ApplicationTrustManager trustManager,
      int timeout,
      LinkedHashSet<PreferredConnection> cnx)
      Set<PreferredConnection> cnx)
  throws ApplicationException
  {
    Map<ADSContext.ServerProperty, Object> adsProperties =
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
Diff too large
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
@@ -53,14 +53,15 @@
import java.util.Set;
import java.util.TreeSet;
import javax.naming.directory.DirContext;
import javax.naming.ldap.InitialLdapContext;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.messages.CoreMessages;
import org.opends.messages.BackendMessages;
import org.opends.messages.CoreMessages;
import org.opends.messages.ReplicationMessages;
import org.opends.quicksetup.Application;
import org.opends.quicksetup.ApplicationException;
@@ -363,26 +364,26 @@
  /**
   * Creates a local database backend on the server.
   * @param ctx the connection to the server.
   * @param backendName the name of the backend to be created.
   * @param baseDNs the list of base DNs to be defined on the server.
   * @param serverDisplay the server display.
   * @throws ApplicationException if something goes wrong.
   *
   * @param ctx
   *          the connection to the server.
   * @param backendName
   *          the name of the backend to be created.
   * @param baseDNs
   *          the list of base DNs to be defined on the server.
   * @param serverDisplay
   *          the server display.
   * @throws ApplicationException
   *           if something goes wrong.
   */
  public void createLocalDBBackend(InitialLdapContext ctx,
      String backendName,
      Set<String> baseDNs,
      String serverDisplay)
  throws ApplicationException
  public void createLocalDBBackend(DirContext ctx, String backendName, Set<String> baseDNs, String serverDisplay)
      throws ApplicationException
  {
    try
    {
      ManagementContext mCtx = LDAPManagementContext.createFromContext(
          JNDIDirContextAdaptor.adapt(ctx));
      ManagementContext mCtx = LDAPManagementContext.createFromContext(JNDIDirContextAdaptor.adapt(ctx));
      RootCfgClient root = mCtx.getRootConfiguration();
      LocalDBBackendCfgDefn provider = LocalDBBackendCfgDefn.getInstance();
      LocalDBBackendCfgClient backend = root.createBackend(provider,
          backendName, null);
      LocalDBBackendCfgClient backend = root.createBackend(LocalDBBackendCfgDefn.getInstance(), backendName, null);
      backend.setEnabled(true);
      Set<DN> setBaseDNs = new HashSet<DN>();
      for (String baseDN : baseDNs)
@@ -397,9 +398,7 @@
    catch (Throwable t)
    {
      throw new ApplicationException(
          ReturnCode.CONFIGURATION_ERROR,
          INFO_ERROR_CONFIGURING_REMOTE_GENERIC.get(serverDisplay, t),
          t);
          ReturnCode.CONFIGURATION_ERROR, INFO_ERROR_CONFIGURING_REMOTE_GENERIC.get(serverDisplay, t), t);
    }
  }