From c3a6c42b47b5ed31e802ea7eed11aa2baf57749d Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 05 Apr 2016 15:19:41 +0000
Subject: [PATCH] Code cleanup in uninstaller
---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java | 76 ++---
opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java | 26 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java | 244 +++++--------------
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java | 174 +++++--------
opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java | 152 +++--------
5 files changed, 228 insertions(+), 444 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
index 7a826ef..e7f7931 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -62,6 +62,7 @@
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.quicksetup.util.UIKeyStore;
import org.opends.quicksetup.util.Utils;
+import org.opends.server.util.DynamicConstants;
import org.opends.server.util.StaticUtils;
import com.forgerock.opendj.cli.CliConstants;
@@ -73,22 +74,29 @@
*/
public class ControlPanelInfo
{
- private long poolingPeriod = 20000;
+ private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
- private ServerDescriptor serverDesc;
+ private static boolean mustDeregisterConfig;
+ private static ControlPanelInfo instance;
+
private Set<Task> tasks = new HashSet<>();
private ConnectionWrapper connWrapper;
private InitialLdapContext userDataCtx;
private final LDAPConnectionPool connectionPool = new LDAPConnectionPool();
/** Used by the browsers. */
private final IconPool iconPool = new IconPool();
+
+ private long poolingPeriod = 20000;
private Thread poolingThread;
private boolean stopPooling;
private boolean pooling;
+
private ApplicationTrustManager trustManager;
private int connectTimeout = CliConstants.DEFAULT_LDAP_CONNECT_TIMEOUT;
private ConnectionProtocolPolicy connectionPolicy =
ConnectionProtocolPolicy.USE_MOST_SECURE_AVAILABLE;
+
+ private ServerDescriptor serverDesc;
private String ldapURL;
private String startTLSURL;
private String ldapsURL;
@@ -99,22 +107,16 @@
private String lastRemoteHostName;
private String lastRemoteAdministrationURL;
- private static boolean mustDeregisterConfig;
-
private boolean isLocal = true;
- private Set<AbstractIndexDescriptor> modifiedIndexes = new HashSet<>();
- private LinkedHashSet<ConfigChangeListener> configListeners = new LinkedHashSet<>();
- private LinkedHashSet<BackupCreatedListener> backupListeners = new LinkedHashSet<>();
- private LinkedHashSet<BackendPopulatedListener> backendPopulatedListeners = new LinkedHashSet<>();
- private LinkedHashSet<IndexModifiedListener> indexListeners = new LinkedHashSet<>();
-
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
- private static ControlPanelInfo instance;
+ private final Set<AbstractIndexDescriptor> modifiedIndexes = new HashSet<>();
+ private final Set<ConfigChangeListener> configListeners = new LinkedHashSet<>();
+ private final Set<BackupCreatedListener> backupListeners = new LinkedHashSet<>();
+ private final Set<BackendPopulatedListener> backendPopulatedListeners = new LinkedHashSet<>();
+ private final Set<IndexModifiedListener> indexListeners = new LinkedHashSet<>();
/** Default constructor. */
- protected ControlPanelInfo()
+ private ControlPanelInfo()
{
}
@@ -392,41 +394,11 @@
}
/**
- * Returns an empty new server descriptor instance.
- * @return an empty new server descriptor instance.
- */
- protected ServerDescriptor createNewServerDescriptorInstance()
- {
- return new ServerDescriptor();
- }
-
- /**
- * Returns a reader that will read the configuration from a file.
- * @return a reader that will read the configuration from a file.
- */
- protected ConfigFromFile createNewConfigFromFileReader()
- {
- return new ConfigFromFile();
- }
-
- /**
- * Returns a reader that will read the configuration from a dir context.
- * @return a reader that will read the configuration from a dir context.
- */
- protected ConfigFromDirContext createNewConfigFromDirContextReader()
- {
- ConfigFromDirContext configFromDirContext = new ConfigFromDirContext();
- configFromDirContext.setIsLocal(isLocal());
- return configFromDirContext;
- }
-
- /**
* Updates the contents of the server descriptor with the provider reader.
* @param reader the configuration reader.
* @param desc the server descriptor.
*/
- protected void updateServerDescriptor(ConfigReader reader,
- ServerDescriptor desc)
+ private void updateServerDescriptor(ConfigReader reader, ServerDescriptor desc)
{
desc.setExceptions(reader.getExceptions());
desc.setAdministrativeUsers(reader.getAdministrativeUsers());
@@ -440,15 +412,11 @@
/** Regenerates the last found ServerDescriptor object. */
public synchronized void regenerateDescriptor()
{
- boolean isLocal = isLocal();
-
- ServerDescriptor desc = createNewServerDescriptorInstance();
+ ServerDescriptor desc = new ServerDescriptor();
desc.setIsLocal(isLocal);
- ConnectionWrapper connWrapper = getConnection();
if (isLocal)
{
- desc.setOpenDSVersion(
- org.opends.server.util.DynamicConstants.FULL_VERSION_STRING);
+ desc.setOpenDSVersion(DynamicConstants.FULL_VERSION_STRING);
String installPath = Utilities.getInstallPathFromClasspath();
desc.setInstallPath(installPath);
desc.setInstancePath(Utils.getInstancePathFromInstallPath(installPath));
@@ -458,8 +426,8 @@
{
desc.setHostname(lastRemoteHostName);
}
- ConfigReader reader;
+ ConfigReader reader;
ServerStatus status = getStatus(desc);
if (status != null)
{
@@ -467,18 +435,17 @@
if (status == ServerStatus.STOPPING)
{
StaticUtils.close(connWrapper);
- this.connWrapper = null;
+ connWrapper = null;
if (userDataCtx != null)
{
- unregisterConnection(connectionPool, connWrapper.getLdapContext());
+ unregisterConnection(connectionPool, null);
StaticUtils.close(userDataCtx);
userDataCtx = null;
}
}
if (isLocal)
{
- reader = createNewConfigFromFileReader();
- ((ConfigFromFile)reader).readConfiguration();
+ reader = newLocalConfigReader();
}
else
{
@@ -515,41 +482,36 @@
{
// Ignore: we will ask the user for credentials.
}
- if (connWrapper != null)
- {
- this.connWrapper = connWrapper;
- }
}
- if (isLocal && connWrapper == null)
+ if (connWrapper == null)
{
- reader = createNewConfigFromFileReader();
- ((ConfigFromFile)reader).readConfiguration();
- }
- else if (!isLocal && connWrapper == null)
- {
- desc.setStatus(ServerStatus.NOT_CONNECTED_TO_REMOTE);
- reader = null;
+ if (isLocal)
+ {
+ reader = newLocalConfigReader();
+ }
+ else
+ {
+ reader = null;
+ desc.setStatus(ServerStatus.NOT_CONNECTED_TO_REMOTE);
+ }
}
else
{
Utilities.initializeConfigurationFramework();
- reader = createNewConfigFromDirContextReader();
- ((ConfigFromDirContext) reader).readConfiguration(connWrapper);
+ reader = newRemoteConfigReader();
boolean connectionWorks = checkConnections(connWrapper.getLdapContext(), userDataCtx);
if (!connectionWorks)
{
if (isLocal)
{
- // Try with off-line info
- reader = createNewConfigFromFileReader();
- ((ConfigFromFile) reader).readConfiguration();
+ reader = newLocalConfigReader();
}
else
{
- desc.setStatus(ServerStatus.NOT_CONNECTED_TO_REMOTE);
reader = null;
+ desc.setStatus(ServerStatus.NOT_CONNECTED_TO_REMOTE);
}
StaticUtils.close(connWrapper);
this.connWrapper = null;
@@ -591,8 +553,7 @@
{
desc.setStatus(ServerStatus.STOPPED);
desc.setAuthenticated(false);
- reader = createNewConfigFromFileReader();
- ((ConfigFromFile)reader).readConfiguration();
+ reader = newLocalConfigReader();
}
if (reader != null)
{
@@ -609,8 +570,7 @@
{
localAdminConnectorURL = adminConnectorURL;
}
- startTLSURL = getURL(serverDesc,
- ConnectionHandlerDescriptor.Protocol.LDAP_STARTTLS);
+ startTLSURL = getURL(serverDesc, ConnectionHandlerDescriptor.Protocol.LDAP_STARTTLS);
ConfigurationChangeEvent ev = new ConfigurationChangeEvent(this, desc);
for (ConfigChangeListener listener : configListeners)
{
@@ -619,6 +579,21 @@
}
}
+ private ConfigReader newRemoteConfigReader()
+ {
+ ConfigFromDirContext reader = new ConfigFromDirContext();
+ reader.setIsLocal(isLocal);
+ reader.readConfiguration(connWrapper);
+ return reader;
+ }
+
+ private ConfigReader newLocalConfigReader()
+ {
+ ConfigFromFile reader = new ConfigFromFile();
+ reader.readConfiguration();
+ return reader;
+ }
+
private ServerStatus getStatus(ServerDescriptor desc)
{
ServerStatus status = null;
@@ -1019,11 +994,7 @@
*/
public boolean connectUsingStartTLS()
{
- if (getStartTLSURL() != null)
- {
- return getStartTLSURL().equals(getURLToConnect());
- }
- return false;
+ return startTLSURL != null && startTLSURL.equals(getURLToConnect());
}
/**
@@ -1033,11 +1004,7 @@
*/
public boolean connectUsingLDAPS()
{
- if (getLDAPSURL() != null)
- {
- return getLDAPSURL().equals(getURLToConnect());
- }
- return false;
+ return ldapsURL != null && ldapsURL.equals(getURLToConnect());
}
/**
@@ -1048,39 +1015,38 @@
*/
public String getURLToConnect()
{
- String url;
switch (getConnectionPolicy())
{
case USE_STARTTLS:
- return getStartTLSURL();
+ return startTLSURL;
case USE_LDAP:
- return getLDAPURL();
+ return ldapURL;
case USE_LDAPS:
- return getLDAPSURL();
+ return ldapsURL;
case USE_ADMIN:
return getAdminConnectorURL();
case USE_MOST_SECURE_AVAILABLE:
- url = getLDAPSURL();
- if (url == null)
+ String url1 = ldapsURL;
+ if (url1 == null)
{
- url = getStartTLSURL();
+ url1 = startTLSURL;
}
- if (url == null)
+ if (url1 == null)
{
- url = getLDAPURL();
+ url1 = ldapURL;
}
- return url;
+ return url1;
case USE_LESS_SECURE_AVAILABLE:
- url = getLDAPURL();
- if (url == null)
+ String url2 = ldapURL;
+ if (url2 == null)
{
- url = getStartTLSURL();
+ url2 = startTLSURL;
}
- if (url == null)
+ if (url2 == null)
{
- url = getLDAPSURL();
+ url2 = ldapsURL;
}
- return url;
+ return url2;
default:
throw new RuntimeException("Unknown policy: "+getConnectionPolicy());
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java
index 49a30e7..67eda8b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2009 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
*/
package org.opends.guitools.controlpanel.ui;
@@ -26,6 +26,7 @@
import java.awt.Insets;
import java.awt.Window;
import java.util.HashMap;
+import java.util.Objects;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
@@ -42,7 +43,6 @@
import org.opends.guitools.controlpanel.browser.IconPool;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
-import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.ui.components.TreePanel;
@@ -53,17 +53,12 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
-/**
- * The pane that is displayed when the user clicks on 'General Monitoring'.
- *
- */
+/** The pane that is displayed when the user clicks on 'General Monitoring'. */
public class BrowseGeneralMonitoringPanel extends StatusGenericPanel
{
private static final long serialVersionUID = 6462914563746678830L;
- /**
- * The panel containing the tree.
- */
+ /** The panel containing the tree. */
private TreePanel treePane;
private JScrollPane treeScroll;
@@ -79,10 +74,7 @@
private LocalizableMessage MULTIPLE_ITEMS_SELECTED =
INFO_CTRL_PANEL_MULTIPLE_ITEMS_SELECTED_LABEL.get();
- /**
- * The enumeration used to define the different static nodes of the tree.
- *
- */
+ /** The enumeration used to define the different static nodes of the tree. */
protected enum NodeType
{
/** Root node. */
@@ -101,43 +93,34 @@
PDB_DATABASES_INFORMATION
}
- /**
- * The panel displaying the informations about the selected node.
- */
+ /** The panel displaying the informations about the selected node. */
protected GeneralMonitoringRightPanel entryPane;
- /**
- * Default constructor.
- *
- */
+ /** Default constructor. */
public BrowseGeneralMonitoringPanel()
{
super();
createLayout();
}
- /** {@inheritDoc} */
@Override
public boolean requiresBorder()
{
return false;
}
- /** {@inheritDoc} */
@Override
public boolean requiresScroll()
{
return false;
}
- /** {@inheritDoc} */
@Override
public boolean callConfigurationChangedInBackground()
{
return true;
}
- /** {@inheritDoc} */
@Override
public void toBeDisplayed(boolean visible)
{
@@ -152,9 +135,7 @@
}
}
- /**
- * Creates the layout of the panel (but the contents are not populated here).
- */
+ /** Creates the layout of the panel (but the contents are not populated here). */
private void createLayout()
{
setBackground(ColorAndFontConstants.greyBackground);
@@ -177,28 +158,24 @@
add(createSplitPane(), gbc);
}
- /** {@inheritDoc} */
@Override
public LocalizableMessage getTitle()
{
return INFO_CTRL_PANEL_GENERAL_MONITORING_TITLE.get();
}
- /** {@inheritDoc} */
@Override
public Component getPreferredFocusComponent()
{
return treePane;
}
- /** {@inheritDoc} */
@Override
public void okClicked()
{
// No ok button
}
- /** {@inheritDoc} */
@Override
public GenericDialog.ButtonType getButtonType()
{
@@ -236,7 +213,6 @@
treePane.getTree().addTreeSelectionListener(new TreeSelectionListener()
{
- /** {@inheritDoc} */
public void valueChanged(TreeSelectionEvent ev)
{
if (!ignoreSelectionEvents)
@@ -270,7 +246,6 @@
return pane;
}
- /** {@inheritDoc} */
@Override
public void setInfo(ControlPanelInfo info)
{
@@ -326,9 +301,7 @@
if (!server.isAuthenticated())
{
LocalizableMessageBuilder mb = new LocalizableMessageBuilder();
- mb.append(
- INFO_CTRL_PANEL_AUTH_REQUIRED_TO_BROWSE_MONITORING_SUMMARY.
- get());
+ mb.append(INFO_CTRL_PANEL_AUTH_REQUIRED_TO_BROWSE_MONITORING_SUMMARY.get());
mb.append("<br><br>").append(getAuthenticateHTML());
errorDetails = mb.toMessage();
errorTitle = INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_SUMMARY.get();
@@ -339,8 +312,7 @@
else if (status == ServerDescriptor.ServerStatus.NOT_CONNECTED_TO_REMOTE)
{
LocalizableMessageBuilder mb = new LocalizableMessageBuilder();
- mb.append(INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(
- server.getHostname()));
+ mb.append(INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_DETAILS.get(server.getHostname()));
mb.append("<br><br>").append(getAuthenticateHTML());
errorDetails = mb.toMessage();
errorTitle = INFO_CTRL_PANEL_CANNOT_CONNECT_TO_REMOTE_SUMMARY.get();
@@ -350,9 +322,7 @@
{
errorTitle = INFO_CTRL_PANEL_SERVER_NOT_RUNNING_SUMMARY.get();
LocalizableMessageBuilder mb = new LocalizableMessageBuilder();
- mb.append(
- INFO_CTRL_PANEL_SERVER_MUST_RUN_TO_BROWSE_MONITORING_SUMMARY.
- get());
+ mb.append(INFO_CTRL_PANEL_SERVER_MUST_RUN_TO_BROWSE_MONITORING_SUMMARY.get());
mb.append("<br><br>");
mb.append(getStartServerHTML());
errorDetails = mb.toMessage();
@@ -363,7 +333,6 @@
final LocalizableMessage fErrorDetails = errorDetails;
SwingUtilities.invokeLater(new Runnable()
{
- /** {@inheritDoc} */
public void run()
{
errorPane.setVisible(fDisplayErrorPane);
@@ -389,31 +358,24 @@
ViewPositions pos = Utilities.getViewPositions(treeScroll);
- ServerDescriptor server = null;
- if (getInfo() != null)
- {
- server = getInfo().getServerDescriptor();
- }
- GeneralMonitoringTreeNode root;
- if (server == null)
- {
- root =
- new GeneralMonitoringTreeNode(
- INFO_CTRL_PANEL_GENERAL_MONITORING_ROOT.get().toString(),
- NodeType.ROOT,
- true);
- }
- else
- {
- root =
- new GeneralMonitoringTreeNode(
- getServerName(server),
- NodeType.ROOT,
- true);
- }
+ GeneralMonitoringTreeNode root = new GeneralMonitoringTreeNode(getServerName(), NodeType.ROOT, true);
- LocalizableMessage[] messages = getNodeMessages();
- NodeType[] identifiers = getNodeTypes();
+ LocalizableMessage[] messages = {
+ INFO_CTRL_PANEL_SYSTEM_INFORMATION.get(),
+ INFO_CTRL_PANEL_JAVA_INFORMATION.get(),
+ INFO_CTRL_PANEL_WORK_QUEUE.get(),
+ INFO_CTRL_PANEL_ENTRY_CACHES.get(),
+ INFO_CTRL_PANEL_JE_DB_INFO.get(),
+ INFO_CTRL_PANEL_PDB_DB_INFO.get()
+ };
+ NodeType[] identifiers = {
+ NodeType.SYSTEM_INFORMATION,
+ NodeType.JAVA_INFORMATION,
+ NodeType.WORK_QUEUE,
+ NodeType.ENTRY_CACHES,
+ NodeType.JE_DATABASES_INFORMATION,
+ NodeType.PDB_DATABASES_INFORMATION
+ };
for (int i=0; i < messages.length; i++)
{
if (isVisible(identifiers[i]))
@@ -422,17 +384,26 @@
}
}
- DefaultTreeModel model = new DefaultTreeModel(root);
- tree.setModel(model);
+ tree.setModel(new DefaultTreeModel(root));
Utilities.updateViewPositions(pos);
ignoreSelectionEvents = false;
}
- /**
- * Updates the right entry panel.
- *
- */
+ private String getServerName() {
+ ServerDescriptor server = null;
+ if (getInfo() != null)
+ {
+ server = getInfo().getServerDescriptor();
+ if (server != null)
+ {
+ return getServerName(server);
+ }
+ }
+ return INFO_CTRL_PANEL_GENERAL_MONITORING_ROOT.get().toString();
+}
+
+ /** Updates the right entry panel. */
private void updateEntryPane()
{
ViewPositions pos = Utilities.getViewPositions(entryPane);
@@ -499,16 +470,13 @@
throw new RuntimeException("Unknown node type: "+type);
}
}
+ else if (paths != null && paths.length > 1)
+ {
+ entryPane.displayMessage(MULTIPLE_ITEMS_SELECTED);
+ }
else
{
- if (paths != null && paths.length > 1)
- {
- entryPane.displayMessage(MULTIPLE_ITEMS_SELECTED);
- }
- else
- {
- entryPane.displayMessage(NO_ELEMENT_SELECTED);
- }
+ entryPane.displayMessage(NO_ELEMENT_SELECTED);
}
}
Utilities.updateViewPositions(pos);
@@ -521,48 +489,18 @@
private boolean serverChanged(ServerDescriptor desc)
{
- boolean changed = false;
- if (lastServer != null)
+ if (lastServer == null)
{
- // Just compare the elements interesting for this panel
- changed =
- !desc.getBackends().equals(lastServer.getBackends());
- if (!changed)
- {
- CustomSearchResult[] monitor1 =
- {
- lastServer.getEntryCachesMonitor(),
- lastServer.getJvmMemoryUsageMonitor(),
- lastServer.getRootMonitor(),
- lastServer.getSystemInformationMonitor(),
- lastServer.getWorkQueueMonitor()
- };
- CustomSearchResult[] monitor2 =
- {
- desc.getEntryCachesMonitor(),
- desc.getJvmMemoryUsageMonitor(),
- desc.getRootMonitor(),
- desc.getSystemInformationMonitor(),
- desc.getWorkQueueMonitor()
- };
- for (int i=0; i<monitor1.length && !changed; i++)
- {
- if (monitor1[i] == null)
- {
- changed = monitor2[i] != null;
- }
- else
- {
- changed = !monitor1[i].equals(monitor2[i]);
- }
- }
- }
+ return true;
}
- else
- {
- changed = true;
- }
- return changed;
+
+ // Just compare the elements interesting for this panel
+ return !Objects.equals(desc.getBackends(), lastServer.getBackends())
+ && !Objects.equals(lastServer.getEntryCachesMonitor(), desc.getEntryCachesMonitor())
+ && !Objects.equals(lastServer.getJvmMemoryUsageMonitor(), desc.getJvmMemoryUsageMonitor())
+ && !Objects.equals(lastServer.getRootMonitor(), desc.getRootMonitor())
+ && !Objects.equals(lastServer.getSystemInformationMonitor(), desc.getSystemInformationMonitor())
+ && !Objects.equals(lastServer.getWorkQueueMonitor(), desc.getWorkQueueMonitor());
}
private HashMap<Object, ImageIcon> hmImages = new HashMap<>();
@@ -587,32 +525,29 @@
};
for (int i=0; i<identifiers.length; i++)
{
- hmImages.put(identifiers[i],
- Utilities.createImageIcon(IconPool.IMAGE_PATH+"/"+ocPaths[i],
- getClass().getClassLoader()));
+ hmImages.put(identifiers[i], createImageIcon(ocPaths[i]));
}
}
+ private ImageIcon createImageIcon(LocalizableMessage msg)
+ {
+ return Utilities.createImageIcon(IconPool.IMAGE_PATH + "/" + msg, getClass().getClassLoader());
+ }
+
private String getServerName(ServerDescriptor server)
{
- String serverName = server.getHostname();
if (server.getAdminConnector() != null)
{
- serverName +=":"+server.getAdminConnector().getPort();
+ return server.getHostname() + ":" + server.getAdminConnector().getPort();
}
- return serverName;
+ return server.getHostname();
}
- /**
- * Specific class used to render the nodes in the tree. It uses specific
- * icons for the nodes.
- *
- */
+ /** Specific class used to render the nodes in the tree. It uses specific icons for the nodes. */
protected class GeneralMonitoringTreeCellRenderer extends TreeCellRenderer
{
private static final long serialVersionUID = -3390566664259441766L;
- /** {@inheritDoc} */
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean isSelected, boolean isExpanded, boolean isLeaf, int row,
@@ -626,55 +561,16 @@
private ImageIcon getIcon(Object value)
{
- ImageIcon icon = null;
- if (value instanceof GeneralMonitoringTreeNode)
- {
- icon = hmImages.get(
- ((GeneralMonitoringTreeNode)value).getIdentifier());
- }
- else
+ if (!(value instanceof GeneralMonitoringTreeNode))
{
throw new RuntimeException("Unexpected tree node: "+value);
}
- return icon;
+ return hmImages.get(((GeneralMonitoringTreeNode) value).getIdentifier());
}
}
- /**
- * Returns the labels of the nodes to be displayed.
- * @return the labels of the nodes to be displayed.
- */
- protected LocalizableMessage[] getNodeMessages()
- {
- return new LocalizableMessage[] {
- INFO_CTRL_PANEL_SYSTEM_INFORMATION.get(),
- INFO_CTRL_PANEL_JAVA_INFORMATION.get(),
- INFO_CTRL_PANEL_WORK_QUEUE.get(),
- INFO_CTRL_PANEL_ENTRY_CACHES.get(),
- INFO_CTRL_PANEL_JE_DB_INFO.get(),
- INFO_CTRL_PANEL_PDB_DB_INFO.get()
- };
- }
-
- /**
- * Returns the node types to be displayed.
- * @return the node types to be displayed.
- */
- protected NodeType[] getNodeTypes()
- {
- return new NodeType[] {
- NodeType.SYSTEM_INFORMATION,
- NodeType.JAVA_INFORMATION,
- NodeType.WORK_QUEUE,
- NodeType.ENTRY_CACHES,
- NodeType.JE_DATABASES_INFORMATION,
- NodeType.PDB_DATABASES_INFORMATION
- };
- }
-
private boolean isVisible(NodeType nodetype)
{
- return !(isOEMVersion() && nodetype == NodeType.JE_DATABASES_INFORMATION);
+ return !isOEMVersion() || nodetype != NodeType.JE_DATABASES_INFORMATION;
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
index 8459a18..26437ae 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LocalOrRemotePanel.java
@@ -49,6 +49,7 @@
import org.opends.admin.ads.util.ConnectionWrapper;
import org.opends.guitools.controlpanel.ControlPanelArgumentParser;
import org.opends.guitools.controlpanel.datamodel.ConfigReadException;
+import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.task.OnlineUpdateException;
@@ -74,12 +75,9 @@
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.server.monitors.VersionMonitorProvider.*;
-/**
- * The panel that appears when the user is asked to provide authentication.
- */
+/** The panel that appears when the user is asked to provide authentication. */
public class LocalOrRemotePanel extends StatusGenericPanel
{
-
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
private static final long serialVersionUID = 5051556513294844797L;
@@ -105,14 +103,12 @@
createLayout();
}
- /** {@inheritDoc} */
@Override
public LocalizableMessage getTitle()
{
return INFO_CTRL_PANEL_LOCAL_OR_REMOTE_PANEL_TITLE.get();
}
- /** {@inheritDoc} */
@Override
public GenericDialog.ButtonType getButtonType()
{
@@ -242,9 +238,7 @@
return callOKWhenVisible;
}
- /**
- * Creates the layout of the panel (but the contents are not populated here).
- */
+ /** Creates the layout of the panel (but the contents are not populated here). */
private void createLayout()
{
GridBagConstraints gbc = new GridBagConstraints();
@@ -312,7 +306,6 @@
gbc.gridx = 0;
gbc.gridwidth = 1;
-
localInstallLabel = Utilities.createPrimaryLabel(
INFO_CTRL_PANEL_INSTANCE_PATH_LABEL.get());
gbc.insets.left = 0;
@@ -386,7 +379,6 @@
addBottomGlue(gbc);
}
- /** {@inheritDoc} */
@Override
public Component getPreferredFocusComponent()
{
@@ -397,13 +389,11 @@
return combo;
}
- /** {@inheritDoc} */
@Override
public void configurationChanged(ConfigurationChangeEvent ev)
{
}
- /** {@inheritDoc} */
@Override
public void toBeDisplayed(boolean visible)
{
@@ -422,7 +412,6 @@
return null;
}
-
@Override
public void backgroundTaskCompleted(Void returnValue,
Throwable t)
@@ -449,7 +438,6 @@
}
}
- /** {@inheritDoc} */
@Override
public void okClicked()
{
@@ -522,11 +510,11 @@
BackgroundTask<InitialLdapContext> worker =
new BackgroundTask<InitialLdapContext>()
{
- /** {@inheritDoc} */
@Override
public InitialLdapContext processBackgroundTask() throws Throwable
{
- getInfo().stopPooling();
+ final ControlPanelInfo info = getInfo();
+ info.stopPooling();
if (isLocal)
{
// At least load the local information.
@@ -539,12 +527,12 @@
INFO_CTRL_PANEL_READING_CONFIGURATION_SUMMARY.get());
}
});
- if (getInfo().isLocal() != isLocal)
+ if (info.isLocal() != isLocal)
{
closeInfoConnections();
}
- getInfo().setIsLocal(isLocal);
- getInfo().regenerateDescriptor();
+ info.setIsLocal(isLocal);
+ info.regenerateDescriptor();
if (!isLocalServerRunning)
{
return null;
@@ -555,8 +543,8 @@
{
if (isLocal)
{
- usedUrl = getInfo().getAdminConnectorURL();
- ctx = Utilities.getAdminDirContext(getInfo(), dn.getText(),
+ usedUrl = info.getAdminConnectorURL();
+ ctx = Utilities.getAdminDirContext(info, dn.getText(),
String.valueOf(pwd.getPassword()));
}
else
@@ -565,8 +553,8 @@
Integer.valueOf(port.getText().trim()), true);
ctx = createLdapsContext(usedUrl, dn.getText(),
String.valueOf(pwd.getPassword()),
- getInfo().getConnectTimeout(), null,
- getInfo().getTrustManager(), null);
+ info.getConnectTimeout(), null,
+ info.getTrustManager(), null);
checkVersion(ctx);
}
@@ -580,11 +568,11 @@
}
});
closeInfoConnections();
- getInfo().setIsLocal(isLocal);
- getInfo().setConnection(
- new ConnectionWrapper(ctx, getInfo().getConnectTimeout(), getInfo().getTrustManager()));
- getInfo().setUserDataDirContext(null);
- getInfo().regenerateDescriptor();
+ info.setIsLocal(isLocal);
+ info.setConnection(
+ new ConnectionWrapper(ctx, info.getConnectTimeout(), info.getTrustManager()));
+ info.setUserDataDirContext(null);
+ info.regenerateDescriptor();
return ctx;
} catch (Throwable t)
{
@@ -593,10 +581,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void backgroundTaskCompleted(InitialLdapContext ctx,
- Throwable throwable)
+ public void backgroundTaskCompleted(InitialLdapContext ctx, Throwable throwable)
{
boolean handleCertificateException = false;
boolean localServerErrorConnecting = false;
@@ -605,6 +591,7 @@
{
logger.info(LocalizableMessage.raw("Error connecting: " + throwable, throwable));
+ final ControlPanelInfo info = getInfo();
if (isVersionException(throwable))
{
errors.add(((OpenDsException)throwable).getMessageObject());
@@ -612,7 +599,7 @@
else if (isCertificateException(throwable))
{
ApplicationTrustManager.Cause cause =
- getInfo().getTrustManager().getLastRefusedCause();
+ info.getTrustManager().getLastRefusedCause();
logger.info(LocalizableMessage.raw("Certificate exception cause: "+cause));
UserDataCertificateException.Type excType = null;
@@ -620,16 +607,13 @@
{
excType = UserDataCertificateException.Type.NOT_TRUSTED;
}
- else if (cause ==
- ApplicationTrustManager.Cause.HOST_NAME_MISMATCH)
+ else if (cause == ApplicationTrustManager.Cause.HOST_NAME_MISMATCH)
{
excType = UserDataCertificateException.Type.HOST_NAME_MISMATCH;
}
else
{
- LocalizableMessage msg = getThrowableMsg(
- INFO_ERROR_CONNECTING_TO_LOCAL.get(), throwable);
- errors.add(msg);
+ errors.add(getThrowableMsg(INFO_ERROR_CONNECTING_TO_LOCAL.get(), throwable));
}
if (excType != null)
@@ -649,12 +633,13 @@
h = INFO_NOT_AVAILABLE_LABEL.get().toString();
p = -1;
}
+ ApplicationTrustManager trustMgr = info.getTrustManager();
UserDataCertificateException udce =
new UserDataCertificateException(null,
INFO_CERTIFICATE_EXCEPTION.get(h, p),
throwable, h, p,
- getInfo().getTrustManager().getLastRefusedChain(),
- getInfo().getTrustManager().getLastRefusedAuthType(),
+ trustMgr.getLastRefusedChain(),
+ trustMgr.getLastRefusedAuthType(),
excType);
handleCertificateException(udce);
@@ -667,7 +652,7 @@
String providedDn = dn.getText();
if (isLocal)
{
- Iterator<DN> it = getInfo().getServerDescriptor().
+ Iterator<DN> it = info.getServerDescriptor().
getAdministrativeUsers().iterator();
while (it.hasNext() && !found)
{
@@ -771,7 +756,6 @@
}
}
- /** {@inheritDoc} */
@Override
public void cancelClicked()
{
@@ -922,10 +906,10 @@
String hostName = ConnectionUtils.getHostName(ctx);
- String productName = String.valueOf(getFirstValueAsString(csr, ATTR_PRODUCT_NAME));
- String major = String.valueOf(getFirstValueAsString(csr, ATTR_MAJOR_VERSION));
- String point = String.valueOf(getFirstValueAsString(csr, ATTR_POINT_VERSION));
- String minor = String.valueOf(getFirstValueAsString(csr, ATTR_MINOR_VERSION));
+ String productName = getFirstValueAsString(csr, ATTR_PRODUCT_NAME);
+ String major = getFirstValueAsString(csr, ATTR_MAJOR_VERSION);
+ String point = getFirstValueAsString(csr, ATTR_POINT_VERSION);
+ String minor = getFirstValueAsString(csr, ATTR_MINOR_VERSION);
// Be strict, control panel is only compatible with exactly the same version
if (!productName.equalsIgnoreCase(DynamicConstants.PRODUCT_NAME))
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java
index b767f19..01d71ba 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -70,10 +70,12 @@
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ConsoleApplication;
+import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.Menu;
import com.forgerock.opendj.cli.MenuBuilder;
import com.forgerock.opendj.cli.MenuResult;
import com.forgerock.opendj.cli.ReturnCode;
+import com.forgerock.opendj.cli.StringArgument;
/**
* The class used to provide some CLI interface in the uninstall.
@@ -83,10 +85,8 @@
*
* Once the user has provided all the required information it calls Uninstaller
* and launches it.
- *
*/
public class UninstallCliHelper extends ConsoleApplication {
-
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
private UninstallerArgumentParser parser;
@@ -97,9 +97,7 @@
private boolean useSSL = true;
private boolean useStartTLS;
- /**
- * Default constructor.
- */
+ /** Default constructor. */
public UninstallCliHelper()
{
// Nothing to do.
@@ -135,8 +133,7 @@
boolean isVerbose;
boolean isCanceled = false;
- /* Step 1: analyze the arguments.
- */
+ /* Step 1: analyze the arguments. */
isInteractive = args.isInteractive();
@@ -151,9 +148,7 @@
userData.setConnectTimeout(getConnectTimeout());
- /*
- * Step 2: check that the provided parameters are compatible.
- */
+ /* Step 2: check that the provided parameters are compatible. */
LocalizableMessageBuilder buf = new LocalizableMessageBuilder();
int v = args.validateGlobalOptions(buf);
if (v != ReturnCode.SUCCESS.get())
@@ -245,9 +240,7 @@
info.setConnectTimeout(getConnectTimeout());
info.regenerateDescriptor();
info.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
-
String adminConnectorUrl = info.getAdminConnectorURL();
-
if (adminConnectorUrl == null)
{
logger.warn(LocalizableMessage.raw(
@@ -268,12 +261,11 @@
if (!isCanceled)
{
isCanceled = checkServerState(userData);
- }
-
- if (isCanceled && !userData.isForceOnError())
- {
- logger.info(LocalizableMessage.raw("User cancelled uninstall."));
- userData = null;
+ if (isCanceled && !userData.isForceOnError())
+ {
+ logger.info(LocalizableMessage.raw("User cancelled uninstall."));
+ userData = null;
+ }
}
if (userData != null && !args.isQuiet())
@@ -790,44 +782,47 @@
while (!couldConnect && accepted)
{
-
// This is done because we do not need to ask the user about these parameters.
// If we force their presence the class LDAPConnectionConsoleInteraction will not prompt the user for them.
SecureConnectionCliArgs secureArgsList = parser.getSecureArgsList();
- secureArgsList.getHostNameArg().setPresent(true);
- secureArgsList.getPortArg().setPresent(true);
- secureArgsList.getHostNameArg().clearValues();
- secureArgsList.getHostNameArg().addValue(
- secureArgsList.getHostNameArg().getDefaultValue());
- secureArgsList.getPortArg().clearValues();
- secureArgsList.getPortArg().addValue(
- secureArgsList.getPortArg().getDefaultValue());
- secureArgsList.getBindDnArg().clearValues();
+ StringArgument hostNameArg = secureArgsList.getHostNameArg();
+ hostNameArg.setPresent(true);
+ hostNameArg.clearValues();
+ hostNameArg.addValue(hostNameArg.getDefaultValue());
+
+ IntegerArgument portArg = secureArgsList.getPortArg();
+ portArg.setPresent(true);
+ portArg.clearValues();
+ portArg.addValue(portArg.getDefaultValue());
+
+ StringArgument bindDnArg = secureArgsList.getBindDnArg();
+ bindDnArg.clearValues();
if (uid != null)
{
- secureArgsList.getBindDnArg().addValue(ADSContext.getAdministratorDN(uid));
- secureArgsList.getBindDnArg().setPresent(true);
+ bindDnArg.addValue(ADSContext.getAdministratorDN(uid));
+ bindDnArg.setPresent(true);
}
else
{
- secureArgsList.getBindDnArg().setPresent(false);
+ bindDnArg.setPresent(false);
}
- secureArgsList.getBindPasswordArg().clearValues();
+
+ StringArgument bindPasswordArg = secureArgsList.getBindPasswordArg();
+ bindPasswordArg.clearValues();
if (pwd != null)
{
- secureArgsList.getBindPasswordArg().addValue(pwd);
- secureArgsList.getBindPasswordArg().setPresent(true);
+ bindPasswordArg.addValue(pwd);
+ bindPasswordArg.setPresent(true);
}
else
{
- secureArgsList.getBindPasswordArg().setPresent(false);
+ bindPasswordArg.setPresent(false);
}
if (ci == null)
{
- ci =
- new LDAPConnectionConsoleInteraction(this, parser.getSecureArgsList());
+ ci = new LDAPConnectionConsoleInteraction(this, parser.getSecureArgsList());
ci.setDisplayLdapIfSecureParameters(true);
}
@@ -838,21 +833,19 @@
userData.setAdminPwd(ci.getBindPassword());
info.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
-
String adminConnectorUrl = info.getAdminConnectorURL();
if (adminConnectorUrl == null)
{
- logger.warn(LocalizableMessage.raw(
- "Error retrieving a valid Administration Connector URL in conf file."));
+ logger.warn(LocalizableMessage.raw("Error retrieving a valid Administration Connector URL in conf file."));
LocalizableMessage msg = ERR_COULD_NOT_FIND_VALID_LDAPURL.get();
- throw new ClientException(ReturnCode.APPLICATION_ERROR, msg);
+ throw new ClientException(ReturnCode.APPLICATION_ERROR, msg);
}
try
{
URI uri = new URI(adminConnectorUrl);
int port = uri.getPort();
- secureArgsList.getPortArg().clearValues();
- secureArgsList.getPortArg().addValue(String.valueOf(port));
+ portArg.clearValues();
+ portArg.addValue(String.valueOf(port));
ci.setPortNumber(port);
}
catch (Throwable t)
@@ -862,9 +855,7 @@
updateTrustManager(userData, ci);
info.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
-
adminConnectorUrl = info.getAdminConnectorURL();
-
if (adminConnectorUrl == null)
{
logger.warn(LocalizableMessage.raw(
@@ -948,13 +939,11 @@
boolean serverStarted = false;
Application application = new Application()
{
- /** {@inheritDoc} */
@Override
public String getInstallationPath()
{
return Installation.getLocal().getRootDirectory().getAbsolutePath();
}
- /** {@inheritDoc} */
@Override
public String getInstancePath()
{
@@ -964,75 +953,51 @@
String instancePathFileName = installPath + File.separator + "lib"
+ File.separator + "resource.loc";
File f = new File(instancePathFileName);
-
- if (! f.exists())
+ if (!f.exists())
{
return installPath;
}
- BufferedReader reader;
- try
- {
- reader = new BufferedReader(new FileReader(instancePathFileName));
- }
- catch (Exception e)
- {
- return installPath;
- }
-
-
// Read the first line and close the file.
- String line;
- try
+ try (BufferedReader reader = new BufferedReader(new FileReader(instancePathFileName)))
{
- line = reader.readLine();
+ String line = reader.readLine();
return new File(line).getAbsolutePath();
}
catch (Exception e)
{
return installPath;
}
- finally
- {
- StaticUtils.close(reader);
- }
}
- /** {@inheritDoc} */
@Override
public ProgressStep getCurrentProgressStep()
{
return UninstallProgressStep.NOT_STARTED;
}
- /** {@inheritDoc} */
@Override
public Integer getRatio(ProgressStep step)
{
return 0;
}
- /** {@inheritDoc} */
@Override
public LocalizableMessage getSummary(ProgressStep step)
{
return null;
}
- /** {@inheritDoc} */
@Override
public boolean isFinished()
{
return false;
}
- /** {@inheritDoc} */
@Override
public boolean isCancellable()
{
return false;
}
- /** {@inheritDoc} */
@Override
public void cancel()
{
}
- /** {@inheritDoc} */
@Override
public void run()
{
@@ -1055,13 +1020,14 @@
Installation.getLocal());
try
{
- if (!suppressOutput)
+ if (suppressOutput)
+ {
+ controller.startServer(true);
+ }
+ else
{
println();
- }
- controller.startServer(suppressOutput);
- if (!suppressOutput)
- {
+ controller.startServer(false);
println();
}
serverStarted = Installation.getLocal().getStatus().isServerRunning();
@@ -1192,8 +1158,7 @@
logger.error(LocalizableMessage.raw("Error parsing url: "+adminConnectorUrl));
}
ctx = createAdministrativeContext(host, port, useSSL, useStartTLS, dn,
- pwd, getConnectTimeout(),
- userData.getTrustManager());
+ pwd, getConnectTimeout(), userData.getTrustManager());
ConnectionWrapper connWrapper = new ConnectionWrapper(ctx, getConnectTimeout(), userData.getTrustManager());
ADSContext adsContext = new ADSContext(connWrapper);
@@ -1233,11 +1198,9 @@
{
logger.warn(LocalizableMessage.raw("Error connecting to server: "+te, te));
exceptionMsg = Utils.getMessage(te);
-
} catch (ClientException ce)
{
throw ce;
-
} catch (Throwable t)
{
logger.warn(LocalizableMessage.raw("Error connecting to server: "+t, t));
@@ -1435,47 +1398,31 @@
return returnValue;
}
- /** {@inheritDoc} */
@Override
public boolean isAdvancedMode() {
return false;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isInteractive() {
return !forceNonInteractive && parser.isInteractive();
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isMenuDrivenMode() {
return true;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isQuiet() {
return false;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isScriptFriendly() {
return false;
}
-
-
- /** {@inheritDoc} */
@Override
public boolean isVerbose() {
return true;
@@ -1507,12 +1454,7 @@
userData.setTrustManager(trust);
}
-
-
- /**
- * Forces the initialization of the trust manager in the
- * LDAPConnectionInteraction object.
- */
+ /** Forces the initialization of the trust manager in the LDAPConnectionInteraction object. */
private void forceTrustManagerInitialization()
{
forceNonInteractive = true;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
index 5cc625c..e17c35d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/status/StatusCli.java
@@ -86,7 +86,9 @@
import com.forgerock.opendj.cli.CliConstants;
import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ConsoleApplication;
+import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.ReturnCode;
+import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.TableBuilder;
import com.forgerock.opendj.cli.TextTablePrinter;
@@ -135,7 +137,6 @@
*
* @param args The command-line arguments provided to this program.
*/
-
public static void main(String[] args)
{
int retCode = mainCLI(args, true, System.out, System.err, System.in);
@@ -267,11 +268,9 @@
// parameters. We force their presence in the
// LDAPConnectionConsoleInteraction, this done, it will not prompt
// the user for them.
- final SecureConnectionCliArgs secureArgsList = argParser.getSecureArgsList();
controlInfo.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
+ String ldapUrl = controlInfo.getAdminConnectorURL();
int port = CliConstants.DEFAULT_ADMINISTRATION_CONNECTOR_PORT;
- controlInfo.setConnectionPolicy(ConnectionProtocolPolicy.USE_ADMIN);
- String ldapUrl = controlInfo.getURLToConnect();
try
{
final URI uri = new URI(ldapUrl);
@@ -281,16 +280,19 @@
{
logger.error(LocalizableMessage.raw("Error parsing url: " + ldapUrl));
}
- secureArgsList.getHostNameArg().setPresent(true);
- secureArgsList.getPortArg().setPresent(true);
- secureArgsList.getHostNameArg().addValue(secureArgsList.getHostNameArg().getDefaultValue());
- secureArgsList.getPortArg().addValue(Integer.toString(port));
+ final SecureConnectionCliArgs secureArgsList = argParser.getSecureArgsList();
+ final StringArgument hostNameArg = secureArgsList.getHostNameArg();
+ hostNameArg.setPresent(true);
+ hostNameArg.addValue(hostNameArg.getDefaultValue());
+ final IntegerArgument portArg = secureArgsList.getPortArg();
+ portArg.setPresent(true);
+ portArg.addValue(Integer.toString(port));
// We already know if SSL or StartTLS can be used. If we cannot
// use them we will not propose them in the connection parameters
// and if none of them can be used we will just not ask for the
// protocol to be used.
final LDAPConnectionConsoleInteraction ci =
- new LDAPConnectionConsoleInteraction(this, argParser.getSecureArgsList(), ALLOW_ANONYMOUS_IF_NON_INTERACTIVE);
+ new LDAPConnectionConsoleInteraction(this, secureArgsList, ALLOW_ANONYMOUS_IF_NON_INTERACTIVE);
try
{
ci.run(false);
@@ -1108,38 +1110,32 @@
return argParser.getTrustManager();
}
- /** {@inheritDoc} */
@Override
public boolean isAdvancedMode()
{
return false;
}
- /** {@inheritDoc} */
@Override
public boolean isInteractive() {
return argParser.isInteractive();
}
- /** {@inheritDoc} */
@Override
public boolean isMenuDrivenMode() {
return true;
}
- /** {@inheritDoc} */
@Override
public boolean isQuiet() {
return false;
}
- /** {@inheritDoc} */
@Override
public boolean isScriptFriendly() {
return argParser.isScriptFriendly();
}
- /** {@inheritDoc} */
@Override
public boolean isVerbose() {
return true;
--
Gitblit v1.10.0