From 01bf9b6a5d324d45355659581e9ebbd1280834fe Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 25 Apr 2016 14:41:26 +0000
Subject: [PATCH] Improvements suggested by UCDetector: remove dead code, add final keywords, change visibilities
---
opendj-server-legacy/src/main/java/org/opends/quicksetup/QuickSetupCli.java | 27
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupStepPanel.java | 21
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupPanel.java | 15
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java | 4
opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginResult.java | 34
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericFrame.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java | 18
opendj-server-legacy/src/main/java/org/opends/server/api/AttributeSyntax.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java | 10
opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java | 30
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionUtils.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java | 19
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java | 41
opendj-server-legacy/src/main/java/org/opends/quicksetup/ReturnCode.java | 5
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CategoryPanel.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupListPanel.java | 11
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java | 44
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CustomHTMLEditorKit.java | 10
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java | 6
opendj-server-legacy/src/main/java/org/opends/quicksetup/Configuration.java | 18
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java | 30
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ViewPositions.java | 20
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java | 3
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/DndBrowserNodes.java | 2
opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java | 127 ---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WorkQueueMonitoringPanel.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VerifyIndexPanel.java | 4
opendj-server-legacy/src/main/java/org/opends/quicksetup/SecurityOptions.java | 6
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java | 11
opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ProgressDialog.java | 12
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomListCellRenderer.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/BasicNode.java | 10
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/Utilities.java | 24
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexDescriptor.java | 4
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java | 54 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionHandlersMonitoringTableModel.java | 8
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java | 38
opendj-server-legacy/src/main/java/org/opends/quicksetup/Launcher.java | 24
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java | 29
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/DataReplicationOptions.java | 2
opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java | 15
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigReader.java | 2
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java | 50 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ExportLDIFPanel.java | 4
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ConfiguredDomain.java | 10
opendj-server-legacy/src/test/java/org/opends/quicksetup/util/UtilsTest.java | 32
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java | 9
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/TaskCellRenderer.java | 4
opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/Requests.java | 43 -
opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java | 3
opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/AddRemovePanel.java | 6
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericDialog.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/ObjectClassCellPanel.java | 19
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomCellRenderer.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java | 4
opendj-server-legacy/src/main/java/org/opends/quicksetup/Application.java | 59 -
opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPStatistics.java | 27
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java | 6
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexTableModel.java | 10
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupDialog.java | 58 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionProtocolPolicy.java | 31
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java | 76 +
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java | 8
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupPanel.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardAttributePanel.java | 79 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java | 8
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java | 149 +--
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/StepsPanel.java | 16
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/RebuildIndexTask.java | 6
opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheFilter.java | 6
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java | 27
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RestorePanel.java | 18
opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginType.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java | 42
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java | 40
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericMenuBar.java | 6
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainMenuBar.java | 8
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/BrowserCellRenderer.java | 21
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java | 111 --
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusPanel.java | 15
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java | 344 +-------
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractNewEntryPanel.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainActionsPane.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BinaryAttributeEditorPanel.java | 4
opendj-server-legacy/src/main/java/org/opends/quicksetup/JavaArguments.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java | 4
opendj-server-legacy/src/main/java/org/opends/server/api/DITCacheMap.java | 10
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/SuperiorObjectClassesEditor.java | 56 -
opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java | 11
95 files changed, 750 insertions(+), 1,484 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheFilter.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheFilter.java
index 87ebe58..5d4210f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheFilter.java
@@ -36,7 +36,7 @@
* @return <CODE>true</CODE> if we must search base DN information and
* <CODE>false</CODE> otherwise.
*/
- public boolean searchBaseDNInformation()
+ boolean searchBaseDNInformation()
{
return searchBaseDNInformation;
}
@@ -58,7 +58,7 @@
* @return <CODE>true</CODE> if we must search monitoring information and
* <CODE>false</CODE> otherwise.
*/
- public boolean searchMonitoringInformation()
+ boolean searchMonitoringInformation()
{
return searchMonitoringInformation;
}
@@ -100,7 +100,7 @@
* @return <CODE>true</CODE> if the filter specifies to search for all the
* base DNs and <CODE>false</CODE> otherwise.
*/
- public boolean searchAllBaseDNs()
+ boolean searchAllBaseDNs()
{
return baseDNs.isEmpty();
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionUtils.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionUtils.java
index 8a3a55f..8b7052e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionUtils.java
@@ -489,7 +489,7 @@
* @return <CODE>true</CODE> if we are connected and read the configuration
* and <CODE>false</CODE> otherwise.
*/
- public static boolean connectedAsAdministrativeUser(InitialLdapContext ctx)
+ static boolean connectedAsAdministrativeUser(InitialLdapContext ctx)
{
try
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
index 34ab23a..346553f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
@@ -99,7 +99,7 @@
* @param conn the connection we retrieve the information from.
* @return a preferred connection object.
*/
- public static PreferredConnection getPreferredConnection(ConnectionWrapper conn)
+ private static PreferredConnection getPreferredConnection(ConnectionWrapper conn)
{
InitialLdapContext ctx = conn.getLdapContext();
String ldapUrl = ConnectionUtils.getLdapUrl(ctx);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java
index c68afd3..628c663 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java
@@ -84,12 +84,12 @@
private SearchResult localEntry;
private SearchResult remoteEntry;
- LDAPURL remoteUrl;
+ private LDAPURL remoteUrl;
private boolean isLeafNode;
private final List<SearchResult> childEntries = new ArrayList<>();
- final boolean differential;
- Exception exception;
- Object exceptionArg;
+ private final boolean differential;
+ private Exception exception;
+ private Object exceptionArg;
/**
* The constructor of the refresher object.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexDescriptor.java
index e84d6fa..61a8e8a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexDescriptor.java
@@ -14,15 +14,15 @@
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2016 ForgeRock AS.
*/
-
package org.opends.guitools.controlpanel.datamodel;
/** Abstract class used to describe the configuration of an index. */
public abstract class AbstractIndexDescriptor
implements Comparable<AbstractIndexDescriptor>
{
- private String name;
+ private final String name;
private BackendDescriptor backend;
+
/**
* Constructor.
* @param name the name of the index.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexTableModel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexTableModel.java
index fafc5d6..f9da2c1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexTableModel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/AbstractIndexTableModel.java
@@ -14,17 +14,17 @@
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2014-2016 ForgeRock AS.
*/
-
package org.opends.guitools.controlpanel.datamodel;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import org.opends.messages.AdminToolMessages;
import org.forgerock.i18n.LocalizableMessage;
+import org.opends.messages.AdminToolMessages;
/**
* Table Model used to store information about indexes. It is used basically
@@ -35,9 +35,9 @@
implements Comparator<AbstractIndexDescriptor>
{
private static final long serialVersionUID = -5131878622200568636L;
- private Set<AbstractIndexDescriptor> data = new HashSet<>();
- private ArrayList<String[]> dataArray = new ArrayList<>();
- private ArrayList<AbstractIndexDescriptor> indexArray = new ArrayList<>();
+ private final Set<AbstractIndexDescriptor> data = new HashSet<>();
+ private final List<String[]> dataArray = new ArrayList<>();
+ private final List<AbstractIndexDescriptor> indexArray = new ArrayList<>();
private final String[] COLUMN_NAMES = getColumnNames();
/** The sort column of the table. */
protected int sortColumn;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionHandlersMonitoringTableModel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionHandlersMonitoringTableModel.java
index 28005cb..edc8e16 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionHandlersMonitoringTableModel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionHandlersMonitoringTableModel.java
@@ -174,10 +174,10 @@
*/
class AddressConnectionHandlerDescriptor
{
- private ConnectionHandlerDescriptor ch;
- private InetAddress address;
- private CustomSearchResult monitoringEntry;
- private int hashCode;
+ private final ConnectionHandlerDescriptor ch;
+ private final InetAddress address;
+ private final CustomSearchResult monitoringEntry;
+ private final int hashCode;
/**
* Constructor of this data structure.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionProtocolPolicy.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionProtocolPolicy.java
index 8da3e7b..4aef33e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionProtocolPolicy.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ConnectionProtocolPolicy.java
@@ -14,11 +14,9 @@
* Copyright 2008 Sun Microsystems, Inc.
* Portions Copyright 2016 ForgeRock AS.
*/
-
package org.opends.guitools.controlpanel.datamodel;
-
- /** Policy to follow to choose the protocol to be used. */
+/** Policy to follow to choose the protocol to be used. */
public enum ConnectionProtocolPolicy
{
/** Force to use Start TLS. */
@@ -33,31 +31,4 @@
USE_MOST_SECURE_AVAILABLE,
/** Use the less secure available (LDAP, and then LDAPs). */
USE_LESS_SECURE_AVAILABLE;
-
- /**
- * Returns the ConnectionProtocolPolicy to be used with the parameters
- * provided by the user.
- * @param useSSL whether the user asked to use SSL or not.
- * @param useStartTLS whether the user asked to use Start TLS or not.
- * @return the ConnectionProtocolPolicy to be used with the parameters
- * provided by the user.
- */
- public static ConnectionProtocolPolicy getConnectionPolicy(boolean useSSL,
- boolean useStartTLS)
- {
- ConnectionProtocolPolicy policy;
- if (useStartTLS)
- {
- policy = ConnectionProtocolPolicy.USE_STARTTLS;
- }
- else if (useSSL)
- {
- policy = ConnectionProtocolPolicy.USE_LDAPS;
- }
- else
- {
- policy = ConnectionProtocolPolicy.USE_LESS_SECURE_AVAILABLE;
- }
- return policy;
- }
}
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 428e0c6..837dd2e 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
@@ -80,7 +80,7 @@
private static boolean mustDeregisterConfig;
private static ControlPanelInfo instance;
- private Set<Task> tasks = new HashSet<>();
+ private final Set<Task> tasks = new HashSet<>();
private ConnectionWrapper connWrapper;
private InitialLdapContext userDataCtx;
private final LDAPConnectionPool connectionPool = new LDAPConnectionPool();
@@ -176,7 +176,7 @@
* Unregisters a task.
* @param task the task to be unregistered.
*/
- public void unregisterTask(Task task)
+ private void unregisterTask(Task task)
{
tasks.remove(task);
}
@@ -385,7 +385,7 @@
* the index listeners that an index has been modified.
* @param modifiedIndex the modified index.
*/
- public void indexModified(AbstractIndexDescriptor modifiedIndex)
+ private void indexModified(AbstractIndexDescriptor modifiedIndex)
{
IndexModifiedEvent ev = new IndexModifiedEvent(modifiedIndex);
for (IndexModifiedListener listener : indexListeners)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/RebuildIndexTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/RebuildIndexTask.java
index 34dbd00..c1aa36e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/RebuildIndexTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/RebuildIndexTask.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2012-2015 ForgeRock AS.
+ * Portions Copyright 2012-2016 ForgeRock AS.
*/
package org.opends.guitools.controlpanel.task;
@@ -44,7 +44,7 @@
*/
public class RebuildIndexTask extends IndexTask
{
- private SortedSet<AbstractIndexDescriptor> indexes = new TreeSet<>();
+ private final SortedSet<AbstractIndexDescriptor> indexes = new TreeSet<>();
/**
* The indexes that must not be specified in the command-line.
@@ -187,7 +187,7 @@
* @return the command line arguments required to rebuild the indexes in the
* specified base DN.
*/
- protected List<String> getCommandLineArguments(String baseDN)
+ private List<String> getCommandLineArguments(String baseDN)
{
List<String> args = new ArrayList<>();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java
index 4f32520..11d737d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java
@@ -69,8 +69,8 @@
*/
public abstract class Task
{
- private static String localHostName = UserData.getDefaultHostName();
- private String binDir;
+ private static final String localHostName = UserData.getDefaultHostName();
+ private static final int MAX_BINARY_LENGTH_TO_DISPLAY = 1024;
/** The different task types. */
public enum Type
@@ -161,17 +161,15 @@
* a bug, because of the way the contents of logs is updated, using
* StringBuffer instead of StringBuilder is required.
*/
- private StringBuffer logs = new StringBuffer();
+ private final StringBuffer logs = new StringBuffer();
/** The error logs of the task. */
- private StringBuilder errorLogs = new StringBuilder();
+ private final StringBuilder errorLogs = new StringBuilder();
/** The standard output logs of the task. */
- private StringBuilder outputLogs = new StringBuilder();
+ private final StringBuilder outputLogs = new StringBuilder();
/** The print stream for the error logs. */
- protected ApplicationPrintStream errorPrintStream =
- new ApplicationPrintStream();
+ protected final ApplicationPrintStream errorPrintStream = new ApplicationPrintStream();
/** The print stream for the standard output logs. */
- protected ApplicationPrintStream outPrintStream =
- new ApplicationPrintStream();
+ protected final ApplicationPrintStream outPrintStream = new ApplicationPrintStream();
/**
* The process (if any) that the task launched. For instance if this is a
@@ -179,15 +177,11 @@
* command-line.
*/
private Process process;
- private ControlPanelInfo info;
-
- private ServerDescriptor server;
-
- private ProgressDialog progressDialog;
-
- private ArrayList<ConfigurationElementCreatedListener> confListeners = new ArrayList<>();
-
- private static int MAX_BINARY_LENGTH_TO_DISPLAY = 1024;
+ private final ControlPanelInfo info;
+ private final ServerDescriptor server;
+ private String binDir;
+ private final ProgressDialog progressDialog;
+ private final List<ConfigurationElementCreatedListener> confListeners = new ArrayList<>();
/**
* Constructor of the task.
@@ -419,7 +413,7 @@
* @return the obfuscated String representing the attribute value to be
* displayed in the logs of the user.
*/
- protected String obfuscateAttributeStringValue(String attrName, Object o)
+ private String obfuscateAttributeStringValue(String attrName, Object o)
{
if (Utilities.mustObfuscate(attrName,
getInfo().getServerDescriptor().getSchema()))
@@ -557,7 +551,7 @@
* Returns the binary/script directory.
* @return the binary/script directory.
*/
- protected String getBinaryDir()
+ private String getBinaryDir()
{
if (binDir == null)
{
@@ -826,7 +820,7 @@
* @param mods the modifications.
* @param useAdminCtx use the administration connector.
*/
- protected void printEquivalentCommandToModify(String dn,
+ private void printEquivalentCommandToModify(String dn,
Collection<ModificationItem> mods, boolean useAdminCtx)
{
ArrayList<String> args = new ArrayList<>(getObfuscatedCommandLineArguments(
@@ -946,7 +940,7 @@
* @return <CODE>true</CODE> if the attribute must be displayed using base 64
* and <CODE>false</CODE> otherwise.
*/
- protected boolean displayBase64(String attrName)
+ private boolean displayBase64(String attrName)
{
Schema schema = null;
if (getInfo() != null)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
index f7c3212..42c0de0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
@@ -16,9 +16,10 @@
*/
package org.opends.guitools.controlpanel.ui;
+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.*;
import java.awt.Component;
import java.awt.GridBagConstraints;
@@ -107,7 +108,7 @@
* when the user can choose a set of entries (for instance when the user adds a
* member to a group in the 'New Group' dialog).
*/
-public abstract class AbstractBrowseEntriesPanel extends StatusGenericPanel implements BackendPopulatedListener
+abstract class AbstractBrowseEntriesPanel extends StatusGenericPanel implements BackendPopulatedListener
{
private static final long serialVersionUID = -6063927039968115236L;
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -158,7 +159,7 @@
private Object lastSelectedBaseDN;
private boolean ignoreBaseDNEvents;
- private List<DN> otherBaseDns = new ArrayList<>();
+ private final List<DN> otherBaseDns = new ArrayList<>();
/** Default constructor. */
public AbstractBrowseEntriesPanel()
@@ -947,6 +948,7 @@
@Override
public void treeNodesChanged(TreeModelEvent e)
{
+ // no-op
}
@Override
@@ -1576,9 +1578,9 @@
* left. The class simply handles this particular case to not to have that
* inset for the 'All Base DNs' item.
*/
- class CustomComboBoxCellRenderer extends CustomListCellRenderer
+ private class CustomComboBoxCellRenderer extends CustomListCellRenderer
{
- private LocalizableMessage ALL_BASE_DNS_STRING = INFO_CTRL_PANEL_ALL_BASE_DNS.get();
+ private final LocalizableMessage ALL_BASE_DNS_STRING = INFO_CTRL_PANEL_ALL_BASE_DNS.get();
/**
* The constructor.
@@ -1586,7 +1588,7 @@
* @param combo
* the combo box to be rendered.
*/
- CustomComboBoxCellRenderer(JComboBox<?> combo)
+ private CustomComboBoxCellRenderer(JComboBox<?> combo)
{
super(combo);
}
@@ -1684,12 +1686,12 @@
* before updating the number of entries and with this approach there is
* hardly no impact on the reactivity of the UI.
*/
- protected class NumberOfEntriesUpdater extends Thread
+ private class NumberOfEntriesUpdater extends Thread
{
private boolean recalculate;
/** Notifies that the number of entries in the browser has changed. */
- public void recalculate()
+ private void recalculate()
{
recalculate = true;
}
@@ -1706,6 +1708,7 @@
}
catch (Throwable t)
{
+ // ignore
}
if (recalculate)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractNewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractNewEntryPanel.java
index c716f3d..c375bbb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractNewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractNewEntryPanel.java
@@ -265,7 +265,7 @@
* @return <CODE>true</CODE> if the schema must be checked and
* <CODE>false</CODE> otherwise.
*/
- protected boolean checkSchema()
+ private boolean checkSchema()
{
return getInfo().getServerDescriptor().isSchemaEnabled();
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupListPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupListPanel.java
index d589efb..f74acf5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupListPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupListPanel.java
@@ -12,17 +12,16 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2015 ForgeRock AS.
+ * Portions Copyright 2011-2016 ForgeRock AS.
*/
-
package org.opends.guitools.controlpanel.ui;
+import static com.forgerock.opendj.util.OperatingSystem.*;
+
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
-import static com.forgerock.opendj.util.OperatingSystem.*;
-
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
@@ -73,10 +72,10 @@
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
/** The refreshing list message, displayed when the list of backups is refreshed. */
- protected static final LocalizableMessage REFRESHING_LIST = INFO_CTRL_PANEL_REFRESHING_LIST_SUMMARY.get();
+ private static final LocalizableMessage REFRESHING_LIST = INFO_CTRL_PANEL_REFRESHING_LIST_SUMMARY.get();
/** The message informing that no backups where found. */
- protected static final LocalizableMessage NO_BACKUPS_FOUND = INFO_CTRL_PANEL_NO_BACKUPS_FOUND.get();
+ private static final LocalizableMessage NO_BACKUPS_FOUND = INFO_CTRL_PANEL_NO_BACKUPS_FOUND.get();
private static final String DUMMY_PARENT_PATH = "/local/OpenDJ-X.X.X/bak";
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupPanel.java
index bd0c048..d1da240 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BackupPanel.java
@@ -610,7 +610,7 @@
}
/** Class that launches the backup. */
- protected class BackupTask extends Task
+ private class BackupTask extends Task
{
private Set<String> backendSet;
private String dir;
@@ -619,7 +619,7 @@
* @param info the control panel info.
* @param dlg the progress dialog that shows the progress of the task.
*/
- public BackupTask(ControlPanelInfo info, ProgressDialog dlg)
+ private BackupTask(ControlPanelInfo info, ProgressDialog dlg)
{
super(info, dlg);
backendSet = new HashSet<>();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BinaryAttributeEditorPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BinaryAttributeEditorPanel.java
index 78b0f11..4d9d15b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BinaryAttributeEditorPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BinaryAttributeEditorPanel.java
@@ -626,7 +626,7 @@
* user provides a path value through the JFileChooser associated with the
* browse button.
*/
- class CustomBrowseActionListener extends BrowseActionListener
+ private class CustomBrowseActionListener extends BrowseActionListener
{
/**
* Constructor of this listener.
@@ -635,7 +635,7 @@
* @param parent the parent component to be used as reference to display
* the file chooser dialog.
*/
- public CustomBrowseActionListener(JTextComponent field, BrowseType type,
+ private CustomBrowseActionListener(JTextComponent field, BrowseType type,
Component parent)
{
super(field, type, parent);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
index 9578817..c44e81b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
@@ -62,6 +62,9 @@
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.TreePath;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.guitools.controlpanel.browser.NodeRefresher;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
@@ -76,9 +79,6 @@
import org.opends.guitools.controlpanel.ui.nodes.DndBrowserNodes;
import org.opends.guitools.controlpanel.util.LDAPEntryReader;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.Schema;
import org.opends.server.util.ServerConstants;
@@ -1101,28 +1101,28 @@
}
/** The specific menu bar of this panel. */
- class BrowseMenuBar extends GenericMenuBar
+ private class BrowseMenuBar extends GenericMenuBar
{
private static final long serialVersionUID = 505187832236882370L;
- JMenuItem deleteMenuItem;
- JMenuItem copyDNMenuItem;
- JMenuItem addToGroupMenuItem;
- JMenuItem resetPasswordMenuItem;
- JMenuItem newUserMenuItem;
- JMenuItem newGroupMenuItem;
- JMenuItem newOUMenuItem;
- JMenuItem newOrganizationMenuItem;
- JMenuItem newDomainMenuItem;
- JMenuItem newEntryFromLDIFMenuItem;
- JMenuItem duplicateEntryMenuItem;
- JMenuItem deleteBaseDNMenuItem;
- JMenuItem deleteBackendMenuItem;
+ private JMenuItem deleteMenuItem;
+ private JMenuItem copyDNMenuItem;
+ private JMenuItem addToGroupMenuItem;
+ private JMenuItem resetPasswordMenuItem;
+ private JMenuItem newUserMenuItem;
+ private JMenuItem newGroupMenuItem;
+ private JMenuItem newOUMenuItem;
+ private JMenuItem newOrganizationMenuItem;
+ private JMenuItem newDomainMenuItem;
+ private JMenuItem newEntryFromLDIFMenuItem;
+ private JMenuItem duplicateEntryMenuItem;
+ private JMenuItem deleteBaseDNMenuItem;
+ private JMenuItem deleteBackendMenuItem;
/**
* Constructor.
* @param info the control panel info.
*/
- public BrowseMenuBar(ControlPanelInfo info)
+ private BrowseMenuBar(ControlPanelInfo info)
{
super(info);
add(createFileMenuBar());
@@ -1170,7 +1170,7 @@
* Creates the view menu bar.
* @return the view menu bar.
*/
- protected JMenu createViewMenuBar()
+ private JMenu createViewMenuBar()
{
JMenu menu = Utilities.createMenu(
INFO_CTRL_PANEL_VIEW_MENU.get(),
@@ -1306,7 +1306,7 @@
* Creates the entries menu bar.
* @return the entries menu bar.
*/
- protected JMenu createEntriesMenuBar()
+ private JMenu createEntriesMenuBar()
{
JMenu menu = Utilities.createMenu(
INFO_CTRL_PANEL_ENTRIES_MENU.get(),
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java
index 9509cbf..f5b998e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java
@@ -31,6 +31,7 @@
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map;
import javax.swing.Box;
import javax.swing.DefaultComboBoxModel;
@@ -53,6 +54,7 @@
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.browser.IconPool;
import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
@@ -60,7 +62,13 @@
import org.opends.guitools.controlpanel.datamodel.IndexDescriptor;
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor;
-import org.opends.guitools.controlpanel.event.*;
+import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
+import org.opends.guitools.controlpanel.event.ConfigurationElementCreatedEvent;
+import org.opends.guitools.controlpanel.event.ConfigurationElementCreatedListener;
+import org.opends.guitools.controlpanel.event.IndexModifiedEvent;
+import org.opends.guitools.controlpanel.event.IndexModifiedListener;
+import org.opends.guitools.controlpanel.event.IndexSelectionEvent;
+import org.opends.guitools.controlpanel.event.IndexSelectionListener;
import org.opends.guitools.controlpanel.task.DeleteIndexTask;
import org.opends.guitools.controlpanel.task.Task;
import org.opends.guitools.controlpanel.ui.components.CustomTree;
@@ -72,15 +80,14 @@
import org.opends.guitools.controlpanel.ui.renderer.TreeCellRenderer;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.guitools.controlpanel.util.ViewPositions;
-import org.forgerock.i18n.LocalizableMessage;
/** The pane that is displayed when the user clicks on 'Browse Indexes'. */
-public class BrowseIndexPanel extends StatusGenericPanel
+class BrowseIndexPanel extends StatusGenericPanel
implements IndexModifiedListener
{
private static final long serialVersionUID = 4560020571983291585L;
- private JComboBox backends;
+ private JComboBox<String> backends;
private JLabel lNoBackendsFound;
private IndexBrowserRightPanel entryPane;
@@ -91,16 +98,16 @@
private JButton newIndex;
private JButton newVLVIndex;
- private CategoryTreeNode standardIndexes = new CategoryTreeNode(
+ private final CategoryTreeNode standardIndexes = new CategoryTreeNode(
INFO_CTRL_PANEL_INDEXES_CATEGORY_NODE.get());
- private CategoryTreeNode vlvIndexes = new CategoryTreeNode(
+ private final CategoryTreeNode vlvIndexes = new CategoryTreeNode(
INFO_CTRL_PANEL_VLV_INDEXES_CATEGORY_NODE.get());
private AbstractIndexDescriptor lastCreatedIndex;
private TreePath lastIndexTreePath;
- private CategoryTreeNode[] categoryNodes = {
+ private final CategoryTreeNode[] categoryNodes = {
standardIndexes, vlvIndexes
};
@@ -174,7 +181,7 @@
add(lBackend, gbc);
backends = Utilities.createComboBox();
- backends.setModel(new DefaultComboBoxModel(new String[]{}));
+ backends.setModel(new DefaultComboBoxModel<>(new String[] {}));
ItemListener comboListener = new ItemListener()
{
@Override
@@ -425,9 +432,8 @@
{
ignoreSelectionEvents = true;
ServerDescriptor desc = ev.getNewDescriptor();
- updateSimpleBackendComboBoxModel(backends, lNoBackendsFound,
- desc);
- refreshContents(desc);
+ updateSimpleBackendComboBoxModel(backends, lNoBackendsFound, desc);
+ refreshContents();
}
/** Adds a pop up menu. */
@@ -475,9 +481,8 @@
/**
* Refresh the contents of the tree.
- * @param desc the descriptor containing the index configuration.
*/
- private void refreshContents(final ServerDescriptor desc)
+ private void refreshContents()
{
SwingUtilities.invokeLater(new Runnable()
{
@@ -510,13 +515,13 @@
@Override
public void indexModified(IndexModifiedEvent ev)
{
- refreshContents(getInfo().getServerDescriptor());
+ refreshContents();
}
@Override
public void backendIndexesModified(IndexModifiedEvent ev)
{
- refreshContents(getInfo().getServerDescriptor());
+ refreshContents();
}
/**
@@ -875,8 +880,8 @@
}
}
- private HashMap<Object, ImageIcon> hmCategoryImages = new HashMap<>();
- private HashMap<Class<?>, ImageIcon> hmImages = new HashMap<>();
+ private final Map<Object, ImageIcon> hmCategoryImages = new HashMap<>();
+ private final Map<Class<?>, ImageIcon> hmImages = new HashMap<>();
{
Object[] nodes = {standardIndexes, vlvIndexes};
String[] paths = {"ds-idx-folder.png", "ds-vlv-idx-folder.png"};
@@ -895,7 +900,7 @@
}
/** Specific class used to render the nodes in the tree. It uses specific icons for the nodes. */
- protected class IndexTreeCellRenderer extends TreeCellRenderer
+ private class IndexTreeCellRenderer extends TreeCellRenderer
{
private ImageIcon readOnlyIndexIcon =
Utilities.createImageIcon(IconPool.IMAGE_PATH+"/ds-idx-ro.png");
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java
index b88aeb9..9d82401 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java
@@ -51,43 +51,38 @@
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableCellRenderer;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes;
import org.opends.guitools.controlpanel.datamodel.CategorizedComboBoxElement;
import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor;
-import org.opends.guitools.controlpanel.datamodel.
- ConnectionHandlersMonitoringTableModel;
+import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor.Protocol;
+import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor.State;
+import org.opends.guitools.controlpanel.datamodel.ConnectionHandlersMonitoringTableModel;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
import org.opends.guitools.controlpanel.datamodel.MonitoringAttributes;
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
-import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor.
- Protocol;
-import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor.
- State;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
-import org.opends.guitools.controlpanel.ui.renderer.
- NoLeftInsetCategoryComboBoxRenderer;
+import org.opends.guitools.controlpanel.ui.renderer.NoLeftInsetCategoryComboBoxRenderer;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.guitools.controlpanel.util.ViewPositions;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
/** Class that displays the monitoring information of connection handlers. */
-public class ConnectionHandlerMonitoringPanel extends StatusGenericPanel
+class ConnectionHandlerMonitoringPanel extends StatusGenericPanel
{
private static final long serialVersionUID = -6462932160985559830L;
- private MonitoringAttributesViewPanel<MonitoringAttributes>
- operationViewPanel;
+ private MonitoringAttributesViewPanel<MonitoringAttributes> operationViewPanel;
private GenericDialog operationViewDlg;
- private JComboBox connectionHandlers;
+ private JComboBox<String> connectionHandlers;
private JTable connectionHandlersTable;
private JScrollPane connectionHandlersScroll;
private ConnectionHandlersMonitoringTableModel connectionHandlersTableModel;
- private JLabel lNoConnectionHandlers = Utilities.createPrimaryLabel(
+ private final JLabel lNoConnectionHandlers = Utilities.createPrimaryLabel(
INFO_CTRL_PANEL_NO_CONNECTION_HANDLER_FOUND.get());
private boolean firstRealDataSet;
@@ -105,7 +100,7 @@
chOperations.add(BasicMonitoringAttributes.MOD_DN_REQUESTS);
chOperations.add(BasicMonitoringAttributes.SEARCH_REQUESTS);
}
- private LinkedHashSet<MonitoringAttributes> allowedChOperations = new LinkedHashSet<>();
+ private final LinkedHashSet<MonitoringAttributes> allowedChOperations = new LinkedHashSet<>();
{
allowedChOperations.addAll(chOperations);
allowedChOperations.add(BasicMonitoringAttributes.ADD_RESPONSES);
@@ -120,7 +115,7 @@
allowedChOperations.add(BasicMonitoringAttributes.UNBIND_REQUESTS);
}
- private LocalizableMessage ALL_CONNECTION_HANDLERS =
+ private static final LocalizableMessage ALL_CONNECTION_HANDLERS =
INFO_CTRL_PANEL_ALL_CONNECTION_HANDLERS.get();
/** Default constructor. */
@@ -156,8 +151,8 @@
viewOptions.add(l, gbc);
gbc.insets.left = 5;
gbc.insets.right = 10;
- connectionHandlers = new JComboBox(
- new DefaultComboBoxModel(new String[]{"fakeconnectionhandlername"}));
+ connectionHandlers = new JComboBox<String>(
+ new DefaultComboBoxModel<>(new String[]{"fakeconnectionhandlername"}));
connectionHandlers.addItemListener(
new IgnoreItemListener(connectionHandlers));
connectionHandlers.addItemListener(new ItemListener()
@@ -302,8 +297,7 @@
newElements.add(new CategorizedComboBoxElement(
connectionHandlerLabel, CategorizedComboBoxElement.Type.REGULAR));
}
- updateComboBoxModel(newElements,
- (DefaultComboBoxModel)connectionHandlers.getModel());
+ updateComboBoxModel(newElements, (DefaultComboBoxModel<String>) connectionHandlers.getModel());
boolean displayErrorPane = false;
LocalizableMessage errorTitle = LocalizableMessage.EMPTY;
@@ -314,9 +308,7 @@
if (!server.isAuthenticated())
{
LocalizableMessageBuilder mb = new LocalizableMessageBuilder();
- mb.append(
- INFO_CTRL_PANEL_AUTH_REQUIRED_TO_SEE_TRAFFIC_MONITORING_SUMMARY.
- get());
+ mb.append(INFO_CTRL_PANEL_AUTH_REQUIRED_TO_SEE_TRAFFIC_MONITORING_SUMMARY.get());
mb.append("<br><br>").append(getAuthenticateHTML());
errorDetails = mb.toMessage();
errorTitle = INFO_CTRL_PANEL_AUTHENTICATION_REQUIRED_SUMMARY.get();
@@ -549,7 +541,7 @@
}
/** The specific menu bar of this panel. */
- class ConnectionHandlerMonitoringMenuBar extends MainMenuBar
+ private class ConnectionHandlerMonitoringMenuBar extends MainMenuBar
{
private static final long serialVersionUID = 505187831116443370L;
@@ -557,7 +549,7 @@
* Constructor.
* @param info the control panel info.
*/
- public ConnectionHandlerMonitoringMenuBar(ControlPanelInfo info)
+ private ConnectionHandlerMonitoringMenuBar(ControlPanelInfo info)
{
super(info);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
index d14838f..7a76779 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
@@ -153,7 +153,7 @@
}
/** Creates the layout of the panel (but the contents are not populated here). */
- protected void createLayout()
+ private void createLayout()
{
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
@@ -213,7 +213,7 @@
* @param c the container where all the components will be layed out.
* @param gbc the grid bag constraints.
*/
- protected void createBasicLayout(Container c, GridBagConstraints gbc)
+ private void createBasicLayout(Container c, GridBagConstraints gbc)
{
SuperiorObjectClassesChangedListener listener =
new SuperiorObjectClassesChangedListener()
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ExportLDIFPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ExportLDIFPanel.java
index 549600a..83a60fb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ExportLDIFPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ExportLDIFPanel.java
@@ -416,7 +416,7 @@
}
/** The class that performs the export. */
- protected class ExportTask extends InclusionExclusionTask
+ private class ExportTask extends InclusionExclusionTask
{
private Set<String> backendSet;
private String fileName;
@@ -425,7 +425,7 @@
* @param info the control panel info.
* @param dlg the progress dialog that shows the progress of the task.
*/
- public ExportTask(ControlPanelInfo info, ProgressDialog dlg)
+ private ExportTask(ControlPanelInfo info, ProgressDialog dlg)
{
super(info, dlg);
backendSet = new HashSet<>();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericDialog.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericDialog.java
index f16ac89..e81c995 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericDialog.java
@@ -64,7 +64,7 @@
private JButton okButton;
/** The close button. */
- protected JButton closeButton;
+ private JButton closeButton;
private JButton cancelButton;
/** The panel contained in the dialog. */
protected StatusGenericPanel panel;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericFrame.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericFrame.java
index a629a0f..359b7a1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericFrame.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericFrame.java
@@ -64,10 +64,10 @@
private JButton okButton;
/** The close button. */
- protected JButton closeButton;
+ private JButton closeButton;
private JButton cancelButton;
/** The panel contained in the frame. */
- protected StatusGenericPanel panel;
+ private StatusGenericPanel panel;
private Component lastComponentWithFocus;
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericMenuBar.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericMenuBar.java
index b33c405..242e243 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericMenuBar.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GenericMenuBar.java
@@ -45,12 +45,12 @@
private ControlPanelInfo info;
/** The URL to the administration guide. */
- protected final String ADMINISTRATION_GUIDE_URL =
+ private final String ADMINISTRATION_GUIDE_URL =
Utils.getCustomizedObject("ADMINISTRATION_GUIDE_URL",
DynamicConstants.ADMINISTRATION_GUIDE_URL, String.class);
/** The URL to the wiki main page. */
- protected final String DOC_REFERENCE_WIKI =
+ private final String DOC_REFERENCE_WIKI =
Utils.getCustomizedObject("DOC_REFERENCE_WIKI",
DynamicConstants.DOC_REFERENCE_WIKI, String.class);
@@ -110,7 +110,7 @@
* Tries to display a URL in the systems default WEB browser.
* @param url the URL to be displayed.
*/
- protected void displayURL(final String url)
+ private void displayURL(final String url)
{
BackgroundTask<Void> worker = new BackgroundTask<Void>()
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
index 7b6a589..6778553 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
@@ -610,7 +610,7 @@
}
/** The class that performs the import. */
- protected class ImportTask extends InclusionExclusionTask
+ private class ImportTask extends InclusionExclusionTask
{
private Set<String> backendSet;
private String fileName;
@@ -622,7 +622,7 @@
* @param info the control panel info.
* @param dlg the progress dialog that shows the progress of the task.
*/
- public ImportTask(ControlPanelInfo info, ProgressDialog dlg)
+ private ImportTask(ControlPanelInfo info, ProgressDialog dlg)
{
super(info, dlg);
backendSet = new HashSet<>();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java
index f27f69f..ca50f25 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/InclusionExclusionPanel.java
@@ -16,8 +16,9 @@
*/
package org.opends.guitools.controlpanel.ui;
+import static com.forgerock.opendj.cli.Utils.*;
+
import static org.opends.messages.AdminToolMessages.*;
-import static com.forgerock.opendj.cli.Utils.isDN;
import java.awt.Component;
import java.awt.GridBagConstraints;
@@ -52,30 +53,30 @@
{
private static final long serialVersionUID = -3826176895778069011L;
/** The DNs to exclude. */
- protected JTextArea dnsToExclude;
+ private JTextArea dnsToExclude;
/** The attributes to exclude. */
- protected JTextField attributesToExclude;
+ private JTextField attributesToExclude;
/** The exclusion filter. */
- protected JTextField exclusionFilter;
+ private JTextField exclusionFilter;
/** The DNs to include. */
- protected JTextArea dnsToInclude;
+ private JTextArea dnsToInclude;
/** The attributes to include. */
- protected JTextField attributesToInclude;
+ private JTextField attributesToInclude;
/** The inclusion filter. */
- protected JTextField inclusionFilter;
+ private JTextField inclusionFilter;
/** The DNs to include. */
- protected JLabel lDnsToInclude;
+ private JLabel lDnsToInclude;
/** The attributes to include. */
- protected JLabel lAttributesToInclude;
+ private JLabel lAttributesToInclude;
/** The inclusion filter label. */
- protected JLabel lInclusionFilter;
+ private JLabel lInclusionFilter;
/** The DNs to exclude label. */
- protected JLabel lDnsToExclude;
+ private JLabel lDnsToExclude;
/** The attributes to exclude label. */
- protected JLabel lAttributesToExclude;
+ private JLabel lAttributesToExclude;
/** The exclusion filter label. */
- protected JLabel lExclusionFilter;
+ private JLabel lExclusionFilter;
@Override
public void cancelClicked()
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
index 0b52a59..235fbcc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
@@ -64,7 +64,7 @@
* The panel that displays an existing index (it appears on the right of the
* 'Manage Indexes' dialog).
*/
-public class IndexPanel extends AbstractIndexPanel
+class IndexPanel extends AbstractIndexPanel
{
private static final long serialVersionUID = 1439500626486823366L;
@@ -221,6 +221,7 @@
@Override
public void okClicked()
{
+ // no-op
}
/**
@@ -231,7 +232,7 @@
* selection of the index should be canceled) and <CODE>false</CODE>
* otherwise.
*/
- public boolean mustCheckUnsavedChanges()
+ boolean mustCheckUnsavedChanges()
{
return index != null &&
saveChanges.isVisible() && saveChanges.isEnabled();
@@ -245,7 +246,7 @@
* panel, to not save them or simply cancelled the selection change in
* the tree.
*/
- public UnsavedChangesDialog.Result checkUnsavedChanges()
+ UnsavedChangesDialog.Result checkUnsavedChanges()
{
UnsavedChangesDialog.Result result;
UnsavedChangesDialog unsavedChangesDlg = new UnsavedChangesDialog(Utilities.getParentDialog(this), getInfo());
@@ -370,7 +371,7 @@
* @param index
* the index descriptor to be used to update the panel.
*/
- public void update(IndexDescriptor index)
+ void update(IndexDescriptor index)
{
ignoreCheckSave = true;
setPrimaryValid(lEntryLimit);
@@ -462,14 +463,14 @@
}
/** The task in charge of modifying the index. */
- protected class ModifyIndexTask extends Task
+ private class ModifyIndexTask extends Task
{
- private Set<String> backendSet;
- private String attributeName;
- private String backendName;
- private int entryLimitValue;
- private IndexDescriptor indexToModify;
- private SortedSet<IndexType> indexTypes = new TreeSet<>();
+ private final Set<String> backendSet;
+ private final String attributeName;
+ private final String backendName;
+ private final int entryLimitValue;
+ private final IndexDescriptor indexToModify;
+ private final SortedSet<IndexType> indexTypes;
private IndexDescriptor modifiedIndex;
/**
@@ -480,7 +481,7 @@
* @param dlg
* the progress dialog that shows the progress of the task.
*/
- public ModifyIndexTask(ControlPanelInfo info, ProgressDialog dlg)
+ private ModifyIndexTask(ControlPanelInfo info, ProgressDialog dlg)
{
super(info, dlg);
backendName = index.getBackend().getBackendID();
@@ -660,10 +661,7 @@
{
return getCommandLinePath("dsconfig");
}
- else
- {
- return null;
- }
+ return null;
}
@Override
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java
index 8fb882b..15595c3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java
@@ -441,7 +441,7 @@
* @return <CODE>true</CODE> if the provided DN corresponds to a read-only
* entry and <CODE>false</CODE> otherwise.
*/
- public boolean isReadOnly(String sDn)
+ private boolean isReadOnly(String sDn)
{
boolean isReadOnly = false;
try
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainActionsPane.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainActionsPane.java
index 45566f9..69fc755 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainActionsPane.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainActionsPane.java
@@ -159,7 +159,7 @@
* @param panel the panel that will be contained in the frame.
* @return the frame to be displayed using the provided panel.
*/
- protected GenericFrame createFrame(StatusGenericPanel panel)
+ private GenericFrame createFrame(StatusGenericPanel panel)
{
return new GenericFrame(panel);
}
@@ -168,7 +168,7 @@
* Creates the categories contained by this panel.
* @return the categories contained by this panel.
*/
- protected ArrayList<Category> createCategories()
+ private ArrayList<Category> createCategories()
{
ArrayList<Category> categories = new ArrayList<>();
LocalizableMessage[][] labels;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainMenuBar.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainMenuBar.java
index a83414c..fd07bf5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainMenuBar.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MainMenuBar.java
@@ -32,10 +32,10 @@
import javax.swing.JMenu;
import javax.swing.JMenuItem;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.task.Task;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
/** The menu bar that appears on the main panel. */
public class MainMenuBar extends GenericMenuBar
@@ -104,7 +104,7 @@
* Creates the File menu bar.
* @return the File menu bar.
*/
- protected JMenu createFileMenuBar()
+ private JMenu createFileMenuBar()
{
JMenu menu = Utilities.createMenu(INFO_CTRL_PANEL_FILE_MENU.get(),
INFO_CTRL_PANEL_FILE_MENU_DESCRIPTION.get());
@@ -202,7 +202,7 @@
}
/** The method called when the user clicks on 'Refresh Options'. */
- protected void refreshOptionsClicked()
+ private void refreshOptionsClicked()
{
if (panel == null)
{
@@ -225,7 +225,7 @@
}
/** The method called when the user clicks on 'Connect to Server...'. */
- protected void connectToServerClicked()
+ private void connectToServerClicked()
{
Set<String> runningTasks = new HashSet<>();
for (Task task : getInfo().getTasks())
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
index 9b4810a..6778767 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
@@ -633,7 +633,7 @@
* the attributes definition and objectclasses in the schema of the server.
* TODO: move somewhere better.
*/
- public static Entry getEntry(CustomSearchResult csr) throws OpenDsException
+ private static Entry getEntry(CustomSearchResult csr) throws OpenDsException
{
DN dn = DN.valueOf(csr.getDN());
Map<ObjectClass,String> objectClasses = new HashMap<>();
@@ -859,7 +859,7 @@
}
/** The specific menu bar of this panel. */
- class ManageTasksMenuBar extends MainMenuBar
+ private class ManageTasksMenuBar extends MainMenuBar
{
private static final long serialVersionUID = 5051878116443370L;
@@ -867,7 +867,7 @@
* Constructor.
* @param info the control panel info.
*/
- public ManageTasksMenuBar(ControlPanelInfo info)
+ private ManageTasksMenuBar(ControlPanelInfo info)
{
super(info);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java
index 73c1f0a..6a3d49f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/MonitoringAttributesViewPanel.java
@@ -36,11 +36,11 @@
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.MonitoringAttributes;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.event.ScrollPaneBorderListener;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
/**
* The panel that allows the user to select which attributes must be displayed
@@ -49,12 +49,12 @@
* @param <T> the type of the objects that this panel manages. For now it only
* manages String and MonitoringAttribute objects.
*/
-public class MonitoringAttributesViewPanel<T> extends StatusGenericPanel
+class MonitoringAttributesViewPanel<T> extends StatusGenericPanel
{
private static final long serialVersionUID = 6462932163745559L;
- private LinkedHashSet<T> selectedAttributes = new LinkedHashSet<>();
- private Set<T> monitoringAttributes;
+ private final LinkedHashSet<T> selectedAttributes = new LinkedHashSet<>();
+ private final Set<T> monitoringAttributes;
private boolean isCanceled = true;
/**
@@ -71,7 +71,7 @@
* @param attributes the list of possible attributes.
* @return an instance of this panel that uses String as attributes.
*/
- public static MonitoringAttributesViewPanel<String> createStringInstance(LinkedHashSet<String> attributes)
+ static MonitoringAttributesViewPanel<String> createStringInstance(LinkedHashSet<String> attributes)
{
return new MonitoringAttributesViewPanel<>(attributes);
}
@@ -83,7 +83,7 @@
* @return an instance of this panel that uses MonitoringAttributes as
* attributes.
*/
- public static MonitoringAttributesViewPanel<MonitoringAttributes>
+ static MonitoringAttributesViewPanel<MonitoringAttributes>
createMonitoringAttributesInstance(LinkedHashSet<MonitoringAttributes> attributes)
{
return new MonitoringAttributesViewPanel<>(attributes);
@@ -95,7 +95,7 @@
* @param attributes the list of possible attributes.
* @return an instance of this panel that uses LocalizableMessage as attributes.
*/
- public static MonitoringAttributesViewPanel<LocalizableMessage>
+ static MonitoringAttributesViewPanel<LocalizableMessage>
createMessageInstance(LinkedHashSet<LocalizableMessage> attributes)
{
return new MonitoringAttributesViewPanel<>(attributes);
@@ -111,7 +111,7 @@
* Default constructor.
* @param attributes the attributes that will be proposed to the user.
*/
- protected MonitoringAttributesViewPanel(LinkedHashSet<T> attributes)
+ private MonitoringAttributesViewPanel(LinkedHashSet<T> attributes)
{
monitoringAttributes = new LinkedHashSet<>(attributes);
createLayout();
@@ -324,7 +324,7 @@
* @param attribute the attribute.
* @return the message for the provided attribute.
*/
- protected LocalizableMessage getMessage(T attribute)
+ private LocalizableMessage getMessage(T attribute)
{
if (attribute instanceof MonitoringAttributes)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
index 8eac255..d4af5b9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
@@ -691,7 +691,7 @@
}
/** The task in charge of creating the base DN (and if required, the backend). */
- protected class NewBaseDNTask extends Task
+ private class NewBaseDNTask extends Task
{
private final Set<String> backendSet;
private final String newBaseDN;
@@ -705,7 +705,7 @@
* @param dlg
* the progress dialog that shows the progress of the task.
*/
- public NewBaseDNTask(ControlPanelInfo info, ProgressDialog dlg)
+ private NewBaseDNTask(ControlPanelInfo info, ProgressDialog dlg)
{
super(info, dlg);
backendSet = new HashSet<>();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java
index e7e54c3..f9754ea 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java
@@ -95,8 +95,7 @@
private JLabel dn = Utilities.createDefaultLabel();
/** An array containing the fields of this panel. */
- protected final JTextField[] fields = {name, description, filter,
- referenceGroup};
+ private final JTextField[] fields = { name, description, filter, referenceGroup };
/** Default constructor. */
public NewGroupPanel()
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ProgressDialog.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ProgressDialog.java
index 97cfa15..e252012 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ProgressDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ProgressDialog.java
@@ -40,13 +40,13 @@
import javax.swing.SwingUtilities;
import javax.swing.text.html.HTMLDocument;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.event.PrintStreamListener;
import org.opends.guitools.controlpanel.ui.components.BasicExpander;
import org.opends.guitools.controlpanel.util.ApplicationPrintStream;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
/** The dialog that is used to display progress in a task. */
public class ProgressDialog extends GenericDialog
@@ -177,7 +177,7 @@
}
/** The panel contained in the progress dialog. */
- static class ProgressPanel extends StatusGenericPanel
+ private static class ProgressPanel extends StatusGenericPanel
{
private static final long serialVersionUID = -364496083928260306L;
private BasicExpander details;
@@ -239,7 +239,7 @@
* will have a new-line char at the end (is similar to println()).
* @param msg the HTML formatted text to be appended.
*/
- public void appendErrorLine(String msg)
+ private void appendErrorLine(String msg)
{
msg = filterForBugID4988885(msg+"<br>");
msg = Utilities.applyFont(msg, ColorAndFontConstants.progressFont);
@@ -281,7 +281,7 @@
* will be preceded by a new line (is similar to println()).
* @param msg the HTML formatted text to be appended.
*/
- public void appendOutputLine(String msg)
+ private void appendOutputLine(String msg)
{
appendErrorLine(msg);
}
@@ -291,7 +291,7 @@
* will be appended as it is (is similar to print()).
* @param msg the HTML formatted text to be appended.
*/
- public void appendHtml(String msg)
+ private void appendHtml(String msg)
{
HTMLDocument doc = (HTMLDocument)logs.getDocument();
@@ -308,7 +308,7 @@
}
/** Resets the contents of the logs (Details) section. */
- public void resetLogs()
+ private void resetLogs()
{
logs.setText(INIT_TEXT);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RestorePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RestorePanel.java
index 9497a6e..0b2ab8f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RestorePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RestorePanel.java
@@ -14,7 +14,6 @@
* Copyright 2008-2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2016 ForgeRock AS.
*/
-
package org.opends.guitools.controlpanel.ui;
import static org.opends.messages.AdminToolMessages.*;
@@ -34,6 +33,7 @@
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
import org.opends.guitools.controlpanel.datamodel.BackupDescriptor;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
@@ -43,12 +43,10 @@
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.task.Task;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.tools.RestoreDB;
/** The panel that appears when the user wants to restore from a backup. */
-public class RestorePanel extends BackupListPanel
-implements BackupCreatedListener
+class RestorePanel extends BackupListPanel implements BackupCreatedListener
{
private static final long serialVersionUID = -205585323128518051L;
private ListSelectionListener listener;
@@ -313,12 +311,12 @@
}
/** The task in charge of restoring or verifying the backup. */
- protected class RestoreTask extends Task
+ private class RestoreTask extends Task
{
- private Set<String> backendSet;
- private String dir;
- private String backupID;
- private boolean verify;
+ private final Set<String> backendSet;
+ private final String dir;
+ private final String backupID;
+ private final boolean verify;
/**
* The constructor of the task.
@@ -327,7 +325,7 @@
* @param verify whether this is an actual restore or a verify of the
* backup.
*/
- public RestoreTask(ControlPanelInfo info, ProgressDialog dlg,
+ private RestoreTask(ControlPanelInfo info, ProgressDialog dlg,
boolean verify)
{
super(info, dlg);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardAttributePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardAttributePanel.java
index 5bd81af..8b76fbb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardAttributePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardAttributePanel.java
@@ -35,39 +35,38 @@
import javax.swing.JLabel;
import javax.swing.JList;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.ldap.schema.AttributeType;
+import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.ui.components.TitlePanel;
import org.opends.guitools.controlpanel.util.LowerCaseComparator;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.opendj.ldap.schema.MatchingRule;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.schema.SomeSchemaElement;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.Schema;
/** The panel that displays a standard attribute definition. */
-public class StandardAttributePanel extends SchemaElementPanel
+class StandardAttributePanel extends SchemaElementPanel
{
private static final long serialVersionUID = -7922968631524763675L;
- private TitlePanel titlePanel = new TitlePanel(LocalizableMessage.EMPTY,
- LocalizableMessage.EMPTY);
- private JLabel name = Utilities.createDefaultLabel();
- private JLabel parent = Utilities.createDefaultLabel();
- private JLabel oid = Utilities.createDefaultLabel();
- private JLabel aliases = Utilities.createDefaultLabel();
- private JLabel origin = Utilities.createDefaultLabel();
- private JLabel description = Utilities.createDefaultLabel();
- private JLabel usage = Utilities.createDefaultLabel();
- private JLabel syntax = Utilities.createDefaultLabel();
- private JLabel approximate = Utilities.createDefaultLabel();
- private JLabel equality = Utilities.createDefaultLabel();
- private JLabel ordering = Utilities.createDefaultLabel();
- private JLabel substring = Utilities.createDefaultLabel();
- private JLabel type = Utilities.createDefaultLabel();
- private JList requiredBy = new JList(new DefaultListModel());
- private JList optionalBy = new JList(new DefaultListModel());
+ private final TitlePanel titlePanel = new TitlePanel(LocalizableMessage.EMPTY, LocalizableMessage.EMPTY);
+ private final JLabel name = Utilities.createDefaultLabel();
+ private final JLabel parent = Utilities.createDefaultLabel();
+ private final JLabel oid = Utilities.createDefaultLabel();
+ private final JLabel aliases = Utilities.createDefaultLabel();
+ private final JLabel origin = Utilities.createDefaultLabel();
+ private final JLabel description = Utilities.createDefaultLabel();
+ private final JLabel usage = Utilities.createDefaultLabel();
+ private final JLabel syntax = Utilities.createDefaultLabel();
+ private final JLabel approximate = Utilities.createDefaultLabel();
+ private final JLabel equality = Utilities.createDefaultLabel();
+ private final JLabel ordering = Utilities.createDefaultLabel();
+ private final JLabel substring = Utilities.createDefaultLabel();
+ private final JLabel type = Utilities.createDefaultLabel();
+ private final JList<String> requiredBy = new JList<>(new DefaultListModel<String>());
+ private final JList<String> optionalBy = new JList<>(new DefaultListModel<String>());
/** Default constructor of the panel. */
public StandardAttributePanel()
@@ -91,15 +90,17 @@
@Override
public void configurationChanged(ConfigurationChangeEvent ev)
{
+ // no-op
}
@Override
public void okClicked()
{
+ // no-op
}
/** Creates the layout of the panel (but the contents are not populated here). */
- protected void createLayout()
+ private void createLayout()
{
createBasicLayout(this, new GridBagConstraints());
setBorder(PANEL_BORDER);
@@ -110,7 +111,7 @@
* @param c the container where all the components will be layed out.
* @param gbc the grid bag constraints.
*/
- protected void createBasicLayout(Container c, GridBagConstraints gbc)
+ private void createBasicLayout(Container c, GridBagConstraints gbc)
{
requiredBy.setVisibleRowCount(5);
optionalBy.setVisibleRowCount(9);
@@ -166,7 +167,7 @@
INFO_CTRL_PANEL_REQUIRED_BY_LABEL.get(),
INFO_CTRL_PANEL_ALLOWED_BY_LABEL.get()
};
- JList[] lists = {requiredBy, optionalBy};
+ JList<?>[] lists = { requiredBy, optionalBy };
gbc.anchor = GridBagConstraints.NORTHWEST;
for (int i=0; i<2; i++)
{
@@ -192,7 +193,7 @@
c.add(Utilities.createScrollPane(lists[i]), gbc);
gbc.gridy ++;
- final JList list = lists[i];
+ final JList<?> list = lists[i];
MouseAdapter clickListener = new MouseAdapter()
{
@Override
@@ -233,14 +234,7 @@
titlePanel.setDetails(LocalizableMessage.raw(n));
name.setText(n);
AttributeType superior = attr.getSuperiorType();
- if (superior == null)
- {
- n = null;
- }
- else
- {
- n = superior.getNameOrOID();
- }
+ n = superior != null ? superior.getNameOrOID() : null;
parent.setText(n);
oid.setText(attr.getOID());
origin.setText(StandardObjectClassPanel.getOrigin(new SomeSchemaElement(attr)).toString());
@@ -250,14 +244,7 @@
n = NOT_APPLICABLE.toString();
}
description.setText(n);
- if (attr.getUsage() == null)
- {
- n = NOT_APPLICABLE.toString();
- }
- else
- {
- n = attr.getUsage().toString();
- }
+ n = attr.getUsage() != null ? attr.getUsage().toString() : NOT_APPLICABLE.toString();
usage.setText(n);
Set<String> aliases = getAliases(attr);
if (!aliases.isEmpty())
@@ -299,7 +286,7 @@
}
}
- DefaultListModel model = (DefaultListModel)requiredBy.getModel();
+ DefaultListModel<String> model = (DefaultListModel<String>) requiredBy.getModel();
model.clear();
for (String oc : requiredByOcs)
{
@@ -315,7 +302,7 @@
}
}
- model = (DefaultListModel)optionalBy.getModel();
+ model = (DefaultListModel<String>) optionalBy.getModel();
model.clear();
for (String oc : optionalByOcs)
{
@@ -333,7 +320,7 @@
static LocalizableMessage getTypeValue(AttributeType attr)
{
LocalizableMessageBuilder mb = new LocalizableMessageBuilder();
- Boolean[] props = {attr.isOperational(), attr.isSingleValue(),
+ boolean[] props = {attr.isOperational(), attr.isSingleValue(),
attr.isNoUserModification(), attr.isCollective(),
attr.isObsolete()};
LocalizableMessage[][] values = {
@@ -344,7 +331,7 @@
{INFO_CTRL_PANEL_ATTRIBUTE_COLLECTIVE_LABEL.get(), null},
{INFO_CTRL_PANEL_ATTRIBUTE_OBSOLETE_LABEL.get(), null}};
int i = 0;
- for (Boolean prop : props)
+ for (boolean prop : props)
{
LocalizableMessage value = prop ? values[i][0] : values[i][1];
if (value != null)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
index ddf0f24..751df1c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
@@ -39,13 +39,13 @@
import javax.swing.JLabel;
import javax.swing.JList;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.ui.components.TitlePanel;
import org.opends.guitools.controlpanel.util.LowerCaseComparator;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.schema.SomeSchemaElement;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.Schema;
@@ -108,7 +108,7 @@
}
/** Creates the layout of the panel (but the contents are not populated here). */
- protected void createLayout()
+ private void createLayout()
{
createBasicLayout(this, new GridBagConstraints());
setBorder(PANEL_BORDER);
@@ -119,7 +119,7 @@
* @param c the container where all the components will be layed out.
* @param gbc the grid bag constraints.
*/
- protected void createBasicLayout(Container c, GridBagConstraints gbc)
+ private void createBasicLayout(Container c, GridBagConstraints gbc)
{
requiredAttributes.setVisibleRowCount(5);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusPanel.java
index 607ca66..309bc24 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusPanel.java
@@ -42,6 +42,11 @@
import javax.swing.JTable;
import javax.swing.SwingUtilities;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.LdapException;
+import org.forgerock.util.Utils;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor;
import org.opends.guitools.controlpanel.datamodel.BaseDNTableModel;
@@ -50,17 +55,11 @@
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.event.ScrollPaneBorderListener;
-import org.opends.guitools.controlpanel.ui.components.
- SelectableLabelWithHelpIcon;
+import org.opends.guitools.controlpanel.ui.components.SelectableLabelWithHelpIcon;
import org.opends.guitools.controlpanel.ui.renderer.BaseDNCellRenderer;
import org.opends.guitools.controlpanel.ui.renderer.CustomCellRenderer;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.guitools.controlpanel.util.ViewPositions;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.opendj.ldap.DN;
-import org.forgerock.opendj.ldap.LdapException;
-import org.forgerock.util.Utils;
/**
* The panel displaying the general status of the server (started/stopped),
@@ -206,7 +205,7 @@
* Updates the contents of the panel with the provided ServerDescriptor.
* @param desc the ServerDescriptor.
*/
- public void updateContents(ServerDescriptor desc)
+ private void updateContents(ServerDescriptor desc)
{
JScrollPane scroll = Utilities.getContainingScroll(this);
ViewPositions pos;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
index 2afbf3c..ead16f9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
@@ -518,7 +518,7 @@
}
/** The task in charge of modifying the VLV index. */
- protected class ModifyVLVIndexTask extends Task
+ private class ModifyVLVIndexTask extends Task
{
private final Set<String> backendSet;
private final String indexName;
@@ -539,7 +539,7 @@
* @param dlg
* the progress dialog that shows the progress of the task.
*/
- public ModifyVLVIndexTask(ControlPanelInfo info, ProgressDialog dlg)
+ private ModifyVLVIndexTask(ControlPanelInfo info, ProgressDialog dlg)
{
super(info, dlg);
backendID = index.getBackend().getBackendID();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VerifyIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VerifyIndexPanel.java
index 6b8987a..39cc3cb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VerifyIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VerifyIndexPanel.java
@@ -439,7 +439,7 @@
}
/** The task in charge of verifying the index. */
- protected class VerifyIndexTask extends IndexTask
+ private class VerifyIndexTask extends IndexTask
{
private String baseDN;
@@ -451,7 +451,7 @@
* @param dlg
* the progress dialog that shows the progress of the task.
*/
- public VerifyIndexTask(ControlPanelInfo info, ProgressDialog dlg)
+ private VerifyIndexTask(ControlPanelInfo info, ProgressDialog dlg)
{
super(info, dlg, getSelectedBaseDN());
this.baseDN = getSelectedBaseDN();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
index d3e5732..0386a4d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
@@ -36,11 +36,11 @@
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.opends.guitools.controlpanel.task.Task;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.tools.ConfigureWindowsService;
/** The panel that displays the Windows Service panel configuration for the server. */
@@ -249,9 +249,9 @@
}
/** The task in charge of updating the windows service configuration. */
- protected class WindowsServiceTask extends Task
+ private class WindowsServiceTask extends Task
{
- Set<String> backendSet;
+ private Set<String> backendSet;
private boolean enableService;
/**
* The constructor of the task.
@@ -260,7 +260,7 @@
* @param enableService whether the windows service must be enabled or
* disabled.
*/
- public WindowsServiceTask(ControlPanelInfo info, ProgressDialog dlg,
+ private WindowsServiceTask(ControlPanelInfo info, ProgressDialog dlg,
boolean enableService)
{
super(info, dlg);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WorkQueueMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WorkQueueMonitoringPanel.java
index 4b40fe4..6a26e64 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WorkQueueMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WorkQueueMonitoringPanel.java
@@ -36,7 +36,7 @@
class WorkQueueMonitoringPanel extends GeneralMonitoringPanel
{
private static final long serialVersionUID = 9031734563700069830L;
- static final List<BasicMonitoringAttributes> attributes = CollectionUtils.newArrayList(
+ private static final List<BasicMonitoringAttributes> attributes = CollectionUtils.newArrayList(
BasicMonitoringAttributes.AVERAGE_REQUEST_BACKLOG,
BasicMonitoringAttributes.MAX_REQUEST_BACKLOG,
BasicMonitoringAttributes.CURRENT_REQUEST_BACKLOG,
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/AddRemovePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/AddRemovePanel.java
index d0a73df..c9e836b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/AddRemovePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/AddRemovePanel.java
@@ -72,13 +72,13 @@
* Mask used as display option. If the provided display options contain
* this mask, the panel will display the remove all button.
*/
- public static final int DISPLAY_REMOVE_ALL = 0x001;
+ private static final int DISPLAY_REMOVE_ALL = 0x001;
/**
* Mask used as display option. If the provided display options contain
* this mask, the panel will display the add all button.
*/
- public static final int DISPLAY_ADD_ALL = 0x010;
+ private static final int DISPLAY_ADD_ALL = 0x010;
/**
@@ -99,7 +99,7 @@
* @param displayOptions the display options.
* @param theClass the class of the objects in the panel.
*/
- public AddRemovePanel(int displayOptions, Class<T> theClass)
+ private AddRemovePanel(int displayOptions, Class<T> theClass)
{
super(new GridBagLayout());
setOpaque(false);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CategoryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CategoryPanel.java
index 5fd1dce..e3194bc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CategoryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CategoryPanel.java
@@ -43,7 +43,7 @@
private CategoryButton expandButton;
private boolean expanded = true;
- static final Border categoryBorder = new AccordionElementBorder();
+ private static final Border categoryBorder = new AccordionElementBorder();
/**
* Constructor the the panel.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java
index c4bdb55..2aa5799 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java
@@ -55,53 +55,41 @@
public class DoubleAddRemovePanel<T> extends JPanel
{
private static final long serialVersionUID = 6881453848780359594L;
- private SortableListModel<T> availableListModel;
- private SortableListModel<T> selectedListModel1;
- private SortableListModel<T> selectedListModel2;
- private JLabel selectedLabel1;
- private JLabel selectedLabel2;
- private JLabel availableLabel;
- private JButton add1;
- private JButton remove1;
- private JButton add2;
- private JButton remove2;
- private JButton addAll1;
- private JButton removeAll1;
- private JButton addAll2;
- private JButton removeAll2;
- private JScrollPane availableScroll;
- private JScrollPane selectedScroll1;
- private JScrollPane selectedScroll2;
- private JList availableList;
- private JList<T> selectedList1;
- private JList<T> selectedList2;
- private Class<T> theClass;
- private Collection<T> unmovableItems = new ArrayList<>();
+ private final SortableListModel<T> availableListModel;
+ private final SortableListModel<T> selectedListModel1;
+ private final SortableListModel<T> selectedListModel2;
+ private final JLabel selectedLabel1;
+ private final JLabel selectedLabel2;
+ private final JLabel availableLabel;
+ private final JButton add1;
+ private final JButton remove1;
+ private final JButton add2;
+ private final JButton remove2;
+ private final JButton addAll1;
+ private final JButton removeAll1;
+ private final JButton addAll2;
+ private final JButton removeAll2;
+ private final JScrollPane availableScroll;
+ private final JScrollPane selectedScroll1;
+ private final JScrollPane selectedScroll2;
+ private final JList availableList;
+ private final JList<T> selectedList1;
+ private final JList<T> selectedList2;
+ private final Class<T> theClass;
+ private final Collection<T> unmovableItems = new ArrayList<>();
private boolean ignoreListEvents;
/**
* Mask used as display option. If the provided display options contain
* this mask, the panel will display the remove all button.
*/
- public static final int DISPLAY_REMOVE_ALL = 0x001;
+ private static final int DISPLAY_REMOVE_ALL = 0x001;
/**
* Mask used as display option. If the provided display options contain
* this mask, the panel will display the add all button.
*/
- public static final int DISPLAY_ADD_ALL = 0x010;
-
-
- /**
- * Constructor of the default double add remove panel (including 'Add All' and
- * 'Remove All' buttons).
- * The class is required to avoid warnings in compilation.
- * @param theClass the class of the objects in the panel.
- */
- public DoubleAddRemovePanel(Class<T> theClass)
- {
- this(DISPLAY_REMOVE_ALL | DISPLAY_ADD_ALL, theClass);
- }
+ private static final int DISPLAY_ADD_ALL = 0x010;
/**
* Constructor of the double add remove panel allowing the user to provide
@@ -261,6 +249,10 @@
gbc.gridy ++;
add(addAll1, gbc);
}
+ else
+ {
+ addAll1 = null;
+ }
remove1 = Utilities.createButton(
INFO_CTRL_PANEL_ADDREMOVE_REMOVE_BUTTON.get());
@@ -295,6 +287,10 @@
gbc.insets.top = 5;
add(removeAll1, gbc);
}
+ else
+ {
+ removeAll1 = null;
+ }
gbc.weighty = 1.0;
@@ -340,6 +336,10 @@
gbc.gridy ++;
add(addAll2, gbc);
}
+ else
+ {
+ addAll2 = null;
+ }
remove2 = Utilities.createButton(
INFO_CTRL_PANEL_ADDREMOVE_REMOVE_BUTTON.get());
@@ -374,6 +374,10 @@
gbc.insets.top = 5;
add(removeAll2, gbc);
}
+ else
+ {
+ removeAll2 = null;
+ }
gbc.weighty = 1.0;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java
index 2dc7954..d22aedc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/LabelWithHelpIcon.java
@@ -43,13 +43,13 @@
/** The label with the text. */
protected JLabel label = Utilities.createDefaultLabel();
/** The label with the icon. */
- protected JLabel iconLabel = new JLabel(icon);
+ private JLabel iconLabel = new JLabel(icon);
private static final ImageIcon icon =
Utilities.createImageIcon("org/opends/quicksetup/images/help_small.gif");
/** The left inset of the help icon. */
- protected final int INSET_WITH_ICON= 3;
+ private final int INSET_WITH_ICON = 3;
/**
* The constructor of this panel.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/ObjectClassCellPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/ObjectClassCellPanel.java
index c93f1fe..1b8eb4d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/ObjectClassCellPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/ObjectClassCellPanel.java
@@ -31,12 +31,12 @@
import javax.swing.JPanel;
import javax.swing.KeyStroke;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.guitools.controlpanel.browser.IconPool;
import org.opends.guitools.controlpanel.datamodel.ObjectClassValue;
import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
/**
* A simple panel used in the LDAP entry viewers to display the object class
@@ -47,12 +47,12 @@
public class ObjectClassCellPanel extends JPanel
{
private static final long serialVersionUID = -2362754512894888888L;
- private JLabel label;
- private CellEditorButton editButton;
+ private final JLabel label;
+ private final CellEditorButton editButton;
private ObjectClassValue value;
- private JLabel lockLabel = Utilities.createDefaultLabel();
+ private final JLabel lockLabel = Utilities.createDefaultLabel();
- private ImageIcon lockIcon =
+ private final ImageIcon lockIcon =
Utilities.createImageIcon(IconPool.IMAGE_PATH+"/field-locked.png");
/** Default constructor. */
@@ -120,13 +120,6 @@
}
}
- /** Explicitly request the focus for the edit button of this panel. */
- public void requestFocusForButton()
- {
- editButton.requestFocusInWindow();
- }
-
-
/**
* Adds an action listener to this panel. The action listener will be
* invoked when the user clicks on the 'Edit' button.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/SuperiorObjectClassesEditor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/SuperiorObjectClassesEditor.java
index beb6d56..86213d6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/SuperiorObjectClassesEditor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/SuperiorObjectClassesEditor.java
@@ -41,12 +41,10 @@
import javax.swing.JPanel;
import org.opends.guitools.controlpanel.event.SuperiorObjectClassesChangedEvent;
-import org.opends.guitools.controlpanel.event.
- SuperiorObjectClassesChangedListener;
+import org.opends.guitools.controlpanel.event.SuperiorObjectClassesChangedListener;
import org.opends.guitools.controlpanel.ui.GenericDialog;
import org.opends.guitools.controlpanel.ui.SelectObjectClassesPanel;
-import org.opends.guitools.controlpanel.ui.renderer.
- SchemaElementComboBoxCellRenderer;
+import org.opends.guitools.controlpanel.ui.renderer.SchemaElementComboBoxCellRenderer;
import org.opends.guitools.controlpanel.util.LowerCaseComparator;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.server.types.ObjectClass;
@@ -57,26 +55,26 @@
{
private static final long serialVersionUID = 123123973933568L;
- private Set<ObjectClass> toExclude = new HashSet<>();
- private JComboBox singleSuperior = Utilities.createComboBox();
- private JLabel multipleSuperiors = Utilities.createDefaultLabel();
- private JButton bSpecifyMultiple = Utilities.createButton(
+ private final Set<ObjectClass> toExclude = new HashSet<>();
+ private final JComboBox<ObjectClass> singleSuperior = Utilities.createComboBox();
+ private final JLabel multipleSuperiors = Utilities.createDefaultLabel();
+ private final JButton bSpecifyMultiple = Utilities.createButton(
INFO_CTRL_PANEL_SPECIFY_MULTIPLE_SUPERIORS_LABEL.get());
- private JButton bUpdateMultiple = Utilities.createButton(
+ private final JButton bUpdateMultiple = Utilities.createButton(
INFO_CTRL_PANEL_UPDATE_MULTIPLE_SUPERIORS_LABEL.get());
private SelectObjectClassesPanel superiorsPanel;
private GenericDialog superiorsDialog;
- private String MULTIPLE = "Multiple";
- private String SINGLE = "Single";
+ private static final String MULTIPLE = "Multiple";
+ private static final String SINGLE = "Single";
- private CardLayout cardLayout = new CardLayout();
+ private final CardLayout cardLayout;
private boolean isMultiple;
- private Set<ObjectClass> selectedMultipleSuperiors = new HashSet<>();
- private Set<SuperiorObjectClassesChangedListener> listeners = new HashSet<>();
+ private final Set<ObjectClass> selectedMultipleSuperiors = new HashSet<>();
+ private final Set<SuperiorObjectClassesChangedListener> listeners = new HashSet<>();
private Schema schema;
@@ -89,16 +87,6 @@
createLayout();
}
- /**
- * Constructor for this panel.
- * @param schema a non {@code null} schema object.
- */
- public SuperiorObjectClassesEditor(Schema schema)
- {
- this();
- updateWithSchema(schema);
- }
-
/** Creates the layout of this panel. */
private void createLayout()
{
@@ -124,8 +112,7 @@
});
SchemaElementComboBoxCellRenderer renderer = new
SchemaElementComboBoxCellRenderer(singleSuperior);
- DefaultComboBoxModel model = new DefaultComboBoxModel();
- singleSuperior.setModel(model);
+ singleSuperior.setModel(new DefaultComboBoxModel<ObjectClass>());
singleSuperior.setRenderer(renderer);
ItemListener itemListener = new ItemListener()
{
@@ -285,14 +272,11 @@
{
newParents.add(objectClassNameMap.get(key));
}
- Utilities.updateComboBoxModel(newParents,
- (DefaultComboBoxModel)singleSuperior.getModel());
+ Utilities.updateComboBoxModel(newParents, (DefaultComboBoxModel<ObjectClass>) singleSuperior.getModel());
if (this.schema == null)
{
- // Select the values.
- ObjectClass topClass = schema.getObjectClass("top");
- singleSuperior.setSelectedItem(topClass);
+ singleSuperior.setSelectedItem(schema.getObjectClass("top"));
}
this.schema = schema;
}
@@ -308,16 +292,6 @@
listeners.add(listener);
}
- /**
- * Removes the provided listener.
- * @param listener the listener to be removed.
- */
- public void removeParentObjectClassesChangedListener(
- SuperiorObjectClassesChangedListener listener)
- {
- listeners.remove(listener);
- }
-
private void specifyMultipleClicked()
{
updateMultipleClicked();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/BasicNode.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/BasicNode.java
index 02b0a94..128f649 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/BasicNode.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/BasicNode.java
@@ -19,10 +19,10 @@
import javax.swing.Icon;
import javax.swing.tree.DefaultMutableTreeNode;
-import org.opends.guitools.controlpanel.browser.BasicNodeError;
import org.forgerock.opendj.ldap.DN;
-import org.opends.server.types.LDAPURL;
import org.forgerock.opendj.ldap.RDN;
+import org.opends.guitools.controlpanel.browser.BasicNodeError;
+import org.opends.server.types.LDAPURL;
/** The basic node used to render entries in the 'Manage Entries' tree. */
public class BasicNode extends DefaultMutableTreeNode {
@@ -388,7 +388,8 @@
* or not.
* @return the RDN value from the DN.
*/
- public static String extractRDN(String dn, boolean showAttributeName) {
+ private static String extractRDN(String dn, boolean showAttributeName)
+ {
String result;
if (dn == null)
{
@@ -429,7 +430,8 @@
* @param dn the DN.
* @return the RDN value from the DN.
*/
- public static String extractRDN(String dn) {
+ private static String extractRDN(String dn)
+ {
return extractRDN(dn, false);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/DndBrowserNodes.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/DndBrowserNodes.java
index 4958a07..5392f06 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/DndBrowserNodes.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/nodes/DndBrowserNodes.java
@@ -33,7 +33,7 @@
public static final DataFlavor INFO_FLAVOR =
new DataFlavor(BrowserNodeInfo.class, "Browse Node Information");
- static DataFlavor[] FLAVORS = {INFO_FLAVOR };
+ private static DataFlavor[] FLAVORS = { INFO_FLAVOR };
private BrowserNodeInfo[] nodes;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/BrowserCellRenderer.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/BrowserCellRenderer.java
index ef519fc..985cb2b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/BrowserCellRenderer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/BrowserCellRenderer.java
@@ -22,7 +22,6 @@
import javax.swing.JTree;
-import org.opends.guitools.controlpanel.browser.BrowserController;
import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
import org.opends.guitools.controlpanel.ui.nodes.BasicNode;
@@ -30,11 +29,11 @@
public class BrowserCellRenderer extends TreeCellRenderer {
private static final long serialVersionUID = 6756291700611741513L;
- Font defaultFont = ColorAndFontConstants.treeFont;
- Font italicFont = defaultFont.deriveFont(Font.ITALIC);
- Font boldFont = defaultFont.deriveFont(Font.BOLD);
- Font italicBoldFont = defaultFont.deriveFont(Font.ITALIC|Font.BOLD);
- BasicNode inspectedNode;
+ private final Font defaultFont = ColorAndFontConstants.treeFont;
+ private final Font italicFont = defaultFont.deriveFont(Font.ITALIC);
+ private final Font boldFont = defaultFont.deriveFont(Font.BOLD);
+ private final Font italicBoldFont = defaultFont.deriveFont(Font.ITALIC | Font.BOLD);
+ private BasicNode inspectedNode;
/**
* Sets which is the inspected node. This method simply marks the selected
@@ -87,14 +86,4 @@
setFont(newFont);
return this;
}
-
-
- /**
- * Returns the row height for the provided browser controller.
- * @param controller the browser controller.
- * @return the row height for the provided browser controller.
- */
- public static int calculateRowHeight(BrowserController controller) {
- return 16;
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomCellRenderer.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomCellRenderer.java
index e86dea6..ed1fe77 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomCellRenderer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomCellRenderer.java
@@ -26,10 +26,10 @@
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
import org.opends.guitools.controlpanel.ui.components.LabelWithHelpIcon;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
/** Class used to render the tables. */
public class CustomCellRenderer extends LabelWithHelpIcon
@@ -37,7 +37,7 @@
{
private static final long serialVersionUID = -8604332267021523835L;
/** The border of the first column. */
- protected static final Border column0Border =
+ private static final Border column0Border =
BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(0, 1, 0, 0,
ColorAndFontConstants.gridColor),
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomListCellRenderer.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomListCellRenderer.java
index 5ba6897..e1ce66e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomListCellRenderer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/CustomListCellRenderer.java
@@ -39,11 +39,11 @@
{
private ListCellRenderer defaultRenderer;
/** The separator used to render a non-selectable separator in the combo box. */
- protected Component separator;
+ private Component separator;
/** The default font. */
protected Font defaultFont;
/** The category font. */
- protected Font categoryFont;
+ private Font categoryFont;
/**
* Constructor of a renderer to be used with a combo box.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/TaskCellRenderer.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/TaskCellRenderer.java
index 6ba32b4..3427849 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/TaskCellRenderer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/renderer/TaskCellRenderer.java
@@ -31,13 +31,13 @@
{
private static final long serialVersionUID = -84332267021523835L;
/** The border of the first column. TODO: modify CustomCellRenderer to make this public. */
- protected static final Border column0Border =
+ private static final Border column0Border =
BorderFactory.createCompoundBorder(
BorderFactory.createMatteBorder(0, 1, 0, 0,
ColorAndFontConstants.gridColor),
BorderFactory.createEmptyBorder(4, 4, 4, 4));
/** The default border. */
- public static final Border defaultBorder = CustomCellRenderer.defaultBorder;
+ private static final Border defaultBorder = CustomCellRenderer.defaultBorder;
/** Default constructor. */
public TaskCellRenderer()
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java
index 2b42966..95e96d2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromDirContext.java
@@ -44,17 +44,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
-import org.opends.admin.ads.util.ConnectionUtils;
-import org.opends.admin.ads.util.ConnectionWrapper;
-import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor;
-import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
-import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor;
-import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor;
-import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
-import org.opends.guitools.controlpanel.datamodel.IndexDescriptor;
-import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor;
-import org.opends.guitools.controlpanel.datamodel.VLVSortOrder;
-import org.opends.guitools.controlpanel.task.OnlineUpdateException;
+import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.server.config.client.AdministrationConnectorCfgClient;
import org.forgerock.opendj.server.config.client.BackendCfgClient;
import org.forgerock.opendj.server.config.client.BackendIndexCfgClient;
@@ -77,10 +67,20 @@
import org.forgerock.opendj.server.config.client.RootDNUserCfgClient;
import org.forgerock.opendj.server.config.client.SNMPConnectionHandlerCfgClient;
import org.forgerock.opendj.server.config.client.TaskBackendCfgClient;
+import org.opends.admin.ads.util.ConnectionUtils;
+import org.opends.admin.ads.util.ConnectionWrapper;
+import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor;
+import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
+import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor;
+import org.opends.guitools.controlpanel.datamodel.ConnectionHandlerDescriptor;
+import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
+import org.opends.guitools.controlpanel.datamodel.IndexDescriptor;
+import org.opends.guitools.controlpanel.datamodel.VLVIndexDescriptor;
+import org.opends.guitools.controlpanel.datamodel.VLVSortOrder;
+import org.opends.guitools.controlpanel.task.OnlineUpdateException;
import org.opends.server.config.ConfigConstants;
import org.opends.server.core.DirectoryServer;
import org.opends.server.tools.tasks.TaskEntry;
-import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.OpenDsException;
import org.opends.server.util.ServerConstants;
@@ -108,17 +108,17 @@
private final Map<String, CustomSearchResult> hmConnectionHandlersMonitor = new HashMap<>();
/** The monitor root entry DN. */
- protected DN monitorDN = DN.rootDN();
+ private DN monitorDN = DN.rootDN();
/** The JVM memory usage monitoring entry DN. */
- protected DN jvmMemoryUsageDN = DN.rootDN();
+ private DN jvmMemoryUsageDN = DN.rootDN();
/** The system information monitoring entry DN. */
- protected DN systemInformationDN = DN.rootDN();
+ private DN systemInformationDN = DN.rootDN();
/**The entry cache monitoring entry DN. */
- protected DN entryCachesDN = DN.rootDN();
+ private DN entryCachesDN = DN.rootDN();
/** The work queue monitoring entry DN. */
- protected DN workQueueDN = DN.rootDN();
+ private DN workQueueDN = DN.rootDN();
/** The version monitoring entry DN. */
- protected DN versionDN = DN.rootDN();
+ private DN versionDN = DN.rootDN();
{
try
@@ -616,7 +616,7 @@
*
* @return an array of monitoring attributes to be returned in the request.
*/
- protected String[] getMonitoringAttributes()
+ private String[] getMonitoringAttributes()
{
return new String[] {"*"};
}
@@ -665,9 +665,7 @@
* @throws NamingException
* if there is an error retrieving the values of the search result.
*/
- protected void handleMonitoringSearchResult(SearchResult sr,
- String searchBaseDN)
- throws NamingException
+ private void handleMonitoringSearchResult(SearchResult sr, String searchBaseDN) throws NamingException
{
if (javaVersion == null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigReader.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigReader.java
index 2c26dbd..5a59e2c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigReader.java
@@ -93,7 +93,7 @@
protected List<Exception> exceptions = Collections.emptyList();
/** Whether the configuration has already been read or not. */
- protected boolean configRead;
+ private boolean configRead;
/** The set of connection listeners. */
protected Set<ConnectionHandlerDescriptor> listeners = Collections.emptySet();
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ViewPositions.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ViewPositions.java
index 390054b..0f8a550 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ViewPositions.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ViewPositions.java
@@ -18,6 +18,7 @@
import java.awt.Point;
import java.util.ArrayList;
+import java.util.List;
import javax.swing.JScrollPane;
@@ -27,14 +28,14 @@
*/
public class ViewPositions
{
- private ArrayList<JScrollPane> scrolls = new ArrayList<>();
- private ArrayList<Point> points = new ArrayList<>();
+ private final List<JScrollPane> scrolls = new ArrayList<>();
+ private final List<Point> points = new ArrayList<>();
/**
* Returns the size of the lists.
* @return the size of the lists.
*/
- public int size()
+ int size()
{
return scrolls.size();
}
@@ -44,25 +45,18 @@
* @param scroll the scroll bar.
* @param p the point.
*/
- public void add(JScrollPane scroll, Point p)
+ void add(JScrollPane scroll, Point p)
{
scrolls.add(scroll);
points.add(p);
}
- /** Clears the contents of both lists. */
- public void clear()
- {
- scrolls.clear();
- points.clear();
- }
-
/**
* Returns the point at the provided index.
* @param index the index.
* @return the point at the provided index.
*/
- public Point getPoint(int index)
+ Point getPoint(int index)
{
return points.get(index);
}
@@ -72,7 +66,7 @@
* @param index the index.
* @return the scroll at the provided index.
*/
- public JScrollPane getScrollPane(int index)
+ JScrollPane getScrollPane(int index)
{
return scrolls.get(index);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
index 5174190..683391f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
@@ -1383,7 +1383,7 @@
*
* @throws ApplicationException if something goes wrong.
*/
- protected void disableWindowsService() throws ApplicationException {
+ private void disableWindowsService() throws ApplicationException {
notifyListeners(getFormattedWithPoints(
INFO_PROGRESS_DISABLING_WINDOWS_SERVICE.get()));
int code = disableService(System.out, System.err);
@@ -1393,7 +1393,6 @@
switch (code) {
case SERVICE_DISABLE_SUCCESS:
- break;
case SERVICE_ALREADY_DISABLED:
break;
default:
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Application.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Application.java
index 014fd22..0b1bcef 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Application.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Application.java
@@ -17,15 +17,17 @@
package org.opends.quicksetup;
-import static org.opends.messages.QuickSetupMessages.*;
import static com.forgerock.opendj.cli.Utils.*;
+import static org.opends.messages.QuickSetupMessages.*;
+
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.Map;
import java.util.Set;
import javax.naming.NamingException;
+
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
@@ -39,7 +41,6 @@
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.util.Utils;
@@ -67,58 +68,15 @@
protected ProgressMessageFormatter formatter;
/** Handler for listeners and event firing. */
- protected ProgressUpdateListenerDelegate listenerDelegate;
+ private ProgressUpdateListenerDelegate listenerDelegate;
- private ErrorPrintStream err = new ErrorPrintStream();
- private OutputPrintStream out = new OutputPrintStream();
+ private final ErrorPrintStream err = new ErrorPrintStream();
+ private final OutputPrintStream out = new OutputPrintStream();
/** Temporary log file where messages will be logged. */
protected TempLogFile tempLogFile;
/**
- * Creates an application by instantiating the Application class
- * denoted by the System property
- * <code>org.opends.quicksetup.Application.class</code>.
- * @return Application object that was newly instantiated
- * @throws RuntimeException if there was a problem
- * creating the new Application object
- */
- public static GuiApplication create() throws RuntimeException {
- GuiApplication app;
- String appClassName =
- System.getProperty("org.opends.quicksetup.Application.class");
- if (appClassName != null) {
- Class<?> appClass = null;
- try {
- appClass = Class.forName(appClassName);
- app = (GuiApplication) appClass.newInstance();
- } catch (ClassNotFoundException e) {
- logger.info(LocalizableMessage.raw("error creating quicksetup application", e));
- String msg = "Application class " + appClass + " not found";
- throw new RuntimeException(msg, e);
- } catch (IllegalAccessException e) {
- logger.info(LocalizableMessage.raw("error creating quicksetup application", e));
- String msg = "Could not access class " + appClass;
- throw new RuntimeException(msg, e);
- } catch (InstantiationException e) {
- logger.info(LocalizableMessage.raw("error creating quicksetup application", e));
- String msg = "Error instantiating class " + appClass;
- throw new RuntimeException(msg, e);
- } catch (ClassCastException e) {
- String msg = "The class indicated by the system property " +
- "'org.opends.quicksetup.Application.class' must " +
- " must be of type Application";
- throw new RuntimeException(msg, e);
- }
- } else {
- String msg = "System property 'org.opends.quicksetup.Application.class'" +
- " must specify class quicksetup application";
- throw new RuntimeException(msg);
- }
- return app;
- }
-
- /**
* Sets this instances user data.
* @param userData UserData this application will use
* when executing
@@ -573,6 +531,7 @@
*/
public void checkAbort() throws ApplicationException
{
+ // no-op
}
/**
@@ -692,6 +651,7 @@
*/
protected void applicationPrintStreamReceived(String message)
{
+ // no-op
}
/**
@@ -758,7 +718,8 @@
* This class is used to notify the ProgressUpdateListeners of events
* that are written to the standard streams.
*/
- protected abstract class ApplicationPrintStream extends PrintStream {
+ private abstract class ApplicationPrintStream extends PrintStream
+ {
private boolean isFirstLine;
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Configuration.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Configuration.java
index 2bcb2c1..0ad85f0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Configuration.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Configuration.java
@@ -12,19 +12,18 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
*/
-
package org.opends.quicksetup;
-import org.opends.quicksetup.util.Utils;
-
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.util.Set;
import java.util.HashSet;
+import java.util.Set;
+
+import org.opends.quicksetup.util.Utils;
/**
* Represents the contents of an OpenDS configuration file.
@@ -33,8 +32,8 @@
private String contents;
private String lowerCaseContents;
- private Installation install;
- private File file;
+ private final Installation install;
+ private final File file;
/**
* Create a Configuration from a file.
@@ -315,7 +314,8 @@
* Loads the contents of the configuration file into memory.
* @throws IOException if there were problems loading the file
*/
- public void load() throws IOException {
+ private void load() throws IOException
+ {
StringBuilder buf = new StringBuilder();
FileReader reader = new FileReader(file);
BufferedReader in = new BufferedReader(reader);
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java
index 2043626..5dbe297 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Installation.java
@@ -52,48 +52,48 @@
/** The relative path where all the UNIX binaries (scripts) are. */
public static final String UNIX_BINARIES_PATH_RELATIVE = "bin";
/** The relative path where all the MacOS X Applications are. */
- public static final String MAC_APPLICATIONS_PATH_RELATIVE = "bin";
+ private static final String MAC_APPLICATIONS_PATH_RELATIVE = "bin";
/** The relative path where all the libraries (jar files) are. */
public static final String LIBRARIES_PATH_RELATIVE = SetupUtils.LIBRARIES_PATH_RELATIVE;
/** The relative path where the resources directory (to customize the product) is. */
- public static final String RESOURCES_PATH_RELATIVE = "resources";
+ private static final String RESOURCES_PATH_RELATIVE = "resources";
/** The relative path where customer classes are. */
- public static final String CLASSES_PATH_RELATIVE = "classes";
+ private static final String CLASSES_PATH_RELATIVE = "classes";
/** The relative path where the database files are. */
- public static final String DATABASES_PATH_RELATIVE = "db";
+ private static final String DATABASES_PATH_RELATIVE = "db";
/** The relative path where the log files are. */
- public static final String LOGS_PATH_RELATIVE = "logs";
+ private static final String LOGS_PATH_RELATIVE = "logs";
/** The relative path where the LDIF files are. */
- public static final String LDIFS_PATH_RELATIVE = "ldif";
+ private static final String LDIFS_PATH_RELATIVE = "ldif";
/** The relative path where the backup files are. */
public static final String BACKUPS_PATH_RELATIVE = "bak";
/** The relative path where the config files are. */
public static final String CONFIG_PATH_RELATIVE = "config";
/** The relative path where the config files are. */
- public static final String HISTORY_PATH_RELATIVE = "history";
+ private static final String HISTORY_PATH_RELATIVE = "history";
/** Path to the config/upgrade directory where upgrade base files are stored. */
- public static final String UPGRADE_PATH = "upgrade";
+ private static final String UPGRADE_PATH = "upgrade";
/** Relative path to the locks directory. */
public static final String LOCKS_PATH_RELATIVE = "locks";
/** Relative path to the locks directory. */
- public static final String TMP_PATH_RELATIVE = "tmp";
+ private static final String TMP_PATH_RELATIVE = "tmp";
/** The relative path to the current Configuration LDIF file. */
- public static final String CURRENT_CONFIG_FILE_NAME = "config.ldif";
+ private static final String CURRENT_CONFIG_FILE_NAME = "config.ldif";
/** The relative path to the current Configuration LDIF file. */
- public static final String BASE_CONFIG_FILE_PREFIX = "config.ldif.";
+ private static final String BASE_CONFIG_FILE_PREFIX = "config.ldif.";
/** The relative path to the instance.loc file. */
public static final String INSTANCE_LOCATION_PATH_RELATIVE = "instance.loc";
/** The path to the instance.loc file. */
public static final String INSTANCE_LOCATION_PATH = "/etc/opendj/"
+ INSTANCE_LOCATION_PATH_RELATIVE;
/** The relative path to tmpl_instance. */
- public static final String TEMPLATE_RELATIVE_PATH = "template";
+ private static final String TEMPLATE_RELATIVE_PATH = "template";
/** The relative path to buildinfo file. */
- public static final String BUILDINFO_RELATIVE_PATH = "buildinfo";
+ private static final String BUILDINFO_RELATIVE_PATH = "buildinfo";
/** The UNIX setup script file name. */
public static final String UNIX_SETUP_FILE_NAME = "setup";
/** The Windows setup batch file name. */
- public static final String WINDOWS_SETUP_FILE_NAME = "setup.bat";
+ private static final String WINDOWS_SETUP_FILE_NAME = "setup.bat";
/** The UNIX uninstall script file name. */
public static final String UNIX_UNINSTALL_FILE_NAME = "uninstall";
/** The Windows uninstall batch file name. */
@@ -877,7 +877,7 @@
* consuming
* @return BuildInformation object describing this instance
*/
- public BuildInformation getInstanceBuildInformation(boolean useCachedVersion)
+ private BuildInformation getInstanceBuildInformation(boolean useCachedVersion)
{
if (instanceInformation == null || !useCachedVersion)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/JavaArguments.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/JavaArguments.java
index 3f563c6..8ba8229 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/JavaArguments.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/JavaArguments.java
@@ -167,7 +167,7 @@
* @param defaultJavaArguments the default values for the java arguments.
* @return the message representing a java arguments object.
*/
- public static LocalizableMessage getMessage(JavaArguments javaArguments,
+ private static LocalizableMessage getMessage(JavaArguments javaArguments,
JavaArguments defaultJavaArguments)
{
LocalizableMessage msg;
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Launcher.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Launcher.java
index 391bf7b..1fc34e7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/Launcher.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/Launcher.java
@@ -16,18 +16,18 @@
*/
package org.opends.quicksetup;
-import org.forgerock.i18n.LocalizableMessage;
-import com.forgerock.opendj.cli.ArgumentParser;
-
-import static org.opends.messages.QuickSetupMessages.*;
-import static org.opends.server.util.DynamicConstants.PRINTABLE_VERSION_STRING;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
-import org.opends.quicksetup.util.Utils;
+import static org.opends.messages.QuickSetupMessages.*;
+import static org.opends.server.util.DynamicConstants.*;
import java.io.PrintStream;
+import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.opends.quicksetup.util.Utils;
+
+import com.forgerock.opendj.cli.ArgumentParser;
/**
* Responsible for providing initial evaluation of command line arguments
@@ -38,7 +38,7 @@
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
/** Arguments with which this launcher was invoked. */
- protected String[] args;
+ protected final String[] args;
/** The temporary log file which will be kept if an error occurs. */
protected final TempLogFile tempLogFile;
@@ -153,7 +153,8 @@
* @param toStdErr whether the message must be printed to the standard error
* or the standard output.
*/
- protected void printUsage(String i18nMsg, boolean toStdErr) {
+ private void printUsage(String i18nMsg, boolean toStdErr)
+ {
if (toStdErr)
{
System.err.println(i18nMsg);
@@ -252,7 +253,7 @@
* @return 0 if everything worked fine, and an error code if something wrong
* occurred.
*/
- protected int launchCli(CliApplication cliApp)
+ private int launchCli(CliApplication cliApp)
{
System.setProperty(Constants.CLI_JAVA_PROPERTY, "true");
QuickSetupCli cli = new QuickSetupCli(cliApp, this);
@@ -274,7 +275,7 @@
}
/** Prints the version statement to standard output terminal. */
- protected void printVersion()
+ private void printVersion()
{
System.out.print(PRINTABLE_VERSION_STRING);
}
@@ -285,7 +286,8 @@
* @param toStdErr whether the message must be printed to the standard error
* or the standard output.
*/
- protected void printUsage(boolean toStdErr) {
+ private void printUsage(boolean toStdErr)
+ {
try
{
ArgumentParser argParser = getArgumentParser();
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/QuickSetupCli.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/QuickSetupCli.java
index 02de2e0..7283159 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/QuickSetupCli.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/QuickSetupCli.java
@@ -14,33 +14,30 @@
* Copyright 2008-2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2016 ForgeRock AS.
*/
-
package org.opends.quicksetup;
-import static com.forgerock.opendj.cli.Utils.wrapText;
+import static com.forgerock.opendj.cli.Utils.*;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
-
-import org.opends.quicksetup.util.ProgressMessageFormatter;
-import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
-import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.event.ProgressUpdateEvent;
+import org.opends.quicksetup.event.ProgressUpdateListener;
+import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
+import org.opends.quicksetup.util.ProgressMessageFormatter;
+import org.opends.quicksetup.util.Utils;
+
import com.forgerock.opendj.cli.ClientException;
/** Class used by Launcher to start a CLI application. */
public class QuickSetupCli {
- /** Arguments passed in the command line. */
- protected Launcher launcher;
-
- private CliApplication cliApp;
-
- private UserData userData;
-
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
+ /** Arguments passed in the command line. */
+ private final Launcher launcher;
+ private final CliApplication cliApp;
+ private UserData userData;
+
/**
* Creates a QuickSetupCli instance.
* @param cliApp the application to be run
@@ -66,7 +63,7 @@
* @return the return code (SUCCESSFUL, CANCELLED, USER_DATA_ERROR,
* ERROR_ACCESSING_FILE_SYSTEM, ERROR_STOPPING_SERVER or BUG.
*/
- public ReturnCode run()
+ ReturnCode run()
{
ReturnCode returnValue;
// Parse the arguments
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ReturnCode.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ReturnCode.java
index 3af990e..6ec1bae 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ReturnCode.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ReturnCode.java
@@ -55,14 +55,15 @@
/** Return code for errors that are non-specified. */
public static final ReturnCode UNKNOWN = new ReturnCode(100);
- private int code;
+ private final int code;
/**
* Creates a new parameterized instance.
*
* @param code to return
*/
- public ReturnCode(int code) {
+ private ReturnCode(int code)
+ {
this.code = code;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/SecurityOptions.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/SecurityOptions.java
index fcd8d00..c021bc9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/SecurityOptions.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/SecurityOptions.java
@@ -54,7 +54,7 @@
private CertificateType certificateType;
private String keyStorePath;
private String keyStorePassword;
- private Set<String> aliasesToUse = new TreeSet<>();
+ private final Set<String> aliasesToUse = new TreeSet<>();
private SecurityOptions()
{
@@ -111,7 +111,7 @@
* @return a new instance of a SecurityOptions using a self-signed
* certificate.
*/
- public static SecurityOptions createSelfSignedCertificateOptions(boolean enableSSL, boolean enableStartTLS,
+ private static SecurityOptions createSelfSignedCertificateOptions(boolean enableSSL, boolean enableStartTLS,
int sslPort, Collection<String> aliasesToUse)
{
return createOptionsForCertificatType(
@@ -404,7 +404,7 @@
* Sets the certificates aliases name.
* @param aliasesToUse the certificates aliases name.
*/
- void setAliasToUse(Collection<String> aliasesToUse)
+ private void setAliasToUse(Collection<String> aliasesToUse)
{
this.aliasesToUse.clear();
this.aliasesToUse.addAll(aliasesToUse);
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ConfiguredDomain.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ConfiguredDomain.java
index 2d9100a..2636e88 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ConfiguredDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ConfiguredDomain.java
@@ -12,9 +12,8 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
-
package org.opends.quicksetup.installer;
import java.util.HashSet;
@@ -24,13 +23,12 @@
* Class used to know what has been modified in the configuration of a
* replication domain.
* This class provides a read only view of what has been configured.
- *
*/
class ConfiguredDomain
{
- private String domainName;
- private boolean isCreated;
- Set<String> addedReplicationServers;
+ private final String domainName;
+ private final boolean isCreated;
+ private final Set<String> addedReplicationServers;
/**
* Constructor of the ConfiguredDomain object.
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/DataReplicationOptions.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/DataReplicationOptions.java
index e00d2fb..c671ed9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/DataReplicationOptions.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/DataReplicationOptions.java
@@ -153,7 +153,7 @@
* @return the free port of type X989 if it is available and we can use and -1
* if not.
*/
- static int getDefaultReplicationPort()
+ private static int getDefaultReplicationPort()
{
int defaultPort = -1;
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
index cf3532b..fd156b0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/Installer.java
@@ -183,28 +183,23 @@
private TopologyCache lastLoadedCache;
/** Indicates that we've detected that there is something installed. */
- boolean forceToDisplaySetup;
+ private boolean forceToDisplaySetup;
/** When true indicates that the user has canceled this operation. */
- protected boolean canceled;
-
+ private boolean canceled;
private boolean javaVersionCheckFailed;
/** Map containing information about what has been configured remotely. */
private final Map<ServerDescriptor, ConfiguredReplication> hmConfiguredRemoteReplication = new HashMap<>();
/** Set of progress steps that have been completed. */
- protected Set<InstallProgressStep> completedProgress = new HashSet<>();
-
- private final List<WizardStep> lstSteps = new ArrayList<>();
-
- private final Set<WizardStep> SUBSTEPS = new HashSet<>();
- {
- SUBSTEPS.add(Step.CREATE_GLOBAL_ADMINISTRATOR);
- SUBSTEPS.add(Step.SUFFIXES_OPTIONS);
- SUBSTEPS.add(Step.NEW_SUFFIX_OPTIONS);
- SUBSTEPS.add(Step.REMOTE_REPLICATION_PORTS);
- }
+ private final Set<InstallProgressStep> completedProgress = new HashSet<>();
+ private final List<WizardStep> listSteps = new ArrayList<>();
+ private final Set<WizardStep> SUBSTEPS = CollectionUtils.<WizardStep> newHashSet(
+ Step.CREATE_GLOBAL_ADMINISTRATOR,
+ Step.SUFFIXES_OPTIONS,
+ Step.NEW_SUFFIX_OPTIONS,
+ Step.REMOTE_REPLICATION_PORTS);
private final Map<WizardStep, WizardStep> hmPreviousSteps = new HashMap<>();
@@ -216,9 +211,10 @@
private String lastImportProgress;
/** Aliases of self-signed certificates. */
- protected static final String SELF_SIGNED_CERT_ALIASES[] = new String[] {
+ private static final String[] SELF_SIGNED_CERT_ALIASES = {
SecurityOptions.SELF_SIGNED_CERT_ALIAS,
- SecurityOptions.SELF_SIGNED_EC_CERT_ALIAS };
+ SecurityOptions.SELF_SIGNED_EC_CERT_ALIAS
+ };
/**
* The threshold in minutes used to know whether we must display a warning
@@ -621,7 +617,7 @@
/** Creates a default instance. */
public Installer()
{
- addStepsInOrder(lstSteps, LicenseFile.exists());
+ addStepsInOrder(listSteps, LicenseFile.exists());
}
@Override
@@ -880,7 +876,7 @@
@Override
public Set<? extends WizardStep> getWizardSteps()
{
- return Collections.unmodifiableSet(new HashSet<WizardStep>(lstSteps));
+ return Collections.unmodifiableSet(new HashSet<WizardStep>(listSteps));
}
@Override
@@ -1079,10 +1075,10 @@
}
else
{
- int i = lstSteps.indexOf(step);
- if (i != -1 && i + 1 < lstSteps.size())
+ int i = listSteps.indexOf(step);
+ if (i != -1 && i + 1 < listSteps.size())
{
- return lstSteps.get(i + 1);
+ return listSteps.get(i + 1);
}
}
return null;
@@ -1092,7 +1088,7 @@
public LinkedHashSet<WizardStep> getOrderedSteps()
{
LinkedHashSet<WizardStep> orderedSteps = new LinkedHashSet<>();
- addStepsInOrder(orderedSteps, lstSteps.contains(LICENSE));
+ addStepsInOrder(orderedSteps, listSteps.contains(LICENSE));
return orderedSteps;
}
@@ -1123,10 +1119,10 @@
if (prev == null)
{
- int i = lstSteps.indexOf(step);
+ int i = listSteps.indexOf(step);
if (i != -1 && i > 0)
{
- prev = lstSteps.get(i - 1);
+ prev = listSteps.get(i - 1);
}
}
return prev;
@@ -1142,7 +1138,7 @@
* Uninstalls installed services. This is to be used when the user has elected
* to cancel an installation.
*/
- protected void uninstallServices()
+ private void uninstallServices()
{
if (completedProgress.contains(InstallProgressStep.ENABLING_WINDOWS_SERVICE))
{
@@ -1191,7 +1187,7 @@
* @throws ApplicationException
* if something goes wrong.
*/
- protected void configureServer() throws ApplicationException
+ private void configureServer() throws ApplicationException
{
notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CONFIGURING.get()));
copyTemplateInstance();
@@ -1861,7 +1857,7 @@
* @throws ApplicationException
* if something goes wrong.
*/
- protected void createReplicatedBackendsIfRequired() throws ApplicationException
+ private void createReplicatedBackendsIfRequired() throws ApplicationException
{
if (FIRST_IN_TOPOLOGY == getUserData().getReplicationOptions().getType())
{
@@ -1965,7 +1961,7 @@
* @throws ApplicationException
* if something goes wrong.
*/
- protected void configureReplication() throws ApplicationException
+ private void configureReplication() throws ApplicationException
{
notifyListeners(getFormattedWithPoints(INFO_PROGRESS_CONFIGURING_REPLICATION.get()));
@@ -2183,7 +2179,7 @@
* @throws ApplicationException
* if something goes wrong.
*/
- protected void enableWindowsService() throws ApplicationException
+ private void enableWindowsService() throws ApplicationException
{
notifyListeners(getFormattedWithPoints(INFO_PROGRESS_ENABLING_WINDOWS_SERVICE.get()));
InstallerHelper helper = new InstallerHelper();
@@ -2200,7 +2196,7 @@
* @param isCli
* a boolean to indicate if the install is using CLI or GUI
*/
- protected void initSummaryMap(Map<ProgressStep, LocalizableMessage> hmSummary, boolean isCli)
+ private void initSummaryMap(Map<ProgressStep, LocalizableMessage> hmSummary, boolean isCli)
{
put(hmSummary, NOT_STARTED, INFO_SUMMARY_INSTALL_NOT_STARTED);
put(hmSummary, CONFIGURING_SERVER, INFO_SUMMARY_CONFIGURING);
@@ -2250,7 +2246,7 @@
* @param isCli
* a boolean to indicate if the install is using CLI or GUI
*/
- protected void updateSummaryWithServerState(Map<ProgressStep, LocalizableMessage> hmSummary, Boolean isCli)
+ private void updateSummaryWithServerState(Map<ProgressStep, LocalizableMessage> hmSummary, Boolean isCli)
{
Installation installation = getInstallation();
String cmd = getPath(installation.getControlPanelCommandFile());
@@ -2400,7 +2396,7 @@
* @param currentProgressStep
* the current progress step of the installation process.
*/
- protected void setCurrentProgressStep(InstallProgressStep currentProgressStep)
+ private void setCurrentProgressStep(InstallProgressStep currentProgressStep)
{
if (currentProgressStep != null)
{
@@ -2416,7 +2412,7 @@
* @throws ApplicationException
* if something goes wrong.
*/
- protected void createData() throws ApplicationException
+ private void createData() throws ApplicationException
{
if (createNotReplicatedSuffix()
&& NewSuffixOptions.Type.LEAVE_DATABASE_EMPTY != getUserData().getNewSuffixOptions().getType())
@@ -2451,7 +2447,7 @@
* @throws ApplicationException
* if something goes wrong.
*/
- protected void initializeSuffixes() throws ApplicationException
+ private void initializeSuffixes() throws ApplicationException
{
ConnectionWrapper conn = null;
try
@@ -2623,7 +2619,7 @@
* @throws ApplicationException
* if something goes wrong.
*/
- protected void updateADS() throws ApplicationException
+ private void updateADS() throws ApplicationException
{
DataReplicationOptions repl = getUserData().getReplicationOptions();
boolean isRemoteServer = repl.getType() == DataReplicationOptions.Type.IN_EXISTING_TOPOLOGY;
@@ -2792,7 +2788,7 @@
*
* @return {@code true} if we must create a new suffix and {@code false} otherwise.
*/
- protected boolean createNotReplicatedSuffix()
+ private boolean createNotReplicatedSuffix()
{
DataReplicationOptions repl = getUserData().getReplicationOptions();
@@ -2808,7 +2804,7 @@
*
* @return {@code true} if we must configure replication and {@code false} otherwise.
*/
- protected boolean mustConfigureReplication()
+ private boolean mustConfigureReplication()
{
return getUserData().getReplicationOptions().getType() != DataReplicationOptions.Type.STANDALONE;
}
@@ -2818,7 +2814,7 @@
*
* @return {@code true} if we must create the ADS and {@code false} otherwise.
*/
- protected boolean mustCreateAds()
+ private boolean mustCreateAds()
{
return getUserData().getReplicationOptions().getType() != DataReplicationOptions.Type.STANDALONE;
}
@@ -2828,7 +2824,7 @@
*
* @return {@code true} if we must start the server and {@code false} otherwise.
*/
- protected boolean mustStart()
+ private boolean mustStart()
{
return getUserData().getStartServer() || mustCreateAds();
}
@@ -2841,7 +2837,7 @@
*
* @return {@code true} if the start server must be launched in verbose mode and {@code false} otherwise.
*/
- protected boolean isStartVerbose()
+ private boolean isStartVerbose()
{
if (isVerbose())
{
@@ -2883,7 +2879,7 @@
*
* @return {@code true} if we must stop the server and {@code false} otherwise.
*/
- protected boolean mustStop()
+ private boolean mustStop()
{
return !getUserData().getStartServer() && mustCreateAds();
}
@@ -2893,7 +2889,7 @@
*
* @return {@code true} if we must initialize suffixes and {@code false} otherwise.
*/
- protected boolean mustInitializeSuffixes()
+ private boolean mustInitializeSuffixes()
{
return getUserData().getReplicationOptions().getType() == DataReplicationOptions.Type.IN_EXISTING_TOPOLOGY;
}
@@ -2997,7 +2993,6 @@
private void updateUserDataForServerSettingsPanel(QuickSetup qs) throws UserDataException
{
List<LocalizableMessage> errorMsgs = new ArrayList<>();
- LocalizableMessage confirmationMsg = null;
// Check the host is not empty.
// TODO: check that the host name is valid...
@@ -3183,10 +3178,6 @@
{
throw new UserDataException(Step.SERVER_SETTINGS, getMessageFromCollection(errorMsgs, "\n"));
}
- if (confirmationMsg != null)
- {
- throw new UserDataConfirmationException(Step.SERVER_SETTINGS, confirmationMsg);
- }
}
private LocalizableMessage getCannotBindErrorMessage(int port)
@@ -3404,32 +3395,12 @@
{
host = getHostNameForLdapUrl(host);
HostPort hostPort = new HostPort(host, port);
- ConnectionWrapper conn = null;
ApplicationTrustManager trustManager = getTrustManager();
trustManager.setHost(host);
trustManager.resetLastRefusedItems();
- try
+ try (ConnectionWrapper conn = newConnectionWrapper(dn, pwd, effectiveDn, hostPort, trustManager))
{
- effectiveDn[0] = dn;
- try
- {
- conn = new ConnectionWrapper(hostPort, LDAPS, dn, pwd, getConnectTimeout(), trustManager);
- }
- catch (Throwable t)
- {
- if (!isCertificateException(t))
- {
- // Try using a global administrator
- dn = ADSContext.getAdministratorDN(dn);
- effectiveDn[0] = dn;
- conn = new ConnectionWrapper(hostPort, LDAPS, dn, pwd, getConnectTimeout(), trustManager);
- }
- else
- {
- throw t;
- }
- }
ADSContext adsContext = new ADSContext(conn);
if (adsContext.hasAdminData())
{
@@ -3537,14 +3508,11 @@
throw new UserDataCertificateException(Step.REPLICATION_OPTIONS, INFO_CERTIFICATE_EXCEPTION.get(host, port),
t, host, port, trustManager.getLastRefusedChain(), trustManager.getLastRefusedAuthType(), excType);
}
- else
- {
- qs.displayFieldInvalid(FieldName.REMOTE_SERVER_HOST, true);
- qs.displayFieldInvalid(FieldName.REMOTE_SERVER_PORT, true);
- qs.displayFieldInvalid(FieldName.REMOTE_SERVER_DN, true);
- qs.displayFieldInvalid(FieldName.REMOTE_SERVER_PWD, true);
- errorMsgs.add(INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(host + ":" + port, t));
- }
+ qs.displayFieldInvalid(FieldName.REMOTE_SERVER_HOST, true);
+ qs.displayFieldInvalid(FieldName.REMOTE_SERVER_PORT, true);
+ qs.displayFieldInvalid(FieldName.REMOTE_SERVER_DN, true);
+ qs.displayFieldInvalid(FieldName.REMOTE_SERVER_PWD, true);
+ errorMsgs.add(INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(host + ":" + port, t));
}
else if (t instanceof NamingException)
{
@@ -3566,9 +3534,26 @@
throw new UserDataException(Step.REPLICATION_OPTIONS, getThrowableMsg(INFO_BUG_MSG.get(), t));
}
}
- finally
+ }
+
+ private ConnectionWrapper newConnectionWrapper(String dn, String pwd, String[] effectiveDn, HostPort hostPort,
+ ApplicationTrustManager trustManager) throws Throwable
+ {
+ try
{
- StaticUtils.close(conn);
+ effectiveDn[0] = dn;
+ return new ConnectionWrapper(hostPort, LDAPS, dn, pwd, getConnectTimeout(), trustManager);
+ }
+ catch (Throwable t)
+ {
+ if (isCertificateException(t))
+ {
+ throw t;
+ }
+ // Try using a global administrator
+ dn = ADSContext.getAdministratorDN(dn);
+ effectiveDn[0] = dn;
+ return new ConnectionWrapper(hostPort, LDAPS, dn, pwd, getConnectTimeout(), trustManager);
}
}
@@ -4004,7 +3989,7 @@
* @return the keystore path to be used for generating a self-signed
* certificate.
*/
- protected String getSelfSignedKeystorePath()
+ private String getSelfSignedKeystorePath()
{
return getPath2("keystore");
}
@@ -4077,7 +4062,7 @@
*
* @return the self-signed certificate password used for this session.
*/
- protected String getSelfSignedCertificatePwd()
+ private String getSelfSignedCertificatePwd()
{
if (selfSignedCertPw == null)
{
@@ -4618,7 +4603,7 @@
* the ServerDescriptor.
* @return the host port string representation of the provided server.
*/
- protected HostPort getHostPort(ServerDescriptor server)
+ private HostPort getHostPort(ServerDescriptor server)
{
HostPort hostPort = null;
@@ -4658,7 +4643,7 @@
* @return the timeout to be used to connect in milliseconds. Returns
* {@code 0} if there is no timeout.
*/
- protected int getConnectTimeout()
+ private int getConnectTimeout()
{
return getUserData().getConnectTimeout();
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
index 7318f2c..54c3c2b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
@@ -301,29 +301,6 @@
}
/**
- * Deletes a backend on the server.
- * @param connWrapper the connection to the server.
- * @param backendName the name of the backend to be deleted.
- * @param serverDisplay the server display.
- * @throws ApplicationException if something goes wrong.
- */
- public void deleteBackend(ConnectionWrapper connWrapper, String backendName, String serverDisplay)
- throws ApplicationException
- {
- try
- {
- connWrapper.getRootConfiguration().removeBackend(backendName);
- }
- catch (Throwable t)
- {
- throw new ApplicationException(
- ReturnCode.CONFIGURATION_ERROR,
- INFO_ERROR_CONFIGURING_REMOTE_GENERIC.get(serverDisplay, t),
- t);
- }
- }
-
- /**
* Deletes a backend on the server. It assumes the server is stopped.
* @param backendName the name of the backend to be deleted.
* @throws ApplicationException if something goes wrong.
@@ -367,7 +344,7 @@
RootCfgClient root = conn.getRootConfiguration();
BackendCfgClient backend = root.createBackend(backendType, backendName, null);
backend.setEnabled(true);
- backend.setBaseDN(toByteStrings(baseDNs));
+ backend.setBaseDN(toDNs(baseDNs));
backend.setBackendId(backendName);
backend.setWritabilityMode(BackendCfgDefn.WritabilityMode.ENABLED);
backend.commit();
@@ -379,7 +356,7 @@
}
}
- private Set<DN> toByteStrings(Set<String> strings) throws DirectoryException
+ private Set<DN> toDNs(Set<String> strings) throws DirectoryException
{
Set<DN> results = new HashSet<>();
for (String s : strings)
@@ -390,33 +367,6 @@
}
/**
- * Sets the base DNs on a given backend.
- * @param connWrapper the connection to the server.
- * @param backendName the name of the backend where the base Dns must be
- * defined.
- * @param baseDNs the list of base DNs to be defined on the server.
- * @param serverDisplay the server display.
- * @throws ApplicationException if something goes wrong.
- */
- public void setBaseDns(ConnectionWrapper connWrapper, String backendName, Set<String> baseDNs, String serverDisplay)
- throws ApplicationException
- {
- try
- {
- BackendCfgClient backend = connWrapper.getRootConfiguration().getBackend(backendName);
- backend.setBaseDN(toByteStrings(baseDNs));
- backend.commit();
- }
- catch (Throwable t)
- {
- throw new ApplicationException(
- ReturnCode.CONFIGURATION_ERROR,
- INFO_ERROR_CONFIGURING_REMOTE_GENERIC.get(serverDisplay, t),
- t);
- }
- }
-
- /**
* Configures the replication on a given server.
* @param conn the connection to the server where we want to configure
* the replication.
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java
index 2913dbf..9704d8c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java
@@ -12,9 +12,8 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
*/
-
package org.opends.quicksetup.ui;
import static org.opends.messages.QuickSetupMessages.*;
@@ -80,7 +79,7 @@
}
private static final long serialVersionUID = -8989965057591475064L;
private ReturnType returnValue = ReturnType.NOT_ACCEPTED;
- private UserDataCertificateException ce;
+ private final UserDataCertificateException ce;
private JButton doNotAcceptButton;
private JComponent certificateDetails;
private JEditorPane explanationPane;
@@ -391,7 +390,7 @@
p.setLayout(new GridBagLayout());
if (ce.getChain() != null && ce.getChain().length > 0)
{
- final JComboBox combo = new JComboBox();
+ final JComboBox<String> combo = new JComboBox<String>();
combo.setToolTipText(
INFO_CERTIFICATE_CHAIN_COMBO_TOOLTIP.get().toString());
final CardLayout cl = new CardLayout();
@@ -596,7 +595,7 @@
* @param cert the certificate object.
* @return the LocalizableMessage representation of the SHA1 fingerprint.
*/
- public static LocalizableMessage getSHA1FingerPrint(X509Certificate cert)
+ private static LocalizableMessage getSHA1FingerPrint(X509Certificate cert)
{
return getFingerPrint(cert, "SHA1");
}
@@ -606,7 +605,7 @@
* @param cert the certificate object.
* @return the LocalizableMessage representation of the MD5 fingerprint.
*/
- public static LocalizableMessage getMD5FingerPrint(X509Certificate cert)
+ private static LocalizableMessage getMD5FingerPrint(X509Certificate cert)
{
return getFingerPrint(cert, "MD5");
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CustomHTMLEditorKit.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CustomHTMLEditorKit.java
index 1dcd7da..0ac8cc8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CustomHTMLEditorKit.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CustomHTMLEditorKit.java
@@ -14,13 +14,13 @@
* Copyright 2008 Sun Microsystems, Inc.
* Portions Copyright 2015-2016 ForgeRock AS.
*/
-
package org.opends.quicksetup.ui;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashSet;
+import java.util.Set;
import javax.swing.JButton;
import javax.swing.text.Element;
@@ -32,7 +32,7 @@
/** Class used to be able to detect events in the button inside an HTML pane. */
public class CustomHTMLEditorKit extends HTMLEditorKit
{
- private HashSet<ActionListener> listeners = new HashSet<>();
+ private final Set<ActionListener> listeners = new HashSet<>();
private static final long serialVersionUID = 298103926252426388L;
/** Default constructor. */
@@ -66,7 +66,7 @@
}
/** Class used to be able to detect events in the button inside an HTML pane. */
- class MyHTMLFactory extends HTMLFactory
+ private class MyHTMLFactory extends HTMLFactory
{
@Override
public View create(Element elem)
@@ -81,14 +81,14 @@
}
/** Class used to be able to detect events in the button inside an HTML pane. */
- class MyFormView extends FormView
+ private class MyFormView extends FormView
{
/**
* Creates a new FormView object.
*
* @param elem the element to decorate
*/
- MyFormView(Element elem)
+ private MyFormView(Element elem)
{
super(elem);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java
index 53c3370..209ccda3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetup.java
@@ -16,32 +16,38 @@
*/
package org.opends.quicksetup.ui;
-import org.opends.quicksetup.event.ButtonActionListener;
-import org.opends.quicksetup.event.ProgressUpdateListener;
-import org.opends.quicksetup.event.ButtonEvent;
-import org.opends.quicksetup.event.ProgressUpdateEvent;
-import org.opends.quicksetup.*;
-import org.opends.quicksetup.util.ProgressMessageFormatter;
-import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
-import org.opends.quicksetup.util.BackgroundTask;
-import org.opends.server.util.SetupUtils;
+import static com.forgerock.opendj.cli.Utils.*;
+import static com.forgerock.opendj.util.OperatingSystem.*;
-import static org.opends.quicksetup.util.Utils.*;
-import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.i18n.LocalizableMessage;
import static org.opends.messages.QuickSetupMessages.*;
-import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
-import static com.forgerock.opendj.cli.Utils.getThrowableMsg;
-
-import javax.swing.*;
+import static org.opends.quicksetup.util.Utils.*;
import java.awt.Cursor;
import java.util.ArrayList;
import java.util.List;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-
-import java.util.logging.Handler;
import java.util.Map;
+import java.util.logging.Handler;
+
+import javax.swing.SwingUtilities;
+
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.opends.quicksetup.CurrentInstallStatus;
+import org.opends.quicksetup.Installation;
+import org.opends.quicksetup.ProgressDescriptor;
+import org.opends.quicksetup.ProgressStep;
+import org.opends.quicksetup.Step;
+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.event.ProgressUpdateEvent;
+import org.opends.quicksetup.event.ProgressUpdateListener;
+import org.opends.quicksetup.util.BackgroundTask;
+import org.opends.server.util.SetupUtils;
/**
* This class is responsible for doing the following:
@@ -56,23 +62,16 @@
*/
public class QuickSetup implements ButtonActionListener, ProgressUpdateListener
{
-
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
private GuiApplication application;
-
private CurrentInstallStatus installStatus;
-
private WizardStep currentStep;
-
private QuickSetupDialog dialog;
- private LocalizableMessageBuilder progressDetails = new LocalizableMessageBuilder();
-
+ private final LocalizableMessageBuilder progressDetails = new LocalizableMessageBuilder();
private ProgressDescriptor lastDescriptor;
-
private ProgressDescriptor lastDisplayedDescriptor;
-
private ProgressDescriptor descriptorToDisplay;
/** Update period of the dialogs. */
@@ -82,56 +81,6 @@
private static final String MAC_APPLICATIONS_OPENER = "/usr/bin/open";
/**
- * This method creates the install/uninstall dialogs and to check the current
- * install status. This method must be called outside the event thread because
- * it can perform long operations which can make the user think that the UI is
- * blocked.
- *
- * @param tempLogFile
- * temporary log file where messages will be logged.
- * @param args
- * for the moment this parameter is not used but we keep it in order
- * to (in case of need) pass parameters through the command line.
- */
- public void initialize(final TempLogFile tempLogFile, String[] args)
- {
- ProgressMessageFormatter formatter = new HtmlProgressMessageFormatter();
-
- installStatus = new CurrentInstallStatus();
-
- application = Application.create();
- application.setProgressMessageFormatter(formatter);
- application.setCurrentInstallStatus(installStatus);
- application.setTempLogFile(tempLogFile);
- if (args != null)
- {
- application.setUserArguments(args);
- }
- else
- {
- application.setUserArguments(new String[] {});
- }
- try
- {
- initLookAndFeel();
- }
- catch (Throwable t)
- {
- // This is likely a bug.
- t.printStackTrace();
- }
-
- /* In the calls to setCurrentStep the dialog will be created */
- setCurrentStep(application.getFirstWizardStep());
- }
-
- /** This method displays the setup dialog. This method must be called from the event thread. */
- public void display()
- {
- getDialog().packAndShow();
- }
-
- /**
* ButtonActionListener implementation. It assumes that we are called in the
* event thread.
*
@@ -613,12 +562,6 @@
getDialog().displayFieldInvalid(fieldName, invalid);
}
- /** A method to initialize the look and feel. */
- private void initLookAndFeel() throws Throwable
- {
- UIFactory.initialize();
- }
-
/**
* A methods that creates an ProgressDescriptor based on the value of a
* ProgressUpdateEvent.
@@ -663,6 +606,7 @@
try
{
application.updateUserData(cStep, QuickSetup.this);
+ return null;
}
catch (UserDataException uide)
{
@@ -672,7 +616,6 @@
{
throw new UserDataException(cStep, getThrowableMsg(INFO_BUG_MSG.get(), t));
}
- return null;
}
@Override
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupDialog.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupDialog.java
index 4acac22..ba62918 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupDialog.java
@@ -20,9 +20,7 @@
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.HashSet;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-
+import java.util.Set;
import javax.swing.JButton;
import javax.swing.JFrame;
@@ -30,11 +28,16 @@
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
-import org.opends.quicksetup.*;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.opends.quicksetup.ButtonName;
+import org.opends.quicksetup.CurrentInstallStatus;
+import org.opends.quicksetup.ProgressDescriptor;
+import org.opends.quicksetup.ProgressStep;
+import org.opends.quicksetup.UserData;
+import org.opends.quicksetup.WizardStep;
import org.opends.quicksetup.event.ButtonActionListener;
import org.opends.quicksetup.event.ButtonEvent;
-import org.opends.quicksetup.event.MinimumSizeComponentListener;
-import org.opends.quicksetup.ProgressDescriptor;
/**
* This class represents the dialog used by quicksetup applications.
*
@@ -49,23 +52,18 @@
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
- private JFrame frame;
+ private final JFrame frame;
private QuickSetupErrorPanel installedPanel;
private JPanel framePanel;
private StepsPanel stepsPanel;
private CurrentStepPanel currentStepPanel;
private ButtonsPanel buttonsPanel;
-
private WizardStep displayedStep;
- private CurrentInstallStatus installStatus;
-
- private HashSet<ButtonActionListener> buttonListeners = new HashSet<>();
-
- private GuiApplication application;
-
- private QuickSetup quickSetup;
-
+ private final CurrentInstallStatus installStatus;
+ private final Set<ButtonActionListener> buttonListeners = new HashSet<>();
+ private final GuiApplication application;
+ private final QuickSetup quickSetup;
private boolean forceToDisplay;
/**
@@ -96,20 +94,6 @@
Utilities.setFrameIcon(frame);
}
- /** Packs and displays this dialog. */
- public void packAndShow()
- {
- frame.pack();
- int minWidth = (int) frame.getPreferredSize().getWidth();
- int minHeight = (int) frame.getPreferredSize().getHeight();
- Utilities.centerOnScreen(frame);
- setFocusOnButton(application.getInitialFocusButtonName());
- frame.addComponentListener(new MinimumSizeComponentListener(frame,
- minWidth, minHeight));
-
- frame.setVisible(true);
- }
-
/**
* This method is called when we detected that there is something installed
* we inform of this to the user and the user wants to proceed with the
@@ -281,20 +265,6 @@
}
/**
- * Notification telling that the installation/uninstallation is finished.
- * @param successful a boolean telling whether the setup was successful or
- * not.
- */
- public void finished(boolean successful)
- {
- setButtonEnabled(ButtonName.CLOSE, true);
- if (!successful)
- {
- // Do nothing... all the error messages
- }
- }
-
- /**
* Returns the frame containing the dialog.
* @return the frame containing the dialog.
*/
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupPanel.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupPanel.java
index 86d3477..da2a1fc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupPanel.java
@@ -14,7 +14,6 @@
* Copyright 2006-2008 Sun Microsystems, Inc.
* Portions Copyright 2016 ForgeRock AS.
*/
-
package org.opends.quicksetup.ui;
import java.awt.Component;
@@ -23,15 +22,12 @@
import javax.swing.JPanel;
-import org.opends.quicksetup.UserData;
-
/** This class is an abstract class that provides some commodity methods. */
abstract class QuickSetupPanel extends JPanel
{
private static final long serialVersionUID = 2096518919339628055L;
- private GuiApplication application;
-
+ private final GuiApplication application;
private QuickSetup quickSetup;
/**
@@ -95,13 +91,4 @@
protected GuiApplication getApplication() {
return this.application;
}
-
- /**
- * Gets the user data associated with the current application.
- * @return UserData user specified data
- */
- protected UserData getUserData() {
- return application.getUserData();
- }
-
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupStepPanel.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupStepPanel.java
index 28f39c2..3f12105 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupStepPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/QuickSetupStepPanel.java
@@ -16,13 +16,16 @@
*/
package org.opends.quicksetup.ui;
+import static org.opends.messages.QuickSetupMessages.*;
+
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
-
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
import javax.swing.Box;
import javax.swing.JEditorPane;
@@ -31,15 +34,14 @@
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
-import org.opends.quicksetup.event.ButtonActionListener;
-import org.opends.quicksetup.event.ButtonEvent;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.quicksetup.ProgressDescriptor;
import org.opends.quicksetup.UserData;
+import org.opends.quicksetup.event.ButtonActionListener;
+import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.util.HtmlProgressMessageFormatter;
import org.opends.quicksetup.util.ProgressMessageFormatter;
import org.opends.quicksetup.util.URLWorker;
-import org.forgerock.i18n.LocalizableMessage;
-import static org.opends.messages.QuickSetupMessages.*;
/**
* This is an abstract class that is extended by all the classes that are in
@@ -54,7 +56,7 @@
private JPanel inputContainer;
private Component inputPanel;
- private HashSet<ButtonActionListener> buttonListeners = new HashSet<>();
+ private final Set<ButtonActionListener> buttonListeners = new HashSet<>();
private ProgressMessageFormatter formatter;
@@ -67,7 +69,7 @@
* We can use a HashMap (not multi-thread safe) because all
* the calls to this object are done in the event-thread.
*/
- private HashMap<String, URLWorker> hmURLWorkers = new HashMap<>();
+ private final Map<String, URLWorker> hmURLWorkers = new HashMap<>();
/**
* Creates a default instance.
@@ -93,11 +95,13 @@
*/
public void beginDisplay(UserData data)
{
+ // no-op
}
/** Called just after the panel is shown: used to set focus properly. */
public void endDisplay()
{
+ // no-op
}
/**
@@ -118,6 +122,7 @@
*/
public void displayProgress(ProgressDescriptor descriptor)
{
+ // no-op
}
/**
@@ -266,7 +271,7 @@
}
}
/** Creates the layout of the panel. */
- protected void createLayout()
+ private void createLayout()
{
setLayout(new GridBagLayout());
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/StepsPanel.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/StepsPanel.java
index 5127a25..8309174 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/StepsPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/StepsPanel.java
@@ -12,24 +12,23 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
*/
-
package org.opends.quicksetup.ui;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
-
import java.util.HashMap;
import java.util.LinkedHashSet;
+import java.util.Map;
import javax.swing.Box;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.WizardStep;
-import org.forgerock.i18n.LocalizableMessage;
/**
* This class displays the different steps of the wizard. It appears on the
@@ -37,15 +36,14 @@
*
* The current step is highlighted using a different label style and an icon.
* The current displayed step can be changed calling the method setCurrentStep.
- *
*/
-public class StepsPanel extends QuickSetupPanel
+class StepsPanel extends QuickSetupPanel
{
private static final long serialVersionUID = -2003945907121690657L;
- HashMap<WizardStep, JLabel> hmLabels = new HashMap<>();
- HashMap<WizardStep, JLabel> hmIcons = new HashMap<>();
- HashMap<WizardStep, JPanel> hmSubPanels = new HashMap<>();
+ private final Map<WizardStep, JLabel> hmLabels = new HashMap<>();
+ private final Map<WizardStep, JLabel> hmIcons = new HashMap<>();
+ private final Map<WizardStep, JPanel> hmSubPanels = new HashMap<>();
/**
* Creates a StepsPanel.
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java
index 89cf901..76e78f2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/UIFactory.java
@@ -53,7 +53,6 @@
import javax.swing.text.html.HTMLEditorKit;
import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
/**
* This class provides constants an methods to create Swing objects and to
@@ -64,9 +63,7 @@
*/
public class UIFactory
{
- private static boolean initialized;
private static String parentPackagePath;
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
/** Specifies the horizontal insets between buttons. */
public static final int HORIZONTAL_INSET_BETWEEN_BUTTONS = 5;
@@ -188,16 +185,17 @@
/** Specifies the dialog border. */
public static final Border DIALOG_PANEL_BORDER = BorderFactory.createMatteBorder(0, 0, 2, 0, PANEL_BORDER_COLOR);
- private static Font DEFAULT_FONT;
- static
+ private static final Font DEFAULT_FONT = getDefaultFont();
+
+ private static Font getDefaultFont()
{
try
{
- DEFAULT_FONT = UIManager.getFont("Label.font").deriveFont(Font.PLAIN).deriveFont(12f);
+ return UIManager.getFont("Label.font").deriveFont(Font.PLAIN).deriveFont(12f);
}
catch (Throwable t)
{
- DEFAULT_FONT = Font.decode("SansSerif-PLAIN-12");
+ return Font.decode("SansSerif-PLAIN-12");
}
}
@@ -418,33 +416,6 @@
}
/**
- * This method initialize the look and feel and UI settings specific to quick
- * setup.
- *
- * @throws Throwable
- * if there is a problem initializing the look and feel.
- */
- public static void initialize() throws Throwable
- {
- if (!initialized)
- {
- try
- {
- UIManager.put("OptionPane.background", getColor(INFO_OPTIONPANE_BACKGROUND_COLOR.get()));
- UIManager.put("Panel.background", getColor(INFO_PANEL_BACKGROUND_COLOR.get()));
- UIManager.put("ComboBox.background", getColor(INFO_COMBOBOX_BACKGROUND_COLOR.get()));
- }
- catch (Throwable t)
- {
- // This might occur when we do not get the display
- logger.warn(LocalizableMessage.raw("Error updating UIManager: " + t, t));
- }
- initializeLookAndFeel();
- initialized = true;
- }
- }
-
- /**
* Creates a new JPanel.
*
* @return JPanel newly created
@@ -884,7 +855,7 @@
* @return a read only JEditorPane containing the provided text with the
* provided font.
*/
- public static JEditorPane makeHtmlPane(LocalizableMessage text, HTMLEditorKit ek, Font font)
+ private static JEditorPane makeHtmlPane(LocalizableMessage text, HTMLEditorKit ek, Font font)
{
JEditorPane pane = new JEditorPane();
if (ek != null) {
@@ -1034,13 +1005,9 @@
* @return a string that represents the original HTML with the font specified
* as parameter.
*/
- public static String applyFontToHtmlWithDiv(String html, Font font)
+ private static String applyFontToHtmlWithDiv(String html, Font font)
{
- StringBuilder buf = new StringBuilder();
-
- buf.append("<div style=\"").append(getFontStyle(font)).append("\">").append(html).append(DIV_CLOSE);
-
- return buf.toString();
+ return "<div style=\"" + getFontStyle(font) + "\">" + html + DIV_CLOSE;
}
/**
@@ -1497,5 +1464,6 @@
@Override
public void focusLost(FocusEvent e)
{
+ // no-op
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/Utilities.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/Utilities.java
index da0a213..3a7967c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/Utilities.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/Utilities.java
@@ -12,18 +12,30 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
-import org.forgerock.i18n.LocalizableMessage;
import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
-import javax.swing.*;
-import javax.swing.text.JTextComponent;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Toolkit;
+import java.awt.Window;
import java.util.StringTokenizer;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.text.JTextComponent;
+
+import org.forgerock.i18n.LocalizableMessage;
+
/**
* A set of utilities specific to GUI QuickSetup applications.
*/
@@ -189,7 +201,7 @@
* @param width the maximum width of the column.
* @return the wrapped message.
*/
- public static String wrapMsg(String msg, int width)
+ private static String wrapMsg(String msg, int width)
{
StringBuilder buffer = new StringBuilder();
StringTokenizer lineTokenizer = new StringTokenizer(msg, "\n", true);
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
index 95d5896..151d9d6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/Utils.java
@@ -23,6 +23,7 @@
import static org.opends.admin.ads.util.ConnectionUtils.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.quicksetup.Installation.*;
+import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.DynamicConstants.*;
import java.io.BufferedOutputStream;
@@ -37,7 +38,6 @@
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
-import java.io.RandomAccessFile;
import java.net.InetAddress;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -87,7 +87,6 @@
import org.opends.quicksetup.ui.UIFactory;
import org.opends.server.tools.BackendTypeHelper;
import org.opends.server.util.SetupUtils;
-import org.opends.server.util.StaticUtils;
import com.forgerock.opendj.cli.ArgumentConstants;
import com.forgerock.opendj.cli.ClientException;
@@ -239,7 +238,7 @@
* @throws IOException
* if something goes wrong
*/
- public static boolean createFile(File f) throws IOException
+ static boolean createFile(File f) throws IOException
{
if (f != null)
{
@@ -344,22 +343,6 @@
}
/**
- * Returns <CODE>true</CODE> if the parent directory for the provided path
- * exists and <CODE>false</CODE> otherwise.
- *
- * @param path
- * the path that we are analyzing.
- * @return <CODE>true</CODE> if the parent directory for the provided path
- * exists and <CODE>false</CODE> otherwise.
- */
- public static boolean parentDirectoryExists(String path)
- {
- File f = new File(path);
- File parentFile = f.getParentFile();
- return parentFile != null && parentFile.isDirectory();
- }
-
- /**
* Returns <CODE>true</CODE> if the the provided path is a file and exists and
* <CODE>false</CODE> otherwise.
*
@@ -446,7 +429,7 @@
* @return boolean indicating whether or not the input <code>f</code> has a
* parent after this method is invoked.
*/
- public static boolean ensureParentsExist(File f)
+ static boolean ensureParentsExist(File f)
{
final File parent = f.getParentFile();
return parent.exists() || parent.mkdirs();
@@ -455,21 +438,6 @@
/**
* Creates the a directory in the provided path.
*
- * @param path
- * the path.
- * @return <CODE>true</CODE> if the path was created or already existed (and
- * was a directory) and <CODE>false</CODE> otherwise.
- * @throws IOException
- * if something goes wrong.
- */
- public static boolean createDirectory(String path) throws IOException
- {
- return createDirectory(new File(path));
- }
-
- /**
- * Creates the a directory in the provided path.
- *
* @param f
* the path.
* @return <CODE>true</CODE> if the path was created or already existed (and
@@ -477,7 +445,7 @@
* @throws IOException
* if something goes wrong.
*/
- public static boolean createDirectory(File f) throws IOException
+ static boolean createDirectory(File f) throws IOException
{
if (f.exists())
{
@@ -497,23 +465,18 @@
* @throws IOException
* if something goes wrong.
*/
- public static void createFile(File path, InputStream is) throws IOException
+ static void createFile(File path, InputStream is) throws IOException
{
- FileOutputStream out;
- BufferedOutputStream dest;
- byte[] data = new byte[BUFFER_SIZE];
- int count;
-
- out = new FileOutputStream(path);
-
- dest = new BufferedOutputStream(out);
-
- while ((count = is.read(data, 0, BUFFER_SIZE)) != -1)
+ try (FileOutputStream out = new FileOutputStream(path);
+ BufferedOutputStream dest = new BufferedOutputStream(out))
{
- dest.write(data, 0, count);
+ byte[] data = new byte[BUFFER_SIZE];
+ int count;
+ while ((count = is.read(data, 0, BUFFER_SIZE)) != -1)
+ {
+ dest.write(data, 0, count);
+ }
}
- dest.flush();
- dest.close();
}
/**
@@ -593,58 +556,6 @@
}
/**
- * Returns <CODE>true</CODE> if there is more disk space in the provided path
- * than what is specified with the bytes parameter.
- *
- * @param directoryPath
- * the path.
- * @param bytes
- * the disk space.
- * @return <CODE>true</CODE> if there is more disk space in the provided path
- * than what is specified with the bytes parameter.
- */
- public static synchronized boolean hasEnoughSpace(String directoryPath, long bytes)
- {
- // TODO This does not work with quotas etc. but at least it seems that
- // we do not write all data on disk if it fails.
- boolean hasEnoughSpace = false;
- File file = null;
- RandomAccessFile raf = null;
- File directory = new File(directoryPath);
- boolean deleteDirectory = false;
- if (!directory.exists())
- {
- deleteDirectory = directory.mkdir();
- }
-
- try
- {
- file = File.createTempFile("temp" + System.nanoTime(), ".tmp", directory);
- raf = new RandomAccessFile(file, "rw");
- raf.setLength(bytes);
- hasEnoughSpace = true;
- }
- catch (IOException ex)
- { /* do nothing */
- }
- finally
- {
- StaticUtils.close(raf);
- if (file != null)
- {
- file.delete();
- }
- }
-
- if (deleteDirectory)
- {
- directory.delete();
- }
-
- return hasEnoughSpace;
- }
-
- /**
* Gets a localized representation of the provide TopologyCacheException.
*
* @param te
@@ -701,7 +612,7 @@
* @throws InterruptedException
* if the Runtime.exec method is interrupted.
*/
- public static int setPermissionsUnix(List<String> paths, String permissions) throws IOException,
+ static int setPermissionsUnix(List<String> paths, String permissions) throws IOException,
InterruptedException
{
String[] args = new String[paths.size() + 2];
@@ -730,7 +641,7 @@
* @throws InterruptedException
* if the Runtime.exec method is interrupted.
*/
- public static int setPermissionsUnix(String path, String permissions) throws IOException, InterruptedException
+ static int setPermissionsUnix(String path, String permissions) throws IOException, InterruptedException
{
String[] args = new String[] { "chmod", permissions, path };
Process p = Runtime.getRuntime().exec(args);
@@ -911,14 +822,9 @@
{
String line = reader.readLine();
File instanceLoc = new File(line.trim());
- if (instanceLoc.isAbsolute())
- {
- return getCanonicalPath(instanceLoc);
- }
- else
- {
- return getCanonicalPath(new File(installPath + File.separator + instanceLoc.getPath()));
- }
+ return getCanonicalPath(instanceLoc.isAbsolute()
+ ? instanceLoc
+ : new File(installPath + File.separator + instanceLoc.getPath()));
}
catch (Exception e)
{
@@ -953,63 +859,13 @@
}
/**
- * Returns the number of entries contained in the zip file. This is used to
- * update properly the progress bar ratio.
- *
- * @return the number of entries contained in the zip file.
- */
- public static int getNumberZipEntries()
- {
- // TODO we should get this dynamically during build
- return 165;
- }
-
- /**
- * Creates a string consisting of the string representation of the elements in
- * the <code>list</code> separated by <code>separator</code>.
- *
- * @param list
- * the list to print
- * @param separator
- * to use in separating elements
- * @param prefix
- * prepended to each individual element in the list before adding to
- * the returned string.
- * @param suffix
- * appended to each individual element in the list before adding to
- * the returned string.
- * @return String representing the list
- */
- public static String listToString(List<?> list, String separator, String prefix, String suffix)
- {
- StringBuilder sb = new StringBuilder();
- for (int i = 0; i < list.size(); i++)
- {
- if (prefix != null)
- {
- sb.append(prefix);
- }
- sb.append(list.get(i));
- if (suffix != null)
- {
- sb.append(suffix);
- }
- if (i < list.size() - 1)
- {
- sb.append(separator);
- }
- }
- return sb.toString();
- }
-
- /**
* Returns the file system permissions for a file.
*
* @param file
* the file for which we want the file permissions.
* @return the file system permissions for the file.
*/
- public static String getFileSystemPermissions(File file)
+ static String getFileSystemPermissions(File file)
{
String name = file.getName();
if (file.getParent().endsWith(File.separator + Installation.WINDOWS_BINARIES_PATH_RELATIVE)
@@ -1047,89 +903,42 @@
*/
public static String breakHtmlString(CharSequence cs, int maxll)
{
- if (cs != null)
- {
- String d = cs.toString();
- int len = d.length();
- if (len <= 0)
- {
- return d;
- }
- if (len > maxll)
- {
- // First see if there are any tags that would cause a
- // natural break in the line. If so start line break
- // point evaluation from that point.
- for (String tag : Constants.BREAKING_TAGS)
- {
- int p = d.lastIndexOf(tag, maxll);
- if (p > 0 && p < len)
- {
- return d.substring(0, p + tag.length()) + breakHtmlString(d.substring(p + tag.length()), maxll);
- }
- }
-
- // Now look for spaces in which to insert a break.
- // First see if there are any spaces counting backward
- // from the max line length. If there aren't any, then
- // use the first space encountered after the max line
- // length.
- int p = d.lastIndexOf(' ', maxll);
- if (p <= 0)
- {
- p = d.indexOf(' ', maxll);
- }
- if (p > 0 && p < len)
- {
- return d.substring(0, p) + Constants.HTML_LINE_BREAK + breakHtmlString(d.substring(p + 1), maxll);
- }
- else
- {
- return d;
- }
- }
- else
- {
- return d;
- }
- }
- else
+ if (cs == null)
{
return null;
}
- }
- /**
- * Converts existing HTML break tags to native line separators.
- *
- * @param s
- * string to convert
- * @return converted string
- */
- public static String convertHtmlBreakToLineSeparator(String s)
- {
- return s.replaceAll("<br>", Constants.LINE_SEPARATOR);
- }
-
- /**
- * Strips any potential HTML markup from a given string.
- *
- * @param s
- * string to strip
- * @return resulting string
- */
- public static String stripHtml(String s)
- {
- if (s != null)
+ String d = cs.toString();
+ int len = d.length();
+ if (len <= 0 || len <= maxll)
{
- // This is not a comprehensive solution but addresses the few tags
- // that we have in Resources.properties at the moment.
- // Note that the following might strip out more than is intended for non-tags
- // like '<your name here>' or for funky tags like '<tag attr="1 > 0">'.
- // See test class for cases that might cause problems.
- return s.replaceAll("<.*?>", "");
+ return d;
}
- return null;
+
+ // First see if there are any tags that would cause a natural break in the line.
+ // If so start line break point evaluation from that point.
+ for (String tag : Constants.BREAKING_TAGS)
+ {
+ int p = d.lastIndexOf(tag, maxll);
+ if (p > 0 && p < len)
+ {
+ return d.substring(0, p + tag.length()) + breakHtmlString(d.substring(p + tag.length()), maxll);
+ }
+ }
+
+ // Now look for spaces in which to insert a break.
+ // First see if there are any spaces counting backward from the max line length.
+ // If there aren't any, then use the first space encountered after the max line length.
+ int p = d.lastIndexOf(' ', maxll);
+ if (p <= 0)
+ {
+ p = d.indexOf(' ', maxll);
+ }
+ if (0 < p && p < len)
+ {
+ return d.substring(0, p) + Constants.HTML_LINE_BREAK + breakHtmlString(d.substring(p + 1), maxll);
+ }
+ return d;
}
/**
@@ -1139,7 +948,7 @@
* String to test
* @return true if the string contains HTML
*/
- public static boolean containsHtml(String text)
+ static boolean containsHtml(String text)
{
return text != null && text.indexOf('<') != -1 && text.indexOf('>') != -1;
}
@@ -1650,7 +1459,7 @@
public static List<String> getSetupEquivalentCommandLine(final UserData userData)
{
List<String> cmdLine = new ArrayList<>();
- cmdLine.add(getInstallDir(userData) + getSetupFileName());
+ cmdLine.add(getInstallDir() + getSetupFileName());
cmdLine.add("--cli");
final ManagedObjectDefinition<? extends BackendCfgClient, ? extends BackendCfg> backendType =
@@ -1885,15 +1694,13 @@
/**
* Returns the full path of the command-line for a given script name.
*
- * @param userData
- * the user data.
* @param scriptBasicName
* the script basic name (with no extension).
* @return the full path of the command-line for a given script name.
*/
- private static String getCommandLinePath(UserData userData, String scriptBasicName)
+ private static String getCommandLinePath(String scriptBasicName)
{
- String installDir = getInstallDir(userData);
+ String installDir = getInstallDir();
if (isWindows())
{
return installDir + WINDOWS_BINARIES_PATH_RELATIVE + File.separatorChar + scriptBasicName + ".bat";
@@ -1911,7 +1718,7 @@
*
* @return the installation directory.
*/
- private static String getInstallDir(UserData userData)
+ private static String getInstallDir()
{
if (installDir == null)
{
@@ -1922,7 +1729,6 @@
installDir += File.separatorChar;
}
}
-
return installDir;
}
@@ -1942,7 +1748,7 @@
Set<String> baseDNs, ServerDescriptor server)
{
List<String> cmdLine = new ArrayList<>();
- String cmdName = getCommandLinePath(userData, "dsreplication");
+ String cmdName = getCommandLinePath("dsreplication");
cmdLine.add(cmdName);
cmdLine.add(subcommand);
@@ -2087,32 +1893,24 @@
public static List<List<String>> getDsConfigReplicationEnableEquivalentCommandLines(UserData userData)
{
final List<List<String>> cmdLines = new ArrayList<>();
- final String cmdName = getCommandLinePath(userData, "dsconfig");
+ final String cmdName = getCommandLinePath("dsconfig");
- List<String> connectionArgs = new ArrayList<>();
- connectionArgs.add("--hostName");
- connectionArgs.add(userData.getHostName());
- connectionArgs.add("--port");
- connectionArgs.add(String.valueOf(userData.getAdminConnectorPort()));
- connectionArgs.add("--bindDN");
- connectionArgs.add(userData.getDirectoryManagerDn());
- connectionArgs.add("--bindPassword");
- connectionArgs.add(OBFUSCATED_VALUE);
- connectionArgs.add("--trustAll");
- connectionArgs.add("--no-prompt");
- connectionArgs.add("--noPropertiesFile");
+ List<String> connectionArgs = newArrayList(
+ "--hostName", userData.getHostName(),
+ "--port", String.valueOf(userData.getAdminConnectorPort()),
+ "--bindDN", userData.getDirectoryManagerDn(),
+ "--bindPassword", OBFUSCATED_VALUE,
+ "--trustAll",
+ "--no-prompt",
+ "--noPropertiesFile");
- List<String> cmdReplicationServer = new ArrayList<>();
- cmdReplicationServer.add(cmdName);
- cmdReplicationServer.add("create-replication-server");
- cmdReplicationServer.add("--provider-name");
- cmdReplicationServer.add("Multimaster Synchronization");
- cmdReplicationServer.add("--set");
- cmdReplicationServer.add("replication-port:" + userData.getReplicationOptions().getReplicationPort());
- cmdReplicationServer.add("--set");
- cmdReplicationServer.add("replication-server-id:1");
- cmdReplicationServer.add("--type");
- cmdReplicationServer.add("generic");
+ List<String> cmdReplicationServer = newArrayList(
+ cmdName,
+ "create-replication-server",
+ "--provider-name", "Multimaster Synchronization",
+ "--set", "replication-port:" + userData.getReplicationOptions().getReplicationPort(),
+ "--set", "replication-server-id:1",
+ "--type", "generic");
cmdReplicationServer.addAll(connectionArgs);
cmdLines.add(cmdReplicationServer);
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
index 715a90b..91ca3b9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
@@ -93,7 +93,7 @@
* @throws FileNotFoundException if the specified file does not exist
* @throws IllegalArgumentException if the zip file is not a zip file
*/
- public ZipExtractor(File zipFile, int minRatio, int maxRatio,
+ private ZipExtractor(File zipFile, int minRatio, int maxRatio,
int numberZipEntries,
Application app)
throws FileNotFoundException, IllegalArgumentException
@@ -118,7 +118,7 @@
* @param zipFileName name of the input zip file
* @param app application to be notified about progress
*/
- public ZipExtractor(InputStream is, int minRatio, int maxRatio,
+ private ZipExtractor(InputStream is, int minRatio, int maxRatio,
int numberZipEntries,
String zipFileName,
Application app) {
@@ -144,7 +144,8 @@
* @param destination File where the zip file will be extracted
* @throws ApplicationException if something goes wrong
*/
- public void extract(String destination) throws ApplicationException {
+ private void extract(String destination) throws ApplicationException
+ {
extract(destination, true);
}
@@ -158,7 +159,7 @@
* directory as 'some_file'.
* @throws ApplicationException if something goes wrong
*/
- public void extract(String destDir, boolean removeFirstPath)
+ private void extract(String destDir, boolean removeFirstPath)
throws ApplicationException
{
ZipInputStream zipIn = new ZipInputStream(is);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
index 28e4b8a..bafc511 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
@@ -49,7 +49,7 @@
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
/** The root connection. */
- private InternalClientConnection internalConnection;
+ private final InternalClientConnection internalConnection;
/** The attribute name used to store the port. TODO Use the default one. */
private static final String LDAP_PORT = "ds-cfg-listen-port";
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
index 5c1ec35..0bbed86 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
@@ -16,11 +16,12 @@
*/
package org.opends.server.admin.client.cli;
+import static com.forgerock.opendj.cli.CommonArguments.*;
import static com.forgerock.opendj.cli.ReturnCode.*;
import static com.forgerock.opendj.cli.Utils.*;
-import static com.forgerock.opendj.cli.CommonArguments.*;
-import static org.opends.messages.ToolMessages.*;
+
import static org.opends.messages.AdminToolMessages.*;
+import static org.opends.messages.ToolMessages.*;
import java.io.File;
import java.io.FileInputStream;
@@ -35,7 +36,6 @@
import java.util.List;
import java.util.Set;
-import com.forgerock.opendj.cli.ArgumentParser;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.LocalizableMessageDescriptor.Arg1;
@@ -51,6 +51,7 @@
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CliConstants;
import com.forgerock.opendj.cli.FileBasedArgument;
@@ -95,7 +96,7 @@
private boolean configurationInitialized;
/** Defines if the CLI always use the SSL connection type. */
- private boolean alwaysSSL;
+ private final boolean alwaysSSL;
/**
* Creates a new instance of secure arguments.
@@ -294,7 +295,7 @@
* the LocalizableMessageBuilder to write the error messages.
* @return return code.
*/
- public int validateGlobalOptions(LocalizableMessageBuilder buf)
+ int validateGlobalOptions(LocalizableMessageBuilder buf)
{
final List<LocalizableMessage> errors = new ArrayList<>();
addErrorMessageIfArgumentsConflict(errors, bindPasswordArg, bindPasswordFileArg);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/AttributeSyntax.java b/opendj-server-legacy/src/main/java/org/opends/server/api/AttributeSyntax.java
index bb7a51a..1fa52f7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/AttributeSyntax.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/AttributeSyntax.java
@@ -20,12 +20,12 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.opendj.server.config.server.AttributeSyntaxCfg;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.Schema;
import org.forgerock.opendj.ldap.schema.Syntax;
+import org.forgerock.opendj.server.config.server.AttributeSyntaxCfg;
import org.opends.server.core.ServerContext;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.InitializationException;
@@ -329,7 +329,7 @@
* @param buffer The buffer to which the information should be
* appended.
*/
- public final void toString(StringBuilder buffer)
+ private final void toString(StringBuilder buffer)
{
buffer.append("( ");
buffer.append(getOID());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java b/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
index 6e16b95..c22fdf9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
@@ -91,7 +91,7 @@
private final ServerContext serverContext;
/** Lock to update the maps. */
- final ReadWriteLock lock = new ReentrantReadWriteLock();
+ private final ReadWriteLock lock = new ReentrantReadWriteLock();
private final Lock exclusiveLock = lock.writeLock();
private final Lock sharedLock = lock.readLock();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/DITCacheMap.java b/opendj-server-legacy/src/main/java/org/opends/server/api/DITCacheMap.java
index 757e1a0..12c610e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/DITCacheMap.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/DITCacheMap.java
@@ -720,14 +720,4 @@
return size;
}
}
-
- /**
- * Returns the size of the internal map. Used for testing purposes only.
- *
- * @return The size of the internal map.
- */
- int getMapSize()
- {
- return ditCacheMap.size();
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginResult.java b/opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginResult.java
index 590d840..1ed9cba 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginResult.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginResult.java
@@ -16,13 +16,13 @@
*/
package org.opends.server.api.plugin;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.DN;
-import org.opends.server.types.DisconnectReason;
-
import java.util.List;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.opends.server.types.DisconnectReason;
+
/**
* This class defines a data structure that holds information about
* the result of processing by a plugin.
@@ -35,7 +35,7 @@
public final class PluginResult
{
/** Contract for operation results. */
- public static interface OperationResult
+ public interface OperationResult
{
/**
* Indicates whether processing on the associated operation should continue.
@@ -93,7 +93,7 @@
/** An message explaining why startup should stop. */
private final LocalizableMessage errorMessage;
- private static Startup DEFAULT_RESULT =
+ private static final Startup DEFAULT_RESULT =
new Startup(true, true, null);
/**
@@ -207,7 +207,7 @@
/** The result code for this result. */
private final ResultCode resultCode;
- private static PreParse DEFAULT_RESULT =
+ private static final PreParse DEFAULT_RESULT =
new PreParse(true, true, null, null, null, null);
/**
@@ -357,7 +357,7 @@
/** The result code for this result. */
private final ResultCode resultCode;
- private static PreOperation DEFAULT_RESULT =
+ private static final PreOperation DEFAULT_RESULT =
new PreOperation(true, true, null, null, null, null);
/**
@@ -503,7 +503,7 @@
/** The result code for this result. */
private final ResultCode resultCode;
- private static PostOperation DEFAULT_RESULT =
+ private static final PostOperation DEFAULT_RESULT =
new PostOperation(true, null, null, null, null);
/**
@@ -611,7 +611,7 @@
/** Whether to invoke the rest of the plugins. */
private final boolean continuePluginProcessing;
- private static PostResponse DEFAULT_RESULT =
+ private static final PostResponse DEFAULT_RESULT =
new PostResponse(true);
/**
@@ -673,7 +673,7 @@
/** An message explaining why processing should stop. */
private final LocalizableMessage errorMessage;
- private static ImportLDIF DEFAULT_RESULT =
+ private static final ImportLDIF DEFAULT_RESULT =
new ImportLDIF(true, true, null);
/**
@@ -787,7 +787,7 @@
/** The result code for this result. */
private final ResultCode resultCode;
- private static SubordinateModifyDN DEFAULT_RESULT =
+ private static final SubordinateModifyDN DEFAULT_RESULT =
new SubordinateModifyDN(true, true, null, null, null, null);
/**
@@ -938,7 +938,7 @@
/** The result code for this result. */
private final ResultCode resultCode;
- private static SubordinateDelete DEFAULT_RESULT =
+ private static final SubordinateDelete DEFAULT_RESULT =
new SubordinateDelete(true, true, null, null, null, null);
/**
@@ -1091,7 +1091,7 @@
/** The result code for this result. */
private final ResultCode resultCode;
- private static IntermediateResponse DEFAULT_RESULT =
+ private static final IntermediateResponse DEFAULT_RESULT =
new IntermediateResponse(true, true, true, null, null, null,
null);
@@ -1275,7 +1275,7 @@
/** Whether to send a disconnect notification to the client. */
private final boolean sendDisconnectNotification;
- private static PostConnect DEFAULT_RESULT =
+ private static final PostConnect DEFAULT_RESULT =
new PostConnect(true, true, null, null, false);
/**
@@ -1408,7 +1408,7 @@
/** Whether to invoke the rest of the plugins. */
private final boolean continuePluginProcessing;
- private static PostDisconnect DEFAULT_RESULT =
+ private static final PostDisconnect DEFAULT_RESULT =
new PostDisconnect(true);
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginType.java b/opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginType.java
index ce2c2b9..ecfe5ba 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginType.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/plugin/PluginType.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
package org.opends.server.api.plugin;
@@ -474,7 +474,7 @@
}
/** The name for this plugin type. */
- private String name;
+ private final String name;
/**
* Creates a new plugin type instance with the specified name.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java
index da03788..7570c30 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java
@@ -28,7 +28,11 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.opends.server.types.*;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.Attributes;
+import org.opends.server.types.DirectoryException;
+import org.opends.server.types.Entry;
+import org.opends.server.types.SearchFilter;
/**
* The TargAttrFilters class represents a targattrfilters rule of an ACI.
@@ -39,7 +43,7 @@
* A valid targattrfilters rule may have two TargFilterlist parts -- the
* first one is required.
*/
- private TargAttrFilterList firstFilterList;
+ private final TargAttrFilterList firstFilterList;
private TargAttrFilterList secondFilterList;
/**
@@ -61,41 +65,40 @@
/**
* Regular expression used to check for valid expression separator.
*/
- private static final
- String secondOpSeparator="\\)" + ZERO_OR_MORE_WHITESPACE + ",";
+ private static final Pattern secondOpSeparator = Pattern.compile("\\)" + ZERO_OR_MORE_WHITESPACE + ",");
/**
* Regular expression used to match the second operation of the filter list.
* If the first was "add" this must be "del", if the first was "del" this
* must be "add".
*/
- public static final String secondOp =
+ private static final Pattern secondOp = Pattern.compile(
"[,]{1}" + ZERO_OR_MORE_WHITESPACE + "del|add" +
- ZERO_OR_MORE_WHITESPACE + EQUAL_SIGN + ZERO_OR_MORE_WHITESPACE;
+ ZERO_OR_MORE_WHITESPACE + EQUAL_SIGN + ZERO_OR_MORE_WHITESPACE);
/**
* Regular expression used to match the first targFilterList, it must exist
* or an exception is thrown.
*/
- private static final String firstOp = "^" + ADD_OR_DEL_KEYWORD_GROUP +
- ZERO_OR_MORE_WHITESPACE + EQUAL_SIGN + ZERO_OR_MORE_WHITESPACE;
+ private static final Pattern firstOp = Pattern.compile("^" + ADD_OR_DEL_KEYWORD_GROUP +
+ ZERO_OR_MORE_WHITESPACE + EQUAL_SIGN + ZERO_OR_MORE_WHITESPACE);
/**
* Regular expression used to group the remainder of a partially parsed
* rule. Any character one or more times.
*/
- private static String restOfExpression = "(.+)";
+ private final static String restOfExpression = "(.+)";
/**
* Regular expression used to match the first operation keyword and the
* rest of the expression.
*/
- private static String keywordFullPattern = firstOp + restOfExpression;
+ private final static String keywordFullPattern = firstOp + restOfExpression;
/**
* The enumeration representing the operation.
*/
- private EnumTargetOperator op;
+ private final EnumTargetOperator op;
/**
* A mask used to denote if the rule has add, del or both operations in the
@@ -174,13 +177,13 @@
* Check that there are not too many filter lists. There can only
* be either one or two.
*/
- String[] filterLists = subExpression.split(secondOp, -1);
+ String[] filterLists = secondOp.split(subExpression, -1);
if(filterLists.length > 2) {
throw new AciException(WARN_ACI_SYNTAX_INVALID_TARGATTRFILTERS_MAX_FILTER_LISTS.get(expression));
} else if (filterLists.length == 1) {
//Check if the there is something like ") , deel=". A bad token
//that the regular expression didn't pick up.
- String [] filterList2=subExpression.split(secondOpSeparator);
+ String[] filterList2 = secondOpSeparator.split(subExpression);
if(filterList2.length == 2) {
throw new AciException(WARN_ACI_SYNTAX_INVALID_TARGATTRFILTERS_EXPRESSION.get(expression));
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
index 0b03a4a..ec1950b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
@@ -117,7 +117,7 @@
private boolean enabled;
/** The set of listeners for this connection handler. */
- private List<HostPort> listeners = new LinkedList<>();
+ private final List<HostPort> listeners = new LinkedList<>();
/** The HTTP server embedded in OpenDJ. */
private HttpServer httpServer;
@@ -130,7 +130,7 @@
* ensure no concurrent reads/writes can happen and adds/removes are fast. We
* only use the keys, so it does not matter what value is put there.
*/
- private Map<ClientConnection, ClientConnection> clientConnections = new ConcurrentHashMap<>();
+ private final Map<ClientConnection, ClientConnection> clientConnections = new ConcurrentHashMap<>();
/** The set of statistics collected for this connection handler. */
private HTTPStatistics statTracker;
@@ -374,17 +374,6 @@
return protocol;
}
- /**
- * Returns the SSL engine configured for this connection handler if SSL is
- * enabled, null otherwise.
- *
- * @return the SSL engine if SSL is enabled, null otherwise
- */
- SSLEngine getSSLEngine()
- {
- return sslEngineConfigurator.createSSLEngine();
- }
-
@Override
public String getShutdownListenerName()
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPStatistics.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPStatistics.java
index 3e84e41..b9ae86b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPStatistics.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPStatistics.java
@@ -33,7 +33,6 @@
*/
public class HTTPStatistics extends LDAPStatistics
{
-
/**
* Map containing the total number of requests per HTTP methods.
* <p>
@@ -43,7 +42,7 @@
* The keys are static because they need to be listed in the schema which is
* static.
*/
- private Map<String, AtomicInteger> requestMethodsTotalCount = new HashMap<>();
+ private final Map<String, AtomicInteger> requestMethodsTotalCount = new HashMap<>();
/**
* Map containing the total execution time for the requests per HTTP methods.
* <p>
@@ -54,13 +53,13 @@
* The keys are static because they need to be listed in the schema which is
* static.
*/
- private Map<String, AtomicLong> requestMethodsTotalTime = new HashMap<>();
+ private final Map<String, AtomicLong> requestMethodsTotalTime = new HashMap<>();
/**
* Total number of requests. The total number may be different than the sum of
* the supported HTTP methods above because clients could use unsupported HTTP
* methods.
*/
- private AtomicInteger requestsTotalCount = new AtomicInteger(0);
+ private final AtomicInteger requestsTotalCount = new AtomicInteger(0);
/**
* Constructor for this class.
@@ -115,26 +114,6 @@
}
/**
- * Adds a request to the stats using the provided HTTP method.
- *
- * @param httpMethod
- * the method of the HTTP request to add to the stats
- * @throws NullPointerException
- * if the httpMethod is null
- */
- public void addRequest(String httpMethod) throws NullPointerException
- {
- AtomicInteger nb =
- this.requestMethodsTotalCount.get(httpMethod.toLowerCase());
- if (nb != null)
- {
- nb.incrementAndGet();
- } // else this is an unsupported HTTP method
- // always count any requests regardless of whether the method is supported
- this.requestsTotalCount.incrementAndGet();
- }
-
- /**
* Adds to the total time of an HTTP request method.
*
* @param httpMethod
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
index 60cdc7b..5dd9aef 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -16,6 +16,14 @@
*/
package org.opends.server.protocols.internal;
+import static org.forgerock.opendj.adapter.server3x.Converters.*;
+import static org.forgerock.opendj.ldap.ByteString.*;
+import static org.opends.messages.ProtocolMessages.*;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.util.CollectionUtils.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.opends.server.util.StaticUtils.*;
+
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collection;
@@ -29,7 +37,6 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.RDN;
@@ -79,14 +86,6 @@
import org.opends.server.util.ModifyChangeRecordEntry;
import org.opends.server.util.ModifyDNChangeRecordEntry;
-import static org.forgerock.opendj.adapter.server3x.Converters.*;
-import static org.forgerock.opendj.ldap.ByteString.*;
-import static org.opends.messages.ProtocolMessages.*;
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.util.CollectionUtils.*;
-import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
* This class defines a pseudo-connection object that can be used for
* performing internal operations.
@@ -918,32 +917,6 @@
ByteString.valueOfUtf8(password), null);
}
-
-
- /**
- * Processes an internal bind operation with the provided
- * information. Note that regardless of whether the bind is
- * successful, the authentication state for this internal connection
- * will not be altered in any way.
- *
- * @param rawBindDN The bind DN for the operation.
- * @param password The bind password for the operation.
- * @param controls The set of controls to include in the
- * request.
- *
- * @return A reference to the bind operation that was processed and
- * contains information about the result of the processing.
- */
- public BindOperation processSimpleBind(String rawBindDN,
- String password,
- List<Control> controls)
- {
- return processSimpleBind(ByteString.valueOfUtf8(rawBindDN),
- ByteString.valueOfUtf8(password), controls);
- }
-
-
-
/**
* Processes an internal bind operation with the provided
* information. Note that regardless of whether the bind is
@@ -1208,37 +1181,6 @@
}
/**
- * Processes an internal compare operation with the provided information.
- *
- * @param entryDN
- * The entry DN for the compare operation.
- * @param attributeDescription
- * The attribute description for the compare operation.
- * @param assertionValue
- * The assertion value for the compare operation.
- * @param controls
- * The set of controls to include in the request.
- * @return A reference to the compare operation that was processed and contains information about
- * the result of the processing.
- */
- public CompareOperation processCompare(DN entryDN,
- AttributeDescription attributeDescription,
- ByteString assertionValue,
- List<Control> controls)
- {
- CompareOperationBasis compareOperation =
- new CompareOperationBasis(this, nextOperationID(),
- nextMessageID(), controls, entryDN,
- attributeDescription, assertionValue);
- compareOperation.setInternalOperation(true);
-
- compareOperation.run();
- return compareOperation;
- }
-
-
-
- /**
* Processes an internal delete operation with the provided
* information.
*
@@ -1253,28 +1195,6 @@
return processDelete(ByteString.valueOfUtf8(rawEntryDN), null);
}
-
-
- /**
- * Processes an internal delete operation with the provided
- * information.
- *
- * @param rawEntryDN The entry DN for the delete operation.
- * @param controls The set of controls to include in the
- * request.
- *
- * @return A reference to the delete operation that was processed
- * and contains information about the result of the
- * processing.
- */
- public DeleteOperation processDelete(String rawEntryDN,
- List<Control> controls)
- {
- return processDelete(ByteString.valueOfUtf8(rawEntryDN), controls);
- }
-
-
-
/**
* Processes an internal delete operation with the provided
* information.
@@ -1572,37 +1492,6 @@
ByteString.valueOfUtf8(rawNewSuperior), null);
}
-
-
- /**
- * Processes an internal modify DN operation with the provided
- * information.
- *
- * @param rawEntryDN The current DN of the entry to rename.
- * @param rawNewRDN The new RDN to use for the entry.
- * @param deleteOldRDN The flag indicating whether the old RDN
- * value is to be removed from the entry.
- * @param rawNewSuperior The new superior for the modify DN
- * operation, or <CODE>null</CODE> if the
- * entry will remain below the same parent.
- * @param controls The set of controls to include in the
- * request.
- *
- * @return A reference to the modify DN operation that was
- * processed and contains information about the result of
- * the processing.
- */
- public ModifyDNOperation processModifyDN(String rawEntryDN,
- String rawNewRDN,
- boolean deleteOldRDN,
- String rawNewSuperior,
- List<Control> controls)
- {
- return processModifyDN(ByteString.valueOfUtf8(rawEntryDN),
- ByteString.valueOfUtf8(rawNewRDN), deleteOldRDN,
- ByteString.valueOfUtf8(rawNewSuperior), controls);
- }
-
/**
* Processes an internal modify DN operation with the provided
* information.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/Requests.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/Requests.java
index e7f4083..80beca1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/Requests.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/Requests.java
@@ -17,10 +17,9 @@
package org.opends.server.protocols.internal;
-import org.forgerock.i18n.LocalizedIllegalArgumentException;
+import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.util.Reject;
-import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.SearchFilter;
@@ -78,46 +77,6 @@
}
/**
- * Creates a new search request using the provided distinguished name,
- * scope, and filter, decoded using the default schema.
- *
- * @param name
- * The distinguished name of the base entry relative to which the
- * search is to be performed.
- * @param scope
- * The scope of the search.
- * @param filter
- * The filter that defines the conditions that must be fulfilled
- * in order for an entry to be returned.
- * @param attributeDescriptions
- * The names of the attributes to be included with each entry.
- * @return The new search request.
- * @throws DirectoryException
- * If a problem occurs while decoding the provided string as a
- * search filter.
- * @throws LocalizedIllegalArgumentException
- * If {@code name} could not be decoded using the default
- * schema, or if {@code filter} is not a valid LDAP string
- * representation of a filter.
- * @throws NullPointerException
- * If the {@code name}, {@code scope}, or {@code filter} were
- * {@code null}.
- */
- public static SearchRequest newSearchRequest(final String name, final SearchScope scope,
- final String filter, final String... attributeDescriptions)
- throws NullPointerException, LocalizedIllegalArgumentException, DirectoryException {
- Reject.ifNull(name, scope, filter);
- SearchFilter f = "(objectclass=*)".equals(filter.toLowerCase())
- ? SearchFilter.objectClassPresent()
- : SearchFilter.createFilterFromString(filter);
- final SearchRequest request = new SearchRequest(DN.valueOf(name), scope, f);
- for (final String attributeDescription : attributeDescriptions) {
- request.addAttribute(attributeDescription);
- }
- return request;
- }
-
- /**
* Return a new search request object.
*
* @param name
diff --git a/opendj-server-legacy/src/test/java/org/opends/quicksetup/util/UtilsTest.java b/opendj-server-legacy/src/test/java/org/opends/quicksetup/util/UtilsTest.java
index 2fdf579..d2c692c 100644
--- a/opendj-server-legacy/src/test/java/org/opends/quicksetup/util/UtilsTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/quicksetup/util/UtilsTest.java
@@ -12,18 +12,19 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
package org.opends.quicksetup.util;
import static org.testng.Assert.*;
-import org.testng.annotations.*;
-import org.opends.server.DirectoryServerTestCase;
-/**
- * Utils Tester.
- */
+import org.opends.server.DirectoryServerTestCase;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/** Utils Tester. */
@Test(sequential=true)
+@SuppressWarnings("javadoc")
public class UtilsTest extends DirectoryServerTestCase {
@DataProvider(name = "breakHtmlStringData")
@@ -45,25 +46,6 @@
assertEquals(Utils.breakHtmlString(s, maxll), expectedValue);
}
- @DataProvider(name = "stripHtmlData")
- public Object[][] stripHtmlData() {
- return new Object[][]{
- {"Hi <i>Ho</i>", "Hi Ho"},
- {"Hi <b>Ho</b>", "Hi Ho"},
- {"Hi<br> Ho", "Hi Ho"},
- {"Hi<br/> Ho", "Hi Ho"},
- {"Hi<input value=\"abc\"/> Ho", "Hi Ho"},
- {"Hi<input value=\"abc\"></input> Ho", "Hi Ho"},
- // {"Hi<tag attr=\"1 > 0\"> Ho", "Hi Ho"}, // broken case
- // {"Hi <your name here>", "Hi <your name here>"} // broken case
- };
- }
-
- @Test(enabled = false, dataProvider = "stripHtmlData")
- public void testStripHtml(String html, String expectedResult) {
- assertEquals(expectedResult, Utils.stripHtml(html));
- }
-
@DataProvider(name = "containsHtmlData")
public Object[][] containsHtmlData() {
return new Object[][]{
--
Gitblit v1.10.0