opendj3-server-dev/src/ads/org/opends/admin/ads/TopologyCache.java
@@ -35,9 +35,6 @@ import java.util.Map; import java.util.Set; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import javax.naming.NameNotFoundException; import javax.naming.NamingEnumeration; import javax.naming.NamingException; @@ -46,6 +43,8 @@ import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.LdapName; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.opends.admin.ads.ADSContext.ServerProperty; import org.opends.admin.ads.util.ApplicationTrustManager; import org.opends.admin.ads.util.ConnectionUtils; @@ -53,6 +52,8 @@ import org.opends.admin.ads.util.ServerLoader; import org.opends.quicksetup.util.Utils; import static com.forgerock.opendj.cli.Utils.*; import static org.opends.messages.QuickSetupMessages.*; /** @@ -76,7 +77,7 @@ private final Set<PreferredConnection> preferredConnections = new LinkedHashSet<PreferredConnection>(); private final TopologyCacheFilter filter = new TopologyCacheFilter(); private final static int MULTITHREAD_TIMEOUT = 90 * 1000; private static final int MULTITHREAD_TIMEOUT = 90 * 1000; private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); /** @@ -441,7 +442,7 @@ break; case GENERIC_CREATING_CONNECTION: if (Utils.isCertificateException(e.getCause())) if (isCertificateException(e.getCause())) { exceptionMsgs.add( INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get( @@ -507,7 +508,7 @@ // This is not a replica, but a replication server. Skip it continue; } replicaId = new Integer(sid); replicaId = Integer.valueOf(sid); } catch (Throwable t) { @@ -519,7 +520,7 @@ { if (Utils.areDnsEqual(dn, replica.getSuffix().getDN()) && replica.isReplicated() && (replica.getReplicationId() == replicaId)) && replica.getReplicationId() == replicaId) { // This statistic is optional. String s = ConnectionUtils.getFirstValue(sr, opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
@@ -27,10 +27,6 @@ package org.opends.guitools.controlpanel.ui; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.INFO_CERTIFICATE_EXCEPTION; import static org.opends.messages.QuickSetupMessages.INFO_NOT_AVAILABLE_LABEL; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -51,9 +47,6 @@ import java.util.SortedSet; import java.util.TreeSet; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import javax.naming.NamingException; import javax.naming.ldap.InitialLdapContext; import javax.swing.BorderFactory; @@ -77,6 +70,10 @@ import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.forgerock.opendj.ldap.ByteString; import org.opends.admin.ads.util.ApplicationTrustManager; import org.opends.admin.ads.util.ConnectionUtils; import org.opends.guitools.controlpanel.browser.BrowserController; @@ -97,16 +94,22 @@ import org.opends.guitools.controlpanel.ui.nodes.BasicNode; import org.opends.guitools.controlpanel.ui.renderer.CustomListCellRenderer; import org.opends.guitools.controlpanel.util.Utilities; import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.opendj.ldap.ByteString; import org.opends.quicksetup.UserDataCertificateException; import org.opends.quicksetup.ui.CertificateDialog; import org.opends.quicksetup.util.UIKeyStore; import org.opends.quicksetup.util.Utils; import org.opends.server.protocols.ldap.LDAPFilter; import org.opends.server.types.*; import org.opends.server.types.AttributeType; import org.opends.server.types.DN; import org.opends.server.types.DirectoryException; import org.opends.server.types.LDAPException; import org.opends.server.types.SearchFilter; import org.opends.server.util.ServerConstants; import static com.forgerock.opendj.cli.Utils.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; /** * The abstract class used to refactor some code. The classes that extend this * class are the 'Browse Entries' panel and the panel of the dialog we display @@ -161,9 +164,8 @@ private GenericDialog otherBaseDNDlg; private boolean firstTimeDisplayed = true; private Object lastSelectedBaseDN = null; private boolean ignoreBaseDNEvents = false; private Object lastSelectedBaseDN; private boolean ignoreBaseDNEvents; /** * LDAP filter message. @@ -211,36 +213,28 @@ createLayout(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean requiresBorder() { return false; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean requiresScroll() { return false; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean callConfigurationChangedInBackground() { return true; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setInfo(ControlPanelInfo info) { @@ -253,9 +247,7 @@ info.addBackendPopulatedListener(this); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public final GenericDialog.ButtonType getButtonType() { @@ -271,9 +263,7 @@ */ protected abstract GenericDialog.ButtonType getBrowseButtonType(); /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void toBeDisplayed(boolean visible) { @@ -289,18 +279,14 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override protected void setEnabledOK(boolean enable) { okButton.setEnabled(enable); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override protected void setEnabledCancel(boolean enable) { @@ -351,6 +337,7 @@ baseDNs.setRenderer(new CustomComboBoxCellRenderer(baseDNs)); baseDNs.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent ev) { if (ignoreBaseDNEvents || (ev.getStateChange() != ItemEvent.SELECTED)) @@ -522,6 +509,7 @@ }); filter.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { filter.displayRefreshIcon(true); @@ -542,6 +530,7 @@ add(applyButton, gbc); applyButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { applyButtonClicked(); @@ -602,6 +591,7 @@ buttonsPanel.add(closeButton, gbc); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { closeClicked(); @@ -615,6 +605,7 @@ buttonsPanel.add(okButton, gbc); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { okClicked(); @@ -629,6 +620,7 @@ buttonsPanel.add(okButton, gbc); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { okClicked(); @@ -643,6 +635,7 @@ buttonsPanel.add(cancelButton, gbc); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { cancelClicked(); @@ -657,17 +650,14 @@ return buttonsPanel; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public Component getPreferredFocusComponent() { return baseDNs; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void cancelClicked() { @@ -692,7 +682,7 @@ DN theDN = null; if (s != null) { displayAll = s.equals(ALL_BASE_DNS); displayAll = ALL_BASE_DNS.equals(s); if (!displayAll) { try @@ -738,11 +728,7 @@ { for (BaseDNDescriptor baseDN : backend.getBaseDns()) { boolean isBaseDN = false; if ((theDN != null) && baseDN.getDn().equals(theDN)) { isBaseDN = true; } boolean isBaseDN = baseDN.getDn().equals(theDN); String dn = Utilities.unescapeUtf8(baseDN.getDn().toString()); if (displayAll) { @@ -837,7 +823,7 @@ } else if (USER_FILTER.equals(attr)) { if (s.equals("*")) if ("*".equals(s)) { returnValue = "(objectClass=person)"; } @@ -849,7 +835,7 @@ } else if (GROUP_FILTER.equals(attr)) { if (s.equals("*")) if ("*".equals(s)) { returnValue = "(|(objectClass=groupOfUniqueNames)(objectClass=groupOfURLs))"; @@ -898,9 +884,8 @@ protected abstract Component createMainPanel(); /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void backendPopulated(BackendPopulatedEvent ev) { if (controller.getConfigurationConnection() != null) @@ -911,7 +896,7 @@ String s = getBaseDN(); if (s != null) { displayAll = s.equals(ALL_BASE_DNS); displayAll = ALL_BASE_DNS.equals(s); if (!displayAll) { try @@ -940,11 +925,11 @@ for (BaseDNDescriptor baseDN : backend.getBaseDns()) { boolean isBaseDN = false; if ((theDN != null) && baseDN.getDn().equals(theDN)) if (baseDN.getDn().equals(theDN)) { isBaseDN = true; } else if ((theDN != null) && baseDN.getDn().isAncestorOf(theDN)) else if (baseDN.getDn().isAncestorOf(theDN)) { isSubordinate = true; } @@ -983,20 +968,16 @@ } } } if (isSubordinate) { if (controller.findChildNode(rootNode, s) == -1) if (isSubordinate && controller.findChildNode(rootNode, s) == -1) { controller.addNodeUnderRoot(s); } } } } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void configurationChanged(ConfigurationChangeEvent ev) { final ServerDescriptor desc = ev.getNewDescriptor(); @@ -1042,7 +1023,7 @@ Utilities.setBorder(lNoMatchFound, new EmptyBorder(15, 15, 15, 15)); p.add(lNoMatchFound, gbc); if ((getInfo() != null) && (controller == null)) if (getInfo() != null && controller == null) { createBrowserController(getInfo()); } @@ -1068,9 +1049,8 @@ controller.setMaxChildren(MAX_NUMBER_ENTRIES); controller.addBrowserEventListener(new BrowserEventListener() { /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void processBrowserEvent(BrowserEvent ev) { if (ev.getType() == BrowserEvent.Type.SIZE_LIMIT_REACHED) @@ -1082,29 +1062,25 @@ }); controller.getTreeModel().addTreeModelListener(new TreeModelListener() { /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void treeNodesChanged(TreeModelEvent e) { } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void treeNodesInserted(TreeModelEvent e) { checkRootNode(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void treeNodesRemoved(TreeModelEvent e) { checkRootNode(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void treeStructureChanged(TreeModelEvent e) { checkRootNode(); @@ -1112,7 +1088,7 @@ }); } final static String[] systemIndexes = {"aci", "dn2id", "ds-sync-hist", static final String[] systemIndexes = {"aci", "dn2id", "ds-sync-hist", "entryUUID", "id2children", "id2subtree"}; private static boolean displayIndex(String name) { @@ -1166,9 +1142,8 @@ { SwingUtilities.invokeLater(new Runnable() { /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void run() { Object selected = filterAttribute.getSelectedItem(); @@ -1235,7 +1210,7 @@ } } hmBaseDNs.put(backendID, someBaseDNs); if (backendID.equalsIgnoreCase("userRoot")) if ("userRoot".equalsIgnoreCase(backendID)) { for (String baseDN : someBaseDNs) { @@ -1285,23 +1260,22 @@ baseDNNewElements.add(COMBO_SEPARATOR); baseDNNewElements.add(OTHER_BASE_DN); } if (firstTimeDisplayed && (baseDNWithEntries != null)) if (firstTimeDisplayed && baseDNWithEntries != null) { ignoreBaseDNEvents = true; } updateComboBoxModel(baseDNNewElements, (DefaultComboBoxModel)baseDNs.getModel()); // Select the element in the combo box. if (firstTimeDisplayed && (baseDNWithEntries != null)) if (firstTimeDisplayed && baseDNWithEntries != null) { final Object toSelect = new CategorizedComboBoxElement( Utilities.unescapeUtf8(baseDNWithEntries.getDn().toString()), CategorizedComboBoxElement.Type.REGULAR); SwingUtilities.invokeLater(new Runnable() { /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void run() { // After this updateBrowseController is called. @@ -1339,7 +1313,7 @@ LocalizableMessageBuilder mb = new LocalizableMessageBuilder(); mb.append( INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_TO_BROWSE_SUMMARY.get()); mb.append("<br><br>"+getAuthenticateHTML()); mb.append("<br><br>").append(getAuthenticateHTML()); errorDetails = mb.toMessage(); errorTitle = INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_SUMMARY.get(); @@ -1365,9 +1339,8 @@ final NamingException[] fNe = {null}; Runnable runnable = new Runnable() { /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void run() { try @@ -1424,7 +1397,7 @@ LocalizableMessageBuilder mb = new LocalizableMessageBuilder(); mb.append(INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get( desc.getHostname())); mb.append("<br><br>"+getAuthenticateHTML()); mb.append("<br><br>").append(getAuthenticateHTML()); errorDetails = mb.toMessage(); errorTitle = INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_SUMMARY.get(); displayErrorPane = true; @@ -1447,9 +1420,8 @@ final LocalizableMessage fErrorDetails = errorDetails; SwingUtilities.invokeLater(new Runnable() { /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void run() { applyButton.setEnabled(!fDisplayErrorPane); @@ -1562,19 +1534,10 @@ { dn = null; } if (dn != null) { if (dn.trim().length() == 0) if (dn != null && dn.trim().length() == 0) { dn = ALL_BASE_DNS; } // The following is never true. OTHER_BASE_DN is a LocalizableMessage // Comment out buggy code // else if (OTHER_BASE_DN.equals(dn)) // { // dn = null; // } } return dn; } @@ -1600,7 +1563,7 @@ } catch (NamingException ne) { if (Utils.isCertificateException(ne)) if (isCertificateException(ne)) { ApplicationTrustManager.Cause cause = getInfo().getTrustManager().getLastRefusedCause(); @@ -1654,6 +1617,7 @@ { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { try @@ -1717,7 +1681,7 @@ String authType = ce.getAuthType(); String host = ce.getHost(); if ((chain != null) && (authType != null) && (host != null)) if (chain != null && authType != null && host != null) { logger.info(LocalizableMessage.raw("Accepting certificate presented by host "+host)); getInfo().getTrustManager().acceptCertificate(chain, authType, host); @@ -1780,9 +1744,7 @@ super(combo); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) @@ -1916,6 +1878,7 @@ recalculate = false; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { int nEntries = 0; @@ -1942,6 +1905,7 @@ { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { filter.displayRefreshIcon(mustDisplayRefreshIcon); opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/ErrorSearchingEntryPanel.java
@@ -27,8 +27,6 @@ package org.opends.guitools.controlpanel.ui; import static org.opends.messages.AdminToolMessages.*; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.Insets; @@ -36,27 +34,27 @@ import javax.naming.NameNotFoundException; import javax.naming.NamingException; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; import org.opends.guitools.controlpanel.browser.BasicNodeError; import org.opends.guitools.controlpanel.browser.ReferralLimitExceededException; import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; import org.opends.quicksetup.util.Utils; import org.opends.server.types.LDAPURL; import org.opends.server.types.OpenDsException; import static com.forgerock.opendj.cli.Utils.*; import static org.opends.messages.AdminToolMessages.*; /** * The panel that is displayed when there is an error searching an entry. * */ public class ErrorSearchingEntryPanel extends StatusGenericPanel { private static final long serialVersionUID = -8460172599072631973L; /** * Default constructor. * */ /** Default constructor. */ public ErrorSearchingEntryPanel() { super(); @@ -74,35 +72,30 @@ errorPane.setVisible(true); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public Component getPreferredFocusComponent() { return errorPane; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void okClicked() { } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getTitle() { return INFO_CTRL_PANEL_ERROR_SEARCHING_ENTRY_TITLE.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void configurationChanged(ConfigurationChangeEvent ev) { } /** @@ -145,7 +138,7 @@ { sb.append("<br>"); } sb.append(" "+ref); sb.append(" ").append(ref); } details.append(INFO_CTRL_PANEL_ERROR_RESOLVING_REFERRAL_MSG.get(dn, sb)); Exception ex = error.getException(); @@ -172,12 +165,10 @@ } else { msg = Utils.getMessageForException((NamingException)ex, hostPort); msg = getMessageForException((NamingException) ex, hostPort); } } else { if (ex instanceof ReferralLimitExceededException) else if (ex instanceof ReferralLimitExceededException) { msg = LocalizableMessage.raw(ex.getLocalizedMessage()); } @@ -190,7 +181,6 @@ msg = Utils.getMessageForException((NamingException)ex); } } } catch (Throwable t) { } @@ -209,12 +199,11 @@ } if (arg != null) { details.append("<br><br>"+ ERR_CTRL_PANEL_RESOLVING_REFERRAL_DETAILS.get(arg, msg)); details.append("<br><br>").append(ERR_CTRL_PANEL_RESOLVING_REFERRAL_DETAILS.get(arg, msg)); } else { details.append("<br><br>"+INFO_CTRL_PANEL_DETAILS_THROWABLE.get(msg)); details.append("<br><br>").append(INFO_CTRL_PANEL_DETAILS_THROWABLE.get(msg)); } } else if (ex != null) @@ -224,9 +213,9 @@ { msg = ex.toString(); } details.append("<br><br>"+INFO_CTRL_PANEL_DETAILS_THROWABLE.get(msg)); details.append("<br><br>").append(INFO_CTRL_PANEL_DETAILS_THROWABLE.get(msg)); } details.append("<br><br>"+INFO_CTRL_PANEL_HOW_TO_EDIT_REFERRALS.get()); details.append("<br><br>").append(INFO_CTRL_PANEL_HOW_TO_EDIT_REFERRALS.get()); updateErrorPane(errorPane, title, ColorAndFontConstants.errorTitleFont, details.toMessage(), ColorAndFontConstants.defaultFont); } opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
@@ -27,11 +27,6 @@ package org.opends.guitools.controlpanel.ui; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; import static com.forgerock.opendj.cli.Utils.isDN; import static com.forgerock.opendj.cli.Utils.getThrowableMsg; import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.event.ActionEvent; @@ -82,9 +77,13 @@ import org.opends.server.util.DynamicConstants; import org.opends.server.util.StaticUtils; import static com.forgerock.opendj.cli.Utils.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; /** * The panel that appears when the user is asked to provide authentication. * */ public class LocalOrRemotePanel extends StatusGenericPanel { @@ -120,18 +119,14 @@ createLayout(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getTitle() { return INFO_CTRL_PANEL_LOCAL_OR_REMOTE_PANEL_TITLE.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public GenericDialog.ButtonType getButtonType() { @@ -153,16 +148,14 @@ */ public int getPort() { int port = -1; try { port = new Integer(this.port.getText().trim()); return Integer.valueOf(this.port.getText().trim()); } catch (Exception ex) catch (Exception ignored) { // Ignore return -1; } return port; } /** @@ -407,9 +400,7 @@ addBottomGlue(gbc); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public Component getPreferredFocusComponent() { @@ -417,23 +408,16 @@ { return pwd; } else { return combo; } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void configurationChanged(ConfigurationChangeEvent ev) { } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void toBeDisplayed(boolean visible) { @@ -485,9 +469,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void okClicked() { @@ -540,7 +522,7 @@ try { int p = Integer.parseInt(port.getText()); if ((p <= 0) || (p > 65535)) if (p <= 0 || p > 65535) { errors.add(INFO_INVALID_REMOTE_SERVER_PORT.get(0, 65535)); } @@ -560,9 +542,7 @@ BackgroundTask<InitialLdapContext> worker = new BackgroundTask<InitialLdapContext>() { /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public InitialLdapContext processBackgroundTask() throws Throwable { @@ -639,15 +619,12 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void backgroundTaskCompleted(InitialLdapContext ctx, Throwable throwable) { boolean handleCertificateException = false; boolean localServerErrorConnecting = false; if (throwable != null) @@ -658,7 +635,7 @@ { errors.add(((OpenDsException)throwable).getMessageObject()); } else if (Utils.isCertificateException(throwable)) else if (isCertificateException(throwable)) { ApplicationTrustManager.Cause cause = getInfo().getTrustManager().getLastRefusedCause(); @@ -739,7 +716,7 @@ hostName.getText().trim(), new Integer(port.getText().trim())); NamingException ne = (NamingException)throwable; errors.add(Utils.getMessageForException(ne, hostPort)); errors.add(getMessageForException(ne, hostPort)); setPrimaryInvalid(portLabel); } setPrimaryInvalid(dnLabel); @@ -820,9 +797,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void cancelClicked() { @@ -852,7 +827,7 @@ String authType = ce.getAuthType(); String host = ce.getHost(); if ((chain != null) && (authType != null) && (host != null)) if (chain != null && authType != null && host != null) { logger.info(LocalizableMessage.raw("Accepting certificate presented by host "+host)); getInfo().getTrustManager().acceptCertificate(chain, authType, host); @@ -997,18 +972,15 @@ msg = ERR_NOT_SAME_PRODUCT_IN_REMOTE_SERVER_NOT_FOUND.get(hostName, productName, DynamicConstants.PRODUCT_NAME); } else { if (!String.valueOf(DynamicConstants.MAJOR_VERSION).equals(major) || !String.valueOf(DynamicConstants.MINOR_VERSION).equals(minor) || !String.valueOf(DynamicConstants.POINT_VERSION).equals(point)) else if (!String.valueOf(DynamicConstants.MAJOR_VERSION).equals(major) || !String.valueOf(DynamicConstants.MINOR_VERSION).equals(minor) || !String.valueOf(DynamicConstants.POINT_VERSION).equals(point)) { msg = ERR_INCOMPATIBLE_VERSION_IN_REMOTE_SERVER.get(hostName, major, minor, point, DynamicConstants.MAJOR_VERSION, DynamicConstants.MINOR_VERSION, DynamicConstants.POINT_VERSION); } } } catch (Throwable t) { msg = ERR_VERSION_IN_REMOTE_SERVER_NOT_FOUND.get(); opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LoginPanel.java
@@ -27,11 +27,6 @@ package org.opends.guitools.controlpanel.ui; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; import static com.forgerock.opendj.cli.Utils.isDN; import static com.forgerock.opendj.cli.Utils.getThrowableMsg; import java.awt.Component; import java.awt.GridBagConstraints; import java.net.URI; @@ -60,9 +55,13 @@ import org.opends.server.types.DN; import org.opends.server.util.StaticUtils; import static com.forgerock.opendj.cli.Utils.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; /** * The panel that appears when the user is asked to provide authentication. * */ public class LoginPanel extends StatusGenericPanel { @@ -85,9 +84,7 @@ createLayout(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getTitle() { @@ -136,26 +133,20 @@ addBottomGlue(gbc); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public Component getPreferredFocusComponent() { return pwd; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void configurationChanged(ConfigurationChangeEvent ev) { } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void toBeDisplayed(boolean visible) { @@ -166,9 +157,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void okClicked() { @@ -214,9 +203,7 @@ BackgroundTask<InitialLdapContext> worker = new BackgroundTask<InitialLdapContext>() { /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public InitialLdapContext processBackgroundTask() throws Throwable { @@ -274,9 +261,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void backgroundTaskCompleted(InitialLdapContext ctx, Throwable throwable) @@ -286,7 +271,7 @@ { logger.info(LocalizableMessage.raw("Error connecting: " + throwable, throwable)); if (Utils.isCertificateException(throwable)) if (isCertificateException(throwable)) { ApplicationTrustManager.Cause cause = getInfo().getTrustManager().getLastRefusedCause(); @@ -409,9 +394,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void cancelClicked() { @@ -440,7 +423,7 @@ String authType = ce.getAuthType(); String host = ce.getHost(); if ((chain != null) && (authType != null) && (host != null)) if (chain != null && authType != null && host != null) { logger.info(LocalizableMessage.raw("Accepting certificate presented by host "+host)); getInfo().getTrustManager().acceptCertificate(chain, authType, host); opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -26,14 +26,6 @@ */ package org.opends.guitools.uninstaller; import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_LONG_BINDPWD; import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_LONG_BINDPWD_FILE; import static com.forgerock.opendj.cli.Utils.CONFIRMATION_MAX_TRIES; import static com.forgerock.opendj.cli.Utils.getThrowableMsg; import static org.forgerock.util.Utils.joinAsString; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -85,6 +77,13 @@ import com.forgerock.opendj.cli.MenuResult; import com.forgerock.opendj.cli.ReturnCode; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.Utils.*; import static org.forgerock.util.Utils.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; /** * The class used to provide some CLI interface in the uninstall. * @@ -100,15 +99,12 @@ private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); private UninstallerArgumentParser parser; private boolean forceNonInteractive; private LDAPConnectionConsoleInteraction ci = null; private LDAPConnectionConsoleInteraction ci; private ControlPanelInfo info; private boolean forceNonInteractive; private boolean useSSL = true; private boolean useStartTLS = false; private boolean useStartTLS; /** * Default constructor. @@ -220,9 +216,7 @@ userData.setExternalDbsToRemove(outsideDbs); userData.setExternalLogsToRemove(outsideLogs); } else { if (!isInteractive) else if (!isInteractive) { throw new UserDataException(null, ERR_CLI_UNINSTALL_NOTHING_TO_BE_UNINSTALLED_NON_INTERACTIVE.get()); @@ -231,7 +225,6 @@ { isCanceled = askWhatToDelete(userData, outsideDbs, outsideLogs); } } String adminUid = args.getAdministratorUID(); if (adminUid == null && !args.isInteractive()) { @@ -560,9 +553,9 @@ { try { println(); if (confirmToUpdateRemote()) { println(); cancelled = !askForAuthenticationIfNeeded(userData); if (cancelled) { @@ -583,7 +576,6 @@ } else { println(); /* Ask for confirmation to stop server */ cancelled = !confirmToStopServer(); } @@ -602,9 +594,7 @@ errorWithRemote)); } } else { if (interactive) else if (interactive) { println(); try @@ -672,7 +662,6 @@ userData.setStopServer(false); } } } if (!cancelled || parser.isForceOnError()) { /* During all the confirmations, the server might be stopped. */ @@ -682,9 +671,7 @@ userData.getStopServer())); } } else { if (conf.isServerRunning()) else if (conf.isServerRunning()) { try { @@ -726,7 +713,6 @@ } } } } logger.info(LocalizableMessage.raw("cancelled: "+cancelled)); return cancelled; } @@ -1245,17 +1231,15 @@ catch (NamingException ne) { logger.warn(LocalizableMessage.raw("Error connecting to server: "+ne, ne)); if (Utils.isCertificateException(ne)) if (isCertificateException(ne)) { String details = ne.getMessage() != null ? ne.getMessage() : ne.toString(); exceptionMsg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE.get(details); exceptionMsg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE.get(details); } else { exceptionMsg = getThrowableMsg( INFO_ERROR_CONNECTING_TO_LOCAL.get(), ne); exceptionMsg = getThrowableMsg(INFO_ERROR_CONNECTING_TO_LOCAL.get(), ne); } } catch (TopologyCacheException te) { @@ -1376,8 +1360,7 @@ stopProcessing = true; break; case GENERIC_CREATING_CONNECTION: if (e.getCause() != null && Utils.isCertificateException(e.getCause())) if (isCertificateException(e.getCause())) { if (isInteractive()) { @@ -1479,11 +1462,7 @@ /** {@inheritDoc} */ @Override public boolean isInteractive() { if (forceNonInteractive) { return false; } return parser.isInteractive(); return !forceNonInteractive && parser.isInteractive(); } opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -24,9 +24,23 @@ * Copyright 2006-2010 Sun Microsystems, Inc. * Portions Copyright 2014 ForgeRock AS */ package org.opends.guitools.uninstaller; import java.awt.event.WindowEvent; import java.io.File; import java.io.FileFilter; import java.io.PrintStream; import java.net.InetAddress; import java.net.URI; import java.security.cert.X509Certificate; import java.util.*; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.ldap.InitialLdapContext; import javax.swing.JFrame; import javax.swing.SwingUtilities; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.i18n.slf4j.LocalizedLogger; @@ -55,38 +69,25 @@ import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor; import org.opends.server.admin.client.ldap.LDAPManagementContext; import org.opends.server.admin.std.client.ReplicationDomainCfgClient; import org.opends.server.admin.std.client.ReplicationSynchronizationProviderCfgClient; import org.opends.server.admin.std.client.ReplicationServerCfgClient; import org.opends.server.admin.std.client.ReplicationSynchronizationProviderCfgClient; import org.opends.server.admin.std.client.RootCfgClient; import org.opends.server.core.DirectoryServer; import org.opends.server.tools.ConfigureWindowsService; import org.opends.server.util.DynamicConstants; import org.opends.server.util.StaticUtils; import com.forgerock.opendj.cli.ClientException; import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.util.OperatingSystem.*; import static org.forgerock.util.Utils.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; import static org.opends.quicksetup.Step.*; 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; import java.io.*; import java.net.InetAddress; import java.net.URI; import java.security.cert.X509Certificate; import java.util.*; import java.awt.event.WindowEvent; import javax.naming.Context; import javax.naming.NamingException; import javax.naming.ldap.InitialLdapContext; import javax.swing.JFrame; import javax.swing.SwingUtilities; import static org.opends.server.tools.ConfigureWindowsService.*; /** * This class is in charge of performing the uninstallation of Open DS. @@ -153,20 +154,14 @@ logger.info(LocalizableMessage.raw("Uninstaller is created.")); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getFrameTitle() { LocalizableMessage title = Utils.getCustomizedObject("INFO_FRAME_UNINSTALL_TITLE", INFO_FRAME_UNINSTALL_TITLE.get( DynamicConstants.PRODUCT_NAME), LocalizableMessage.class); return title; LocalizableMessage defaultVal = INFO_FRAME_UNINSTALL_TITLE.get(DynamicConstants.PRODUCT_NAME); return Utils.getCustomizedObject("INFO_FRAME_UNINSTALL_TITLE", defaultVal, LocalizableMessage.class); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public UserData createUserData() { UninstallUserData data = new UninstallUserData(); @@ -174,17 +169,13 @@ return data; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public WizardStep getFirstWizardStep() { return Step.CONFIRM_UNINSTALL; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public WizardStep getNextWizardStep(WizardStep step) { Step nextStep = null; @@ -198,9 +189,7 @@ return nextStep; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public WizardStep getPreviousWizardStep(WizardStep step) { Step prevStep = null; @@ -214,73 +203,60 @@ return prevStep; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public WizardStep getFinishedStep() { return Step.FINISHED; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean finishOnLeft() { return false; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean canGoBack(WizardStep step) { return false; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean canGoForward(WizardStep step) { return false; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean canFinish(WizardStep step) { return step == Step.CONFIRM_UNINSTALL; } /** * {@inheritDoc} * Whether the provided wizard step allow to quit. * * @param step the wizard step * @return true if the provided wizard step allow to quit, false otherwise */ public boolean canQuit(WizardStep step) { return step == Step.CONFIRM_UNINSTALL; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void nextClicked(WizardStep cStep, QuickSetup qs) { if (cStep == PROGRESS) { throw new IllegalStateException( "Cannot click on next from progress step"); throw new IllegalStateException("Cannot click on next from progress step"); } else if (cStep == REVIEW) { throw new IllegalStateException("Cannot click on next from review step"); } else if (cStep == FINISHED) { throw new IllegalStateException( "Cannot click on next from finished step"); throw new IllegalStateException("Cannot click on next from finished step"); } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void closeClicked(WizardStep cStep, QuickSetup qs) { if (cStep == PROGRESS) { @@ -338,8 +314,8 @@ uud.setExternalDbsToRemove(dbs); uud.setExternalLogsToRemove(logs); if ((dbs.size() == 0) && (logs.size() == 0) && if (dbs.size() == 0 && logs.size() == 0 && !uud.getRemoveLibrariesAndTools() && !uud.getRemoveDatabases() && !uud.getRemoveConfigurationAndSchema() && @@ -352,9 +328,7 @@ } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void quitClicked(WizardStep step, QuickSetup qs) { if (step == Step.PROGRESS) { @@ -368,33 +342,25 @@ qs.quit(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getCloseButtonToolTip() { return INFO_CLOSE_BUTTON_UNINSTALL_TOOLTIP.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getFinishButtonToolTip() { return INFO_FINISH_BUTTON_UNINSTALL_TOOLTIP.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getFinishButtonLabel() { return INFO_FINISH_BUTTON_UNINSTALL_LABEL.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void previousClicked(WizardStep cStep, QuickSetup qs) { if (cStep == PROGRESS) { @@ -407,9 +373,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void notifyListeners(Integer ratio, LocalizableMessage currentPhaseSummary, final LocalizableMessage newLogDetail) @@ -438,9 +402,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean finishClicked(final WizardStep cStep, final QuickSetup qs) { if (cStep == Step.CONFIRM_UNINSTALL) { @@ -491,28 +453,20 @@ { askForAuthenticationAndLaunch(qs); } else { if (qs.displayConfirmation( else if (qs.displayConfirmation( INFO_CONFIRM_UNINSTALL_SERVER_RUNNING_MSG.get(), INFO_CONFIRM_UNINSTALL_SERVER_RUNNING_TITLE.get())) { getUserData().setStopServer(true); qs.launch(); qs.setCurrentStep( getNextWizardStep(Step.CONFIRM_UNINSTALL)); qs.setCurrentStep(getNextWizardStep(Step.CONFIRM_UNINSTALL)); } else { getUserData().setStopServer(false); } } } else { if (qs.displayConfirmation( INFO_CONFIRM_UNINSTALL_REPLICATION_SERVER_NOT_RUNNING_MSG .get(), INFO_CONFIRM_UNINSTALL_REPLICATION_SERVER_NOT_RUNNING_TITLE .get())) else if (qs.displayConfirmation( INFO_CONFIRM_UNINSTALL_REPLICATION_SERVER_NOT_RUNNING_MSG.get(), INFO_CONFIRM_UNINSTALL_REPLICATION_SERVER_NOT_RUNNING_TITLE.get())) { boolean startWorked = startServer(qs.getDialog().getFrame()); if (startWorked) @@ -545,7 +499,6 @@ } } } } else if (!conf.isServerRunning()) { getUserData().setStopServer(false); @@ -554,23 +507,20 @@ INFO_CONFIRM_UNINSTALL_SERVER_NOT_RUNNING_TITLE.get())) { qs.launch(); qs.setCurrentStep(getNextWizardStep( Step.CONFIRM_UNINSTALL)); qs.setCurrentStep(getNextWizardStep(Step.CONFIRM_UNINSTALL)); } } else { if (qs.displayConfirmation( } else if (qs.displayConfirmation( INFO_CONFIRM_UNINSTALL_SERVER_RUNNING_MSG.get(), INFO_CONFIRM_UNINSTALL_SERVER_RUNNING_TITLE.get())) { getUserData().setStopServer(true); qs.launch(); qs.setCurrentStep(getNextWizardStep( Step.CONFIRM_UNINSTALL)); qs.setCurrentStep(getNextWizardStep(Step.CONFIRM_UNINSTALL)); } else { getUserData().setStopServer(false); } } } } }; qs.getDialog().workerStarted(); worker.startBackgroundTask(); @@ -579,17 +529,13 @@ return false; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void updateUserData(WizardStep step, QuickSetup qs) { // do nothing; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setWizardDialogState(QuickSetupDialog dlg, UserData userData, @@ -597,7 +543,7 @@ if (step == Step.CONFIRM_UNINSTALL) { dlg.setDefaultButton(ButtonName.FINISH); dlg.setFocusOnButton(ButtonName.FINISH); } else if ((step == PROGRESS) || (step == FINISHED)) { } else if (step == PROGRESS || step == FINISHED) { dlg.setDefaultButton(ButtonName.CLOSE); dlg.setFocusOnButton(ButtonName.CLOSE); dlg.setButtonEnabled(ButtonName.CLOSE, false); @@ -695,23 +641,17 @@ } else { arg = joinAsString(getLineBreak().toString(), paths); } successMsg = INFO_SUMMARY_UNINSTALL_FINISHED_SUCCESSFULLY_REMOVE_JARFILES_CLI .get(arg); successMsg = INFO_SUMMARY_UNINSTALL_FINISHED_SUCCESSFULLY_REMOVE_JARFILES_CLI.get(arg); } else { successMsg = INFO_SUMMARY_UNINSTALL_FINISHED_SUCCESSFULLY_CLI.get(); } } else { if (getUninstallUserData().getRemoveLibrariesAndTools()) { } else if (getUninstallUserData().getRemoveLibrariesAndTools()) { String formattedPath = addWordBreaks(joinAsString(getLineBreak().toString(), paths), 60, 5); successMsg = INFO_SUMMARY_UNINSTALL_FINISHED_SUCCESSFULLY_REMOVE_JARFILES .get(formattedPath); successMsg = INFO_SUMMARY_UNINSTALL_FINISHED_SUCCESSFULLY_REMOVE_JARFILES.get(formattedPath); } else { successMsg = INFO_SUMMARY_UNINSTALL_FINISHED_SUCCESSFULLY.get(); } } hmSummary.put(UninstallProgressStep.FINISHED_SUCCESSFULLY, getFormattedSuccess(successMsg)); @@ -1059,8 +999,8 @@ /** {@inheritDoc} */ @Override public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) { if ((dlg.getDisplayedStep() == PROGRESS) || (dlg.getDisplayedStep() == FINISHED)) { if (dlg.getDisplayedStep() == PROGRESS || dlg.getDisplayedStep() == FINISHED) { // Simulate a close button event dlg.notifyButtonEvent(ButtonName.CLOSE); } else { @@ -1266,9 +1206,8 @@ for (File rootFile : rootFiles) { int beforeRatio = minRatio + ((it.next() * (maxRatio - minRatio)) / totalRatio); hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, beforeRatio); (it.next() * (maxRatio - minRatio)) / totalRatio; hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, beforeRatio); deleteRecursively(rootFile, filter); } hmRatio.put(UninstallProgressStep.DELETING_INSTALLATION_FILES, maxRatio); @@ -1421,9 +1360,7 @@ private File installationPath = installation.getRootDirectory(); /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean accept(File file) { UninstallUserData userData = getUninstallUserData(); @@ -1485,19 +1422,12 @@ private boolean isWindowsServiceEnabled() { if (isWindowsServiceEnabled == null) { if (ConfigureWindowsService.serviceState(null, null) == ConfigureWindowsService.SERVICE_STATE_ENABLED) { isWindowsServiceEnabled = Boolean.TRUE; } else { isWindowsServiceEnabled = Boolean.FALSE; } isWindowsServiceEnabled = serviceState(null, null) == SERVICE_STATE_ENABLED; } return isWindowsServiceEnabled.booleanValue(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public ApplicationTrustManager getTrustManager() { @@ -1512,20 +1442,18 @@ protected void disableWindowsService() throws ApplicationException { notifyListeners(getFormattedWithPoints( INFO_PROGRESS_DISABLING_WINDOWS_SERVICE.get())); int code = ConfigureWindowsService.disableService(System.out, System.err); int code = disableService(System.out, System.err); LocalizableMessage errorMessage = INFO_ERROR_DISABLING_WINDOWS_SERVICE.get( getInstallationPath()); switch (code) { case ConfigureWindowsService.SERVICE_DISABLE_SUCCESS: case SERVICE_DISABLE_SUCCESS: break; case ConfigureWindowsService.SERVICE_ALREADY_DISABLED: case SERVICE_ALREADY_DISABLED: break; default: throw new ApplicationException( ReturnCode.WINDOWS_SERVICE_ERROR, errorMessage, null); throw new ApplicationException(ReturnCode.WINDOWS_SERVICE_ERROR, errorMessage, null); } notifyListeners(getLineBreak()); } @@ -1680,9 +1608,7 @@ qs.getDialog().workerStarted(); worker.startBackgroundTask(); } else { if (qs.displayConfirmation( else if (qs.displayConfirmation( INFO_CONFIRM_UNINSTALL_SERVER_RUNNING_MSG.get(), INFO_CONFIRM_UNINSTALL_SERVER_RUNNING_TITLE.get())) { @@ -1693,7 +1619,6 @@ getUserData().setStopServer(false); } } } /** * Method that interacts with the user depending on what errors where @@ -1740,8 +1665,7 @@ stopProcessing = true; break; case GENERIC_CREATING_CONNECTION: if ((e.getCause() != null) && isCertificateException(e.getCause())) if (isCertificateException(e.getCause())) { UserDataCertificateException.Type excType; ApplicationTrustManager.Cause cause = null; @@ -1792,7 +1716,7 @@ } exceptionMsgs.add(getMessage(e)); } if (!stopProcessing && (exceptionMsgs.size() > 0)) if (!stopProcessing && exceptionMsgs.size() > 0) { LocalizableMessage confirmationMsg = ERR_UNINSTALL_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE.get( @@ -1836,7 +1760,7 @@ String authType = ce.getAuthType(); String host = ce.getHost(); if ((chain != null) && (authType != null) && (host != null)) if (chain != null && authType != null && host != null) { logger.info(LocalizableMessage.raw("Accepting certificate presented by host "+host)); getTrustManager().acceptCertificate(chain, authType, host); @@ -2191,7 +2115,7 @@ try { if (adsContext.hasAdminData() && (serverADSProperties != null)) if (adsContext.hasAdminData() && serverADSProperties != null) { logger.info(LocalizableMessage.raw("Unregistering server on ADS of server "+ ConnectionUtils.getHostPort(ctx)+". Properties: "+ opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java
@@ -36,9 +36,6 @@ import java.security.cert.X509Certificate; import java.util.ArrayList; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import javax.naming.NamingException; import javax.naming.ldap.InitialLdapContext; import javax.swing.Box; @@ -51,6 +48,8 @@ import javax.swing.SwingUtilities; import javax.swing.text.JTextComponent; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.opends.admin.ads.ADSContext; import org.opends.admin.ads.util.ApplicationTrustManager; import org.opends.guitools.controlpanel.datamodel.ConnectionProtocolPolicy; @@ -59,10 +58,10 @@ import org.opends.quicksetup.ApplicationException; import org.opends.quicksetup.Constants; import org.opends.quicksetup.Installation; import org.opends.quicksetup.ReturnCode; import org.opends.quicksetup.Step; import org.opends.quicksetup.UserData; import org.opends.quicksetup.UserDataCertificateException; import org.opends.quicksetup.ReturnCode; import org.opends.quicksetup.event.MinimumSizeComponentListener; import org.opends.quicksetup.ui.CertificateDialog; import org.opends.quicksetup.ui.UIFactory; @@ -71,9 +70,10 @@ import org.opends.quicksetup.util.UIKeyStore; import org.opends.quicksetup.util.Utils; import static com.forgerock.opendj.cli.Utils.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.messages.QuickSetupMessages.*; import static com.forgerock.opendj.cli.Utils.getThrowableMsg; /** * This class is a dialog that appears when the user must provide authentication @@ -149,10 +149,8 @@ return isCanceled; } /** * {@inheritDoc} * */ /** {@inheritDoc} */ @Override public void setVisible(boolean visible) { cancelButton.setEnabled(true); @@ -331,6 +329,7 @@ buttonPanel.add(okButton, gbc); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { okClicked(); @@ -345,6 +344,7 @@ buttonPanel.add(cancelButton, gbc); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ev) { cancelClicked(); @@ -384,6 +384,7 @@ { BackgroundTask<Boolean> worker = new BackgroundTask<Boolean>() { @Override public Boolean processBackgroundTask() throws NamingException, ApplicationException { @@ -432,13 +433,14 @@ return isServerRunning; } @Override public void backgroundTaskCompleted(Boolean returnValue, Throwable throwable) { if (throwable != null) { logger.info(LocalizableMessage.raw("Error connecting: " + throwable, throwable)); if (Utils.isCertificateException(throwable)) if (isCertificateException(throwable)) { ApplicationTrustManager.Cause cause = trustManager.getLastRefusedCause(); @@ -570,7 +572,7 @@ else { String hostName = tfHostName.getText(); if ((hostName == null) || (hostName.trim().length() == 0)) if (hostName == null || hostName.trim().length() == 0) { displayError(INFO_EMPTY_REMOTE_HOST.get(), INFO_ERROR_TITLE.get()); @@ -665,13 +667,14 @@ String authType = ce.getAuthType(); String host = ce.getHost(); if ((chain != null) && (authType != null) && (host != null)) if (chain != null && authType != null && host != null) { logger.info(LocalizableMessage.raw("Accepting certificate presented by host "+host)); getTrustManager().acceptCertificate(chain, authType, host); /* Simulate a click on the OK by calling in the okClicked method. */ SwingUtilities.invokeLater(new Runnable() { @Override public void run() { okClicked(); opendj3-server-dev/src/quicksetup/org/opends/quicksetup/Application.java
@@ -27,9 +27,18 @@ package org.opends.quicksetup; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; import java.util.LinkedHashSet; import java.util.Map; import javax.naming.NamingException; import javax.naming.ldap.InitialLdapContext; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.opends.admin.ads.ADSContext; import org.opends.admin.ads.ServerDescriptor; import org.opends.admin.ads.TopologyCacheException; @@ -39,25 +48,15 @@ import org.opends.admin.ads.util.ServerLoader; import org.opends.quicksetup.event.ProgressNotifier; import org.opends.quicksetup.event.ProgressUpdateListener; import org.opends.quicksetup.ui.GuiApplication; import org.opends.quicksetup.util.ProgressMessageFormatter; import org.opends.quicksetup.util.UIKeyStore; import org.opends.quicksetup.ui.GuiApplication; import org.opends.quicksetup.util.Utils; import static com.forgerock.opendj.cli.Utils.*; import static org.opends.messages.QuickSetupMessages.*; import java.io.PrintStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.util.LinkedHashSet; import java.util.Map; import org.forgerock.i18n.slf4j.LocalizedLogger; import javax.naming.NamingException; import javax.naming.ldap.InitialLdapContext; /** * This class represents an application that can be run in the context of * QuickSetup. Examples of applications might be 'installer' and 'uninstaller'. @@ -94,8 +93,7 @@ * @throws RuntimeException if there was a problem * creating the new Application object */ static public GuiApplication create() throws RuntimeException { public static GuiApplication create() throws RuntimeException { GuiApplication app; String appClassName = System.getProperty("org.opends.quicksetup.Application.class"); @@ -152,6 +150,7 @@ * the install progress. * @param l the ProgressUpdateListener to be added. */ @Override public void addProgressUpdateListener(ProgressUpdateListener l) { listenerDelegate.addProgressUpdateListener(l); @@ -161,6 +160,7 @@ * Removes a ProgressUpdateListener. * @param l the ProgressUpdateListener to be removed. */ @Override public void removeProgressUpdateListener(ProgressUpdateListener l) { listenerDelegate.removeProgressUpdateListener(l); @@ -176,13 +176,13 @@ String installPath = getInstallationPath(); String instancePath = getInstancePath(); if (installPath != null) { if (instancePath == null) if (instancePath != null) { installation = new Installation(installPath, installPath); installation = new Installation(installPath, instancePath); } else { installation = new Installation(installPath, instancePath); installation = new Installation(installPath, installPath); } } } @@ -247,6 +247,7 @@ * @param newLogDetail the new log messages that we have for the * installation in formatted form. */ @Override public void notifyListeners(Integer ratio, LocalizableMessage currentPhaseSummary, LocalizableMessage newLogDetail) { @@ -514,7 +515,7 @@ * @return <CODE>true</CODE> if the install is finished or <CODE>false * </CODE> if not. */ abstract public boolean isFinished(); public abstract boolean isFinished(); /** * Returns the trust manager that can be used to establish secure connections. @@ -562,7 +563,7 @@ * * @return boolean where true inidcates that the operation is cancellable */ abstract public boolean isCancellable(); public abstract boolean isCancellable(); /** * Signals that the application should cancel a currently running @@ -571,7 +572,7 @@ * out changes the application should make sure that <code>isFinished</code> * returns true so that the application can complete. */ abstract public void cancel(); public abstract void cancel(); /** * Checks whether the operation has been aborted. If it has throws an @@ -658,7 +659,7 @@ catch (NamingException ne) { LocalizableMessage msg; if (Utils.isCertificateException(ne)) if (isCertificateException(ne)) { msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get( server.getHostPort(true), ne.toString(true)); @@ -750,9 +751,8 @@ super(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override protected LocalizableMessage formatString(String s) { return getFormattedLogError(LocalizableMessage.raw(s)); } @@ -781,9 +781,8 @@ super(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override protected LocalizableMessage formatString(String s) { return getFormattedLog(LocalizableMessage.raw(s)); } @@ -803,7 +802,7 @@ * @param string to format * @return formatted message */ abstract protected LocalizableMessage formatString(String string); protected abstract LocalizableMessage formatString(String string); /** * Default constructor. @@ -815,24 +814,16 @@ isFirstLine = true; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void println(String msg) { LocalizableMessageBuilder mb = new LocalizableMessageBuilder(); if (isFirstLine) { mb.append(formatString(msg)); } else { if (!Utils.isCli()) if (!isFirstLine && !Utils.isCli()) { mb.append(getLineBreak()); } mb.append(formatString(msg)); } notifyListeners(mb.toMessage()); applicationPrintStreamReceived(msg); @@ -840,9 +831,7 @@ isFirstLine = false; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void write(byte[] b, int off, int len) { @@ -864,7 +853,6 @@ /** * Class used to add points periodically to the end of the logs. * */ protected class PointAdder implements Runnable { @@ -921,9 +909,8 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void run() { while (!stopPointAdder) opendj3-server-dev/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -32,27 +32,82 @@ import java.io.FileWriter; import java.io.IOException; import java.net.URI; import java.util.*; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.slf4j.LocalizedLogger; import javax.naming.*; import javax.naming.directory.*; import javax.naming.NameAlreadyBoundException; import javax.naming.NameNotFoundException; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import javax.naming.NamingSecurityException; import javax.naming.directory.Attribute; import javax.naming.directory.BasicAttribute; import javax.naming.directory.BasicAttributes; import javax.naming.directory.DirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; import javax.naming.ldap.InitialLdapContext; import javax.naming.ldap.Rdn; import javax.swing.JPanel; import org.opends.admin.ads.*; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.i18n.slf4j.LocalizedLogger; import org.opends.admin.ads.ADSContext; import org.opends.admin.ads.ADSContextException; import org.opends.admin.ads.ReplicaDescriptor; import org.opends.admin.ads.ServerDescriptor; import org.opends.admin.ads.SuffixDescriptor; import org.opends.admin.ads.TopologyCache; import org.opends.admin.ads.TopologyCacheException; import org.opends.admin.ads.TopologyCacheFilter; import org.opends.admin.ads.util.ApplicationTrustManager; import org.opends.admin.ads.util.ConnectionUtils; import org.opends.admin.ads.util.PreferredConnection; import org.forgerock.i18n.LocalizableMessageBuilder; import org.opends.quicksetup.*; import org.opends.quicksetup.ApplicationException; import org.opends.quicksetup.ButtonName; import org.opends.quicksetup.Constants; import org.opends.quicksetup.Installation; import org.opends.quicksetup.JavaArguments; import org.opends.quicksetup.LicenseFile; import org.opends.quicksetup.ProgressStep; import org.opends.quicksetup.QuickSetupLog; import org.opends.quicksetup.ReturnCode; import org.opends.quicksetup.SecurityOptions; import org.opends.quicksetup.Step; import org.opends.quicksetup.UserData; import org.opends.quicksetup.UserDataCertificateException; import org.opends.quicksetup.UserDataConfirmationException; import org.opends.quicksetup.UserDataException; import org.opends.quicksetup.WizardStep; import org.opends.quicksetup.event.ButtonActionListener; import org.opends.quicksetup.event.ButtonEvent; import org.opends.quicksetup.installer.ui.*; import org.opends.quicksetup.ui.*; import org.opends.quicksetup.installer.ui.DataOptionsPanel; import org.opends.quicksetup.installer.ui.DataReplicationPanel; import org.opends.quicksetup.installer.ui.GlobalAdministratorPanel; import org.opends.quicksetup.installer.ui.InstallLicensePanel; import org.opends.quicksetup.installer.ui.InstallReviewPanel; import org.opends.quicksetup.installer.ui.InstallWelcomePanel; import org.opends.quicksetup.installer.ui.RemoteReplicationPortsPanel; import org.opends.quicksetup.installer.ui.RuntimeOptionsPanel; import org.opends.quicksetup.installer.ui.ServerSettingsPanel; import org.opends.quicksetup.installer.ui.SuffixesToReplicatePanel; import org.opends.quicksetup.ui.FieldName; import org.opends.quicksetup.ui.FinishedPanel; import org.opends.quicksetup.ui.GuiApplication; import org.opends.quicksetup.ui.ProgressPanel; import org.opends.quicksetup.ui.QuickSetup; import org.opends.quicksetup.ui.QuickSetupDialog; import org.opends.quicksetup.ui.QuickSetupErrorPanel; import org.opends.quicksetup.ui.QuickSetupStepPanel; import org.opends.quicksetup.ui.UIFactory; import org.opends.quicksetup.util.FileManager; import org.opends.quicksetup.util.IncompatibleVersionException; import org.opends.quicksetup.util.Utils; @@ -63,14 +118,12 @@ import com.forgerock.opendj.util.OperatingSystem; import static com.forgerock.opendj.cli.Utils.*; import static org.forgerock.util.Utils.*; import static org.opends.messages.QuickSetupMessages.*; import static org.opends.quicksetup.Step.*; import static org.opends.quicksetup.util.Utils.*; import static com.forgerock.opendj.cli.Utils.canWrite; import static com.forgerock.opendj.cli.Utils.isDN; import static com.forgerock.opendj.cli.Utils.getHostNameForLdapUrl; import static com.forgerock.opendj.cli.Utils.getThrowableMsg; /** * This is an abstract class that is in charge of actually performing the @@ -93,10 +146,10 @@ private TopologyCache lastLoadedCache; /** Indicates that we've detected that there is something installed. */ boolean forceToDisplaySetup = false; boolean forceToDisplaySetup; /** When true indicates that the user has canceled this operation. */ protected boolean canceled = false; protected boolean canceled; private boolean javaVersionCheckFailed; @@ -105,7 +158,7 @@ hmConfiguredRemoteReplication = new HashMap<ServerDescriptor, ConfiguredReplication>(); // Constants used to do checks /** Constants used to do checks. */ private static final int MIN_DIRECTORY_MANAGER_PWD = 1; private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); @@ -153,7 +206,7 @@ private final Map<WizardStep, WizardStep> hmPreviousSteps = new HashMap<WizardStep, WizardStep>(); private char[] selfSignedCertPw = null; private char[] selfSignedCertPw; private boolean registeredNewServerOnRemote; private boolean createdAdministrator; @@ -195,26 +248,24 @@ lstSteps.add(FINISHED); try { if (!QuickSetupLog.isInitialized()) { QuickSetupLog.initLogFileHandler( File.createTempFile( Constants.LOG_FILE_PREFIX, Constants.LOG_FILE_SUFFIX)); } } catch (IOException e) { System.err.println("Failed to initialize log"); } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isCancellable() { return true; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public UserData createUserData() { UserData ud = new UserData(); @@ -228,7 +279,7 @@ { for (int i=0; i<userArguments.length; i++) { if (userArguments[i].equalsIgnoreCase("--connectTimeout")) if ("--connectTimeout".equalsIgnoreCase(userArguments[i])) { if (i < userArguments.length - 1) { @@ -247,17 +298,13 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void forceToDisplay() { forceToDisplaySetup = true; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean canGoBack(WizardStep step) { return step != WELCOME && @@ -265,9 +312,7 @@ step != FINISHED; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean canGoForward(WizardStep step) { return step != REVIEW && @@ -275,26 +320,20 @@ step != FINISHED; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean canFinish(WizardStep step) { return step == REVIEW; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isSubStep(WizardStep step) { return SUBSTEPS.contains(step); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isVisible(WizardStep step, UserData userData) { @@ -313,31 +352,27 @@ { DataReplicationOptions repl = userData.getReplicationOptions(); return repl != null && (repl.getType() != DataReplicationOptions.Type.STANDALONE) && (repl.getType() != DataReplicationOptions.Type.FIRST_IN_TOPOLOGY); && repl.getType() != DataReplicationOptions.Type.STANDALONE && repl.getType() != DataReplicationOptions.Type.FIRST_IN_TOPOLOGY; } else if (step == REMOTE_REPLICATION_PORTS) { return isVisible(SUFFIXES_OPTIONS, userData) && (userData.getRemoteWithNoReplicationPort().size() > 0) && (userData.getSuffixesToReplicateOptions().getType() == SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES); return isVisible(SUFFIXES_OPTIONS, userData) && userData.getRemoteWithNoReplicationPort().size() > 0 && userData.getSuffixesToReplicateOptions().getType() == SuffixesToReplicateOptions.Type.REPLICATE_WITH_EXISTING_SUFFIXES; } return true; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isVisible(WizardStep step, QuickSetup qs) { return isVisible(step, getUserData()); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean finishClicked(final WizardStep cStep, final QuickSetup qs) { if (cStep == Step.REVIEW) { @@ -352,9 +387,7 @@ return false; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void nextClicked(WizardStep cStep, QuickSetup qs) { if (cStep == PROGRESS) { @@ -368,9 +401,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void closeClicked(WizardStep cStep, QuickSetup qs) { if (cStep == PROGRESS) { @@ -389,9 +420,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public boolean isFinished() { @@ -400,9 +429,7 @@ || getCurrentProgressStep() == InstallProgressStep.FINISHED_WITH_ERROR; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void cancel() { setCurrentProgressStep(InstallProgressStep.WAITING_TO_CANCEL); @@ -410,9 +437,7 @@ this.canceled = true; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void quitClicked(WizardStep cStep, QuickSetup qs) { if (cStep == FINISHED) @@ -435,32 +460,24 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public ButtonName getInitialFocusButtonName() { ButtonName name; if (!installStatus.isInstalled() || forceToDisplaySetup) { name = ButtonName.NEXT; } else return ButtonName.NEXT; } else if (installStatus.canOverwriteCurrentInstall()) { if (installStatus.canOverwriteCurrentInstall()) { name = ButtonName.CONTINUE_INSTALL; return ButtonName.CONTINUE_INSTALL; } else { name = ButtonName.QUIT; return ButtonName.QUIT; } } return name; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public JPanel createFramePanel(QuickSetupDialog dlg) { JPanel p; @@ -505,17 +522,13 @@ return p; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public Set<? extends WizardStep> getWizardSteps() { return Collections.unmodifiableSet(new HashSet<WizardStep>(lstSteps)); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public QuickSetupStepPanel createWizardStepPanel(WizardStep step) { QuickSetupStepPanel p = null; @@ -547,17 +560,14 @@ return p; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void windowClosing(QuickSetupDialog dlg, WindowEvent evt) { if (installStatus.isInstalled() && forceToDisplaySetup) { // Simulate a close button event dlg.notifyButtonEvent(ButtonName.QUIT); } else { if (dlg.getDisplayedStep() == Step.PROGRESS) { } else if (dlg.getDisplayedStep() == Step.PROGRESS) { // Simulate a close button event dlg.notifyButtonEvent(ButtonName.CLOSE); } else { @@ -565,43 +575,32 @@ dlg.notifyButtonEvent(ButtonName.QUIT); } } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getCloseButtonToolTip() { return INFO_CLOSE_BUTTON_INSTALL_TOOLTIP.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getQuitButtonToolTip() { return INFO_QUIT_BUTTON_INSTALL_TOOLTIP.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getFinishButtonToolTip() { return INFO_FINISH_BUTTON_INSTALL_TOOLTIP.get(); } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public int getExtraDialogHeight() { return UIFactory.EXTRA_DIALOG_HEIGHT; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void previousClicked(WizardStep cStep, QuickSetup qs) { if (cStep == WELCOME) { @@ -616,9 +615,7 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LocalizableMessage getFrameTitle() { return Utils.getCustomizedObject("INFO_FRAME_INSTALL_TITLE", @@ -630,9 +627,7 @@ private InstallProgressStep currentProgressStep = InstallProgressStep.NOT_STARTED; /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public void setWizardDialogState(QuickSetupDialog dlg, UserData userData, @@ -645,7 +640,7 @@ } else if (step == WELCOME) { dlg.setDefaultButton(ButtonName.NEXT); dlg.setFocusOnButton(ButtonName.NEXT); } else if ((step == PROGRESS) || (step == FINISHED)) { } else if (step == PROGRESS || step == FINISHED) { dlg.setDefaultButton(ButtonName.CLOSE); dlg.setFocusOnButton(ButtonName.CLOSE); } else { @@ -654,26 +649,20 @@ } } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public ProgressStep getCurrentProgressStep() { return currentProgressStep; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public WizardStep getFirstWizardStep() { return WELCOME; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public WizardStep getNextWizardStep(WizardStep step) { WizardStep next = null; @@ -736,9 +725,7 @@ return next; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public LinkedHashSet<WizardStep> getOrderedSteps() { @@ -760,9 +747,7 @@ return orderedSteps; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public WizardStep getPreviousWizardStep(WizardStep step) { // Try with the steps calculated in method getNextWizardStep. @@ -778,9 +763,7 @@ return prev; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override public WizardStep getFinishedStep() { return Step.FINISHED; @@ -882,15 +865,7 @@ } String aliasInKeyStore = sec.getAliasToUse(); String aliasInTrustStore; if (aliasInKeyStore == null) { aliasInTrustStore = SELF_SIGNED_CERT_ALIAS; } else { aliasInTrustStore = aliasInKeyStore; } String aliasInTrustStore = aliasInKeyStore != null ? aliasInKeyStore : SELF_SIGNED_CERT_ALIAS; switch (sec.getCertificateType()) { @@ -1023,13 +998,10 @@ ReturnCode.CONFIGURATION_ERROR, INFO_ERROR_CONFIGURING.get(), null); } else { if (getUserData().getNewSuffixOptions().getBaseDns().isEmpty()) else if (getUserData().getNewSuffixOptions().getBaseDns().isEmpty()) { helper.deleteBackend(getBackendName()); } } } catch (ApplicationException aex) { ae = aex; @@ -1321,9 +1293,7 @@ joinAsString(", ", ldifPaths)))); } } else { if (isVerbose()) else if (isVerbose()) { mb.append(getFormattedProgress(INFO_PROGRESS_IMPORTING_LDIF.get( ldifPaths.getFirst()))); @@ -1332,9 +1302,7 @@ else { mb.append(getFormattedProgress( INFO_PROGRESS_IMPORTING_LDIF_NON_VERBOSE.get( ldifPaths.getFirst()))); } INFO_PROGRESS_IMPORTING_LDIF_NON_VERBOSE.get(ldifPaths.getFirst()))); } notifyListeners(mb.toMessage()); @@ -1416,15 +1384,12 @@ invokeLongOperation(thread); } catch (ApplicationException ae) { if (!isVerbose()) { if (lastImportProgress != null) if (!isVerbose() && lastImportProgress != null) { notifyListeners( getFormattedProgress(LocalizableMessage.raw(lastImportProgress))); notifyListeners(getLineBreak()); } } throw ae; } if (!isVerbose()) @@ -1451,7 +1416,7 @@ File templatePath = createTemplateFile(); int nEntries = getUserData().getNewSuffixOptions().getNumberEntries(); LocalizableMessageBuilder mb = new LocalizableMessageBuilder(); if (isVerbose() || (nEntries > THRESHOLD_AUTOMATIC_DATA_VERBOSE)) if (isVerbose() || nEntries > THRESHOLD_AUTOMATIC_DATA_VERBOSE) { mb.append(getFormattedProgress( INFO_PROGRESS_IMPORT_AUTOMATICALLY_GENERATED.get(nEntries))); @@ -1864,8 +1829,7 @@ getUserData().getSuffixesToReplicateOptions().getSuffixes(); for (SuffixDescriptor suffix : suffixes) { Set<String> h = new HashSet<String>(); h.addAll(suffix.getReplicationServers()); Set<String> h = new HashSet<String>(suffix.getReplicationServers()); adsServers.addAll(suffix.getReplicationServers()); h.add(getLocalReplicationServer()); adsServers.add(getLocalReplicationServer()); @@ -2013,18 +1977,15 @@ knownServerIds); long remoteTimeMeasureTime = System.currentTimeMillis(); long remoteTime = Utils.getServerClock(ctx); if ((localTime != -1) && (remoteTime != -1)) { if (Math.abs(localTime - remoteTime - localTimeMeasureTime + remoteTimeMeasureTime) > (THRESHOLD_CLOCK_DIFFERENCE_WARNING * 60 * 1000)) if (localTime != -1 && remoteTime != -1 && Math.abs(localTime - remoteTime - localTimeMeasureTime + remoteTimeMeasureTime) > THRESHOLD_CLOCK_DIFFERENCE_WARNING * 60 * 1000) { notifyListeners(getFormattedWarning( INFO_WARNING_SERVERS_CLOCK_DIFFERENCE.get( localServerDisplay, ConnectionUtils.getHostPort(ctx), THRESHOLD_CLOCK_DIFFERENCE_WARNING))); } } hmConfiguredRemoteReplication.put(server, repl); @@ -2404,7 +2365,7 @@ catch (NamingException ne) { LocalizableMessage msg; if (Utils.isCertificateException(ne)) if (isCertificateException(ne)) { msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get( getHostPort(server), ne.toString(true)); @@ -2471,8 +2432,7 @@ TopologyCacheFilter filter = new TopologyCacheFilter(); filter.setSearchMonitoringInformation(false); filter.addBaseDNToSearch(dn); ServerDescriptor s = ServerDescriptor.createStandalone(rCtx, filter); ServerDescriptor s = ServerDescriptor.createStandalone(rCtx, filter); for (ReplicaDescriptor r : s.getReplicas()) { if (areDnsEqual(r.getSuffix().getDN(), dn)) @@ -2484,7 +2444,7 @@ catch (NamingException ne) { LocalizableMessage msg; if (Utils.isCertificateException(ne)) if (isCertificateException(ne)) { msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get( getHostPort(server), ne.toString(true)); @@ -2567,8 +2527,7 @@ DataReplicationOptions repl = getUserData().getReplicationOptions(); boolean isRemoteServer = repl.getType() == DataReplicationOptions.Type.IN_EXISTING_TOPOLOGY; AuthenticationData auth = (isRemoteServer) ? repl.getAuthenticationData() : null; AuthenticationData auth = isRemoteServer ? repl.getAuthenticationData() : null; InitialLdapContext remoteCtx = null; // Bound to remote ADS host (if any). InitialLdapContext localCtx = null; // Bound to local server. ADSContext adsContext = null; // Bound to ADS host (via one of above). @@ -2651,7 +2610,10 @@ filter); server.updateAdsPropertiesWithServerProperties(); if (0 == adsContext.registerOrUpdateServer(server.getAdsProperties())) { if (isRemoteServer) registeredNewServerOnRemote = true; if (isRemoteServer) { registeredNewServerOnRemote = true; } } else { logger.warn(LocalizableMessage.raw("Server was already registered. Updating " + "server registration.")); @@ -2679,7 +2641,10 @@ } adsContext.createAdministrator(getAdministratorProperties( getUserData())); if (isRemoteServer && !createdRemoteAds) createdAdministrator = true; if (isRemoteServer && !createdRemoteAds) { createdAdministrator = true; } if (isVerbose()) { notifyListeners(getFormattedDoneWithLineBreak()); @@ -2708,16 +2673,13 @@ LocalizableMessage msg; if (isRemoteServer) { msg = Utils.getMessageForException(ne, getHostDisplay(auth)); msg = getMessageForException(ne, getHostDisplay(auth)); } else { msg = Utils.getMessageForException(ne); } throw new ApplicationException( ReturnCode.CONFIGURATION_ERROR, msg, ne); throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg, ne); } catch (ADSContextException ace) { @@ -2741,20 +2703,15 @@ */ protected boolean createNotReplicatedSuffix() { boolean createSuffix; DataReplicationOptions repl = getUserData().getReplicationOptions(); SuffixesToReplicateOptions suf = getUserData().getSuffixesToReplicateOptions(); createSuffix = (repl.getType() == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY) || (repl.getType() == DataReplicationOptions.Type.STANDALONE) || (suf.getType() == SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY); return createSuffix; return repl.getType() == DataReplicationOptions.Type.FIRST_IN_TOPOLOGY || repl.getType() == DataReplicationOptions.Type.STANDALONE || suf.getType() == SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY; } /** @@ -3002,7 +2959,7 @@ // Check the server location String serverLocation = qs.getFieldStringValue(FieldName.SERVER_LOCATION); if ((serverLocation == null) || ("".equals(serverLocation.trim()))) if (serverLocation == null || "".equals(serverLocation.trim())) { errorMsgs.add(INFO_EMPTY_SERVER_LOCATION.get()); qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); @@ -3011,10 +2968,10 @@ { String existingParentDirectory = null; File f = new File(serverLocation); while ((existingParentDirectory == null) && (f != null)) while (existingParentDirectory == null && f != null) { f = f.getParentFile(); if ((f != null) && f.exists()) if (f != null && f.exists()) { if (f.isDirectory()) { @@ -3033,9 +2990,7 @@ serverLocation)); qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); } else { if (!canWrite(existingParentDirectory)) else if (!canWrite(existingParentDirectory)) { errorMsgs.add(INFO_DIRECTORY_NOT_WRITABLE.get( existingParentDirectory)); @@ -3056,7 +3011,6 @@ serverLocation); getUserData().setServerLocation(serverLocation); } } } else if (fileExists(serverLocation)) { errorMsgs.add(INFO_FILE_EXISTS.get(serverLocation)); @@ -3074,7 +3028,7 @@ long requiredInMb = getRequiredInstallSpace() / (1024 * 1024); errorMsgs.add(INFO_NOT_ENOUGH_DISK_SPACE.get(serverLocation, requiredInMb)); qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); } else if (OperatingSystem.isWindows() && (serverLocation.contains("%"))) } else if (OperatingSystem.isWindows() && serverLocation.contains("%")) { errorMsgs.add(INFO_INVALID_CHAR_IN_PATH.get("%")); qs.displayFieldInvalid(FieldName.SERVER_LOCATION, true); @@ -3088,7 +3042,7 @@ // Check the host is not empty. // TODO: check that the host name is valid... String hostName = qs.getFieldStringValue(FieldName.HOST_NAME); if ((hostName == null) || hostName.trim().length() == 0) if (hostName == null || hostName.trim().length() == 0) { errorMsgs.add(INFO_EMPTY_HOST_NAME.get()); qs.displayFieldInvalid(FieldName.HOST_NAME, true); @@ -3105,7 +3059,7 @@ try { port = Integer.parseInt(sPort); if ((port < MIN_PORT_VALUE) || (port > MAX_PORT_VALUE)) if (port < MIN_PORT_VALUE || port > MAX_PORT_VALUE) { errorMsgs.add(INFO_INVALID_PORT_VALUE_RANGE.get(MIN_PORT_VALUE, MAX_PORT_VALUE)); qs.displayFieldInvalid(FieldName.SERVER_PORT, true); @@ -3130,8 +3084,8 @@ try { adminConnectorPort = Integer.parseInt(sPort); if ((adminConnectorPort < MIN_PORT_VALUE) || (adminConnectorPort > MAX_PORT_VALUE)) if (adminConnectorPort < MIN_PORT_VALUE || adminConnectorPort > MAX_PORT_VALUE) { errorMsgs.add(INFO_INVALID_PORT_VALUE_RANGE.get(MIN_PORT_VALUE, MAX_PORT_VALUE)); qs.displayFieldInvalid(FieldName.ADMIN_CONNECTOR_PORT, true); @@ -3163,7 +3117,7 @@ int securePort = sec.getSslPort(); if (sec.getEnableSSL()) { if ((securePort < MIN_PORT_VALUE) || (securePort > MAX_PORT_VALUE)) if (securePort < MIN_PORT_VALUE || securePort > MAX_PORT_VALUE) { errorMsgs.add(INFO_INVALID_SECURE_PORT_VALUE_RANGE.get(MIN_PORT_VALUE, MAX_PORT_VALUE)); qs.displayFieldInvalid(FieldName.SECURITY_OPTIONS, true); @@ -3200,7 +3154,7 @@ // Check the Directory Manager DN String dmDn = qs.getFieldStringValue(FieldName.DIRECTORY_MANAGER_DN); if ((dmDn == null) || (dmDn.trim().length() == 0)) if (dmDn == null || dmDn.trim().length() == 0) { errorMsgs.add(INFO_EMPTY_DIRECTORY_MANAGER_DN.get()); qs.displayFieldInvalid(FieldName.DIRECTORY_MANAGER_DN, true); @@ -3239,7 +3193,7 @@ { errorMsgs.add(INFO_PWD_TOO_SHORT.get(MIN_DIRECTORY_MANAGER_PWD)); qs.displayFieldInvalid(FieldName.DIRECTORY_MANAGER_PWD, true); if ((pwd2 == null) || (pwd2.length() < MIN_DIRECTORY_MANAGER_PWD)) if (pwd2 == null || pwd2.length() < MIN_DIRECTORY_MANAGER_PWD) { qs.displayFieldInvalid(FieldName.DIRECTORY_MANAGER_PWD_CONFIRM, true); } @@ -3423,8 +3377,8 @@ try { replicationPort = Integer.parseInt(sPort); if ((replicationPort < MIN_PORT_VALUE) || (replicationPort > MAX_PORT_VALUE)) if (replicationPort < MIN_PORT_VALUE || replicationPort > MAX_PORT_VALUE) { errorMsgs.add(INFO_INVALID_REPLICATION_PORT_VALUE_RANGE.get(MIN_PORT_VALUE, MAX_PORT_VALUE)); qs.displayFieldInvalid(FieldName.SERVER_PORT, true); @@ -3436,9 +3390,9 @@ { /* Check that we did not chose this port for another protocol */ SecurityOptions sec = getUserData().getSecurityOptions(); if ((replicationPort == getUserData().getServerPort()) || (replicationPort == getUserData().getServerJMXPort()) || ((replicationPort == sec.getSslPort()) && sec.getEnableSSL())) if (replicationPort == getUserData().getServerPort() || replicationPort == getUserData().getServerJMXPort() || (replicationPort == sec.getSslPort() && sec.getEnableSSL())) { errorMsgs.add( INFO_REPLICATION_PORT_ALREADY_CHOSEN_FOR_OTHER_PROTOCOL.get()); @@ -3462,7 +3416,7 @@ String pwd, QuickSetup qs, List<LocalizableMessage> errorMsgs) { // Check host if ((host == null) || (host.length() == 0)) if (host == null || host.length() == 0) { errorMsgs.add(INFO_EMPTY_REMOTE_HOST.get()); qs.displayFieldInvalid(FieldName.REMOTE_SERVER_HOST, true); @@ -3485,7 +3439,7 @@ } // Check dn if ((dn == null) || (dn.length() == 0)) if (dn == null || dn.length() == 0) { errorMsgs.add(INFO_EMPTY_REMOTE_DN.get()); qs.displayFieldInvalid(FieldName.REMOTE_SERVER_DN, true); @@ -3496,7 +3450,7 @@ } // Check password if ((pwd == null) || (pwd.length() == 0)) if (pwd == null || pwd.length() == 0) { errorMsgs.add(INFO_EMPTY_REMOTE_PWD.get()); qs.displayFieldInvalid(FieldName.REMOTE_SERVER_PWD, true); @@ -3561,8 +3515,7 @@ LocalizableMessage errorMsg = INFO_NOT_GLOBAL_ADMINISTRATOR_PROVIDED.get(); throw new UserDataException(Step.REPLICATION_OPTIONS, errorMsg); case GENERIC_CREATING_CONNECTION: if ((e.getCause() != null) && isCertificateException(e.getCause())) if (isCertificateException(e.getCause())) { UserDataCertificateException.Type excType; ApplicationTrustManager.Cause cause = null; @@ -3670,8 +3623,7 @@ } else if (t instanceof NamingException) { errorMsgs.add(Utils.getMessageForException((NamingException)t, host+":"+port)); errorMsgs.add(getMessageForException((NamingException) t, host + ":" + port)); qs.displayFieldInvalid(FieldName.REMOTE_SERVER_DN, true); qs.displayFieldInvalid(FieldName.REMOTE_SERVER_PWD, true); if (!(t instanceof NamingSecurityException)) @@ -3713,7 +3665,7 @@ // Check the Global Administrator UID String uid = qs.getFieldStringValue(FieldName.GLOBAL_ADMINISTRATOR_UID); if ((uid == null) || (uid.trim().length() == 0)) if (uid == null || uid.trim().length() == 0) { errorMsgs.add(INFO_EMPTY_ADMINISTRATOR_UID.get()); qs.displayFieldInvalid(FieldName.GLOBAL_ADMINISTRATOR_UID, true); @@ -3744,10 +3696,9 @@ { errorMsgs.add(INFO_PWD_TOO_SHORT.get(MIN_DIRECTORY_MANAGER_PWD)); qs.displayFieldInvalid(FieldName.GLOBAL_ADMINISTRATOR_PWD, true); if ((pwd2 == null) || (pwd2.length() < MIN_DIRECTORY_MANAGER_PWD)) if (pwd2 == null || pwd2.length() < MIN_DIRECTORY_MANAGER_PWD) { qs.displayFieldInvalid(FieldName.GLOBAL_ADMINISTRATOR_PWD_CONFIRM, true); qs.displayFieldInvalid(FieldName.GLOBAL_ADMINISTRATOR_PWD_CONFIRM, true); } pwdValid = false; } @@ -3855,8 +3806,8 @@ try { int replicationPort = Integer.parseInt(sPort); if ((replicationPort < MIN_PORT_VALUE) || (replicationPort > MAX_PORT_VALUE)) if (replicationPort < MIN_PORT_VALUE || replicationPort > MAX_PORT_VALUE) { errorMsgs.add(INFO_INVALID_REMOTE_REPLICATION_PORT_VALUE_RANGE.get( getHostPort(server), MIN_PORT_VALUE, MAX_PORT_VALUE)); @@ -3868,11 +3819,10 @@ { securePort = getUserData().getSecurityOptions().getSslPort(); } if ((replicationPort == getUserData().getServerPort()) || (replicationPort == getUserData().getServerJMXPort()) || (replicationPort == getUserData().getReplicationOptions().getReplicationPort()) || (replicationPort == securePort)) if (replicationPort == getUserData().getServerPort() || replicationPort == getUserData().getServerJMXPort() || replicationPort == getUserData().getReplicationOptions().getReplicationPort() || replicationPort == securePort) { errorMsgs.add( INFO_REMOTE_REPLICATION_PORT_ALREADY_CHOSEN_FOR_OTHER_PROTOCOL @@ -3920,7 +3870,7 @@ // Check the base dn boolean validBaseDn = false; String baseDn = qs.getFieldStringValue(FieldName.DIRECTORY_BASE_DN); if ((baseDn == null) || (baseDn.trim().length() == 0)) if (baseDn == null || baseDn.trim().length() == 0) { // Do nothing, the user does not want to provide a base DN. baseDn = ""; @@ -3938,7 +3888,7 @@ validBaseDn = true; } if (baseDn.equals("")) if ("".equals(baseDn)) { List<String> baseDns = new LinkedList<String>(); dataOptions = NewSuffixOptions.createEmpty(baseDns); @@ -3953,7 +3903,7 @@ { case IMPORT_FROM_LDIF_FILE: String ldifPath = qs.getFieldStringValue(FieldName.LDIF_PATH); if ((ldifPath == null) || (ldifPath.trim().equals(""))) if (ldifPath == null || "".equals(ldifPath.trim())) { errorMsgs.add(INFO_NO_LDIF_PATH.get()); qs.displayFieldInvalid(FieldName.LDIF_PATH, true); @@ -3981,7 +3931,7 @@ // Check the number of entries String nEntries = qs.getFieldStringValue(FieldName.NUMBER_ENTRIES); if ((nEntries == null) || (nEntries.trim().equals(""))) if (nEntries == null || "".equals(nEntries.trim())) { errorMsgs.add(INFO_NO_NUMBER_ENTRIES.get()); qs.displayFieldInvalid(FieldName.NUMBER_ENTRIES, true); @@ -4101,8 +4051,8 @@ getUserData().getSuffixesToReplicateOptions(); SuffixesToReplicateOptions.Type type; if ((suf == null) || (suf.getType() == SuffixesToReplicateOptions.Type.NO_SUFFIX_TO_REPLICATE)) if (suf == null || suf.getType() == SuffixesToReplicateOptions.Type.NO_SUFFIX_TO_REPLICATE) { type = SuffixesToReplicateOptions.Type.NO_SUFFIX_TO_REPLICATE; } @@ -4157,13 +4107,13 @@ getUserData().getSuffixesToReplicateOptions(); SuffixesToReplicateOptions.Type type; Set<SuffixDescriptor> suffixes = new HashSet<SuffixDescriptor>(); if (suf == null) if (suf != null) { type = SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY; type = suf.getType(); } else { type = suf.getType(); type = SuffixesToReplicateOptions.Type.NEW_SUFFIX_IN_TOPOLOGY; } ServerDescriptor s = ServerDescriptor.createStandalone(ctx, @@ -4189,9 +4139,7 @@ */ protected String getSelfSignedKeystorePath() { String parentFile = getPath(getInstancePath(), Installation.CONFIG_PATH_RELATIVE); return (getPath(parentFile, "keystore")); return getPath2("keystore"); } /** @@ -4202,9 +4150,7 @@ */ private String getTrustManagerPath() { String parentFile = getPath(getInstancePath(), Installation.CONFIG_PATH_RELATIVE); return (getPath(parentFile, "truststore")); return getPath2("truststore"); } /** @@ -4214,9 +4160,7 @@ */ private String getTemporaryCertificatePath() { String parentFile = getPath(getInstancePath(), Installation.CONFIG_PATH_RELATIVE); return (getPath(parentFile, "server-cert.txt")); return getPath2("server-cert.txt"); } /** @@ -4225,11 +4169,14 @@ */ private String getKeystorePinPath() { String parentFile = getPath(getInstancePath(), Installation.CONFIG_PATH_RELATIVE); return (getPath(parentFile, "keystore.pin")); return getPath2("keystore.pin"); } private String getPath2(String relativePath) { String parentFile = getPath(getInstancePath(), Installation.CONFIG_PATH_RELATIVE); return getPath(parentFile, relativePath); } /** * Returns the validity period to be used to generate the self-signed @@ -4484,7 +4431,7 @@ } totalEntries = Math.max(totalEntries, processed+unprocessed); if ((processed != -1) && (unprocessed != -1)) if (processed != -1 && unprocessed != -1) { if (processed + unprocessed > 0) { @@ -4531,15 +4478,14 @@ { minRefreshPeriod = 10000; } if (((currentTime - minRefreshPeriod) > lastTimeMsgLogged)) if (currentTime - minRefreshPeriod > lastTimeMsgLogged) { lastTimeMsgLogged = currentTime; logger.info(LocalizableMessage.raw("Progress msg: "+msg)); } if (displayProgress) { if (((currentTime - minRefreshPeriod) > lastTimeMsgDisplayed) && !msg.equals(lastDisplayedMsg)) if (displayProgress && currentTime - minRefreshPeriod > lastTimeMsgDisplayed && !msg.equals(lastDisplayedMsg)) { notifyListeners(getFormattedProgress(msg)); lastDisplayedMsg = msg; @@ -4547,17 +4493,13 @@ lastTimeMsgDisplayed = currentTime; } } } String logMsg = getFirstValue(sr, "ds-task-log-message"); if (logMsg != null) { if (!logMsg.equals(lastLogMsg)) if (logMsg != null && !logMsg.equals(lastLogMsg)) { logger.info(LocalizableMessage.raw(logMsg)); lastLogMsg = logMsg; } } InstallerHelper helper = new InstallerHelper(); String state = getFirstValue(sr, "ds-task-state"); @@ -4566,23 +4508,22 @@ isOver = true; LocalizableMessage errorMsg; logger.info(LocalizableMessage.raw("Last task entry: "+sr)); if (displayProgress && (msg != null) && !msg.equals(lastDisplayedMsg)) if (displayProgress && msg != null && !msg.equals(lastDisplayedMsg)) { notifyListeners(getFormattedProgress(msg)); lastDisplayedMsg = msg; notifyListeners(getLineBreak()); } if (lastLogMsg == null) if (lastLogMsg != null) { errorMsg = INFO_ERROR_DURING_INITIALIZATION_NO_LOG.get( sourceServerDisplay, state, sourceServerDisplay); errorMsg = INFO_ERROR_DURING_INITIALIZATION_LOG.get( sourceServerDisplay, lastLogMsg, state, sourceServerDisplay); } else { errorMsg = INFO_ERROR_DURING_INITIALIZATION_LOG.get( sourceServerDisplay, lastLogMsg, state, sourceServerDisplay); errorMsg = INFO_ERROR_DURING_INITIALIZATION_NO_LOG.get( sourceServerDisplay, state, sourceServerDisplay); } logger.warn(LocalizableMessage.raw("Processed errorMsg: "+errorMsg)); @@ -4599,8 +4540,7 @@ ApplicationException ae = new ApplicationException( ReturnCode.APPLICATION_ERROR, errorMsg, null); if ((lastLogMsg == null) || helper.isPeersNotFoundError(lastLogMsg)) if (lastLogMsg == null || helper.isPeersNotFoundError(lastLogMsg)) { logger.warn(LocalizableMessage.raw("Throwing peer not found error. "+ "Last Log Msg: "+lastLogMsg)); @@ -4753,14 +4693,11 @@ res.close(); } String logMsg = getFirstValue(sr, "ds-task-log-message"); if (logMsg != null) { if (!logMsg.equals(lastLogMsg)) if (logMsg != null && !logMsg.equals(lastLogMsg)) { logger.info(LocalizableMessage.raw(logMsg)); lastLogMsg = logMsg; } } InstallerHelper helper = new InstallerHelper(); String state = getFirstValue(sr, "ds-task-state"); @@ -4768,16 +4705,15 @@ { isOver = true; LocalizableMessage errorMsg; if (lastLogMsg == null) if (lastLogMsg != null) { errorMsg = INFO_ERROR_DURING_INITIALIZATION_NO_LOG.get( sourceServerDisplay, state, sourceServerDisplay); errorMsg = INFO_ERROR_DURING_INITIALIZATION_LOG.get( sourceServerDisplay, lastLogMsg, state, sourceServerDisplay); } else { errorMsg = INFO_ERROR_DURING_INITIALIZATION_LOG.get( sourceServerDisplay, lastLogMsg, state, sourceServerDisplay); errorMsg = INFO_ERROR_DURING_INITIALIZATION_NO_LOG.get( sourceServerDisplay, state, sourceServerDisplay); } if (helper.isCompletedWithErrors(state)) @@ -4901,9 +4837,7 @@ return hostPort; } /** * {@inheritDoc} */ /** {@inheritDoc} */ @Override protected void applicationPrintStreamReceived(String message) { @@ -4945,7 +4879,7 @@ */ abstract class InvokeThread extends Thread implements Runnable { protected boolean isOver = false; protected boolean isOver; protected ApplicationException ae; /** opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -810,74 +810,6 @@ env, trustManager, null, verifier); } /** * Tells whether the provided Throwable was caused because of a problem with * a certificate while trying to establish a connection. * @param t the Throwable to analyze. * @return <CODE>true</CODE> if the provided Throwable was caused because of a * problem with a certificate while trying to establish a connection and * <CODE>false</CODE> otherwise. */ public static boolean isCertificateException(Throwable t) { return com.forgerock.opendj.cli.Utils.isCertificateException(t); } /** * Returns a message object for the given NamingException. * @param ne the NamingException. * @param hostPort the hostPort representation of the server we were * contacting when the NamingException occurred. * @return a message object for the given NamingException. */ public static LocalizableMessage getMessageForException(NamingException ne, String hostPort) { LocalizableMessage msg; String arg; if (ne.getLocalizedMessage() != null) { arg = ne.getLocalizedMessage(); } else if (ne.getExplanation() != null) { arg = ne.getExplanation(); } else { arg = ne.toString(true); } if (Utils.isCertificateException(ne)) { msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get( hostPort, arg); } else if (ne instanceof AuthenticationException) { msg = INFO_CANNOT_CONNECT_TO_REMOTE_AUTHENTICATION.get(hostPort, arg); } else if (ne instanceof NoPermissionException) { msg = INFO_CANNOT_CONNECT_TO_REMOTE_PERMISSIONS.get(hostPort, arg); } else if (ne instanceof NamingSecurityException) { msg = INFO_CANNOT_CONNECT_TO_REMOTE_PERMISSIONS.get(hostPort, arg); } else if (ne instanceof CommunicationException) { msg = ERR_CANNOT_CONNECT_TO_REMOTE_COMMUNICATION.get(hostPort, arg); } else { msg = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(hostPort, arg); } return msg; } /** * Returns a message object for the given NamingException. The code assume * that we are trying to connect to the local server. @@ -887,7 +819,7 @@ public static LocalizableMessage getMessageForException(NamingException ne) { LocalizableMessage msg; if (Utils.isCertificateException(ne)) if (isCertificateException(ne)) { msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE.get(ne.toString(true)); } opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -27,8 +27,28 @@ */ package org.opends.server.tools.dsreplication; import java.io.*; import java.util.*; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import javax.naming.NameAlreadyBoundException; import javax.naming.NameNotFoundException; @@ -120,11 +140,7 @@ import static com.forgerock.opendj.cli.ArgumentConstants.*; import static com.forgerock.opendj.cli.CliMessages.*; import static com.forgerock.opendj.cli.Utils.CONFIRMATION_MAX_TRIES; import static com.forgerock.opendj.cli.Utils.getCurrentOperationDateMessage; import static com.forgerock.opendj.cli.Utils.getMessageForException; import static com.forgerock.opendj.cli.Utils.getThrowableMsg; import static com.forgerock.opendj.cli.Utils.SHELL_COMMENT_SEPARATOR; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.util.OperatingSystem.*; import static org.forgerock.util.Utils.*;