From f298aaee8802d3eaad4ff712ed088546586388d8 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 24 Oct 2014 09:47:16 +0000
Subject: [PATCH] More code cleanup of ReplicationCliMain Removed utility methods that are just forwarding to other utility methods. Removed methods that have been ported to com.forgerock.opendj.cli.Utils.
---
opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java | 48 ++++++++++++++++--------------------------------
1 files changed, 16 insertions(+), 32 deletions(-)
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
index 5347b9d..8834ec3 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -27,8 +27,6 @@
package org.opends.guitools.controlpanel.datamodel;
-import static com.forgerock.opendj.util.OperatingSystem.isWindows;
-
import java.io.File;
import java.net.InetAddress;
import java.util.Collection;
@@ -67,6 +65,11 @@
import com.forgerock.opendj.cli.CliConstants;
+import static com.forgerock.opendj.cli.Utils.*;
+import static com.forgerock.opendj.util.OperatingSystem.*;
+
+import static org.opends.admin.ads.util.ConnectionUtils.*;
+
/**
* This is the classes that is shared among all the different places in the
* Control Panel. It contains information about the server status and
@@ -248,16 +251,14 @@
toRemove.add(i);
}
}
+
if (!toRemove.isEmpty())
{
boolean returnValue = modifiedIndexes.removeAll(toRemove);
indexModified(toRemove.iterator().next());
return returnValue;
}
- else
- {
- return false;
- }
+ return false;
}
/**
@@ -566,11 +567,11 @@
}
else if (lastRemoteAdministrationURL != null)
{
- ctx = Utils.createLdapsContext(lastRemoteAdministrationURL,
+ ctx = createLdapsContext(lastRemoteAdministrationURL,
lastWorkingBindDN,
lastWorkingBindPwd,
getConnectTimeout(), null,
- getTrustManager());
+ getTrustManager(), null);
}
}
catch (ConfigReadException cre)
@@ -819,7 +820,6 @@
regenerateDescriptor();
Thread.sleep(poolingPeriod);
}
-
}
catch (Throwable t)
{
@@ -944,10 +944,7 @@
// been called).
return localAdminConnectorURL;
}
- else
- {
- return adminConnectorURL;
- }
+ return adminConnectorURL;
}
/**
@@ -1033,9 +1030,7 @@
}
else
{
- url = sProtocol +"://"+
- ConnectionUtils.getHostNameForLdapUrl(server.getHostname())+
- ":"+port;
+ url = sProtocol + "://" + getHostNameForLdapUrl(server.getHostname()) + ":" + port;
}
}
}
@@ -1046,16 +1041,11 @@
if (server.isLocal())
{
InetAddress address = addresses.first();
- url = sProtocol +"://"+
- ConnectionUtils.getHostNameForLdapUrl(address.getHostAddress())+
- ":"+
- port;
+ url = sProtocol + "://" + getHostNameForLdapUrl(address.getHostAddress()) + ":" + port;
}
else
{
- url = sProtocol +"://"+
- ConnectionUtils.getHostNameForLdapUrl(server.getHostname())+
- ":"+port;
+ url = sProtocol + "://" + getHostNameForLdapUrl(server.getHostname()) + ":" + port;
}
}
}
@@ -1072,8 +1062,6 @@
* @return the Administration Connector URL.
*/
private static String getAdminConnectorURL(ServerDescriptor server) {
- String url = null;
-
ConnectionHandlerDescriptor desc = server.getAdminConnector();
if (desc != null)
{
@@ -1081,21 +1069,17 @@
SortedSet<InetAddress> addresses = desc.getAddresses();
if (addresses.size() == 0) {
if (port > 0) {
- url = ConnectionUtils.getLDAPUrl("localhost", port, true);
+ return getLDAPUrl("localhost", port, true);
}
} else {
if (port > 0) {
InetAddress address = addresses.first();
String a = address.getHostAddress();
- url = ConnectionUtils.getLDAPUrl(a, port, true);
+ return getLDAPUrl(a, port, true);
}
}
}
- else
- {
- url = null;
- }
- return url;
+ return null;
}
/**
--
Gitblit v1.10.0