| | |
| | | |
| | | 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; |
| | |
| | | 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 |
| | | { |
| | |
| | | createLayout(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public LocalizableMessage getTitle() |
| | | { |
| | | return INFO_CTRL_PANEL_LOCAL_OR_REMOTE_PANEL_TITLE.get(); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public GenericDialog.ButtonType getButtonType() |
| | | { |
| | |
| | | */ |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | addBottomGlue(gbc); |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public Component getPreferredFocusComponent() |
| | | { |
| | |
| | | { |
| | | return pwd; |
| | | } |
| | | else |
| | | { |
| | | return combo; |
| | | } |
| | | return combo; |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void configurationChanged(ConfigurationChangeEvent ev) |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void toBeDisplayed(boolean visible) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void okClicked() |
| | | { |
| | |
| | | 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)); |
| | | } |
| | |
| | | BackgroundTask<InitialLdapContext> worker = |
| | | new BackgroundTask<InitialLdapContext>() |
| | | { |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public InitialLdapContext processBackgroundTask() throws Throwable |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void backgroundTaskCompleted(InitialLdapContext ctx, |
| | | Throwable throwable) |
| | | { |
| | | boolean handleCertificateException = false; |
| | | |
| | | boolean localServerErrorConnecting = false; |
| | | |
| | | if (throwable != null) |
| | |
| | | { |
| | | errors.add(((OpenDsException)throwable).getMessageObject()); |
| | | } |
| | | else if (Utils.isCertificateException(throwable)) |
| | | else if (isCertificateException(throwable)) |
| | | { |
| | | ApplicationTrustManager.Cause cause = |
| | | getInfo().getTrustManager().getLastRefusedCause(); |
| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * {@inheritDoc} |
| | | */ |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void cancelClicked() |
| | | { |
| | |
| | | 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); |
| | |
| | | msg = ERR_NOT_SAME_PRODUCT_IN_REMOTE_SERVER_NOT_FOUND.get(hostName, |
| | | productName, DynamicConstants.PRODUCT_NAME); |
| | | } |
| | | else |
| | | else if (!String.valueOf(DynamicConstants.MAJOR_VERSION).equals(major) |
| | | || !String.valueOf(DynamicConstants.MINOR_VERSION).equals(minor) |
| | | || !String.valueOf(DynamicConstants.POINT_VERSION).equals(point)) |
| | | { |
| | | 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); |
| | | } |
| | | msg = ERR_INCOMPATIBLE_VERSION_IN_REMOTE_SERVER.get(hostName, |
| | | major, minor, point, DynamicConstants.MAJOR_VERSION, |
| | | DynamicConstants.MINOR_VERSION, DynamicConstants.POINT_VERSION); |
| | | } |
| | | } |
| | | catch (Throwable t) |