opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/InstallReviewPanel.java
@@ -374,7 +374,7 @@ if (repl.getType() == DataReplicationOptions.Type.IN_EXISTING_TOPOLOGY && suf.getType() == SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES && remotePorts.size() > 0) && !remotePorts.isEmpty()) { final AuthenticationData authData = userInstallData.getReplicationOptions().getAuthenticationData(); final String serverToConnectDisplay = authData == null ? "" : authData.getHostName() + ":" + authData.getPort(); @@ -526,28 +526,14 @@ { gbc.gridwidth = GridBagConstraints.RELATIVE; gbc.weightx = 0.0; if (!isFirst) { gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD; } else { gbc.insets.top = 0; } gbc.insets.top = isFirst ? 0 : UIFactory.TOP_INSET_PRIMARY_FIELD; gbc.insets.left = 0; gbc.anchor = GridBagConstraints.NORTHWEST; panel.add(getLabel(fieldName), gbc); gbc.weightx = 1.0; gbc.fill = GridBagConstraints.HORIZONTAL; if (!isFirst) { gbc.insets.top = UIFactory.TOP_INSET_PRIMARY_FIELD; } else { gbc.insets.top = 0; } gbc.insets.top = isFirst ? 0 : UIFactory.TOP_INSET_PRIMARY_FIELD; gbc.insets.left = UIFactory.LEFT_INSET_PRIMARY_FIELD; gbc.gridwidth = GridBagConstraints.REMAINDER; @@ -697,16 +683,14 @@ .append(formatter.getTaskSeparator()); } sb.append(formatter.getFormattedProgress(INFO_INSTALL_SETUP_EQUIVALENT_COMMAND_LINE.get())) .append(formatter.getLineBreak()) .append(Constants.HTML_BOLD_OPEN) .append(getFormattedEquivalentCommandLine(getSetupEquivalentCommandLine(userData), formatter)) .append(Constants.HTML_BOLD_CLOSE); sb.append(formatter.getFormattedProgress(INFO_INSTALL_SETUP_EQUIVALENT_COMMAND_LINE.get())); List<String> setupCmdLine = getSetupEquivalentCommandLine(userData); appendText(sb, formatter, getFormattedEquivalentCommandLine(setupCmdLine, formatter)); if (userData.getReplicationOptions().getType() == DataReplicationOptions.Type.IN_EXISTING_TOPOLOGY) { sb.append(formatter.getTaskSeparator()); final List<List<String>> cmdLines = getDsReplicationEnableEquivalentCommandLines(userData); final List<List<String>> cmdLines = getDsReplicationEquivalentCommandLines("enable", userData); if (cmdLines.size() == 1) { sb.append(formatter.getFormattedProgress(INFO_INSTALL_ENABLE_REPLICATION_EQUIVALENT_COMMAND_LINE.get())); @@ -718,15 +702,11 @@ for (final List<String> cmdLine : cmdLines) { sb.append(formatter.getLineBreak()) .append(Constants.HTML_BOLD_OPEN) .append(getFormattedEquivalentCommandLine(cmdLine, formatter)) .append(Constants.HTML_BOLD_CLOSE); appendText(sb, formatter, getFormattedEquivalentCommandLine(cmdLine, formatter)); } sb.append(formatter.getLineBreak()); sb.append(formatter.getLineBreak()); final List<List<String>> dsReplicationCmdLines = getDsReplicationInitializeEquivalentCommandLines(userData); if (cmdLines.size() == 1) { @@ -737,12 +717,10 @@ sb.append(formatter.getFormattedProgress(INFO_INSTALL_INITIALIZE_REPLICATION_EQUIVALENT_COMMAND_LINES.get())); } final List<List<String>> dsReplicationCmdLines = getDsReplicationEquivalentCommandLines("initialize", userData); for (final List<String> cmdLine : dsReplicationCmdLines) { sb.append(formatter.getLineBreak()) .append(Constants.HTML_BOLD_OPEN) .append(Utils.getFormattedEquivalentCommandLine(cmdLine, formatter)) .append(Constants.HTML_BOLD_CLOSE); appendText(sb, formatter, getFormattedEquivalentCommandLine(cmdLine, formatter)); } } else if (userData.getReplicationOptions().getType() == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY) @@ -751,10 +729,7 @@ .append(formatter.getFormattedProgress(INFO_INSTALL_ENABLE_REPLICATION_EQUIVALENT_COMMAND_LINES.get())); for (final List<String> cmdLine : getDsConfigReplicationEnableEquivalentCommandLines(userData)) { sb.append(formatter.getLineBreak()) .append(Constants.HTML_BOLD_OPEN) .append(Utils.getFormattedEquivalentCommandLine(cmdLine, formatter)) .append(Constants.HTML_BOLD_CLOSE); appendText(sb, formatter, getFormattedEquivalentCommandLine(cmdLine, formatter)); } } @@ -762,17 +737,22 @@ && !userData.getStartServer()) { sb.append(formatter.getTaskSeparator()); sb.append(formatter.getFormattedProgress(INFO_INSTALL_STOP_SERVER_EQUIVALENT_COMMAND_LINE.get())); final String cmd = getPath(Installation.getLocal().getServerStopCommandFile()); sb.append(formatter.getFormattedProgress(INFO_INSTALL_STOP_SERVER_EQUIVALENT_COMMAND_LINE.get())) .append(formatter.getLineBreak()) .append(Constants.HTML_BOLD_OPEN) .append(formatter.getFormattedProgress(LocalizableMessage.raw(cmd))) .append(Constants.HTML_BOLD_CLOSE); appendText(sb, formatter, formatter.getFormattedProgress(LocalizableMessage.raw(cmd))); } equivalentCommandPane.setText(sb.toString()); } private void appendText(final StringBuilder sb, final HtmlProgressMessageFormatter formatter, CharSequence text) { sb.append(formatter.getLineBreak()) .append(Constants.HTML_BOLD_OPEN) .append(text) .append(Constants.HTML_BOLD_CLOSE); } private String getEquivalentJavaPropertiesProcedure(final UserData userData, final ProgressMessageFormatter formatter) { opendj-sdk/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
@@ -1185,18 +1185,9 @@ } catch (Throwable t) { String setupFile; if (isWindows()) { setupFile = Installation.WINDOWS_SETUP_FILE_NAME; } else { setupFile = Installation.UNIX_SETUP_FILE_NAME; } throw new IncompatibleVersionException( INFO_DOWNLOADING_ERROR_NO_SERVICE_FOUND.get( JNLP_SERVICE_NAME, setupFile), JNLP_SERVICE_NAME, getSetupFilename()), t); } } @@ -1637,8 +1628,7 @@ public static List<String> getSetupEquivalentCommandLine(final UserData userData) { List<String> cmdLine = new ArrayList<String>(); final String setupFile = isWindows() ? Installation.WINDOWS_SETUP_FILE_NAME : Installation.UNIX_SETUP_FILE_NAME; cmdLine.add(getInstallDir(userData) + setupFile); cmdLine.add(getInstallDir(userData) + getSetupFilename()); cmdLine.add("--cli"); for (final String baseDN : getBaseDNs(userData)) @@ -1731,6 +1721,11 @@ return cmdLine; } private static String getSetupFilename() { return isWindows() ? Installation.WINDOWS_SETUP_FILE_NAME : Installation.UNIX_SETUP_FILE_NAME; } private static List<String> getSecurityOptionSetupEquivalentCmdLine(final UserData userData) { final List<String> cmdLine = new ArrayList<String>(); @@ -1817,55 +1812,29 @@ } /** * Returns the list of equivalent command-lines that must be executed to * enable replication as the setup does. * Returns the list of equivalent command-lines that must be executed to enable or initialize * replication as the setup does. * * @param subcommand * either {@code "enable"} or {@code "initialize"} * @param userData * the user data. * @return the list of equivalent command-lines that must be executed to * enable replication as the setup does. * @return the list of equivalent command-lines that must be executed to enable or initialize * replication as the setup does. */ public static List<List<String>> getDsReplicationEnableEquivalentCommandLines(final UserData userData) public static List<List<String>> getDsReplicationEquivalentCommandLines(String subcommand, UserData userData) { final List<List<String>> cmdLines = new ArrayList<List<String>>(); final Map<ServerDescriptor, Set<String>> hmServerBaseDNs = getServerDescriptorBaseDNMap(userData); for (ServerDescriptor server : hmServerBaseDNs.keySet()) { cmdLines.add(getDsReplicationEnableEquivalentCommandLine(userData, hmServerBaseDNs.get(server), server)); cmdLines.add(getDsReplicationEquivalentCommandLine(subcommand, userData, hmServerBaseDNs.get(server), server)); } return cmdLines; } /** * Returns the list of equivalent command-lines that must be executed to * initialize replication as the setup does. * * @param userData * the user data. * @return the list of equivalent command-lines that must be executed to * initialize replication as the setup does. */ public static List<List<String>> getDsReplicationInitializeEquivalentCommandLines(UserData userData) private static void addEnableCommandOptions(UserData userData, ServerDescriptor server, ArrayList<String> cmdLine) { final List<List<String>> cmdLines = new ArrayList<List<String>>(); final Map<ServerDescriptor, Set<String>> hmServerBaseDNs = getServerDescriptorBaseDNMap(userData); for (ServerDescriptor server : hmServerBaseDNs.keySet()) { cmdLines.add(getDsReplicationInitializeEquivalentCommandLine(userData, hmServerBaseDNs.get(server), server)); } return cmdLines; } private static ArrayList<String> getDsReplicationEnableEquivalentCommandLine( UserData userData, Set<String> baseDNs, ServerDescriptor server) { ArrayList<String> cmdLine = new ArrayList<String>(); String cmdName = getCommandLinePath(userData, "dsreplication"); cmdLine.add(cmdName); cmdLine.add("enable"); DataReplicationOptions replOptions = userData.getReplicationOptions(); cmdLine.add("--host1"); cmdLine.add(server.getHostName()); @@ -1910,29 +1879,12 @@ if (replOptions.getReplicationPort() != -1) { cmdLine.add("--replicationPort2"); cmdLine.add( String.valueOf(replOptions.getReplicationPort())); cmdLine.add(String.valueOf(replOptions.getReplicationPort())); if (replOptions.useSecureReplication()) { cmdLine.add("--secureReplication2"); } } for (String baseDN : baseDNs) { cmdLine.add("--baseDN"); cmdLine.add(baseDN); } cmdLine.add("--adminUID"); cmdLine.add(userData.getGlobalAdministratorUID()); cmdLine.add("--adminPassword"); cmdLine.add(OBFUSCATED_VALUE); cmdLine.add("--trustAll"); cmdLine.add("--no-prompt"); cmdLine.add("--noPropertiesFile"); return cmdLine; } /** @@ -1997,15 +1949,33 @@ return installDir; } private static ArrayList<String> getDsReplicationInitializeEquivalentCommandLine( UserData userData, Set<String> baseDNs, ServerDescriptor server) private static ArrayList<String> getDsReplicationEquivalentCommandLine( String subcommand, UserData userData, Set<String> baseDNs, ServerDescriptor server) { ArrayList<String> cmdLine = new ArrayList<String>(); String cmdName = getCommandLinePath(userData, "dsreplication"); cmdLine.add(cmdName); cmdLine.add("initialize"); cmdLine.add(subcommand); if ("enable".equals(subcommand)) { addEnableCommandOptions(userData, server, cmdLine); } else if ("initialize".equals(subcommand)) { addInitializeCommandOptions(userData, server, cmdLine); } else { throw new IllegalArgumentException("Code is not implemented for subcommand " + subcommand); } addCommonOptions(userData, baseDNs, cmdLine); return cmdLine; } private static void addInitializeCommandOptions(UserData userData, ServerDescriptor server, ArrayList<String> cmdLine) { cmdLine.add("--hostSource"); cmdLine.add(server.getHostName()); cmdLine.add("--portSource"); @@ -2015,7 +1985,10 @@ cmdLine.add(userData.getHostName()); cmdLine.add("--portDestination"); cmdLine.add(String.valueOf(userData.getAdminConnectorPort())); } private static void addCommonOptions(UserData userData, Set<String> baseDNs, ArrayList<String> cmdLine) { for (String baseDN : baseDNs) { cmdLine.add("--baseDN"); @@ -2030,7 +2003,6 @@ cmdLine.add("--trustAll"); cmdLine.add("--no-prompt"); cmdLine.add("--noPropertiesFile"); return cmdLine; } private static ArrayList<String> getBaseDNs(UserData userData) opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/BackendToolUtils.java
@@ -26,28 +26,27 @@ */ package org.opends.server.tools; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.opends.server.api.Backend; import org.opends.server.config.ConfigEntry; import org.forgerock.opendj.config.server.ConfigException; import org.opends.server.config.StringConfigAttribute; import org.opends.server.config.DNConfigAttribute; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import org.opends.server.core.DirectoryServer; import static org.opends.server.config.ConfigConstants.*; import static org.opends.messages.ToolMessages.*; import static org.opends.messages.ConfigMessages.*; import static org.opends.server.util.StaticUtils.*; import org.opends.server.admin.std.server.BackendCfg; import org.opends.server.admin.std.server.RootCfg; import org.opends.server.admin.server.ServerManagementContext; import java.util.ArrayList; import java.util.List; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.config.server.ConfigException; import org.opends.server.admin.server.ServerManagementContext; import org.opends.server.admin.std.server.BackendCfg; import org.opends.server.admin.std.server.RootCfg; import org.opends.server.api.Backend; import org.opends.server.config.ConfigEntry; import org.opends.server.config.DNConfigAttribute; import org.opends.server.config.StringConfigAttribute; import org.opends.server.core.DirectoryServer; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import static org.opends.messages.ConfigMessages.*; import static org.opends.messages.ToolMessages.*; import static org.opends.server.config.ConfigConstants.*; import static org.opends.server.util.StaticUtils.*; /** * This class provides utility functions for all JE related client tools. */ @@ -88,13 +87,8 @@ for (final ConfigEntry configEntry : baseEntry.getChildren().values()) { final String backendID = getBackendID(configEntry); if (backendID == null) { continue; } final String backendClassName = getBackendClassName(configEntry); if (backendClassName == null) if (backendID == null || backendClassName == null) { continue; } @@ -137,22 +131,18 @@ final DNConfigAttribute baseDNStub = new DNConfigAttribute( ATTR_BACKEND_BASE_DN, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(), true, true, true); final DNConfigAttribute baseDNAttr = (DNConfigAttribute) configEntry.getConfigAttribute(baseDNStub); if (baseDNAttr == null) { logger.error(ERR_NO_BASES_FOR_BACKEND, configEntry.getDN()); } else if (baseDNAttr != null) { return baseDNAttr.activeValues(); } logger.error(ERR_NO_BASES_FOR_BACKEND, configEntry.getDN()); return null; } catch (final Exception e) { logger.error(ERR_CANNOT_DETERMINE_BASES_FOR_BACKEND, configEntry.getDN(), getExceptionMessage(e)); throw e; } return null; } private static Class<?> getBackendClass(String backendClassName, ConfigEntry configEntry) throws Exception @@ -175,11 +165,6 @@ final StringConfigAttribute classStub = new StringConfigAttribute( ATTR_BACKEND_CLASS, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_CLASS.get(), true, false, false); final StringConfigAttribute classAttr = (StringConfigAttribute) configEntry.getConfigAttribute(classStub); if (classAttr == null) { return null; } return classAttr != null ? classAttr.activeValue() : null; } catch (final org.opends.server.config.ConfigException ce) @@ -201,7 +186,6 @@ final StringConfigAttribute idStub = new StringConfigAttribute( ATTR_BACKEND_ID, INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BACKEND_ID.get(), true, false, true); final StringConfigAttribute idAttr = (StringConfigAttribute) configEntry.getConfigAttribute(idStub); return idAttr != null ? idAttr.activeValue() : null; } catch (final org.opends.server.config.ConfigException ce) opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
@@ -1014,7 +1014,7 @@ nTries++; } uData.setDirectoryManagerPwd(String.valueOf(pwd)); uData.setDirectoryManagerPwd(pwd); } /** @@ -1317,8 +1317,7 @@ final int printableIndex = getPromptedBackendTypeIndex(); builder.setDefault(LocalizableMessage.raw(Integer.toString(printableIndex)), MenuResult.success(printableIndex)); final Menu<Integer> menu = builder.toMenu(); return menu; return builder.toMenu(); } private int getPromptedBackendTypeIndex() @@ -1327,7 +1326,6 @@ { return backendTypeHelper.getBackendTypeNames().indexOf(lastResetBackendType) + 1; } return 1; }