From 83f86f11c27378d650c3bfc7e55397687062edbc Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 22 Apr 2016 14:23:28 +0000
Subject: [PATCH] Improvements suggested by UCDetector: remove dead code, add final keywords, change visibilities
---
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/OpendsCertificateException.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/AbstractNodeTask.java | 4
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandlerFactory.java | 2
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java | 60 +-
opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ANDCondition.java | 3
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java | 11
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ByteStringUtility.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringPanel.java | 13
opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java | 43 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/MonitoringAttributes.java | 9
opendj-config/src/main/java/org/forgerock/opendj/config/server/ConstraintViolationException.java | 7
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLExtendedOperation.java | 10
opendj-server-legacy/src/main/java/org/opends/server/loggers/MultifileTextWriter.java | 48 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java | 17
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyDNOperation.java | 10
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WorkQueueMonitoringPanel.java | 23
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java | 13
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java | 20
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/Task.java | 8
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/HelpSubCommandHandler.java | 10
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLDeleteOperation.java | 8
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TaskToSchedulePanel.java | 44
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyOperation.java | 10
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RootMonitoringPanel.java | 16
opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java | 46 -
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTask.java | 36 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java | 3
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java | 12
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BasicMonitoringAttributes.java | 13
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/StartStopTask.java | 24
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAddOperation.java | 8
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java | 52 -
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/TrustedSocketFactory.java | 25
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringRightPanel.java | 102 +--
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyEditorModification.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java | 15
opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminClientException.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DeleteBaseDNPanel.java | 8
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAbandonOperation.java | 7
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeRefresher.java | 63 +-
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DatabaseMonitoringTableModel.java | 18
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLCompareOperation.java | 8
opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminSecurityException.java | 2
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ApplicationTrustManager.java | 9
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBackendIndexesPanel.java | 10
opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ResultCodeFactory.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/SearchAbandonException.java | 9
opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheFilter.java | 13
opendj-server-legacy/src/main/java/org/opends/admin/ads/SubtreeDeleteControl.java | 12
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/BinaryCellPanel.java | 31
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java | 9
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/LDAPManagementContextFactory.java | 5
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java | 5
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SystemInformationMonitoringPanel.java | 10
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java | 7
/dev/null | 241 --------
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ControlPanelLauncher.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DatabaseMonitoringPanel.java | 14
opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheException.java | 50 -
opendj-server-legacy/src/main/java/org/opends/admin/ads/ReplicaDescriptor.java | 10
opendj-server-legacy/src/main/java/org/opends/server/api/DITCacheMap.java | 55 -
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java | 4
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java | 181 +----
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaInformationMonitoringPanel.java | 38
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java | 86 --
65 files changed, 489 insertions(+), 1,159 deletions(-)
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminClientException.java b/opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminClientException.java
index 4b409e0..b347d59 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminClientException.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminClientException.java
@@ -28,7 +28,7 @@
* Client exceptions represent communications problems, security problems, and
* service related problems.
*/
-public abstract class AdminClientException extends AdminException {
+abstract class AdminClientException extends AdminException {
/** Serialization ID. */
private static final long serialVersionUID = 4044747533980824456L;
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminSecurityException.java b/opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminSecurityException.java
index 6cf757e..32de826 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminSecurityException.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/client/AdminSecurityException.java
@@ -24,7 +24,7 @@
* interacting with the Directory Server. These fall broadly into two
* categories: authentication problems and authorization problems.
*/
-public abstract class AdminSecurityException extends AdminClientException {
+abstract class AdminSecurityException extends AdminClientException {
/** Fake serialization ID. */
private static final long serialVersionUID = 1L;
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/client/AuthenticationNotSupportedException.java b/opendj-config/src/main/java/org/forgerock/opendj/config/client/AuthenticationNotSupportedException.java
deleted file mode 100644
index e5121bb..0000000
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/client/AuthenticationNotSupportedException.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2015-2016 ForgeRock AS.
- */
-package org.forgerock.opendj.config.client;
-
-import org.forgerock.i18n.LocalizableMessage;
-
-import static com.forgerock.opendj.ldap.config.ConfigMessages.*;
-
-/**
- * This exception is thrown when the particular flavor of authentication
- * requested is not supported by the Directory Server.
- */
-public class AuthenticationNotSupportedException extends AdminSecurityException {
-
- /** Serialization ID. */
- private static final long serialVersionUID = 7387834052676291793L;
-
- /** Creates an authentication not supported exception with a default message. */
- public AuthenticationNotSupportedException() {
- super(ERR_AUTHENTICATION_NOT_SUPPORTED_EXCEPTION_DEFAULT.get());
- }
-
- /**
- * Creates an authentication not supported exception with a cause and a
- * default message.
- *
- * @param cause
- * The cause.
- */
- public AuthenticationNotSupportedException(Throwable cause) {
- super(ERR_AUTHENTICATION_NOT_SUPPORTED_EXCEPTION_DEFAULT.get(), cause);
- }
-
- /**
- * Create an authentication not supported exception with a message and
- * cause.
- *
- * @param message
- * The message.
- * @param cause
- * The cause.
- */
- public AuthenticationNotSupportedException(LocalizableMessage message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Create an authentication not supported exception with a message.
- *
- * @param message
- * The message.
- */
- public AuthenticationNotSupportedException(LocalizableMessage message) {
- super(message);
- }
-}
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ANDCondition.java b/opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ANDCondition.java
index 46ab82c..70a028d 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ANDCondition.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/conditions/ANDCondition.java
@@ -31,7 +31,7 @@
* A condition which evaluates to <code>true</code> if and only if all of its
* sub-conditions are <code>true</code>.
*/
-public final class ANDCondition implements Condition {
+final class ANDCondition implements Condition {
/** The list of sub-conditions. */
private final List<Condition> conditions;
@@ -73,5 +73,4 @@
condition.initialize(d);
}
}
-
}
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java
index 06ef7c7..92bfbfe 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/BuildVersion.java
@@ -33,10 +33,11 @@
import org.forgerock.util.Utils;
/**
- * Represents a particular version of OpenDJ useful for making comparisons between versions. FIXME TODO Move this file
- * in ? package.
+ * Represents a particular version of OpenDJ useful for making comparisons between versions.
+ * <p>
+ * FIXME TODO Move this file in ? package.
*/
-public class BuildVersion implements Comparable<BuildVersion> {
+class BuildVersion implements Comparable<BuildVersion> {
private final int major;
private final int minor;
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/HelpSubCommandHandler.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/HelpSubCommandHandler.java
index c9d0585..b00ca47 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/HelpSubCommandHandler.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/HelpSubCommandHandler.java
@@ -554,21 +554,17 @@
return b.toString();
}
+ /** The sub-command associated with this handler. */
+ private final SubCommand subCommand;
/** The argument which should be used to specify the category of managed object to be retrieved. */
private final StringArgument categoryArgument;
-
/** A table listing all the available types of managed object indexed on their parent type. */
private final Map<String, Map<String, AbstractManagedObjectDefinition<?, ?>>> categoryMap = new TreeMap<>();
/** The argument which should be used to display inherited properties. */
- private BooleanArgument inheritedModeArgument;
-
- /** The sub-command associated with this handler. */
- private final SubCommand subCommand;
-
+ private final BooleanArgument inheritedModeArgument;
/** A table listing all the available types of managed object indexed on their tag(s). */
private final Map<Tag, Map<String, AbstractManagedObjectDefinition<?, ?>>> tagMap = new HashMap<>();
-
/** The argument which should be used to specify the sub-type of managed object to be retrieved. */
private final StringArgument typeArgument;
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/LDAPManagementContextFactory.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/LDAPManagementContextFactory.java
index bd97bfa..c17a325 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/LDAPManagementContextFactory.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/LDAPManagementContextFactory.java
@@ -43,11 +43,9 @@
private ManagementContext context;
/** The connection parameters command builder. */
- private CommandBuilder contextCommandBuilder;
-
+ private final CommandBuilder contextCommandBuilder;
/** The connection factory provider. */
private final ConnectionFactoryProvider provider;
-
/** The connection factory. */
private final ConnectionFactory factory;
@@ -62,6 +60,7 @@
public LDAPManagementContextFactory(ConnectionFactoryProvider cfp) throws ArgumentException {
this.provider = cfp;
factory = cfp.getAuthenticatedConnectionFactory();
+ contextCommandBuilder = null;
}
/** Closes this management context. */
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyEditorModification.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyEditorModification.java
index 8e8e774..d2b5efe 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyEditorModification.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/PropertyEditorModification.java
@@ -43,8 +43,8 @@
REMOVE
}
- private PropertyDefinition<T> propertyDefinition;
- private Type type;
+ private final PropertyDefinition<T> propertyDefinition;
+ private final Type type;
private final SortedSet<T> values;
private final SortedSet<T> originalValues;
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandlerFactory.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandlerFactory.java
index 449145c..757413c 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandlerFactory.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/SubCommandHandlerFactory.java
@@ -136,7 +136,7 @@
/** The set of get-xxx-prop available sub-commands. */
private final SortedSet<GetPropSubCommandHandler> getPropHandlers = new TreeSet<>();
/** The help sub-command handler. */
- private HelpSubCommandHandler helpHandler;
+ private final HelpSubCommandHandler helpHandler;
/** The set of list-xxx available sub-commands. */
private final SortedSet<ListSubCommandHandler> listHandlers = new TreeSet<>();
/** The set of set-xxx-prop available sub-commands. */
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConstraintViolationException.java b/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConstraintViolationException.java
index 2bd6e82..4e519f1 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConstraintViolationException.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/server/ConstraintViolationException.java
@@ -18,21 +18,20 @@
import static com.forgerock.opendj.ldap.config.ConfigMessages.*;
-import org.forgerock.opendj.config.DecodingException;
-import org.forgerock.util.Reject;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.config.DecodingException;
+import org.forgerock.util.Reject;
/**
* This exception is thrown when the server refuses to use or delete a managed
* object due to one or more constraints that cannot be satisfied.
*/
-public class ConstraintViolationException extends DecodingException {
+class ConstraintViolationException extends DecodingException {
/** Serialization ID. */
private static final long serialVersionUID = -4902443848460011875L;
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ByteStringUtility.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ByteStringUtility.java
index a33f9e4..c94cb56 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ByteStringUtility.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ByteStringUtility.java
@@ -27,7 +27,7 @@
* A utility class to assist in converting DsmlValues (in Objects) into
* the required ByteStrings, and back again.
*/
-public class ByteStringUtility
+class ByteStringUtility
{
/**
* Returns a ByteString from a DsmlValue Object.
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAbandonOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAbandonOperation.java
index ae24c5a..48bd94a 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAbandonOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAbandonOperation.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2012-2014 ForgeRock AS.
+ * Portions Copyright 2012-2016 ForgeRock AS.
*/
package org.opends.dsml.protocol;
@@ -20,7 +20,6 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
-
import org.opends.server.protocols.ldap.AbandonRequestProtocolOp;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.LDAPResultCode;
@@ -34,9 +33,9 @@
* This class provides the functionality for the performing an
* LDAP ABANDON operation based on the specified DSML request.
*/
-public class DSMLAbandonOperation
+class DSMLAbandonOperation
{
- private LDAPConnection connection;
+ private final LDAPConnection connection;
/**
* Create an instance with the specified LDAP connection.
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAddOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAddOperation.java
index 0e71fac..e36152a 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAddOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLAddOperation.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2012-2015 ForgeRock AS.
+ * Portions Copyright 2012-2016 ForgeRock AS.
*/
package org.opends.dsml.protocol;
@@ -23,6 +23,7 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.protocols.ldap.AddRequestProtocolOp;
import org.opends.server.protocols.ldap.AddResponseProtocolOp;
@@ -30,7 +31,6 @@
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.ProtocolOp;
import org.opends.server.tools.LDAPConnection;
-import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.LDAPException;
import org.opends.server.types.RawAttribute;
@@ -40,10 +40,10 @@
* This class provides the functionality for the performing an
* LDAP ADD operation based on the specified DSML request.
*/
-public class DSMLAddOperation
+class DSMLAddOperation
{
- private LDAPConnection connection;
+ private final LDAPConnection connection;
/**
* Create the instance with the specified LDAP connection.
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLCompareOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLCompareOperation.java
index 910ab91..94de1dd 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLCompareOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLCompareOperation.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2012-2015 ForgeRock AS.
+ * Portions Copyright 2012-2016 ForgeRock AS.
*/
package org.opends.dsml.protocol;
@@ -22,13 +22,13 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.protocols.ldap.CompareRequestProtocolOp;
import org.opends.server.protocols.ldap.CompareResponseProtocolOp;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.ProtocolOp;
import org.opends.server.tools.LDAPConnection;
-import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.LDAPException;
@@ -37,9 +37,9 @@
* This class provides the functionality for the performing an
* LDAP COMPARE operation based on the specified DSML request.
*/
-public class DSMLCompareOperation
+class DSMLCompareOperation
{
- private LDAPConnection connection;
+ private final LDAPConnection connection;
/**
* Create an instance with the specified LDAP connection.
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLDeleteOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLDeleteOperation.java
index 0b79ebb..1b8ee73 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLDeleteOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLDeleteOperation.java
@@ -20,14 +20,14 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.protocols.ldap.DeleteRequestProtocolOp;
import org.opends.server.protocols.ldap.DeleteResponseProtocolOp;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.ProtocolOp;
import org.opends.server.tools.LDAPConnection;
-import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.LDAPException;
/**
@@ -36,9 +36,9 @@
*
* @author Vivek Nagar
*/
-public class DSMLDeleteOperation
+class DSMLDeleteOperation
{
- private LDAPConnection connection;
+ private final LDAPConnection connection;
/**
* Create an instance with the specified LDAP connection.
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLExtendedOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLExtendedOperation.java
index b9a1501..f3e3bd1 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLExtendedOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLExtendedOperation.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2012-2014 ForgeRock AS.
+ * Portions Copyright 2012-2016 ForgeRock AS.
*/
package org.opends.dsml.protocol;
@@ -23,13 +23,13 @@
import java.util.Set;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp;
import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.ProtocolOp;
import org.opends.server.tools.LDAPConnection;
-import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.LDAPException;
@@ -37,10 +37,10 @@
* This class provides the functionality for the performing an
* LDAP EXTENDED operation based on the specified DSML request.
*/
-public class DSMLExtendedOperation
+class DSMLExtendedOperation
{
- private LDAPConnection connection;
- private Set<String> stringResponses;
+ private final LDAPConnection connection;
+ private final Set<String> stringResponses;
/**
* Create an instance with the specified LDAP connection.
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyDNOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyDNOperation.java
index 540db27..63dd8d5 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyDNOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyDNOperation.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2012-2015 ForgeRock AS.
+ * Portions Copyright 2012-2016 ForgeRock AS.
*/
package org.opends.dsml.protocol;
@@ -22,13 +22,13 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.tools.LDAPConnection;
+import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.ModifyDNRequestProtocolOp;
import org.opends.server.protocols.ldap.ModifyDNResponseProtocolOp;
import org.opends.server.protocols.ldap.ProtocolOp;
-import org.forgerock.opendj.ldap.ByteString;
+import org.opends.server.tools.LDAPConnection;
import org.opends.server.types.LDAPException;
@@ -37,10 +37,10 @@
* This class provides the functionality for the performing an
* LDAP MODIFY_DN operation based on the specified DSML request.
*/
-public class DSMLModifyDNOperation
+class DSMLModifyDNOperation
{
- private LDAPConnection connection;
+ private final LDAPConnection connection;
/**
* Create the instance with the specified connection.
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyOperation.java
index aa7a925..b43d055 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLModifyOperation.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2012-2015 ForgeRock AS.
+ * Portions Copyright 2012-2016 ForgeRock AS.
*/
package org.opends.dsml.protocol;
@@ -23,7 +23,9 @@
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.ModificationType;
import org.opends.server.protocols.ldap.LDAPAttribute;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.LDAPModification;
@@ -31,9 +33,7 @@
import org.opends.server.protocols.ldap.ModifyResponseProtocolOp;
import org.opends.server.protocols.ldap.ProtocolOp;
import org.opends.server.tools.LDAPConnection;
-import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.LDAPException;
-import org.forgerock.opendj.ldap.ModificationType;
import org.opends.server.types.RawModification;
@@ -42,9 +42,9 @@
* This class provides the functionality for the performing an
* LDAP MODIFY operation based on the specified DSML request.
*/
-public class DSMLModifyOperation
+class DSMLModifyOperation
{
- private LDAPConnection connection;
+ private final LDAPConnection connection;
/**
* Create the instance with the specified LDAP connection.
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java
index 90987cb..9cbf791 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLSearchOperation.java
@@ -16,6 +16,8 @@
*/
package org.opends.dsml.protocol;
+import static org.opends.messages.ProtocolMessages.*;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashSet;
@@ -25,7 +27,10 @@
import javax.xml.bind.JAXBElement;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
+import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.protocols.ldap.LDAPAttribute;
import org.opends.server.protocols.ldap.LDAPConstants;
import org.opends.server.protocols.ldap.LDAPFilter;
@@ -35,21 +40,17 @@
import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp;
import org.opends.server.protocols.ldap.SearchResultEntryProtocolOp;
import org.opends.server.tools.LDAPConnection;
-import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.opends.server.types.LDAPException;
import org.opends.server.types.RawFilter;
-import org.forgerock.opendj.ldap.SearchScope;
-import static org.opends.messages.ProtocolMessages.*;
/**
* This class provides the functionality for the performing an LDAP
* SEARCH operation based on the specified DSML request.
*/
-public class DSMLSearchOperation
+class DSMLSearchOperation
{
- private LDAPConnection connection;
+ private final LDAPConnection connection;
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java
index 85853aa..b00def0 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/DSMLServlet.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2015 ForgeRock AS.
+ * Portions Copyright 2011-2016 ForgeRock AS.
*/
package org.opends.dsml.protocol;
@@ -38,6 +38,7 @@
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -59,8 +60,14 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
-import javax.xml.soap.*;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
@@ -83,7 +90,6 @@
import org.opends.server.tools.SSLConnectionFactory;
import org.opends.server.types.LDAPException;
import org.opends.server.util.Base64;
-
import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.EntityResolver;
@@ -131,7 +137,7 @@
private static Schema schema;
/** Prevent multiple logging when trying to set unavailable/unsupported parser features */
- private static AtomicBoolean logFeatureWarnings = new AtomicBoolean(false);
+ private static final AtomicBoolean logFeatureWarnings = new AtomicBoolean(false);
private String hostName;
private Integer port;
@@ -143,7 +149,7 @@
private String trustStorePasswordValue;
private Boolean trustAll;
private Boolean useHTTPAuthzID;
- private HashSet<String> exopStrings = new HashSet<>();
+ private final Set<String> exopStrings = new HashSet<>();
/**
* This method will be called by the Servlet Container when
@@ -155,33 +161,17 @@
*/
@Override
public void init(ServletConfig config) throws ServletException {
-
try {
- hostName = config.getServletContext().getInitParameter(HOST);
-
- port = Integer.valueOf(config.getServletContext().getInitParameter(PORT));
-
- userDN = config.getServletContext().getInitParameter(USERDN);
-
- userPassword = config.getServletContext().getInitParameter(USERPWD);
-
- useSSL = Boolean.valueOf(
- config.getServletContext().getInitParameter(USESSL));
-
- useStartTLS = Boolean.valueOf(
- config.getServletContext().getInitParameter(USESTARTTLS));
-
- trustStorePathValue =
- config.getServletContext().getInitParameter(TRUSTSTOREPATH);
-
- trustStorePasswordValue =
- config.getServletContext().getInitParameter(TRUSTSTOREPASSWORD);
-
- trustAll = Boolean.valueOf(
- config.getServletContext().getInitParameter(TRUSTALLCERTS));
-
- useHTTPAuthzID = Boolean.valueOf(
- config.getServletContext().getInitParameter(USEHTTPAUTHZID));
+ hostName = stringValue(config, HOST);
+ port = Integer.valueOf(stringValue(config, PORT));
+ userDN = stringValue(config, USERDN);
+ userPassword = stringValue(config, USERPWD);
+ useSSL = booleanValue(config, USESSL);
+ useStartTLS = booleanValue(config, USESTARTTLS);
+ trustStorePathValue = stringValue(config, TRUSTSTOREPATH);
+ trustStorePasswordValue = stringValue(config, TRUSTSTOREPASSWORD);
+ trustAll = booleanValue(config, TRUSTALLCERTS);
+ useHTTPAuthzID = booleanValue(config, USEHTTPAUTHZID);
/*
* Find all the param-names matching the pattern:
@@ -224,7 +214,15 @@
}
}
+ private boolean booleanValue(ServletConfig config, String paramName)
+ {
+ return Boolean.valueOf(stringValue(config, paramName));
+ }
+ private String stringValue(ServletConfig config, String paramName)
+ {
+ return config.getServletContext().getInitParameter(paramName);
+ }
/**
* Check if using the proxy authz control will work, by using it to read
diff --git a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ResultCodeFactory.java b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ResultCodeFactory.java
index 8fe6cc3..04070ac 100644
--- a/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ResultCodeFactory.java
+++ b/opendj-dsml-servlet/src/main/java/org/opends/dsml/protocol/ResultCodeFactory.java
@@ -11,7 +11,7 @@
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyright [year] [name of copyright owner]".
*
- * Copyright 2012-2015 ForgeRock AS.
+ * Copyright 2012-2016 ForgeRock AS.
*/
package org.opends.dsml.protocol;
@@ -23,7 +23,7 @@
*/
public class ResultCodeFactory
{
- static HashMap<Integer,LDAPResultCode> codeToDescr = new HashMap<>();
+ static final HashMap<Integer, LDAPResultCode> codeToDescr = new HashMap<>();
static
{
codeToDescr.put(0, LDAPResultCode.SUCCESS);
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ReplicaDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ReplicaDescriptor.java
index f384283..5b78e81 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ReplicaDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ReplicaDescriptor.java
@@ -12,25 +12,21 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2007-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
*/
-
package org.opends.admin.ads;
import java.util.HashSet;
import java.util.Set;
-/**
- * The object of this class represent a Replica (i.e. a suffix in a given
- * server).
- */
+/** The object of this class represent a Replica (i.e. a suffix in a given server). */
public class ReplicaDescriptor
{
private SuffixDescriptor suffix;
private int entries = -1;
private ServerDescriptor server;
- private Set<String> replicationServers = new HashSet<>();
+ private final Set<String> replicationServers = new HashSet<>();
private int replicationId = -1;
private int missingChanges = -1;
private long ageOfOldestMissingChange = -1;
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java
index 8d18a05..2d33ddf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ServerDescriptor.java
@@ -46,7 +46,6 @@
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.quicksetup.Constants;
import org.opends.server.config.ConfigConstants;
-import org.opends.server.schema.SchemaConstants;
import org.opends.server.types.HostPort;
/** The object of this class represent an OpenDS server. */
@@ -1281,48 +1280,6 @@
}
/**
- * Cleans up the contents of the ads truststore.
- *
- * @param ctx the bound instance.
- * @throws NamingException in case an error occurs while updating the
- * instance's ads-truststore via LDAP.
- */
- public static void cleanAdsTrustStore(InitialLdapContext ctx)
- throws NamingException
- {
- try
- {
- SearchControls sc = new SearchControls();
- sc.setSearchScope(SearchControls.ONELEVEL_SCOPE);
- sc.setReturningAttributes(new String[] { SchemaConstants.NO_ATTRIBUTES });
- NamingEnumeration<SearchResult> ne = ctx.search(TRUSTSTORE_DN,
- "(objectclass=ds-cfg-instance-key)", sc);
- ArrayList<String> dnsToDelete = new ArrayList<>();
- try
- {
- while (ne.hasMore())
- {
- SearchResult sr = ne.next();
- dnsToDelete.add(sr.getName()+","+TRUSTSTORE_DN);
- }
- }
- finally
- {
- ne.close();
- }
- for (String dn : dnsToDelete)
- {
- ctx.destroySubcontext(dn);
- }
- }
- catch (NameNotFoundException nnfe)
- {
- // Ignore
- logger.warn(LocalizableMessage.raw("Error cleaning truststore: "+nnfe, nnfe));
- }
- }
-
- /**
* Returns the values of the ds-base-dn-entry count attributes for the given
* backend monitor entry using the provided InitialLdapContext.
* @param ctx the InitialLdapContext to use to update the configuration.
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/SubtreeDeleteControl.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/SubtreeDeleteControl.java
index 197700f..d3d0dc8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/SubtreeDeleteControl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/SubtreeDeleteControl.java
@@ -12,16 +12,14 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2016 ForgeRock AS.
*/
-
package org.opends.admin.ads;
import javax.naming.ldap.BasicControl;
-/**
- * This class implements the LDAP subtree delete control for JNDI.
- */
-public class SubtreeDeleteControl extends BasicControl
+/** This class implements the LDAP subtree delete control for JNDI. */
+class SubtreeDeleteControl extends BasicControl
{
/**
* The serial version identifier required to satisfy the compiler
@@ -32,9 +30,7 @@
*/
static final long serialVersionUID = 3941576361457157921L;
- /**
- * Default constructor.
- */
+ /** Default constructor. */
public SubtreeDeleteControl()
{
super("1.2.840.113556.1.4.805");
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheException.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheException.java
index c796ab4..8a3d7ee 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheException.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/TopologyCacheException.java
@@ -12,15 +12,14 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
*/
-
package org.opends.admin.ads;
-import org.opends.server.types.OpenDsException;
import javax.naming.NamingException;
import org.opends.admin.ads.util.ApplicationTrustManager;
+import org.opends.server.types.OpenDsException;
/**
* This class represents the Exception that can occur while reading server
@@ -29,43 +28,26 @@
public class TopologyCacheException extends OpenDsException {
private static final long serialVersionUID = 1709535837273360382L;
- private Type type;
- private String ldapUrl;
- private ApplicationTrustManager trustManager;
+ private final Type type;
+ private final String ldapUrl;
+ private final ApplicationTrustManager trustManager;
- /**
- * Error type.
- */
+ /** Error type. */
public enum Type
{
- /**
- * Error reading the ADS.
- */
+ /** Error reading the ADS. */
GENERIC_READING_ADS,
- /**
- * Creating connection to a particular server.
- */
+ /** Creating connection to a particular server. */
GENERIC_CREATING_CONNECTION,
- /**
- * Error reading the configuration of a particular server.
- */
+ /** Error reading the configuration of a particular server. */
GENERIC_READING_SERVER,
- /**
- * The DN provided in the DirContext of ADS is not of a global
- * administrator.
- */
+ /** The DN provided in the DirContext of ADS is not of a global administrator. */
NOT_GLOBAL_ADMINISTRATOR,
- /**
- * Not enough permissions to read the server configuration.
- */
+ /** Not enough permissions to read the server configuration. */
NO_PERMISSIONS,
- /**
- * Timeout reading the configuration of a particular server.
- */
+ /** Timeout reading the configuration of a particular server. */
TIMEOUT,
- /**
- * Unexpected error.
- */
+ /** Unexpected error. */
BUG
}
@@ -74,10 +56,12 @@
* ADSContextException occurs.
* @param ace the exception which is the cause of this exception.
*/
- public TopologyCacheException(ADSContextException ace)
+ TopologyCacheException(ADSContextException ace)
{
super(ace);
type = Type.GENERIC_READING_ADS;
+ ldapUrl = null;
+ trustManager = null;
}
/**
@@ -89,6 +73,8 @@
{
super(t);
this.type = type;
+ this.ldapUrl = null;
+ this.trustManager = null;
}
/**
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 736545e..87ebe58 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
@@ -12,7 +12,7 @@
* 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.admin.ads;
@@ -27,7 +27,7 @@
*/
public class TopologyCacheFilter
{
- private Set<String> baseDNs = new HashSet<>();
+ private final Set<String> baseDNs = new HashSet<>();
private boolean searchMonitoringInformation = true;
private boolean searchBaseDNInformation = true;
@@ -86,15 +86,6 @@
}
/**
- * Removes a base DN fom the list of baseDNs to search.
- * @param dn the DN of the base DN to be removed.
- */
- public void removeBaseDNToSearch(String dn)
- {
- baseDNs.remove(dn);
- }
-
- /**
* Returns the list of base DNs that will be searched for. If the list is
* empty we will search for all the base DNs.
* @return the list of base DNs we will search for.
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ApplicationTrustManager.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ApplicationTrustManager.java
index e6d151c..cb1950c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ApplicationTrustManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ApplicationTrustManager.java
@@ -24,6 +24,7 @@
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
+import java.util.List;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
@@ -66,15 +67,15 @@
private String lastRefusedAuthType;
private X509Certificate[] lastRefusedChain;
private Cause lastRefusedCause;
- private KeyStore keystore;
+ private final KeyStore keystore;
/**
* The following ArrayList contain information about the certificates
* explicitly accepted by the user.
*/
- private ArrayList<X509Certificate[]> acceptedChains = new ArrayList<>();
- private ArrayList<String> acceptedAuthTypes = new ArrayList<>();
- private ArrayList<String> acceptedHosts = new ArrayList<>();
+ private final List<X509Certificate[]> acceptedChains = new ArrayList<>();
+ private final List<String> acceptedAuthTypes = new ArrayList<>();
+ private final List<String> acceptedHosts = new ArrayList<>();
private String host;
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/OpendsCertificateException.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/OpendsCertificateException.java
index b7e8e44..25b5cb2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/OpendsCertificateException.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/OpendsCertificateException.java
@@ -12,7 +12,7 @@
* 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.admin.ads.util;
@@ -32,7 +32,7 @@
private static final long serialVersionUID = 1151044344529478436L;
/** Private certificate chain. */
- private X509Certificate[] chain;
+ private final X509Certificate[] chain;
// ------------------
// Constructor
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 855b7f6..34ab23a 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
@@ -38,8 +38,8 @@
START_TLS
}
- private String ldapUrl;
- private Type type;
+ private final String ldapUrl;
+ private final Type type;
/**
* The constructor of the PreferredConnection.
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/TrustedSocketFactory.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/TrustedSocketFactory.java
index b7723ba..f404a36 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/TrustedSocketFactory.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/TrustedSocketFactory.java
@@ -31,24 +31,24 @@
import javax.net.ssl.TrustManager;
/** An implementation of SSLSocketFactory. */
-public class TrustedSocketFactory extends SSLSocketFactory
+class TrustedSocketFactory extends SSLSocketFactory
{
- private static Map<Thread, TrustManager> hmTrustManager = new HashMap<>();
- private static Map<Thread, KeyManager> hmKeyManager = new HashMap<>();
+ private static final Map<Thread, TrustManager> hmTrustManager = new HashMap<>();
+ private static final Map<Thread, KeyManager> hmKeyManager = new HashMap<>();
- private static Map<TrustManager, SocketFactory> hmDefaultFactoryTm = new HashMap<>();
- private static Map<KeyManager, SocketFactory> hmDefaultFactoryKm = new HashMap<>();
+ private static final Map<TrustManager, SocketFactory> hmDefaultFactoryTm = new HashMap<>();
+ private static final Map<KeyManager, SocketFactory> hmDefaultFactoryKm = new HashMap<>();
private SSLSocketFactory innerFactory;
- private TrustManager trustManager;
- private KeyManager keyManager;
+ private final TrustManager trustManager;
+ private final KeyManager keyManager;
/**
* Constructor of the TrustedSocketFactory.
* @param trustManager the trust manager to use.
* @param keyManager the key manager to use.
*/
- public TrustedSocketFactory(TrustManager trustManager, KeyManager keyManager)
+ TrustedSocketFactory(TrustManager trustManager, KeyManager keyManager)
{
this.trustManager = trustManager;
this.keyManager = keyManager;
@@ -63,8 +63,7 @@
* @param keyManager
* the key manager to use.
*/
- public static synchronized void setCurrentThreadTrustManager(
- TrustManager trustManager, KeyManager keyManager)
+ static synchronized void setCurrentThreadTrustManager(TrustManager trustManager, KeyManager keyManager)
{
setThreadTrustManager(trustManager, Thread.currentThread());
setThreadKeyManager (keyManager, Thread.currentThread());
@@ -75,8 +74,7 @@
* @param trustManager the trust manager to use.
* @param thread the thread where we want to use the provided trust manager.
*/
- public static synchronized void setThreadTrustManager(
- TrustManager trustManager, Thread thread)
+ static synchronized void setThreadTrustManager(TrustManager trustManager, Thread thread)
{
TrustManager currentTrustManager = hmTrustManager.get(thread);
if (currentTrustManager != null) {
@@ -93,8 +91,7 @@
* @param keyManager the key manager to use.
* @param thread the thread where we want to use the provided key manager.
*/
- public static synchronized void setThreadKeyManager(
- KeyManager keyManager, Thread thread)
+ static synchronized void setThreadKeyManager(KeyManager keyManager, Thread thread)
{
KeyManager currentKeyManager = hmKeyManager.get(thread);
if (currentKeyManager != null) {
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ControlPanelLauncher.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ControlPanelLauncher.java
index bf7a199..153ba6f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ControlPanelLauncher.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ControlPanelLauncher.java
@@ -247,7 +247,7 @@
/** This occurs for instance when the authentication provided by the user is not valid. */
ERROR_READING_CONFIGURATION_WITH_LDAP(4);
- private int returnCode;
+ private final int returnCode;
private ErrorReturnCode(int returnCode)
{
this.returnCode = returnCode;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/AbstractNodeTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/AbstractNodeTask.java
index 095f887..cadd009 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/AbstractNodeTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/AbstractNodeTask.java
@@ -25,8 +25,8 @@
*/
public abstract class AbstractNodeTask implements Runnable {
- BasicNode node;
- boolean cancelled;
+ private final BasicNode node;
+ private boolean cancelled;
/**
* The constructor of the node searcher.
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 7d708dc..c68afd3 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
@@ -21,6 +21,7 @@
import static org.opends.messages.AdminToolMessages.*;
import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import javax.naming.InterruptedNamingException;
@@ -77,15 +78,15 @@
FAILED
}
- BrowserController controller;
- State state;
- boolean recursive;
+ private final BrowserController controller;
+ private State state;
+ private final boolean recursive;
- SearchResult localEntry;
- SearchResult remoteEntry;
+ private SearchResult localEntry;
+ private SearchResult remoteEntry;
LDAPURL remoteUrl;
- boolean isLeafNode;
- final ArrayList<SearchResult> childEntries = new ArrayList<>();
+ private boolean isLeafNode;
+ private final List<SearchResult> childEntries = new ArrayList<>();
final boolean differential;
Exception exception;
Object exceptionArg;
@@ -146,7 +147,7 @@
* Returns the child entries of the node.
* @return the child entries of the node.
*/
- public ArrayList<SearchResult> getChildEntries() {
+ public List<SearchResult> getChildEntries() {
return childEntries;
}
@@ -579,23 +580,20 @@
i = i + 1;
}
if (entry == null) {
- throw new SearchAbandonException(
- State.FAILED, lastException, lastExceptionArg);
+ throw new SearchAbandonException(State.FAILED, lastException, lastExceptionArg);
}
- else
+
+ if (url.getScope() != SearchScope.BASE_OBJECT)
{
- if (url.getScope() != SearchScope.BASE_OBJECT)
- {
- // The URL is to be transformed: the code assumes that the URL points
- // to the remote entry.
- url = new LDAPURL(url.getScheme(), url.getHost(),
- url.getPort(), entry.getName(), url.getAttributes(),
- SearchScope.BASE_OBJECT, null, url.getExtensions());
- }
- checkLoopInReferral(url, referral[i-1]);
- remoteUrl = url;
- remoteEntry = entry;
+ // The URL is to be transformed: the code assumes that the URL points
+ // to the remote entry.
+ url = new LDAPURL(url.getScheme(), url.getHost(),
+ url.getPort(), entry.getName(), url.getAttributes(),
+ SearchScope.BASE_OBJECT, null, url.getExtensions());
}
+ checkLoopInReferral(url, referral[i-1]);
+ remoteUrl = url;
+ remoteEntry = entry;
}
/**
@@ -770,15 +768,12 @@
while (entries.hasMore())
{
SearchResult r = entries.next();
- String name;
if (r.getName().length() == 0)
{
continue;
}
- else
- {
- name = unquoteRelativeName(r.getName())+","+parentDn;
- }
+
+ String name = unquoteRelativeName(r.getName()) + "," + parentDn;
boolean add = false;
if (useCustomFilter())
{
@@ -916,8 +911,7 @@
private SearchResult searchManuallyEntry(InitialLdapContext ctx, String dn)
throws NamingException
{
- SearchResult sr = null;
-// Send an LDAP search
+ // Send an LDAP search
SearchControls ctls = controller.getBasicSearchControls();
ctls.setSearchScope(SearchControls.OBJECT_SCOPE);
ctls.setReturningAttributes(controller.getAttrsForRedSearch());
@@ -926,6 +920,7 @@
controller.getObjectSearchFilter(),
ctls);
+ SearchResult sr = null;
try
{
while (entries.hasMore())
@@ -1035,21 +1030,19 @@
* and the attribute 'ref' is present and <CODE>false</CODE> otherwise.
* @throws NamingException if an error occurs.
*/
- static boolean isReferralEntry(SearchResult entry) throws NamingException {
- boolean result = false;
+ private static boolean isReferralEntry(SearchResult entry) throws NamingException
+ {
Set<String> ocValues = ConnectionUtils.getValues(entry, "objectClass");
if (ocValues != null) {
for (String value : ocValues)
{
boolean isReferral = "referral".equalsIgnoreCase(value);
-
if (isReferral) {
- result = ConnectionUtils.getFirstValue(entry, "ref") != null;
- break;
+ return ConnectionUtils.getFirstValue(entry, "ref") != null;
}
}
}
- return result;
+ return false;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
index 336bc4b..5844633 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
@@ -18,6 +18,8 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.opends.guitools.controlpanel.ui.nodes.BasicNode;
@@ -32,11 +34,11 @@
*/
class NodeSearcherQueue implements Runnable {
- private String name;
- private ArrayList<AbstractNodeTask> waitingQueue = new ArrayList<>();
- private HashMap<BasicNode, AbstractNodeTask> workingList = new HashMap<>();
- private HashMap<BasicNode, BasicNode> cancelList = new HashMap<>();
- private ThreadGroup threadGroup;
+ private final String name;
+ private final List<AbstractNodeTask> waitingQueue = new ArrayList<>();
+ private final Map<BasicNode, AbstractNodeTask> workingList = new HashMap<>();
+ private final Map<BasicNode, BasicNode> cancelList = new HashMap<>();
+ private final ThreadGroup threadGroup;
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/SearchAbandonException.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/SearchAbandonException.java
index 2df0580..4b521e4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/SearchAbandonException.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/SearchAbandonException.java
@@ -12,21 +12,20 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2016 ForgeRock AS.
*/
-
package org.opends.guitools.controlpanel.browser;
/**
* The exception used by the NodeRefresher when the refresh process is
* cancelled, interrupted or something failed.
- *
*/
class SearchAbandonException extends Exception {
private static final long serialVersionUID = 7768798649278383859L;
- private NodeRefresher.State state;
- private Exception x;
- private Object arg;
+ private final NodeRefresher.State state;
+ private final Exception x;
+ private final Object arg;
/**
* The constructor for the class.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BasicMonitoringAttributes.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BasicMonitoringAttributes.java
index eef9a67..3c0fc38 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BasicMonitoringAttributes.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BasicMonitoringAttributes.java
@@ -175,9 +175,8 @@
}
}
- private LocalizableMessage msg;
- private String attributeName;
- private boolean isAborted;
+ private final LocalizableMessage msg;
+ private final String attributeName;
private boolean isNumeric;
private boolean isGMTDate;
private boolean isValueInBytes;
@@ -203,12 +202,6 @@
}
@Override
- public boolean isAborted()
- {
- return isAborted;
- }
-
- @Override
public boolean isNumeric()
{
return isNumeric;
@@ -246,8 +239,6 @@
private void calculateProperties()
{
- isAborted = attributeName.indexOf("ds-mon-aborted-") == 0;
-
canHaveAverage = attributeName.endsWith("total-count") ||
attributeName.endsWith("Requests") ||
attributeName.endsWith("Responses") ||
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
index 96c149e..fa89de0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
@@ -54,7 +54,7 @@
*/
public class CustomSearchResult implements Comparable<CustomSearchResult>
{
- private String dn;
+ private final String dn;
private Map<String, List<Object>> attributes;
private SortedSet<String> attrNames;
private String toString;
@@ -190,21 +190,6 @@
return toString().compareTo(o.toString());
}
- /**
- * Return a new object, copy of the current object.
- *
- * @return a new object, copy of the current object
- */
- public CustomSearchResult duplicate()
- {
- CustomSearchResult sr = new CustomSearchResult(dn);
- sr.attributes = new HashMap<>(attributes);
- sr.attrNames = new TreeSet<>(attrNames);
- sr.toString = toString;
- sr.hashCode = hashCode;
- return sr;
- }
-
@Override
public boolean equals(Object o)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DatabaseMonitoringTableModel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DatabaseMonitoringTableModel.java
index 8b0f77d..5ab3212 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DatabaseMonitoringTableModel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/DatabaseMonitoringTableModel.java
@@ -21,6 +21,7 @@
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedHashSet;
+import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -34,15 +35,15 @@
public class DatabaseMonitoringTableModel extends SortableTableModel implements Comparator<BackendDescriptor>
{
private static final long serialVersionUID = 548035716525600536L;
- private Set<BackendDescriptor> data = new HashSet<>();
- private ArrayList<String[]> dataArray = new ArrayList<>();
+ private final Set<BackendDescriptor> data = new HashSet<>();
+ private final List<String[]> dataArray = new ArrayList<>();
private String[] columnNames = {};
- private LocalizableMessage NO_VALUE_SET = INFO_CTRL_PANEL_NO_MONITORING_VALUE.get();
- private LocalizableMessage NOT_IMPLEMENTED = INFO_CTRL_PANEL_NOT_IMPLEMENTED.get();
+ private final LocalizableMessage NO_VALUE_SET = INFO_CTRL_PANEL_NO_MONITORING_VALUE.get();
+ private final LocalizableMessage NOT_IMPLEMENTED = INFO_CTRL_PANEL_NOT_IMPLEMENTED.get();
/** The fields to be displayed. */
- private LinkedHashSet<String> attributes = new LinkedHashSet<>();
+ private final Set<String> attributes = new LinkedHashSet<>();
/** The sort column of the table. */
private int sortColumn;
/** Whether the sorting is ascending or descending. */
@@ -195,7 +196,7 @@
* Sets the fields displayed by this table model.
* @param fields the statistic fields displayed by this table model.
*/
- public void setAttributes(LinkedHashSet<String> fields)
+ public void setAttributes(Set<String> fields)
{
this.attributes.clear();
this.attributes.addAll(fields);
@@ -274,7 +275,7 @@
* @param backend the backend.
* @return the label to be used for the provided backend.
*/
- protected String getName(BackendDescriptor backend)
+ private String getName(BackendDescriptor backend)
{
return backend.getBackendID();
}
@@ -285,7 +286,7 @@
* @return the monitoring entry associated with the provided backend. Returns
* <CODE>null</CODE> if there is no monitoring entry associated.
*/
- protected CustomSearchResult getMonitoringEntry(BackendDescriptor backend)
+ private CustomSearchResult getMonitoringEntry(BackendDescriptor backend)
{
return backend.getMonitoringEntry();
}
@@ -311,5 +312,4 @@
}
return line;
}
-
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/MonitoringAttributes.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/MonitoringAttributes.java
index ef4990a..6851d97 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/MonitoringAttributes.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/MonitoringAttributes.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
*/
package org.opends.guitools.controlpanel.datamodel;
@@ -39,13 +39,6 @@
String getAttributeName();
/**
- * Tells whether this is the number of aborted operations.
- * @return <CODE>true</CODE> if this corresponds to the number of aborted
- * operations and <CODE>false</CODE> otherwise.
- */
- boolean isAborted();
-
- /**
* Return whether this attribute contains a numeric value or not.
* @return <CODE>true</CODE> if the value is numeric and <CODE>false</CODE>
* otherwise.
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/MoveEvent.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/MoveEvent.java
deleted file mode 100644
index 86ac4a4..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/MoveEvent.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2008 Sun Microsystems, Inc.
- */
-
-package org.opends.guitools.controlpanel.event;
-
-import org.opends.guitools.controlpanel.ui.nodes.BrowserNodeInfo;
-
-/**
- * The event that is throw when an entry is moved in the LDAP
- * entry browser. For the time being it is not used but it can be used in the
- * future when the move of the entries is implemented.
- *
- */
-public class MoveEvent
-{
- private BrowserNodeInfo newParent;
- private BrowserNodeInfo[] nodes;
-
- /**
- * The constructor of the move event.
- * @param newParent the new parent of the nodes that are being moved.
- * @param nodes the nodes that are being moved.
- */
- public MoveEvent(BrowserNodeInfo newParent, BrowserNodeInfo[] nodes) {
- this.newParent = newParent;
- this.nodes = nodes;
- }
-
- /**
- * Return the new parent of the nodes that are being moved.
- * @return the new parent of the nodes that are being moved.
- */
- public BrowserNodeInfo getNewParent() {
- return newParent;
- }
-
- /**
- * Return the nodes that are being moved.
- * @return the nodes that are being moved.
- */
- public BrowserNodeInfo[] getNodes() {
- return nodes;
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/MoveListener.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/MoveListener.java
deleted file mode 100644
index afea1df..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/MoveListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
- */
-
-package org.opends.guitools.controlpanel.event;
-
-/**
- * Interface that must be implemented by the objects that want to receive
- * notifications when an entry is being moved (for instance using drag and
- * drop).
- * For the time being it is not used but it can be used in the future when the
- * move of the entries is implemented.
- *
- */
-public interface MoveListener
-{
- /**
- * Notification that the entry is being moved.
- * @param ev the event.
- */
- void processMoveEvent(MoveEvent ev);
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/StartStopTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/StartStopTask.java
index 787f158..f0c71d4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/StartStopTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/StartStopTask.java
@@ -19,17 +19,18 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.ui.ProgressDialog;
-import org.forgerock.i18n.LocalizableMessage;
/** An abstract class used to re-factor some code between the start, stop and restart tasks. */
-public abstract class StartStopTask extends Task
+abstract class StartStopTask extends Task
{
- Set<String> backendSet;
+ private final Set<String> backendSet;
/**
* Constructor of the task.
@@ -46,7 +47,6 @@
{
backendSet.add(backend.getBackendID());
}
-
}
@Override
@@ -80,11 +80,8 @@
getInfo().stopPooling();
getInfo().regenerateDescriptor();
- ArrayList<String> arguments = getCommandLineArguments();
-
- String[] args = new String[arguments.size()];
-
- arguments.toArray(args);
+ List<String> arguments = getCommandLineArguments();
+ String[] args = arguments.toArray(new String[arguments.size()]);
returnCode = executeCommandLine(getCommandLinePath(), args);
postCommandLine();
@@ -109,13 +106,6 @@
*/
protected void postCommandLine()
{
- if (returnCode != 0)
- {
- state = State.FINISHED_WITH_ERROR;
- }
- else
- {
- state = State.FINISHED_SUCCESSFULLY;
- }
+ state = returnCode != 0 ? State.FINISHED_WITH_ERROR : State.FINISHED_SUCCESSFULLY;
}
}
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 51a64f0..4f32520 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
@@ -161,11 +161,11 @@
* a bug, because of the way the contents of logs is updated, using
* StringBuffer instead of StringBuilder is required.
*/
- protected StringBuffer logs = new StringBuffer();
+ private StringBuffer logs = new StringBuffer();
/** The error logs of the task. */
- protected StringBuilder errorLogs = new StringBuilder();
+ private StringBuilder errorLogs = new StringBuilder();
/** The standard output logs of the task. */
- protected StringBuilder outputLogs = new StringBuilder();
+ private StringBuilder outputLogs = new StringBuilder();
/** The print stream for the error logs. */
protected ApplicationPrintStream errorPrintStream =
new ApplicationPrintStream();
@@ -178,7 +178,7 @@
* start server task, the process generated executing the start-ds
* command-line.
*/
- protected Process process;
+ private Process process;
private ControlPanelInfo info;
private ServerDescriptor server;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBackendIndexesPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBackendIndexesPanel.java
index 889a8bf..d631ba5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBackendIndexesPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBackendIndexesPanel.java
@@ -47,17 +47,17 @@
* 'Manage Indexes...' dialog when the user clicks on 'Indexes' or
* 'VLV Indexes'.
*/
-public abstract class AbstractBackendIndexesPanel extends StatusGenericPanel
+abstract class AbstractBackendIndexesPanel extends StatusGenericPanel
{
private static final long serialVersionUID = 2702054131388877743L;
private String backendName;
/** The table model. */
protected AbstractIndexTableModel tableModel;
/** The table contained by this panel. */
- protected JTable table;
+ private JTable table;
/** The scroll pane that contains the table. */
- protected JScrollPane tableScroll;
- private Set<IndexSelectionListener> indexListeners = new HashSet<>();
+ private JScrollPane tableScroll;
+ private final Set<IndexSelectionListener> indexListeners = new HashSet<>();
private int lastRowMouseOver = -1;
/** Default constructor. */
@@ -83,7 +83,7 @@
* backend.
* @param backendName the backend name.
*/
- public void update(String backendName)
+ void update(String backendName)
{
this.backendName = backendName;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java
index f678496..04f5325 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractIndexPanel.java
@@ -89,18 +89,13 @@
/** Name of the index label. */
final JLabel name = Utilities.createDefaultLabel();
-
/** Backends label. */
- final JLabel lBackend = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_BACKEND_LABEL.get());
+ private final JLabel lBackend = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_BACKEND_LABEL.get());
/** Read-only backend name label. */
final JLabel backendName = Utilities.createDefaultLabel();
-
final JLabel lAttribute = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ATTRIBUTE_LABEL.get());
-
final JLabel lEntryLimit = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_ENTRY_LIMIT_LABEL.get());
-
final JTextField entryLimit = Utilities.createShortTextField();
-
final JLabel lType = Utilities.createPrimaryLabel(INFO_CTRL_PANEL_INDEX_TYPE_LABEL.get());
/** Panel containing all the index types. */
final JPanel typesPanel = new JPanel(new GridBagLayout());
@@ -118,7 +113,7 @@
/** Array of checkboxes. */
final JCheckBox[] types = { approximate, equality, ordering, presence, substring };
/** Array of index types that matches the array of checkboxes (types). */
- final IndexType[] configTypes = { APPROXIMATE, EQUALITY, ORDERING, PRESENCE, SUBSTRING };
+ private final IndexType[] configTypes = { APPROXIMATE, EQUALITY, ORDERING, PRESENCE, SUBSTRING };
final JButton deleteIndex = Utilities.createButton(INFO_CTRL_PANEL_DELETE_INDEX_LABEL.get());
final JButton saveChanges = Utilities.createButton(INFO_CTRL_PANEL_SAVE_CHANGES_LABEL.get());
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java
index 71260da..41e6de2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseGeneralMonitoringPanel.java
@@ -26,6 +26,7 @@
import java.awt.Insets;
import java.awt.Window;
import java.util.HashMap;
+import java.util.Map;
import java.util.Objects;
import javax.swing.ImageIcon;
@@ -41,6 +42,8 @@
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.LocalizableMessageBuilder;
import org.opends.guitools.controlpanel.browser.IconPool;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
@@ -50,11 +53,9 @@
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;
-import org.forgerock.i18n.LocalizableMessageBuilder;
/** The pane that is displayed when the user clicks on 'General Monitoring'. */
-public class BrowseGeneralMonitoringPanel extends StatusGenericPanel
+class BrowseGeneralMonitoringPanel extends StatusGenericPanel
{
private static final long serialVersionUID = 6462914563746678830L;
@@ -69,9 +70,9 @@
private boolean ignoreSelectionEvents;
- private LocalizableMessage NO_ELEMENT_SELECTED =
+ private final LocalizableMessage NO_ELEMENT_SELECTED =
INFO_CTRL_PANEL_GENERAL_MONITORING_NO_ITEM_SELECTED.get();
- private LocalizableMessage MULTIPLE_ITEMS_SELECTED =
+ private final LocalizableMessage MULTIPLE_ITEMS_SELECTED =
INFO_CTRL_PANEL_MULTIPLE_ITEMS_SELECTED_LABEL.get();
/** The enumeration used to define the different static nodes of the tree. */
@@ -94,7 +95,7 @@
}
/** The panel displaying the informations about the selected node. */
- protected GeneralMonitoringRightPanel entryPane;
+ private GeneralMonitoringRightPanel entryPane;
/** Default constructor. */
public BrowseGeneralMonitoringPanel()
@@ -225,7 +226,7 @@
}
});
JTree tree = treePane.getTree();
- repopulateTree(tree, true);
+ repopulateTree(tree);
tree.setRootVisible(true);
tree.setVisibleRowCount(20);
tree.expandPath(new TreePath(getRoot(tree)));
@@ -273,7 +274,7 @@
// Repopulate the tree to display a root node with server information
if (!serverName.equals(lastServerName))
{
- repopulateTree(treePane.getTree(), false);
+ repopulateTree(treePane.getTree());
lastServerName = serverName;
}
if (firstTimeCalled)
@@ -353,9 +354,8 @@
* Populates the tree. Should be called only once since the tree in this
* panel is static.
* @param tree the tree to be repopulated.
- * @param forceScroll whether the scroll must be reset or not.
*/
- private void repopulateTree(JTree tree, boolean forceScroll)
+ private void repopulateTree(JTree tree)
{
ignoreSelectionEvents = true;
@@ -445,33 +445,7 @@
{
GeneralMonitoringTreeNode node =
(GeneralMonitoringTreeNode)path.getLastPathComponent();
- NodeType type = (NodeType)node.getIdentifier();
- switch (type)
- {
- case ROOT:
- entryPane.updateRoot();
- break;
- case SYSTEM_INFORMATION:
- entryPane.updateSystemInformation();
- break;
- case WORK_QUEUE:
- entryPane.updateWorkQueue();
- break;
- case ENTRY_CACHES:
- entryPane.updateEntryCaches();
- break;
- case JE_DATABASES_INFORMATION:
- entryPane.updateJEDatabaseInformation();
- break;
- case PDB_DATABASES_INFORMATION:
- entryPane.updatePDBDatbaseInformation();
- break;
- case JAVA_INFORMATION:
- entryPane.updateJavaInformation();
- break;
- default:
- throw new RuntimeException("Unknown node type: "+type);
- }
+ entryPane.update((NodeType) node.getIdentifier());
}
else if (paths != null && paths.length > 1)
{
@@ -506,7 +480,7 @@
&& !Objects.equals(lastServer.getWorkQueueMonitor(), desc.getWorkQueueMonitor());
}
- private HashMap<Object, ImageIcon> hmImages = new HashMap<>();
+ private final Map<Object, ImageIcon> hmImages = new HashMap<>();
{
NodeType[] identifiers = {
NodeType.ROOT,
@@ -547,7 +521,7 @@
}
/** Specific class used to render the nodes in the tree. It uses specific icons for the nodes. */
- protected class GeneralMonitoringTreeCellRenderer extends TreeCellRenderer
+ private class GeneralMonitoringTreeCellRenderer extends TreeCellRenderer
{
private static final long serialVersionUID = -3390566664259441766L;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
index 1b32968..613afe6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ColorAndFontConstants.java
@@ -14,10 +14,8 @@
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2014-2016 ForgeRock AS.
*/
-
package org.opends.guitools.controlpanel.ui;
-
import static com.forgerock.opendj.util.OperatingSystem.isWindows;
import static com.forgerock.opendj.util.OperatingSystem.isMacOS;
@@ -127,7 +125,7 @@
public static final Color mouseOverBackground =
UIManager.getColor("TextField.selectionBackground");
/** Text color indicating that a field is valid. */
- public static final Color validFontColor = foreground;
+ static final Color validFontColor = foreground;
/**
* The color of the text when the mouse is over (this is used in some
@@ -164,8 +162,7 @@
public static final Font headerFont =
UIManager.getFont("TableHeader.font").deriveFont(Font.BOLD);
/** The font to be used in the title of the error panes. */
- public static final Font errorTitleFont =
- defaultFont.deriveFont(Font.BOLD).deriveFont(13f);
+ static final Font errorTitleFont = defaultFont.deriveFont(Font.BOLD).deriveFont(13f);
/** The font to be used in the CategoryButton component. */
public static final Font categoryFont =
UIManager.getFont("Label.font").deriveFont(Font.BOLD);
@@ -182,14 +179,12 @@
public static final Font titleFont =
defaultFont.deriveFont(Font.BOLD).deriveFont(14f);
/** Text color indicating that a field is not valid. */
- public static final Color invalidFontColor = Color.red;
+ static final Color invalidFontColor = Color.red;
/** The font to be used when the field associated with a primary label is not valid. */
- public static final Font primaryInvalidFont =
+ static final Font primaryInvalidFont =
primaryFont.deriveFont(Font.ITALIC);
/** The font to be used when the field associated with a normal label is not valid. */
- public static final Font invalidFont = defaultFont.deriveFont(Font.ITALIC);
+ static final Font invalidFont = defaultFont.deriveFont(Font.ITALIC);
/** The font to be used in the progress dialog's 'Details' section. */
public static final Font progressFont = UIManager.getFont("EditorPane.font");
- /** Specifies the font for the command-line output in the detail panel. */
- public static final Font outputFont = Font.decode("Monospaced-PLAIN-12");
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConfirmInitializeAndImportDialog.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConfirmInitializeAndImportDialog.java
deleted file mode 100644
index 6f8de1d..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConfirmInitializeAndImportDialog.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2009 Sun Microsystems, Inc.
- * Portions Copyright 2014-2016 ForgeRock AS.
- */
-
-package org.opends.guitools.controlpanel.ui;
-
-import static org.opends.messages.AdminToolMessages.*;
-
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.Insets;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.JButton;
-import javax.swing.JPanel;
-
-import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
-import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
-import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-
-/**
- * Dialog used to inform the user that there are unsaved changes in a panel.
- * It proposes the user to save the changes, do not save them or cancel the
- * action that make the dialog appear (for instance when the user is editing
- * an entry and clicks on another node, this dialog appears).
- */
-public class ConfirmInitializeAndImportDialog extends GenericDialog
-{
- /** The different input that the user can provide. */
- public enum Result
- {
- /** The user asks to do the import and then the initialization. */
- INITIALIZE_ALL,
- /** The user asks to only do the import locally. */
- IMPORT_ONLY,
- /** The user asks to cancel the operation that made this dialog to appear. */
- CANCEL
- }
- private static final long serialVersionUID = -442311801035162311L;
-
- /**
- * Constructor of the dialog.
- * @param parentDialog the parent dialog.
- * @param info the control panel info.
- */
- public ConfirmInitializeAndImportDialog(Component parentDialog,
- ControlPanelInfo info)
- {
- super(Utilities.getFrame(parentDialog), getPanel(info));
- Utilities.centerGoldenMean(this, parentDialog);
- getRootPane().setDefaultButton(
- ((ConfirmInitializeAndImportPanel)panel).initializeAllButton);
- setModal(true);
- }
-
- /**
- * Sets the message to be displayed in this dialog.
- * @param title the title of the message.
- * @param details the details of the message.
- */
- public void setMessage(LocalizableMessage title, LocalizableMessage details)
- {
- panel.updateConfirmationPane(panel.errorPane, title,
- ColorAndFontConstants.errorTitleFont, details,
- ColorAndFontConstants.defaultFont);
- invalidate();
- pack();
- }
-
- @Override
- public void setVisible(boolean visible)
- {
- if (visible)
- {
- ((ConfirmInitializeAndImportPanel)panel).result = Result.CANCEL;
- }
- super.setVisible(visible);
- }
-
- /**
- * Returns the option the user gave when closing this dialog.
- * @return the option the user gave when closing this dialog.
- */
- public Result getResult()
- {
- return ((ConfirmInitializeAndImportPanel)panel).result;
- }
-
- /**
- * Creates the panel to be displayed inside the dialog.
- * @param info the control panel info.
- * @return the panel to be displayed inside the dialog.
- */
- private static StatusGenericPanel getPanel(ControlPanelInfo info)
- {
- ConfirmInitializeAndImportPanel panel =
- new ConfirmInitializeAndImportPanel();
- panel.setInfo(info);
- return panel;
- }
-
- /** The panel to be displayed inside the dialog. */
- private static class ConfirmInitializeAndImportPanel
- extends StatusGenericPanel
- {
- private static final long serialVersionUID = -9890116762604059L;
-
- private JButton initializeAllButton;
- private JButton importOnlyButton;
- private JButton cancelButton;
-
- private Result result;
-
- /** Default constructor. */
- public ConfirmInitializeAndImportPanel()
- {
- super();
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.gridwidth = 1;
- addErrorPane(gbc);
- errorPane.setVisible(true);
- gbc.gridy ++;
- gbc.fill = GridBagConstraints.VERTICAL;
- gbc.weighty = 1.0;
- add(Box.createVerticalGlue(), gbc);
- gbc.fill = GridBagConstraints.HORIZONTAL;
-// The button panel
- gbc.gridy ++;
- gbc.weighty = 0.0;
- gbc.insets = new Insets(0, 0, 0, 0);
- add(createButtonsPanel(), gbc);
- }
-
- @Override
- public boolean requiresBorder()
- {
- return false;
- }
-
- @Override
- public boolean requiresScroll()
- {
- return false;
- }
-
- private JPanel createButtonsPanel()
- {
- JPanel buttonsPanel = new JPanel(new GridBagLayout());
- buttonsPanel.setOpaque(true);
- buttonsPanel.setBackground(ColorAndFontConstants.greyBackground);
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.anchor = GridBagConstraints.WEST;
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.gridwidth = 1;
- gbc.gridy = 0;
- gbc.weightx = 1.0;
- gbc.gridx ++;
- buttonsPanel.add(Box.createHorizontalStrut(150));
- buttonsPanel.add(Box.createHorizontalGlue(), gbc);
-
- initializeAllButton = Utilities.createButton(
- INFO_CTRL_PANEL_INITIALIZE_ALL_BUTTON_LABEL.get());
- initializeAllButton.setOpaque(false);
- gbc.insets = new Insets(10, 10, 10, 10);
- gbc.weightx = 0.0;
- gbc.gridx ++;
- buttonsPanel.add(initializeAllButton, gbc);
- initializeAllButton.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent ev)
- {
- result = Result.INITIALIZE_ALL;
- cancelClicked();
- }
- });
-
- gbc.gridx ++;
- importOnlyButton = Utilities.createButton(
- INFO_CTRL_PANEL_IMPORT_ONLY_BUTTON_LABEL.get());
- importOnlyButton.setOpaque(false);
- gbc.gridx ++;
- gbc.insets.left = 0;
- gbc.insets.right = 10;
- buttonsPanel.add(importOnlyButton, gbc);
- importOnlyButton.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent ev)
- {
- result = Result.IMPORT_ONLY;
- cancelClicked();
- }
- });
-
- cancelButton = Utilities.createButton(
- INFO_CTRL_PANEL_CANCEL_BUTTON_LABEL.get());
- cancelButton.setOpaque(false);
- gbc.insets.right = 10;
- gbc.gridx ++;
- buttonsPanel.add(cancelButton, gbc);
- cancelButton.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent ev)
- {
- result = Result.CANCEL;
- cancelClicked();
- }
- });
-
- buttonsPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0,
- ColorAndFontConstants.defaultBorderColor));
-
- return buttonsPanel;
- }
-
- @Override
- public Component getPreferredFocusComponent()
- {
- return initializeAllButton;
- }
-
- @Override
- public void okClicked()
- {
- }
-
- @Override
- public LocalizableMessage getTitle()
- {
- return INFO_CTRL_PANEL_CONFIRM_INITIALIZE_TITLE.get();
- }
-
- @Override
- public void configurationChanged(ConfigurationChangeEvent ev)
- {
- }
-
- @Override
- public GenericDialog.ButtonType getButtonType()
- {
- return GenericDialog.ButtonType.NO_BUTTON;
- }
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DatabaseMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DatabaseMonitoringPanel.java
index fcde62c..6a3b0b2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DatabaseMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DatabaseMonitoringPanel.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2009-2010 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
package org.opends.guitools.controlpanel.ui;
@@ -44,7 +44,7 @@
import org.opends.server.util.ServerConstants;
/** The panel displaying the database monitoring filtered attributes. */
-public class DatabaseMonitoringPanel extends GeneralMonitoringPanel
+class DatabaseMonitoringPanel extends GeneralMonitoringPanel
{
private static final long serialVersionUID = 9031734563723229830L;
@@ -54,8 +54,8 @@
private JLabel noDBsFound;
private JLabel noMonitoringFound;
private JButton showFields;
- private LinkedHashSet<String> attributes = new LinkedHashSet<>();
- private LinkedHashSet<String> allAttributes = new LinkedHashSet<>();
+ private Set<String> attributes = new LinkedHashSet<>();
+ private final LinkedHashSet<String> allAttributes = new LinkedHashSet<>();
private MonitoringAttributesViewPanel<String> fieldsViewPanel;
private GenericDialog fieldsViewDlg;
@@ -65,7 +65,7 @@
* Default constructor.
* @param type the type of pluggable backend.
*/
- public DatabaseMonitoringPanel(BackendDescriptor.PluggableType type)
+ DatabaseMonitoringPanel(BackendDescriptor.PluggableType type)
{
pluggableType = type;
createLayout();
@@ -137,7 +137,7 @@
setBorder(PANEL_BORDER);
}
- /** Updates the contents of the panel. The code assumes that this is being called from the event thread. */
+ @Override
public void updateContents()
{
boolean backendsFound = false;
@@ -217,7 +217,7 @@
}
}
- private void setFieldsToDisplay(LinkedHashSet<String> attributes)
+ private void setFieldsToDisplay(Set<String> attributes)
{
this.attributes = attributes;
tableModel.setAttributes(attributes);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DeleteBaseDNPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DeleteBaseDNPanel.java
index b31e4f1..364ea46 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DeleteBaseDNPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/DeleteBaseDNPanel.java
@@ -46,6 +46,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
+import org.forgerock.opendj.ldap.DN;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor;
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
@@ -54,22 +55,21 @@
import org.opends.guitools.controlpanel.task.Task;
import org.opends.guitools.controlpanel.ui.renderer.CustomListCellRenderer;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.opendj.ldap.DN;
/**
* The panel displayed when the user clicks on 'Delete Base DN...' in the
* browse entries dialog.
*/
-public class DeleteBaseDNPanel extends StatusGenericPanel
+class DeleteBaseDNPanel extends StatusGenericPanel
{
private static final long serialVersionUID = 2182662824496761087L;
/** The list containing the base DNs. */
protected JList list;
/** Label indicating that no element was found. */
- protected JLabel lNoElementsFound;
+ private JLabel lNoElementsFound;
/** The main panel. */
- protected JPanel mainPanel;
+ private JPanel mainPanel;
/** Default constructor. */
public DeleteBaseDNPanel()
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java
index 620b6fb..f78d059 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/EntryCachesMonitoringPanel.java
@@ -33,22 +33,23 @@
import static org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes.*;
import static org.opends.guitools.controlpanel.util.Utilities.*;
import static org.opends.messages.AdminToolMessages.*;
+
/** The panel displaying the entry caches monitor panel. */
-public class EntryCachesMonitoringPanel extends GeneralMonitoringPanel
+class EntryCachesMonitoringPanel extends GeneralMonitoringPanel
{
private static final long serialVersionUID = 9031734563700069830L;
- private static List<MonitoringAttributes> ngOperations = CollectionUtils.<MonitoringAttributes> newArrayList(
+ private static final List<MonitoringAttributes> ngOperations = CollectionUtils.<MonitoringAttributes> newArrayList(
ENTRY_CACHE_TRIES, ENTRY_CACHE_HITS, ENTRY_CACHE_HIT_RATIO, CURRENT_ENTRY_CACHE_SIZE, MAX_ENTRY_CACHE_SIZE,
CURRENT_ENTRY_CACHE_COUNT, MAX_ENTRY_CACHE_COUNT);
- private ArrayList<JLabel> monitoringLabels = new ArrayList<>();
+ private final List<JLabel> monitoringLabels = new ArrayList<>();
{
for (int i=0; i<ngOperations.size(); i++)
{
monitoringLabels.add(Utilities.createDefaultLabel());
}
}
- private ArrayList<JLabel> labels = new ArrayList<>();
+ private final List<JLabel> labels = new ArrayList<>();
{
for (int i=0; i<ngOperations.size(); i++)
{
@@ -114,7 +115,7 @@
setBorder(PANEL_BORDER);
}
- /** Updates the contents of the panel. */
+ @Override
public void updateContents()
{
ServerDescriptor server = null;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ErrorPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ErrorPanel.java
deleted file mode 100644
index ade36c2..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ErrorPanel.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2016 ForgeRock AS.
- */
-
-package org.opends.guitools.controlpanel.ui;
-
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.util.Collection;
-
-import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
-import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
-
-/** Class used to display an collection of error messages. */
-public class ErrorPanel extends StatusGenericPanel
-{
- private static final long serialVersionUID = -4494826284037288552L;
- private LocalizableMessage title;
- /**
- * Constructor.
- * @param title the title to be displayed in the dialog.
- * @param errors the collection of errors to be displayed.
- */
- public ErrorPanel(LocalizableMessage title, Collection<LocalizableMessage> errors)
- {
- super();
- this.title = title;
- createLayout(errors);
- }
-
- @Override
- public LocalizableMessage getTitle()
- {
- return title;
- }
-
- private void createLayout(Collection<LocalizableMessage> errors)
- {
- GridBagConstraints gbc = new GridBagConstraints();
- addErrorPane(gbc);
-
- errorPane.setVisible(true);
-
- LocalizableMessageBuilder mb = new LocalizableMessageBuilder();
- for (LocalizableMessage error : errors)
- {
- if (mb.length() > 0)
- {
- mb.append("<br>");
- }
- mb.append(error);
- }
-
- updateErrorPane(errorPane, title, ColorAndFontConstants.errorTitleFont,
- mb.toMessage(), ColorAndFontConstants.defaultFont);
-
- gbc.weighty = 0.0;
- addBottomGlue(gbc);
- }
-
- @Override
- public GenericDialog.ButtonType getButtonType()
- {
- return GenericDialog.ButtonType.OK;
- }
-
- @Override
- public void configurationChanged(ConfigurationChangeEvent ev)
- {
- }
-
- @Override
- public Component getPreferredFocusComponent()
- {
- return null;
- }
-
- @Override
- public void okClicked()
- {
- Utilities.getParentDialog(this).setVisible(false);
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringPanel.java
index 9c3ab4e..712bd9c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringPanel.java
@@ -21,27 +21,28 @@
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
-import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
import org.forgerock.i18n.LocalizableMessage;
+import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
/**
* Abstract class used to refactor some code among the panels that display the
* contents of the global monitoring.
*/
-public abstract class GeneralMonitoringPanel extends StatusGenericPanel
+abstract class GeneralMonitoringPanel extends StatusGenericPanel
{
private static final long serialVersionUID = 2840755228290832143L;
/** The empty border shared by all the panels. */
- protected Border PANEL_BORDER = new EmptyBorder(10, 10, 10, 10);
+ protected final Border PANEL_BORDER = new EmptyBorder(10, 10, 10, 10);
/** The message to express that the value was not found. */
- protected static LocalizableMessage NO_VALUE_SET =
+ protected final static LocalizableMessage NO_VALUE_SET =
INFO_CTRL_PANEL_NO_MONITORING_VALUE.get();
@Override
public void configurationChanged(ConfigurationChangeEvent ev)
{
+ // no-op
}
@Override
@@ -53,5 +54,9 @@
@Override
public void okClicked()
{
+ // no-op
}
+
+ /** Updates the contents of the panel. */
+ public abstract void updateContents();
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringRightPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringRightPanel.java
index 6ce4891..70b4595 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringRightPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/GeneralMonitoringRightPanel.java
@@ -25,28 +25,31 @@
import javax.swing.JPanel;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
+import org.opends.guitools.controlpanel.ui.BrowseGeneralMonitoringPanel.NodeType;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.i18n.LocalizableMessage;
/** The panel on the right of the 'General Information' panel. */
-public class GeneralMonitoringRightPanel extends StatusGenericPanel
+class GeneralMonitoringRightPanel extends StatusGenericPanel
{
private static final long serialVersionUID = -4197460101279681042L;
/** The panel with a CardLayout that contains all the panels. */
- protected JPanel mainPanel;
+ private JPanel mainPanel;
- private RootMonitoringPanel rootPanel = new RootMonitoringPanel();
- private WorkQueueMonitoringPanel workQueuePanel = new WorkQueueMonitoringPanel();
- private EntryCachesMonitoringPanel entryCachesPanel = new EntryCachesMonitoringPanel();
- private DatabaseMonitoringPanel jeMonitoringPanel = new DatabaseMonitoringPanel(BackendDescriptor.PluggableType.JE);
- private DatabaseMonitoringPanel pdbMonitoringPanel = new DatabaseMonitoringPanel(BackendDescriptor.PluggableType.PDB);
- private SystemInformationMonitoringPanel systemInformationPanel = new SystemInformationMonitoringPanel();
- private JavaInformationMonitoringPanel javaInformationPanel = new JavaInformationMonitoringPanel();
+ private final RootMonitoringPanel rootPanel = new RootMonitoringPanel();
+ private final WorkQueueMonitoringPanel workQueuePanel = new WorkQueueMonitoringPanel();
+ private final EntryCachesMonitoringPanel entryCachesPanel = new EntryCachesMonitoringPanel();
+ private final DatabaseMonitoringPanel jeMonitoringPanel = new DatabaseMonitoringPanel(
+ BackendDescriptor.PluggableType.JE);
+ private final DatabaseMonitoringPanel pdbMonitoringPanel = new DatabaseMonitoringPanel(
+ BackendDescriptor.PluggableType.PDB);
+ private final SystemInformationMonitoringPanel systemInformationPanel = new SystemInformationMonitoringPanel();
+ private final JavaInformationMonitoringPanel javaInformationPanel = new JavaInformationMonitoringPanel();
private static final String rootPanelTitle = "RootMonitoringPanel";
private static final String workQueuePanelTitle = "WorkQueueMonitoringPanel";
@@ -57,7 +60,7 @@
private static final String javaInformationPanelTitle = "JavaInformationMonitoringPanel";
/** The panel used to update messages. */
- protected NoItemSelectedPanel noEntryPanel = new NoItemSelectedPanel();
+ private final NoItemSelectedPanel noEntryPanel = new NoItemSelectedPanel();
private static final String noEntryPanelTitle = "JavaInformationMonitoringPanel";
private final StatusGenericPanel[] panels =
@@ -100,7 +103,7 @@
}
/** Creates the layout of the panel (but the contents are not populated here). */
- protected void createLayout()
+ private void createLayout()
{
GridBagConstraints gbc = new GridBagConstraints();
CardLayout cardLayout = new CardLayout();
@@ -156,55 +159,42 @@
@Override
public void configurationChanged(ConfigurationChangeEvent ev)
{
+ // no-op
}
- /** Updates the contents of the panel with the root monitoring information. */
- public void updateRoot()
+ void update(NodeType type)
{
- rootPanel.updateContents();
- ((CardLayout)mainPanel.getLayout()).show(mainPanel, rootPanelTitle);
+ switch (type)
+ {
+ case ROOT:
+ update(rootPanel, rootPanelTitle);
+ break;
+ case SYSTEM_INFORMATION:
+ update(systemInformationPanel, systemInformationPanelTitle);
+ break;
+ case WORK_QUEUE:
+ update(workQueuePanel, workQueuePanelTitle);
+ break;
+ case ENTRY_CACHES:
+ update(entryCachesPanel, entryCachesPanelTitle);
+ break;
+ case JE_DATABASES_INFORMATION:
+ update(jeMonitoringPanel, jeMonitoringPanelTitle);
+ break;
+ case PDB_DATABASES_INFORMATION:
+ update(pdbMonitoringPanel, pdbMonitoringPanelTitle);
+ break;
+ case JAVA_INFORMATION:
+ update(javaInformationPanel, javaInformationPanelTitle);
+ break;
+ default:
+ throw new RuntimeException("Unknown node type: " + type);
+ }
}
- /** Updates the contents of the panel with the system information monitoring. */
- public void updateSystemInformation()
+ private void update(GeneralMonitoringPanel panel, String panelTitle)
{
- systemInformationPanel.updateContents();
- ((CardLayout)mainPanel.getLayout()).show(mainPanel, systemInformationPanelTitle);
+ panel.updateContents();
+ ((CardLayout) mainPanel.getLayout()).show(mainPanel, panelTitle);
}
-
- /** Updates the contents of the panel with the work queue monitoring information. */
- public void updateWorkQueue()
- {
- workQueuePanel.updateContents();
- ((CardLayout)mainPanel.getLayout()).show(mainPanel, workQueuePanelTitle);
- }
-
- /** Updates the contents of the panel with the entry caches monitoring information. */
- public void updateEntryCaches()
- {
- entryCachesPanel.updateContents();
- ((CardLayout)mainPanel.getLayout()).show(mainPanel, entryCachesPanelTitle);
- }
-
- /** Updates the contents of the panel with the je database monitoring information. */
- public void updateJEDatabaseInformation()
- {
- jeMonitoringPanel.updateContents();
- ((CardLayout)mainPanel.getLayout()).show(mainPanel, jeMonitoringPanelTitle);
- }
-
- /** Updates the contents of the panel with the pdb database monitoring information. */
- public void updatePDBDatbaseInformation()
- {
- pdbMonitoringPanel.updateContents();
- ((CardLayout)mainPanel.getLayout()).show(mainPanel, pdbMonitoringPanelTitle);
- }
-
- /** Updates the contents of the panel with the JAVA information. */
- public void updateJavaInformation()
- {
- javaInformationPanel.updateContents();
- ((CardLayout)mainPanel.getLayout()).show(mainPanel, javaInformationPanelTitle);
- }
-
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaInformationMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaInformationMonitoringPanel.java
index 4e33c54..97ac9ac 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaInformationMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaInformationMonitoringPanel.java
@@ -40,6 +40,7 @@
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
import org.opends.guitools.controlpanel.ui.components.BasicExpander;
import org.opends.guitools.controlpanel.util.Utilities;
+import org.opends.server.util.CollectionUtils;
import static org.opends.guitools.controlpanel.util.Utilities.*;
import static org.opends.messages.AdminToolMessages.*;
@@ -49,23 +50,20 @@
public class JavaInformationMonitoringPanel extends GeneralMonitoringPanel
{
private static final long serialVersionUID = 9031734563799969830L;
- private List<BasicMonitoringAttributes> generalAttributes = new ArrayList<>();
- {
- generalAttributes.add(BasicMonitoringAttributes.JVM_VERSION);
- generalAttributes.add(BasicMonitoringAttributes.JVM_VENDOR);
- generalAttributes.add(BasicMonitoringAttributes.JVM_ARCHITECTURE);
- generalAttributes.add(BasicMonitoringAttributes.JVM_ARGUMENTS);
- generalAttributes.add(BasicMonitoringAttributes.CLASS_PATH);
- generalAttributes.add(BasicMonitoringAttributes.JAVA_VERSION);
- generalAttributes.add(BasicMonitoringAttributes.JAVA_VENDOR);
- }
- private List<BasicMonitoringAttributes> extraAttributes = new ArrayList<>();
- {
- extraAttributes.add(BasicMonitoringAttributes.CLASS_PATH);
- extraAttributes.add(BasicMonitoringAttributes.JAVA_VERSION);
- extraAttributes.add(BasicMonitoringAttributes.JAVA_VENDOR);
- }
- private ArrayList<JComponent> generalMonitoringComps = new ArrayList<>();
+
+ private final List<BasicMonitoringAttributes> generalAttributes = CollectionUtils.newArrayList(
+ BasicMonitoringAttributes.JVM_VERSION,
+ BasicMonitoringAttributes.JVM_VENDOR,
+ BasicMonitoringAttributes.JVM_ARCHITECTURE,
+ BasicMonitoringAttributes.JVM_ARGUMENTS,
+ BasicMonitoringAttributes.CLASS_PATH,
+ BasicMonitoringAttributes.JAVA_VERSION,
+ BasicMonitoringAttributes.JAVA_VENDOR);
+ private final List<BasicMonitoringAttributes> extraAttributes = CollectionUtils.newArrayList(
+ BasicMonitoringAttributes.CLASS_PATH,
+ BasicMonitoringAttributes.JAVA_VERSION,
+ BasicMonitoringAttributes.JAVA_VENDOR);
+ private final List<JComponent> generalMonitoringComps = new ArrayList<>();
{
for (int i=0; i<generalAttributes.size(); i++)
{
@@ -86,8 +84,8 @@
}
}
- private List<String> memoryAttributes = new ArrayList<>();
- private List<JLabel> memoryLabels = new ArrayList<>();
+ private final List<String> memoryAttributes = new ArrayList<>();
+ private final List<JLabel> memoryLabels = new ArrayList<>();
private JPanel memoryPanel;
/** Default constructor. */
@@ -270,7 +268,7 @@
setBorder(PANEL_BORDER);
}
- /** Updates the contents of the panel. */
+ @Override
public void updateContents()
{
ServerDescriptor server = null;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RootMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RootMonitoringPanel.java
index b8d51b7..6da6a4a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RootMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RootMonitoringPanel.java
@@ -36,16 +36,16 @@
import static org.opends.messages.BackendMessages.*;
/** The panel displaying the root monitor panel. */
-public class RootMonitoringPanel extends GeneralMonitoringPanel
+class RootMonitoringPanel extends GeneralMonitoringPanel
{
private static final long serialVersionUID = 9031734563746269830L;
- private JLabel openConnections = Utilities.createDefaultLabel();
- private JLabel maxConnections = Utilities.createDefaultLabel();
- private JLabel totalConnections = Utilities.createDefaultLabel();
- private JLabel startTime = Utilities.createDefaultLabel();
- private JLabel upTime = Utilities.createDefaultLabel();
- private JLabel version = Utilities.createDefaultLabel();
+ private final JLabel openConnections = Utilities.createDefaultLabel();
+ private final JLabel maxConnections = Utilities.createDefaultLabel();
+ private final JLabel totalConnections = Utilities.createDefaultLabel();
+ private final JLabel startTime = Utilities.createDefaultLabel();
+ private final JLabel upTime = Utilities.createDefaultLabel();
+ private final JLabel version = Utilities.createDefaultLabel();
/** Default constructor. */
public RootMonitoringPanel()
@@ -119,7 +119,7 @@
setBorder(PANEL_BORDER);
}
- /** Updates the contents of the panel. */
+ @Override
public void updateContents()
{
ServerDescriptor server = null;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
index 8c57c5a..bcba376 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/StatusGenericPanel.java
@@ -225,6 +225,7 @@
*/
public void toBeDisplayed(final boolean visible)
{
+ // to be overridden
}
/**
@@ -2110,7 +2111,7 @@
* @param monitoringEntry
* the monitoring entry containing the information to be displayed.
*/
- protected void updateMonitoringInfo(final List<MonitoringAttributes> monitoringAttrs,
+ protected void updateMonitoringInfo(final List<? extends MonitoringAttributes> monitoringAttrs,
final List<JLabel> monitoringLabels, final CustomSearchResult monitoringEntry)
{
for (int i = 0; i < monitoringAttrs.size(); i++)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SystemInformationMonitoringPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SystemInformationMonitoringPanel.java
index 778f335..b79509c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SystemInformationMonitoringPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SystemInformationMonitoringPanel.java
@@ -26,17 +26,17 @@
import javax.swing.Box;
import javax.swing.JLabel;
-import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
import org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes;
+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.util.Utilities;
/** The panel displaying the system information monitoring panel. */
-public class SystemInformationMonitoringPanel extends GeneralMonitoringPanel
+class SystemInformationMonitoringPanel extends GeneralMonitoringPanel
{
private static final long serialVersionUID = 9031734563298069830L;
- static List<MonitoringAttributes> operations = new ArrayList<>();
+ private static final List<MonitoringAttributes> operations = new ArrayList<>();
{
operations.add(BasicMonitoringAttributes.SYSTEM_NAME);
operations.add(BasicMonitoringAttributes.OPERATING_SYSTEM);
@@ -45,7 +45,7 @@
operations.add(BasicMonitoringAttributes.FREE_USED_MEMORY);
operations.add(BasicMonitoringAttributes.MAX_MEMORY);
}
- private ArrayList<JLabel> monitoringLabels = new ArrayList<>();
+ private final List<JLabel> monitoringLabels = new ArrayList<>();
{
for (int i=0; i<operations.size(); i++)
{
@@ -112,7 +112,7 @@
setBorder(PANEL_BORDER);
}
- /** Updates the contents of the panel. */
+ @Override
public void updateContents()
{
ServerDescriptor server = null;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
index e5af34d..faf1b72 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
@@ -68,7 +68,7 @@
import org.opends.server.util.ServerConstants;
/** The panel displaying a table view of an LDAP entry. */
-public class TableViewEntryPanel extends ViewEntryPanel
+class TableViewEntryPanel extends ViewEntryPanel
{
private static final long serialVersionUID = 2135331526526472175L;
private CustomSearchResult searchResult;
@@ -382,13 +382,13 @@
}
/** The table model used by the tree in the panel. */
- protected class LDAPEntryTableModel extends SortableTableModel
+ private class LDAPEntryTableModel extends SortableTableModel
implements Comparator<AttributeValuePair>
{
private static final long serialVersionUID = -1240282431326505113L;
- private ArrayList<AttributeValuePair> dataArray = new ArrayList<>();
- private SortedSet<AttributeValuePair> allSortedValues = new TreeSet<>(this);
- private Set<String> requiredAttrs = new HashSet<>();
+ private final List<AttributeValuePair> dataArray = new ArrayList<>();
+ private final SortedSet<AttributeValuePair> allSortedValues = new TreeSet<>(this);
+ private final Set<String> requiredAttrs = new HashSet<>();
private final String[] COLUMN_NAMES = new String[] {
getHeader(LocalizableMessage.raw("Attribute"), 40),
getHeader(LocalizableMessage.raw("Value", 40))};
@@ -399,7 +399,7 @@
* Updates the contents of the table model with the
* {@code TableViewEntryPanel.searchResult} object.
*/
- public void displayEntry()
+ private void displayEntry()
{
updateDataArray();
fireTableDataChanged();
@@ -809,18 +809,18 @@
* used by the table model to be able to retrieve more easily all the values
* for a given attribute.
*/
- static class AttributeValuePair
+ private static class AttributeValuePair
{
/** The attribute name. */
- String attrName;
+ private final String attrName;
/** The value. */
- Object value;
+ private Object value;
/**
* Constructor.
* @param attrName the attribute name.
* @param value the value.
*/
- public AttributeValuePair(String attrName, Object value)
+ private AttributeValuePair(String attrName, Object value)
{
this.attrName = attrName;
this.value = value;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TaskToSchedulePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TaskToSchedulePanel.java
index faf8ee7..ab9b7b2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TaskToSchedulePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TaskToSchedulePanel.java
@@ -14,7 +14,6 @@
* Copyright 2009-2010 Sun Microsystems, Inc.
* Portions Copyright 2014-2016 ForgeRock AS.
*/
-
package org.opends.guitools.controlpanel.ui;
import static org.opends.messages.AdminToolMessages.*;
@@ -42,16 +41,14 @@
import javax.swing.JTextField;
import javax.swing.text.PlainDocument;
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.guitools.controlpanel.datamodel.CategorizedComboBoxElement;
import org.opends.guitools.controlpanel.datamodel.ScheduleType;
import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
-import org.opends.guitools.controlpanel.ui.components.
- NumericLimitedSizeDocumentFilter;
+import org.opends.guitools.controlpanel.ui.components.NumericLimitedSizeDocumentFilter;
import org.opends.guitools.controlpanel.ui.components.TimeDocumentFilter;
-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.forgerock.i18n.LocalizableMessage;
import org.opends.server.backends.task.RecurringTask;
/** The panel that allows the user to specify when a task will be launched. */
@@ -59,14 +56,14 @@
{
private static final long serialVersionUID = 6855081932432566784L;
- private String taskName;
+ private final String taskName;
private JComboBox scheduleType;
private JTextField time;
private JTextField day;
- private JComboBox month;
- private JComboBox year;
+ private JComboBox<String> month;
+ private JComboBox<String> year;
private JLabel lTime;
private JLabel lDay;
@@ -79,8 +76,7 @@
private JLabel lWeeklyTime;
private JLabel lWeeklyDays;
private JTextField weeklyTime;
- private JCheckBox sunday, monday, tuesday, wednesday, thursday, friday,
- saturday;
+ private final JCheckBox sunday, monday, tuesday, wednesday, thursday, friday, saturday;
{
sunday =
Utilities.createCheckBox(INFO_CTRL_PANEL_TASK_TO_SCHEDULE_SUNDAY.get());
@@ -99,7 +95,7 @@
Utilities.createCheckBox(INFO_CTRL_PANEL_TASK_TO_SCHEDULE_SATURDAY.get());
}
- JCheckBox[] weekDays =
+ private final JCheckBox[] weekDays =
{
sunday, monday, tuesday, wednesday, thursday, friday, saturday
};
@@ -107,7 +103,7 @@
private JLabel lMonthlyTime;
private JLabel lMonthlyDays;
private JTextField monthlyTime;
- private JCheckBox[] monthDays = new JCheckBox[31];
+ private final JCheckBox[] monthDays = new JCheckBox[31];
private JLabel lCronMinute;
private JLabel lCronHour;
@@ -127,13 +123,13 @@
private Component monthlyPanel;
private Component cronPanel;
- private LocalizableMessage LAUNCH_NOW = INFO_CTRL_PANEL_LAUNCH_NOW.get();
- private LocalizableMessage LAUNCH_LATER = INFO_CTRL_PANEL_LAUNCH_LATER.get();
- private LocalizableMessage LAUNCH_DAILY = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_DAILY.get();
- private LocalizableMessage LAUNCH_WEEKLY = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_WEEKLY.get();
- private LocalizableMessage LAUNCH_MONTHLY =
+ private final LocalizableMessage LAUNCH_NOW = INFO_CTRL_PANEL_LAUNCH_NOW.get();
+ private final LocalizableMessage LAUNCH_LATER = INFO_CTRL_PANEL_LAUNCH_LATER.get();
+ private final LocalizableMessage LAUNCH_DAILY = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_DAILY.get();
+ private final LocalizableMessage LAUNCH_WEEKLY = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_WEEKLY.get();
+ private final LocalizableMessage LAUNCH_MONTHLY =
INFO_CTRL_PANEL_TASK_TO_SCHEDULE_MONTHLY.get();
- private LocalizableMessage CRON = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_CRON.get();
+ private final LocalizableMessage CRON = INFO_CTRL_PANEL_TASK_TO_SCHEDULE_CRON.get();
private ScheduleType schedule;
@@ -714,6 +710,7 @@
@Override
public void configurationChanged(ConfigurationChangeEvent ev)
{
+ // no-op
}
@Override
@@ -770,10 +767,7 @@
{currentYear, currentYear + 5}
};
- JComboBox[] numericBoxes =
- {
- year
- };
+ JComboBox[] numericBoxes = { year };
int[] currentValues =
{
@@ -785,7 +779,7 @@
int min = maxMin[i][0];
int max = maxMin[i][1];
- DefaultComboBoxModel model = new DefaultComboBoxModel();
+ DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
int selectedIndex = 0;
@@ -818,7 +812,7 @@
}
}
- DefaultComboBoxModel model = new DefaultComboBoxModel();
+ DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
month.setModel(model);
LocalizableMessage[] monthMessages =
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 43c11af..4b40fe4 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
@@ -26,25 +26,23 @@
import javax.swing.Box;
import javax.swing.JLabel;
-import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
import org.opends.guitools.controlpanel.datamodel.BasicMonitoringAttributes;
-import org.opends.guitools.controlpanel.datamodel.MonitoringAttributes;
+import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
import org.opends.guitools.controlpanel.datamodel.ServerDescriptor;
import org.opends.guitools.controlpanel.util.Utilities;
+import org.opends.server.util.CollectionUtils;
/** The panel displaying the work queue monitor panel. */
-public class WorkQueueMonitoringPanel extends GeneralMonitoringPanel
+ class WorkQueueMonitoringPanel extends GeneralMonitoringPanel
{
private static final long serialVersionUID = 9031734563700069830L;
- static List<MonitoringAttributes> attributes = new ArrayList<>();
- {
- attributes.add(BasicMonitoringAttributes.AVERAGE_REQUEST_BACKLOG);
- attributes.add(BasicMonitoringAttributes.MAX_REQUEST_BACKLOG);
- attributes.add(BasicMonitoringAttributes.CURRENT_REQUEST_BACKLOG);
- attributes.add(BasicMonitoringAttributes.REQUESTS_SUBMITTED);
- attributes.add(BasicMonitoringAttributes.REQUESTS_REJECTED);
- }
- private ArrayList<JLabel> monitoringLabels = new ArrayList<>();
+ static final List<BasicMonitoringAttributes> attributes = CollectionUtils.newArrayList(
+ BasicMonitoringAttributes.AVERAGE_REQUEST_BACKLOG,
+ BasicMonitoringAttributes.MAX_REQUEST_BACKLOG,
+ BasicMonitoringAttributes.CURRENT_REQUEST_BACKLOG,
+ BasicMonitoringAttributes.REQUESTS_SUBMITTED,
+ BasicMonitoringAttributes.REQUESTS_REJECTED);
+ private final List<JLabel> monitoringLabels = new ArrayList<>();
{
for (int i=0; i<attributes.size(); i++)
{
@@ -112,6 +110,7 @@
}
/** Updates the contents of the panel. */
+ @Override
public void updateContents()
{
ServerDescriptor server = null;
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/BinaryCellPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/BinaryCellPanel.java
index 68d8325..ee98989 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/BinaryCellPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/BinaryCellPanel.java
@@ -25,9 +25,6 @@
import java.awt.event.KeyEvent;
import java.text.ParseException;
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-
import javax.swing.Box;
import javax.swing.Icon;
import javax.swing.ImageIcon;
@@ -36,6 +33,8 @@
import javax.swing.JPanel;
import javax.swing.KeyStroke;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.opends.guitools.controlpanel.browser.IconPool;
import org.opends.guitools.controlpanel.datamodel.BinaryValue;
import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
@@ -48,22 +47,22 @@
*/
public class BinaryCellPanel extends JPanel
{
+ private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
private static final long serialVersionUID = 6607973945986559802L;
- private JButton iconButton;
- private JLabel label;
- private CellEditorButton editButton;
- private CellEditorButton deleteButton;
- private boolean displayDelete;
- private JLabel lockLabel = Utilities.createDefaultLabel();
+ private static final int THUMBNAIL_HEIGHT = 50;
- private ImageIcon lockIcon =
+ private final JButton iconButton;
+ private final JLabel label;
+ private final CellEditorButton editButton;
+ private final CellEditorButton deleteButton;
+ private boolean displayDelete;
+ private final JLabel lockLabel = Utilities.createDefaultLabel();
+
+ private final ImageIcon lockIcon =
Utilities.createImageIcon(IconPool.IMAGE_PATH+"/field-locked.png");
private Object value;
- private static final int THUMBNAIL_HEIGHT = 50;
-
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
/** Default constructor. */
public BinaryCellPanel()
@@ -270,12 +269,6 @@
return value;
}
- /** 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 or the icon.
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/CliUserInteraction.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/CliUserInteraction.java
deleted file mode 100644
index 5b5d41a..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/CliUserInteraction.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2012-2016 ForgeRock AS.
- */
-
-package org.opends.quicksetup;
-
-import static com.forgerock.opendj.cli.Utils.*;
-
-import static org.opends.messages.AdminToolMessages.*;
-
-import java.util.List;
-
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.opends.quicksetup.util.Utils;
-
-import com.forgerock.opendj.cli.ClientException;
-import com.forgerock.opendj.cli.ConsoleApplication;
-import com.forgerock.opendj.cli.Menu;
-import com.forgerock.opendj.cli.MenuBuilder;
-import com.forgerock.opendj.cli.MenuResult;
-
-/** Supports user interactions for a command line driven application. */
-public class CliUserInteraction extends ConsoleApplication
- implements UserInteraction {
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
- private final boolean isInteractive;
- private final boolean isForceOnError;
-
- /**
- * Creates an instance that will use standard streams for interaction and with
- * the provided CLI arguments.
- * @param ud The CLI arguments.
- */
- public CliUserInteraction(UserData ud) {
- isInteractive = ud == null || ud.isInteractive();
- isForceOnError = ud != null && ud.isForceOnError();
- }
-
- @Override
- public Object confirm(LocalizableMessage summary, LocalizableMessage details,
- LocalizableMessage title, MessageType type, LocalizableMessage[] options,
- LocalizableMessage def) {
- return confirm(summary, details, null, title, type, options, def, null);
- }
-
- @Override
- public Object confirm(LocalizableMessage summary, LocalizableMessage details, LocalizableMessage fineDetails,
- LocalizableMessage title, MessageType type, LocalizableMessage[] options,
- LocalizableMessage def, LocalizableMessage viewDetailsOption) {
- MenuBuilder<Integer> builder = new MenuBuilder<>(this);
-
- LocalizableMessageBuilder b = new LocalizableMessageBuilder();
- b.append(summary);
- b.append(Constants.LINE_SEPARATOR);
- b.append(details);
- builder.setPrompt(b.toMessage());
-
- int defInt = -1;
- for (int i=0; i<options.length; i++)
- {
- builder.addNumberedOption(options[i], MenuResult.success(i+1));
- if (options[i].equals(def))
- {
- defInt = i+1;
- }
- }
-
- if (fineDetails != null) {
- LocalizableMessage detailsPrompt = viewDetailsOption;
- if (detailsPrompt == null)
- {
- detailsPrompt = INFO_CLI_VIEW_DETAILS.get();
- }
- builder.addNumberedOption(detailsPrompt,
- MenuResult.success(options.length + 1));
- }
-
- builder.setDefault(LocalizableMessage.raw(String.valueOf(defInt)),
- MenuResult.success(defInt));
-
- Menu<Integer> menu = builder.toMenu();
-
- Object returnValue = null;
- boolean menuDisplayed = false;
- while (returnValue == null) {
- int respInt;
- try
- {
- if (menuDisplayed)
- {
- println();
- builder.setPrompt(null);
- menu = builder.toMenu();
- }
- MenuResult<Integer> m = menu.run();
- menuDisplayed = true;
-
- if (m.isSuccess())
- {
- respInt = m.getValue();
- }
- else
- {
- // Should never happen.
- throw new RuntimeException();
- }
- }
- catch (ClientException ce)
- {
- respInt = defInt;
- logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
- }
- if (fineDetails != null && respInt == options.length + 1) {
- println();
- println(String.valueOf(fineDetails));
- } else {
- returnValue = options[respInt - 1];
- }
- }
- return returnValue;
- }
-
- @Override
- public String createUnorderedList(List<?> list) {
- StringBuilder sb = new StringBuilder();
- if (list != null) {
- for (Object o : list) {
- sb.append("* ");
- sb.append(o);
- sb.append(Constants.LINE_SEPARATOR);
- }
- }
- return sb.toString();
- }
-
- private void println(String text) {
- text = Utils.convertHtmlBreakToLineSeparator(text);
- text = Utils.stripHtml(text);
- text = wrapText(text, Utils.getCommandLineMaxLineWidth());
- getErrorStream().println(text);
- }
-
- @Override
- public boolean isAdvancedMode() {
- return false;
- }
-
- @Override
- public boolean isInteractive() {
- return isInteractive;
- }
-
- @Override
- public boolean isMenuDrivenMode() {
- return true;
- }
-
- @Override
- public boolean isQuiet() {
- return false;
- }
-
- @Override
- public boolean isScriptFriendly() {
- return false;
- }
-
- @Override
- public boolean isVerbose() {
- return true;
- }
-
- @Override
- public boolean isCLI()
- {
- return true;
- }
-
- @Override
- public boolean isForceOnError() {
- return isForceOnError;
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/UserInteraction.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/UserInteraction.java
deleted file mode 100644
index e4c0362..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/UserInteraction.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2012-2014 ForgeRock AS.
- */
-
-package org.opends.quicksetup;
-import org.forgerock.i18n.LocalizableMessage;
-
-import java.util.List;
-
-/**
- * This class describes methods for supporting interaction with the user.
- */
-public interface UserInteraction {
-
- /**
- * Type of message displayed to the user. The type of message
- * may affect the presentation of the interaction.
- */
- public enum MessageType {
-
- /** A message with no context. */
- PLAIN,
-
- /** A message displayed as a result of an error. */
- ERROR,
-
- /** A message displayed informing the user of something. */
- INFORMATION,
-
- /** A message displayed to warn the user. */
- WARNING,
-
- /** A message displayed to ask the user a question. */
- QUESTION
- }
-
- /**
- * Present a list of choices to the user and wait for them to select one
- * of them.
- * @param summary text to present to the user. This is usually just a
- * string bug For GUI applications can be a component that will appear
- * inside a dialog
- * @param detail more details of the message
- * @param title of the prompt if any
- * @param type of message
- * @param options set of options to give the user
- * @param def the default option from <code>options</code>
- * @return Object that is the same value as the user selection from the
- * <code>options</code> parameter.
- */
- Object confirm(LocalizableMessage summary, LocalizableMessage detail,
- LocalizableMessage title, MessageType type,
- LocalizableMessage[] options, LocalizableMessage def);
-
- /**
- * Present a list of choices to the user and wait for them to select one
- * of them.
- * @param summary text to present to the user. This is usually just a
- * string bug For GUI applications can be a component that will appear
- * inside a dialog
- * @param detail more details of the message
- * @param fineDetails even finer details. This text may be rendered in
- * such a way that the user needs to take some sort of action to
- * see this text
- * @param title of the prompt if any
- * @param type of message
- * @param options set of options to give the user
- * @param def the default option from <code>options</code>
- * @param viewDetailsOption name of the option to be used for showing the
- * details. If null a default will be used.
- * @return Object that is the same value as the user selection from the
- * <code>options</code> parameter.
- */
- Object confirm(LocalizableMessage summary, LocalizableMessage detail, LocalizableMessage fineDetails,
- LocalizableMessage title, MessageType type, LocalizableMessage[] options,
- LocalizableMessage def, LocalizableMessage viewDetailsOption);
-
- /**
- * Creates a list appropriate for the presentation implementation.
- *
- * @param list to format
- * @return String representing the list
- */
- String createUnorderedList(List<?> list);
-
- /**
- * Tells whether the interaction is command-line based.
- * @return <CODE>true</CODE> if the user interaction is command-line based and
- * <CODE>false</CODE> otherwise.
- */
- boolean isCLI();
-
- /**
- * Indicates whether or not the CLI based user has requested to continue when
- * a non critical error occurs.
- *
- * @return boolean where true indicates to continue if there is a non critical
- * error.
- */
- boolean isForceOnError();
-
- /**
- * Indicates whether or not the CLI user has requested interactive behavior.
- *
- * @return <code>true</code> if the CLI user has requested interactive
- * behavior.
- */
- boolean isInteractive();
-
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/SortableTableModel.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/SortableTableModel.java
deleted file mode 100644
index 65ca2f1..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/SortableTableModel.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
- */
-
-package org.opends.quicksetup.ui;
-
-import javax.swing.table.TableModel;
-
-/**
- * A generic interface that must implement table models that are sortable.
- */
-public interface SortableTableModel extends TableModel
-{
- /**
- * Returns whether the sort is ascending or descending.
- * @return <CODE>true</CODE> if the sort is ascending and <CODE>false</CODE>
- * otherwise.
- */
- boolean isSortAscending();
-
- /**
- * Sets whether to sort ascending of descending.
- * @param sortAscending whether to sort ascending or descending.
- */
- void setSortAscending(boolean sortAscending);
-
- /**
- * Returns the column index used to sort.
- * @return the column index used to sort.
- */
- int getSortColumn();
-
- /**
- * Sets the column index used to sort.
- * @param sortColumn column index used to sort..
- */
- void setSortColumn(int sortColumn);
-
- /**
- * Updates the table model contents and sorts its contents depending on the
- * sort options set by the user.
- */
- void forceResort();
-}
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 ed646bb..757e1a0 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
@@ -78,10 +78,7 @@
{
/** Node DN. */
DN dn;
- /**
- * Storage object or null if this node exist
- * only to support the DIT like structuring.
- */
+ /** Storage object or null if this node exist only to support the DIT like structuring. */
T element;
/** Parent. */
Node<T> parent;
@@ -92,18 +89,10 @@
/** Previous sibling. */
Node<T> previous;
- /** {@inheritDoc} */
@Override
public String toString()
{
- if (element != null)
- {
- return "node(" + element + ")";
- }
- else
- {
- return "glue";
- }
+ return element != null ? "node(" + element + ")" : "glue";
}
}
@@ -118,38 +107,24 @@
{
}
- /**
- * Constructs a new DITCacheMap from a given Map.
- * @param m existing Map to construct new
- * DITCacheMap from.
- */
- public DITCacheMap(Map<? extends DN, ? extends T> m)
- {
- this.putAll(m);
- }
-
- /** {@inheritDoc} */
@Override
public int size()
{
return size;
}
- /** {@inheritDoc} */
@Override
public boolean isEmpty()
{
return ditCacheMap.isEmpty();
}
- /** {@inheritDoc} */
@Override
public boolean containsKey(Object key)
{
return get(key) != null;
}
- /** {@inheritDoc} */
@Override
public boolean containsValue(Object value)
{
@@ -163,7 +138,6 @@
return false;
}
- /** {@inheritDoc} */
@Override
public T get(Object key)
{
@@ -181,7 +155,6 @@
return new DITSubtreeSet(key);
}
- /** {@inheritDoc} */
@Override
public T put(DN key, T value)
{
@@ -248,7 +221,6 @@
return null;
}
- /** {@inheritDoc} */
@Override
public T remove(Object key)
{
@@ -280,8 +252,6 @@
return returnValue;
}
-
-
/**
* Remove references to a node after it has been removed.
* @param node The node which has just been removed.
@@ -344,8 +314,6 @@
}
}
-
-
/**
* Returns {@code true} if there are stored objects subordinate to subtree DN.
* @param key subtree DN.
@@ -356,8 +324,6 @@
return ditCacheMap.containsKey(key);
}
-
-
/**
* Removes a set of stored objects subordinate to subtree DN.
* @param key subtree DN.
@@ -380,8 +346,6 @@
return false;
}
-
-
/**
* Iterate through detached subtree counting and collecting any elements.
*
@@ -422,9 +386,6 @@
ditCacheMap.remove(node.dn);
}
-
-
- /** {@inheritDoc} */
@Override
public void putAll(Map<? extends DN, ? extends T> m)
{
@@ -434,7 +395,6 @@
}
}
- /** {@inheritDoc} */
@Override
public void clear()
{
@@ -442,7 +402,6 @@
size = 0;
}
- /** {@inheritDoc} */
@Override
public Set<Entry<DN, T>> entrySet()
{
@@ -469,7 +428,6 @@
hasNext = false;
}
- /** {@inheritDoc} */
@Override
public boolean hasNext()
{
@@ -492,7 +450,6 @@
return false;
}
- /** {@inheritDoc} */
@Override
public Entry<DN, T> next()
{
@@ -518,7 +475,6 @@
throw new NoSuchElementException();
}
- /** {@inheritDoc} */
@Override
public void remove()
{
@@ -557,14 +513,12 @@
}
}
- /** {@inheritDoc} */
@Override
public int size()
{
return DITCacheMap.this.size();
}
- /** {@inheritDoc} */
@Override
public Iterator<Entry<DN, T>> iterator()
{
@@ -590,21 +544,18 @@
this.value = value;
}
- /** {@inheritDoc} */
@Override
public DN getKey()
{
return key;
}
- /** {@inheritDoc} */
@Override
public T getValue()
{
return value;
}
- /** {@inheritDoc} */
@Override
public T setValue(T value)
{
@@ -751,7 +702,7 @@
@Override
public boolean isEmpty()
{
- return !(new SubtreeSetIterator(this.key).hasNext());
+ return !new SubtreeSetIterator(this.key).hasNext();
}
@Override
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java
index 2a40bd8..bc9fd69 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java
@@ -28,14 +28,18 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.api.ClientConnection;
import org.opends.server.api.Group;
import org.opends.server.controls.GetEffectiveRightsRequestControl;
import org.opends.server.core.AddOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.protocols.ldap.LDAPClientConnection;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.opends.server.types.*;
+import org.opends.server.types.AuthenticationInfo;
+import org.opends.server.types.AuthenticationType;
+import org.opends.server.types.DirectoryException;
+import org.opends.server.types.Entry;
+import org.opends.server.types.Operation;
/**
* The AciContainer class contains all of the needed information to perform
@@ -43,29 +47,15 @@
* of testing if an ACI is applicable to an operation, and evaluation is
* the actual access evaluation of the ACI.
*/
-public abstract class AciContainer
-implements AciTargetMatchContext, AciEvalContext {
-
- /**
- * The allow and deny lists.
- */
+abstract class AciContainer implements AciTargetMatchContext, AciEvalContext {
+ /** The allow and deny lists. */
private List<Aci> denyList, allowList;
- /**
- * The attribute type in the resource entry currently being evaluated.
- */
+ /** The attribute type in the resource entry currently being evaluated. */
private AttributeType attributeType;
-
- /**
- * The attribute type value in the resource entry currently being
- * evaluated.
- */
+ /** The attribute type value in the resource entry currently being evaluated. */
private ByteString attributeValue;
-
- /**
- * True if this is the first attribute type in the resource entry being
- * evaluated.
- */
+ /** True if this is the first attribute type in the resource entry being evaluated. */
private boolean isFirst;
/**
@@ -74,29 +64,18 @@
*/
private boolean isEntryTestRule;
- /**
- * The right mask to use in the evaluation of the LDAP operation.
- */
+ /** The right mask to use in the evaluation of the LDAP operation. */
private int rightsMask;
- /**
- * The entry being evaluated (resource entry).
- */
- private Entry resourceEntry;
+ /** The entry being evaluated (resource entry). */
+ private final Entry resourceEntry;
- /**
- * The client connection information.
- */
+ /** The client connection information. */
private final ClientConnection clientConnection;
-
- /**
- * The operation being evaluated.
- */
+ /** The operation being evaluated. */
private final Operation operation;
- /**
- * True if a targattrfilters match was found.
- */
+ /** True if a targattrfilters match was found. */
private boolean targAttrFiltersMatch;
/**
@@ -107,12 +86,10 @@
* switched back for non-proxy access checking. If proxied authentication
* is not being used then this entry never changes.
*/
- private Entry authorizationEntry;
+ private final Entry authorizationEntry;
- /**
- * True if proxied authorization is being used.
- */
- private boolean proxiedAuthorization;
+ /** True if proxied authorization is being used. */
+ private final boolean proxiedAuthorization;
/**
* Used by proxied authorization processing. True if the entry has already
@@ -122,20 +99,12 @@
*/
private boolean seenEntry;
- /**
- * True if geteffectiverights evaluation is in progress.
- */
+ /** True if geteffectiverights evaluation is in progress. */
private boolean isGetEffectiveRightsEval;
-
- /**
- * True if the operation has a geteffectiverights control.
- */
- private boolean hasGetEffectiveRightsControl;
-
- /**
- * The geteffectiverights authzID in DN format.
- */
- private DN authzid;
+ /** True if the operation has a geteffectiverights control. */
+ private final boolean hasGetEffectiveRightsControl;
+ /** The geteffectiverights authzID in DN format. */
+ private final DN authzid;
/**
* True if the authZid should be used as the client DN, only used in
@@ -147,7 +116,7 @@
* The list of specific attributes to get rights for, in addition to
* any attributes requested in the search.
*/
- private List<AttributeType> specificAttrs;
+ private final List<AttributeType> specificAttrs;
/**
* Table of ACIs that have targattrfilter keywords that matched. Used
@@ -169,10 +138,7 @@
*/
private int targAttrMatch;
- /**
- * The ACI that decided the last evaluation. Used in geteffectiverights
- * loginfo processing.
- */
+ /** The ACI that decided the last evaluation. Used in geteffectiverights loginfo processing. */
private Aci decidingAci;
/**
@@ -188,25 +154,16 @@
*/
private String summaryString;
- /**
- * Flag used to determine if ACI all attributes target matched.
- */
+ /** Flag used to determine if ACI all attributes target matched. */
private int evalAllAttributes;
- /**
- * String used to hold a control OID string.
- */
+ /** String used to hold a control OID string. */
private String controlOID;
-
- /**
- * String used to hold an extended operation OID string.
- */
+ /** String used to hold an extended operation OID string. */
private String extOpOID;
- /**
- * AuthenticationInfo class to use.
- */
- private AuthenticationInfo authInfo;
+ /** AuthenticationInfo class to use. */
+ private final AuthenticationInfo authInfo;
/**
* This constructor is used by all currently supported LDAP operations
@@ -248,12 +205,13 @@
&& operation instanceof SearchOperation)
{
hasGetEffectiveRightsControl = true;
- if (getEffectiveRightsControl.getAuthzDN() == null) {
- this.authzid = getClientDN();
- } else {
- this.authzid = getEffectiveRightsControl.getAuthzDN();
- }
+ DN authzDN = getEffectiveRightsControl.getAuthzDN();
+ this.authzid = authzDN != null ? authzDN : getClientDN();
this.specificAttrs = getEffectiveRightsControl.getAttributes();
+ } else {
+ hasGetEffectiveRightsControl = false;
+ authzid = null;
+ specificAttrs = null;
}
//If an ACI evaluated because of an Targetattr="*", then the
@@ -273,6 +231,10 @@
{
evalAllAttributes |= ACI_OP_ATTR_PLUS_MATCHED;
}
+ } else {
+ hasGetEffectiveRightsControl = false;
+ authzid = null;
+ specificAttrs = null;
}
//Reference the current authorization entry, so it can be put back
@@ -297,7 +259,12 @@
this.authInfo = authInfo;
this.authorizationEntry = authInfo.getAuthorizationEntry();
this.rightsMask = rights;
+ proxiedAuthorization = false;
+ hasGetEffectiveRightsControl = false;
+ authzid = null;
+ specificAttrs = null;
}
+
/**
* Returns true if an entry has already been processed by an access proxy
* check.
@@ -310,8 +277,7 @@
}
/**
- * Set to true if an entry has already been processed by an access proxy
- * check.
+ * Set to true if an entry has already been processed by an access proxy check.
*
* @param val The value to set the seenEntry boolean to.
*/
@@ -319,13 +285,11 @@
this.seenEntry=val;
}
- /** {@inheritDoc} */
@Override
public boolean isProxiedAuthorization() {
return this.proxiedAuthorization;
}
- /** {@inheritDoc} */
@Override
public boolean isGetEffectiveRightsEval() {
return this.isGetEffectiveRightsEval;
@@ -371,19 +335,16 @@
return this.specificAttrs;
}
- /** {@inheritDoc} */
@Override
public void addTargAttrFiltersMatchAci(Aci aci) {
this.targAttrFilterAcis.put(aci, aci);
}
- /** {@inheritDoc} */
@Override
public boolean hasTargAttrFiltersMatchAci(Aci aci) {
return this.targAttrFilterAcis.containsKey(aci);
}
- /** {@inheritDoc} */
@Override
public boolean isTargAttrFilterMatchAciEmpty() {
return this.targAttrFilterAcis.isEmpty();
@@ -404,31 +365,26 @@
this.targAttrMatch=0;
}
- /** {@inheritDoc} */
@Override
public void setTargAttrFiltersAciName(String name) {
this.targAttrFiltersAciName=name;
}
- /** {@inheritDoc} */
@Override
public String getTargAttrFiltersAciName() {
return this.targAttrFiltersAciName;
}
- /** {@inheritDoc} */
@Override
public void setTargAttrFiltersMatchOp(int flag) {
this.targAttrMatch |= flag;
}
- /** {@inheritDoc} */
@Override
public boolean hasTargAttrFiltersMatchOp(int flag) {
return (this.targAttrMatch & flag) != 0;
}
- /** {@inheritDoc} */
@Override
public String getDecidingAciName() {
if(this.decidingAci != null) {
@@ -437,7 +393,6 @@
return null;
}
- /** {@inheritDoc} */
@Override
public void setEvaluationResult(EnumEvalReason reason, Aci decidingAci)
{
@@ -445,19 +400,16 @@
this.decidingAci = decidingAci;
}
- /** {@inheritDoc} */
@Override
public EnumEvalReason getEvalReason() {
return this.evalReason;
}
- /** {@inheritDoc} */
@Override
public void setEvalSummary(String summary) {
this.summaryString=summary;
}
- /** {@inheritDoc} */
@Override
public String getEvalSummary() {
return this.summaryString;
@@ -473,104 +425,87 @@
return this.authzid.equals(this.authorizationEntry.getName());
}
- /** {@inheritDoc} */
@Override
public void setDenyList(List<Aci> denys) {
denyList=denys;
}
- /** {@inheritDoc} */
@Override
public void setAllowList(List<Aci> allows) {
allowList=allows;
}
- /** {@inheritDoc} */
@Override
public AttributeType getCurrentAttributeType() {
return attributeType;
}
- /** {@inheritDoc} */
@Override
public ByteString getCurrentAttributeValue() {
return attributeValue;
}
- /** {@inheritDoc} */
@Override
public void setCurrentAttributeType(AttributeType type) {
attributeType=type;
}
- /** {@inheritDoc} */
@Override
public void setCurrentAttributeValue(ByteString value) {
attributeValue=value;
}
- /** {@inheritDoc} */
@Override
public boolean isFirstAttribute() {
return isFirst;
}
- /** {@inheritDoc} */
@Override
public void setIsFirstAttribute(boolean val) {
isFirst=val;
}
- /** {@inheritDoc} */
@Override
public boolean hasEntryTestRule() {
return isEntryTestRule;
}
- /** {@inheritDoc} */
@Override
public void setEntryTestRule(boolean val) {
isEntryTestRule=val;
}
- /** {@inheritDoc} */
@Override
public Entry getResourceEntry() {
return resourceEntry;
}
- /** {@inheritDoc} */
@Override
public Entry getClientEntry() {
return this.authorizationEntry;
}
- /** {@inheritDoc} */
@Override
public List<Aci> getDenyList() {
return denyList;
}
- /** {@inheritDoc} */
@Override
public List<Aci> getAllowList() {
return allowList;
}
- /** {@inheritDoc} */
@Override
public boolean isDenyEval() {
return EnumEvalReason.NO_ALLOW_ACIS.equals(evalReason)
|| EnumEvalReason.EVALUATED_DENY_ACI.equals(evalReason);
}
- /** {@inheritDoc} */
@Override
public boolean isAnonymousUser() {
return !authInfo.isAuthenticated();
}
- /** {@inheritDoc} */
@Override
public DN getClientDN() {
if(this.useAuthzid)
@@ -584,7 +519,6 @@
return DN.rootDN();
}
- /** {@inheritDoc} */
@Override
public DN getResourceDN() {
return resourceEntry.getName();
@@ -602,55 +536,46 @@
return (this.rightsMask & rights) != 0;
}
- /** {@inheritDoc} */
@Override
public int getRights() {
return this.rightsMask;
}
- /** {@inheritDoc} */
@Override
public void setRights(int rights) {
this.rightsMask=rights;
}
- /** {@inheritDoc} */
@Override
public String getHostName() {
return clientConnection.getRemoteAddress().getCanonicalHostName();
}
- /** {@inheritDoc} */
@Override
public InetAddress getRemoteAddress() {
return clientConnection.getRemoteAddress();
}
- /** {@inheritDoc} */
@Override
public boolean isAddOperation() {
return operation instanceof AddOperation;
}
- /** {@inheritDoc} */
@Override
public void setTargAttrFiltersMatch(boolean v) {
this.targAttrFiltersMatch=v;
}
- /** {@inheritDoc} */
@Override
public boolean getTargAttrFiltersMatch() {
return targAttrFiltersMatch;
}
- /** {@inheritDoc} */
@Override
public String getControlOID() {
return controlOID;
}
- /** {@inheritDoc} */
@Override
public String getExtOpOID() {
return extOpOID;
@@ -665,7 +590,6 @@
this.controlOID=oid;
}
-
/**
* Set the extended operation OID value to the specified oid string.
*
@@ -675,7 +599,6 @@
this.extOpOID=oid;
}
- /** {@inheritDoc} */
@Override
public EnumEvalResult hasAuthenticationMethod(EnumAuthMethod authMethod,
String saslMech) {
@@ -724,7 +647,6 @@
return matched;
}
- /** {@inheritDoc} */
@Override
public boolean isMemberOf(Group<?> group) {
try {
@@ -794,7 +716,6 @@
return null;
}
- /** {@inheritDoc} */
@Override
public void setEvalUserAttributes(int v) {
if(rightsMask == ACI_READ) {
@@ -809,7 +730,6 @@
}
}
- /** {@inheritDoc} */
@Override
public void setEvalOpAttributes(int v) {
if(rightsMask == ACI_READ) {
@@ -824,13 +744,11 @@
}
}
- /** {@inheritDoc} */
@Override
public boolean hasEvalUserAttributes() {
return hasAttribute(ACI_FOUND_USER_ATTR_RULE);
}
- /** {@inheritDoc} */
@Override
public boolean hasEvalOpAttributes() {
return hasAttribute(ACI_FOUND_OP_ATTR_RULE);
@@ -861,7 +779,6 @@
return (evalAllAttributes & aciAttribute) == aciAttribute;
}
- /** {@inheritDoc} */
@Override
public void clearEvalAttributes(int v) {
if(v == 0)
@@ -874,13 +791,11 @@
}
}
- /** {@inheritDoc} */
@Override
public int getCurrentSSF() {
return clientConnection.getSSF();
}
- /** {@inheritDoc} */
@Override
public String toString()
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java
index fd12753..2f3d200 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/ConfigurableEnvironment.java
@@ -17,6 +17,7 @@
package org.opends.server.backends.jeb;
import static com.sleepycat.je.EnvironmentConfig.*;
+
import static org.opends.messages.BackendMessages.*;
import static org.opends.messages.ConfigMessages.*;
@@ -54,7 +55,7 @@
import com.sleepycat.je.dbi.MemoryBudget;
/** This class maps JE properties to configuration attributes. */
-public class ConfigurableEnvironment
+class ConfigurableEnvironment
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -62,136 +63,107 @@
* The name of the attribute which configures the database cache size as a
* percentage of Java VM heap size.
*/
- public static final String ATTR_DATABASE_CACHE_PERCENT =
+ private static final String ATTR_DATABASE_CACHE_PERCENT =
ConfigConstants.NAME_PREFIX_CFG + "db-cache-percent";
/**
* The name of the attribute which configures the database cache size as an
* approximate number of bytes.
*/
- public static final String ATTR_DATABASE_CACHE_SIZE =
+ private static final String ATTR_DATABASE_CACHE_SIZE =
ConfigConstants.NAME_PREFIX_CFG + "db-cache-size";
/**
- * The name of the attribute which configures whether data updated by a
- * database transaction is forced to disk.
- */
- public static final String ATTR_DATABASE_TXN_NO_SYNC =
- ConfigConstants.NAME_PREFIX_CFG + "db-txn-no-sync";
-
- /**
- * The name of the attribute which configures whether data updated by a
- * database transaction is written from the Java VM to the O/S.
- */
- public static final String ATTR_DATABASE_TXN_WRITE_NO_SYNC =
- ConfigConstants.NAME_PREFIX_CFG + "db-txn-write-no-sync";
-
- /**
* The name of the attribute which configures whether the database background
* cleaner thread runs.
*/
- public static final String ATTR_DATABASE_RUN_CLEANER =
+ private static final String ATTR_DATABASE_RUN_CLEANER =
ConfigConstants.NAME_PREFIX_CFG + "db-run-cleaner";
/**
* The name of the attribute which configures the minimum percentage of log
* space that must be used in log files.
*/
- public static final String ATTR_CLEANER_MIN_UTILIZATION =
+ private static final String ATTR_CLEANER_MIN_UTILIZATION =
ConfigConstants.NAME_PREFIX_CFG + "db-cleaner-min-utilization";
/**
* The name of the attribute which configures the maximum size of each
* individual JE log file, in bytes.
*/
- public static final String ATTR_DATABASE_LOG_FILE_MAX =
+ private static final String ATTR_DATABASE_LOG_FILE_MAX =
ConfigConstants.NAME_PREFIX_CFG + "db-log-file-max";
/** The name of the attribute which configures the database cache eviction algorithm. */
- public static final String ATTR_EVICTOR_LRU_ONLY =
+ private static final String ATTR_EVICTOR_LRU_ONLY =
ConfigConstants.NAME_PREFIX_CFG + "db-evictor-lru-only";
/**
* The name of the attribute which configures the number of nodes in one scan
* of the database cache evictor.
*/
- public static final String ATTR_EVICTOR_NODES_PER_SCAN =
+ private static final String ATTR_EVICTOR_NODES_PER_SCAN =
ConfigConstants.NAME_PREFIX_CFG + "db-evictor-nodes-per-scan";
/**
* The name of the attribute which configures the minimum number of threads
* of the database cache evictor pool.
*/
- public static final String ATTR_EVICTOR_CORE_THREADS =
+ private static final String ATTR_EVICTOR_CORE_THREADS =
ConfigConstants.NAME_PREFIX_CFG + "db-evictor-core-threads";
/**
* The name of the attribute which configures the maximum number of threads
* of the database cache evictor pool.
*/
- public static final String ATTR_EVICTOR_MAX_THREADS =
+ private static final String ATTR_EVICTOR_MAX_THREADS =
ConfigConstants.NAME_PREFIX_CFG + "db-evictor-max-threads";
/**
* The name of the attribute which configures the time excess threads
* of the database cache evictor pool are kept alive.
*/
- public static final String ATTR_EVICTOR_KEEP_ALIVE =
+ private static final String ATTR_EVICTOR_KEEP_ALIVE =
ConfigConstants.NAME_PREFIX_CFG + "db-evictor-keep-alive";
/**
- * The name of the attribute which configures whether the logging file
- * handler will be on or off.
- */
- public static final String ATTR_LOGGING_FILE_HANDLER_ON =
- ConfigConstants.NAME_PREFIX_CFG + "db-logging-file-handler-on";
-
- /** The name of the attribute which configures the trace logging message level. */
- public static final String ATTR_LOGGING_LEVEL =
- ConfigConstants.NAME_PREFIX_CFG + "db-logging-level";
-
- /**
* The name of the attribute which configures how many bytes are written to
* the log before the checkpointer runs.
*/
- public static final String ATTR_CHECKPOINTER_BYTES_INTERVAL =
+ private static final String ATTR_CHECKPOINTER_BYTES_INTERVAL =
ConfigConstants.NAME_PREFIX_CFG + "db-checkpointer-bytes-interval";
/**
* The name of the attribute which configures the amount of time between
* runs of the checkpointer.
*/
- public static final String ATTR_CHECKPOINTER_WAKEUP_INTERVAL =
+ private static final String ATTR_CHECKPOINTER_WAKEUP_INTERVAL =
ConfigConstants.NAME_PREFIX_CFG +
"db-checkpointer-wakeup-interval";
/** The name of the attribute which configures the number of lock tables. */
- public static final String ATTR_NUM_LOCK_TABLES =
+ private static final String ATTR_NUM_LOCK_TABLES =
ConfigConstants.NAME_PREFIX_CFG + "db-num-lock-tables";
/**
* The name of the attribute which configures the number threads
* allocated by the cleaner for log file processing.
*/
- public static final String ATTR_NUM_CLEANER_THREADS =
+ private static final String ATTR_NUM_CLEANER_THREADS =
ConfigConstants.NAME_PREFIX_CFG + "db-num-cleaner-threads";
/** The name of the attribute which configures the size of the file handle cache. */
- public static final String ATTR_LOG_FILECACHE_SIZE =
+ private static final String ATTR_LOG_FILECACHE_SIZE =
ConfigConstants.NAME_PREFIX_CFG + "db-log-filecache-size";
- /** The name of the attribute which may specify any native JE properties. */
- public static final String ATTR_JE_PROPERTY =
- ConfigConstants.NAME_PREFIX_CFG + "je-property";
-
/** A map of JE property names to the corresponding configuration attribute. */
- private static HashMap<String, String> attrMap = new HashMap<>();
+ private static final Map<String, String> attrMap = new HashMap<>();
/**
* A map of configuration attribute names to the corresponding configuration object getter method.
*/
- private static Map<String, Method> jebMethodMap = new HashMap<>();
+ private static final Map<String, Method> jebMethodMap = new HashMap<>();
/** A map of configuration attribute names to the corresponding configuration PropertyDefinition. */
- private static Map<String, PropertyDefinition<?>> jebDefnMap = new HashMap<>();
+ private static final Map<String, PropertyDefinition<?>> jebDefnMap = new HashMap<>();
/** Pulled from resource/admin/ABBREVIATIONS.xsl. db is mose common. */
private static final List<String> ABBREVIATIONS = Arrays.asList(new String[]
@@ -252,16 +224,6 @@
}
/**
- * Get the name of the configuration attribute associated with a JE property.
- * @param jeProperty The name of the JE property.
- * @return The name of the associated configuration attribute.
- */
- public static String getAttributeForProperty(String jeProperty)
- {
- return attrMap.get(jeProperty);
- }
-
- /**
* Get the value of a JE property that is mapped to a configuration attribute.
* @param cfg The configuration containing the property values.
* @param attrName The configuration attribute type name.
@@ -358,7 +320,7 @@
*
* @return A JE environment config containing default values.
*/
- public static EnvironmentConfig defaultConfig()
+ private static EnvironmentConfig defaultConfig()
{
EnvironmentConfig envConfig = new EnvironmentConfig();
@@ -408,7 +370,7 @@
* @throws ConfigException If there is an error in the provided configuration
* entry.
*/
- public static EnvironmentConfig parseConfigEntry(JEBackendCfg cfg) throws ConfigException
+ static EnvironmentConfig parseConfigEntry(JEBackendCfg cfg) throws ConfigException
{
validateDbCacheSize(cfg.getDBCacheSize());
@@ -506,8 +468,8 @@
* @throws ConfigException If there is an error while parsing,
* validating and setting any of the properties provided.
*/
- public static EnvironmentConfig setJEProperties(EnvironmentConfig envConfig,
- SortedSet<String> jeProperties, HashMap<String, String> configAttrMap)
+ private static EnvironmentConfig setJEProperties(EnvironmentConfig envConfig,
+ SortedSet<String> jeProperties, Map<String, String> configAttrMap)
throws ConfigException
{
if (jeProperties.isEmpty()) {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/CoreConstants.java b/opendj-server-legacy/src/main/java/org/opends/server/core/CoreConstants.java
deleted file mode 100644
index a9c13df..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/CoreConstants.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- */
-package org.opends.server.core;
-
-
-
-/**
- * This class defines a number of constant values that are used in core
- * Directory Server processing.
- */
-public class CoreConstants
-{
- /**
- * The name of the log element that will be used to hold the authentication
- * type for a bind operation.
- */
- public static final String LOG_ELEMENT_AUTH_TYPE = "authType";
-
-
-
- /**
- * The name of the log element that will be used to hold the base DN for a
- * search operation.
- */
- public static final String LOG_ELEMENT_BASE_DN = "baseDN";
-
-
-
- /**
- * The name of the log element that will be used to hold the bind DN.
- */
- public static final String LOG_ELEMENT_BIND_DN = "bindDN";
-
-
-
- /**
- * The name of the log element that will be used to hold the name of the
- * attribute to compare.
- */
- public static final String LOG_ELEMENT_COMPARE_ATTR = "compareAttribute";
-
-
-
- /**
- * The name of the log element that will be used to connection ID for the
- * client connection that requested the operation.
- */
- public static final String LOG_ELEMENT_CONNECTION_ID = "connID";
-
-
-
- /**
- * The name of the log element that will be used to indicate whether the old
- * RDN attribute value should be removed from an entry.
- */
- public static final String LOG_ELEMENT_DELETE_OLD_RDN = "deleteOldRDN";
-
-
-
- /**
- * The name of the log element that will be used to hold the number of entries
- * returned to the client for a search operation.
- */
- public static final String LOG_ELEMENT_ENTRIES_SENT = "entriesSent";
-
-
-
- /**
- * The name of the log element that will be used to hold the DN of an entry
- * targeted by an operation.
- */
- public static final String LOG_ELEMENT_ENTRY_DN = "entryDN";
-
-
-
- /**
- * The name of the log element that will be used to hold the error message for
- * an operation.
- */
- public static final String LOG_ELEMENT_ERROR_MESSAGE = "errorMessage";
-
-
-
- /**
- * The name of the log element that will be used to hold the request OID for
- * an extended operation.
- */
- public static final String LOG_ELEMENT_EXTENDED_REQUEST_OID = "requestOID";
-
-
-
- /**
- * The name of the log element that will be used to hold the response OID for
- * an extended operation.
- */
- public static final String LOG_ELEMENT_EXTENDED_RESPONSE_OID = "responseOID";
-
-
-
- /**
- * The name of the log element that will be used to hold the filter for a
- * search operation.
- */
- public static final String LOG_ELEMENT_FILTER = "filter";
-
-
-
- /**
- * The name of the log element that will be used to hold the message ID of an
- * operation to abandon.
- */
- public static final String LOG_ELEMENT_ID_TO_ABANDON = "idToAbandon";
-
-
-
- /**
- * The name of the log element that will be used to hold the matched DN for
- * an operation.
- */
- public static final String LOG_ELEMENT_MATCHED_DN = "matchedDN";
-
-
-
- /**
- * The name of the log element that will be used to message ID for an
- * operation.
- */
- public static final String LOG_ELEMENT_MESSAGE_ID = "messageID";
-
-
-
- /**
- * The name of the log element that will be used to hold the new RDN for a
- * modify DN operation.
- */
- public static final String LOG_ELEMENT_NEW_RDN = "newRDN";
-
-
-
- /**
- * The name of the log element that will be used to hold the new superior DN
- * for a modify DN operation.
- */
- public static final String LOG_ELEMENT_NEW_SUPERIOR = "newSuperior";
-
-
-
- /**
- * The name of the log element that will be used to operation ID for an
- * operation.
- */
- public static final String LOG_ELEMENT_OPERATION_ID = "opID";
-
-
-
- /**
- * The name of the log element that will be used to hold the length of time
- * spent processing an operation.
- */
- public static final String LOG_ELEMENT_PROCESSING_TIME = "processingTime";
-
-
-
- /**
- * The name of the log element that will be used to hold the number of search
- * references returned to the client for a search operation.
- */
- public static final String LOG_ELEMENT_REFERENCES_SENT = "referencesSent";
-
-
-
- /**
- * The name of the log element that will be used to hold the referral URLs for
- * an operation.
- */
- public static final String LOG_ELEMENT_REFERRAL_URLS = "referralURLs";
-
-
-
- /**
- * The name of the log element that will be used to hold the requested
- * attributes for a search operation.
- */
- public static final String LOG_ELEMENT_REQUESTED_ATTRIBUTES = "attributes";
-
-
-
- /**
- * The name of the log element that will be used to hold the result code for
- * an operation.
- */
- public static final String LOG_ELEMENT_RESULT_CODE = "resultCode";
-
-
-
- /**
- * The name of the log element that will be used to hold the SASL mechanism
- * for a bind operation.
- */
- public static final String LOG_ELEMENT_SASL_MECHANISM = "saslMechanism";
-
-
-
- /**
- * The name of the log element that will be used to hold the scope for a
- * search operation.
- */
- public static final String LOG_ELEMENT_SCOPE = "scope";
-
-
-
- /**
- * The name of the log element that will be used to hold the size limit for a
- * search operation.
- */
- public static final String LOG_ELEMENT_SIZE_LIMIT = "sizeLimit";
-
-
-
- /**
- * The name of the log element that will be used to hold the time limit for a
- * search operation.
- */
- public static final String LOG_ELEMENT_TIME_LIMIT = "timeLimit";
-}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/ActionType.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/ActionType.java
deleted file mode 100644
index 37ceb8d..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/ActionType.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2016 ForgeRock AS.
- */
-package org.opends.server.loggers;
-
-/** This enumeration defines the post rotation actions possible. */
-enum ActionType
-{
- /**
- * The action type that indicates the rotated file should be compressed using
- * the gzip mechanism.
- */
- GZIP_COMPRESS("GZIP COMPRESSION"),
- /**
- * The action type that indicates the rotated file should be compressed using
- * the zip mechanism.
- */
- ZIP_COMPRESS("ZIP COMPRESSION"),
- /** The action type that indicates the rotated file should be encrypted. */
- ENCRYPT("ENCRYPT"),
- /** The action type that indicates the rotated file should be digitally signed. */
- SIGN("SIGN"),
- /** An invalid rotation action type. */
- INVALID("INVALID");
-
-
- private String action;
-
- /**
- * Creates the action type.
- *
- * @param action The action.
- */
- private ActionType(String action)
- {
- this.action = action;
- }
-
- @Override
- public String toString()
- {
- return action;
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/LogFileFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/LogFileFilter.java
deleted file mode 100644
index 9a83255..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/LogFileFilter.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2016 ForgeRock AS.
- */
-package org.opends.server.loggers;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-
-/** This class defines a filename filter that will be used for log files. */
-class LogFileFilter implements FilenameFilter
-{
- private String prefix;
-
- /**
- * Create the filter with the specified file name prefix.
- *
- * @param prefix The filename prefix to use for the filter.
- */
- public LogFileFilter(String prefix)
- {
- this.prefix = prefix;
- }
-
- /**
- * Select only files that begin with the specified prefix.
- *
- * @param dir The directory to search.
- * @param name The filename to which to apply the filter.
- *
- * @return <CODE>true</CODE> if the given filename matches the filter, or
- * <CODE>false</CODE> if it does not.
- */
- @Override
- public boolean accept(File dir, String name)
- {
- if(new File(dir, name).isDirectory())
- {
- return false;
- }
- name = name.toLowerCase();
- return name.startsWith(prefix);
- }
-
-}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/LoggerAlarmHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/LoggerAlarmHandler.java
deleted file mode 100644
index efb4a34..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/LoggerAlarmHandler.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
- */
-package org.opends.server.loggers;
-
-import java.util.ArrayList;
-
-/**
- * This interface describes the handler that is invoked when the logger
- * thread generates an alarm based on a rotation policy condition being met.
- */
-interface LoggerAlarmHandler
-{
-
- /**
- * Flush the underlying stream.
- */
- void flush();
-
- /**
- * Action to take when the logger thread generates an alarm based
- * on the rotation policy condition being met.
- */
- void rollover();
-
-
- /**
- * This method sets the actions that need to be executed after rotation.
- *
- * @param actions An array of actions that need to be executed on rotation.
- */
- void setPostRotationActions(ArrayList<ActionType> actions);
-
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/MultifileTextWriter.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/MultifileTextWriter.java
index f9dad7c..7fb0743 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/MultifileTextWriter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/MultifileTextWriter.java
@@ -25,19 +25,18 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.server.SizeLimitLogRotationPolicyCfg;
import org.opends.server.api.DirectoryThread;
import org.opends.server.api.ServerShutdownListener;
import org.opends.server.core.DirectoryServer;
-import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.FilePermission;
import org.opends.server.util.TimeThread;
@@ -60,17 +59,15 @@
private static final String UTF8_ENCODING= "UTF-8";
- private CopyOnWriteArrayList<RotationPolicy> rotationPolicies = new CopyOnWriteArrayList<>();
- private CopyOnWriteArrayList<RetentionPolicy> retentionPolicies = new CopyOnWriteArrayList<>();
+ private final CopyOnWriteArrayList<RotationPolicy<?>> rotationPolicies = new CopyOnWriteArrayList<>();
+ private final CopyOnWriteArrayList<RetentionPolicy<?>> retentionPolicies = new CopyOnWriteArrayList<>();
private FileNamingPolicy namingPolicy;
private FilePermission filePermissions;
- private LogPublisherErrorHandler errorHandler;
- /** TODO: Implement actions. */
- private ArrayList<ActionType> actions;
+ private final LogPublisherErrorHandler errorHandler;
- private String name;
- private String encoding;
+ private final String name;
+ private final String encoding;
private int bufferSize;
private boolean autoFlush;
private boolean append;
@@ -78,7 +75,7 @@
private boolean stopRequested;
private long sizeLimit;
- private Thread rotaterThread;
+ private final Thread rotaterThread;
private Calendar lastRotationTime = TimeThread.getCalendar();
private Calendar lastCleanTime = TimeThread.getCalendar();
@@ -202,7 +199,7 @@
*
* @param policy The rotation policy to add.
*/
- public void addRotationPolicy(RotationPolicy policy)
+ public void addRotationPolicy(RotationPolicy<?> policy)
{
this.rotationPolicies.add(policy);
@@ -224,7 +221,7 @@
*
* @param policy The retention policy to add.
*/
- public void addRetentionPolicy(RetentionPolicy policy)
+ public void addRetentionPolicy(RetentionPolicy<?> policy)
{
this.retentionPolicies.add(policy);
}
@@ -232,7 +229,7 @@
/** Removes all the rotation policies currently enforced by this writer. */
public void removeAllRotationPolicies()
{
- for(RotationPolicy policy : rotationPolicies)
+ for (RotationPolicy<?> policy : rotationPolicies)
{
if(policy instanceof SizeBasedRotationPolicy)
{
@@ -345,7 +342,7 @@
long newSizeLimit = Integer.MAX_VALUE;
// Go through all current size rotation policies and get the lowest size setting.
- for(RotationPolicy policy : rotationPolicies)
+ for (RotationPolicy<?> policy : rotationPolicies)
{
if(policy instanceof SizeBasedRotationPolicy)
{
@@ -371,7 +368,7 @@
private class RotaterThread extends DirectoryThread
{
MultifileTextWriter writer;
- /** Create a new rotater thread. */
+
public RotaterThread(MultifileTextWriter writer)
{
super(name);
@@ -400,7 +397,7 @@
logger.traceException(e);
}
- for(RotationPolicy rotationPolicy : rotationPolicies)
+ for (RotationPolicy<?> rotationPolicy : rotationPolicies)
{
if(rotationPolicy.rotateFile(writer))
{
@@ -408,7 +405,7 @@
}
}
- for(RetentionPolicy retentionPolicy : retentionPolicies)
+ for (RetentionPolicy<?> retentionPolicy : retentionPolicies)
{
try
{
@@ -611,26 +608,11 @@
errorHandler.handleOpenError(currentFile, e);
}
- //RotationActionThread rotThread =
- // new RotationActionThread(newFile, actions, configEntry);
- //rotThread.start();
-
- logger.trace("Log file %s rotated and renamed to %s",
- currentFile, newFile);
+ logger.trace("Log file %s rotated and renamed to %s", currentFile, newFile);
totalFilesRotated++;
lastRotationTime = TimeThread.getCalendar();
}
- /**
- * This method sets the actions that need to be executed after rotation.
- *
- * @param actions An array of actions that need to be executed on rotation.
- */
- public void setPostRotationActions(ArrayList<ActionType> actions)
- {
- this.actions = actions;
- }
-
@Override
public long getBytesWritten()
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/RotationActionThread.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/RotationActionThread.java
deleted file mode 100644
index b14de6f..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/RotationActionThread.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014-2016 ForgeRock AS.
- */
-package org.opends.server.loggers;
-
-import java.util.ArrayList;
-
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.opends.server.api.DirectoryThread;
-import org.opends.server.types.Entry;
-
-/**
- * This thread is spawned off at the time of file rotation to
- * execute specific actions such as compression, encryption,
- * and signing of the log files.
- */
-public class RotationActionThread extends DirectoryThread
-{
- private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
-
- private ArrayList<ActionType> actions;
- private String filename;
- private Entry configEntry;
-
- /**
- * Create the logger thread along with the specified file name,
- * and the rotation actions.
- *
- * @param filename The name of the file to be rotated.
- * @param actions The set of actions that should be performed when the
- * file is rotated.
- * @param configEntry The entry that contains the rotation configuration.
- */
- public RotationActionThread(String filename,
- ArrayList<ActionType> actions,
- Entry configEntry)
- {
- super("Logger Rotation Action Thread");
-
- this.filename = filename;
- this.actions = actions;
- this.configEntry = configEntry;
- }
-
- @Override
- public void run()
- {
- try
- {
- for(ActionType at : actions)
- {
- PostRotationAction action = null;
- switch(at)
- {
- case GZIP_COMPRESS:
- String gzipFile = filename + ".gz";
- action = new GZIPAction(filename, gzipFile, true);
- break;
- case ZIP_COMPRESS:
- String zipFile = filename + ".zip";
- action = new ZIPAction(filename, zipFile, true);
- break;
- case SIGN:
- case ENCRYPT:
- break;
- default:
- System.err.println("Invalid post rollover action:" + at);
- break;
- }
- if(action != null && !action.execute())
- {
- System.err.println("Post rotation action failed.");
- }
- }
- } catch(Exception e)
- {
- logger.traceException(e);
- }
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/NullLDAPMessage.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/NullLDAPMessage.java
deleted file mode 100644
index d9d5f2a..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/NullLDAPMessage.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2008 Sun Microsystems, Inc.
- */
-package org.opends.server.protocols.internal;
-
-
-
-import org.opends.server.protocols.ldap.LDAPMessage;
-import org.opends.server.protocols.ldap.UnbindRequestProtocolOp;
-
-
-
-/**
- * This class provides a special implementation of an LDAP message
- * that will serve as a marker in the internal LDAP input stream
- * message queue that the end of the stream has been reached. It
- * should not be used for any other purpose.
- */
-@org.opends.server.types.PublicAPI(
- stability=org.opends.server.types.StabilityLevel.PRIVATE,
- mayInstantiate=false,
- mayExtend=false,
- mayInvoke=false)
-final class NullLDAPMessage
- extends LDAPMessage
-{
- /**
- * Creates a new null LDAP message.
- */
- NullLDAPMessage()
- {
- super(1, new UnbindRequestProtocolOp());
- }
-}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeOperationComparator.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeOperationComparator.java
deleted file mode 100644
index c472888..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeOperationComparator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2013-2015 ForgeRock AS.
- */
-package org.opends.server.replication.plugin;
-
-import java.util.Comparator;
-
-/**
- * This Class implements a Comparator that can be used to build TreeSet
- * containing FakeOperations sorted by the CSN order.
- */
-public class FakeOperationComparator implements Comparator<FakeOperation>
-{
- /** {@inheritDoc} */
- @Override
- public int compare(FakeOperation op1, FakeOperation op2)
- {
- if (op1 == null)
- {
- return -1;
- }
- return op1.getCSN().compareTo(op2.getCSN());
- }
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
index 120ec0c..6bc8fde 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
@@ -17,15 +17,15 @@
*/
package org.opends.server.tools;
+import static com.forgerock.opendj.cli.Utils.*;
+import static com.forgerock.opendj.util.OperatingSystem.*;
+
import static org.forgerock.util.Utils.*;
import static org.opends.messages.AdminToolMessages.*;
import static org.opends.messages.QuickSetupMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.messages.UtilityMessages.*;
-import static com.forgerock.opendj.cli.Utils.*;
-import static com.forgerock.opendj.util.OperatingSystem.*;
-
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -57,8 +57,8 @@
import org.opends.quicksetup.CurrentInstallStatus;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.LicenseFile;
-import org.opends.quicksetup.TempLogFile;
import org.opends.quicksetup.SecurityOptions;
+import org.opends.quicksetup.TempLogFile;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.UserDataException;
import org.opends.quicksetup.event.ProgressUpdateEvent;
@@ -100,44 +100,26 @@
*/
public class InstallDS extends ConsoleApplication
{
-
private final PlainTextProgressMessageFormatter formatter = new PlainTextProgressMessageFormatter();
- /** Prefix for log files. */
- public static final String TMP_FILE_PREFIX = "opendj-setup-";
-
- /** Suffix for log files. */
- public static final String LOG_FILE_SUFFIX = ".log";
-
- /**
- * The enumeration containing the different return codes that the command-line
- * can have.
- */
+ /** The enumeration containing the different return codes that the command-line can have. */
private enum InstallReturnCode
{
SUCCESSFUL(0),
-
/** We did no have an error but the setup was not executed (displayed version or usage). */
SUCCESSFUL_NOP(0),
-
/** Unexpected error (potential bug). */
ERROR_UNEXPECTED(1),
-
/** Cannot parse arguments or data provided by user is not valid. */
ERROR_USER_DATA(2),
-
/** Error server already installed. */
ERROR_SERVER_ALREADY_INSTALLED(3),
-
/** Error initializing server. */
ERROR_INITIALIZING_SERVER(4),
-
/** The user failed providing password (for the keystore for instance). */
ERROR_PASSWORD_LIMIT(5),
-
/** The user cancelled the setup. */
ERROR_USER_CANCELLED(6),
-
/** The user doesn't accept the license. */
ERROR_LICENSE_NOT_ACCEPTED(7);
@@ -192,7 +174,7 @@
* The maximum number of times that we should ask the user to provide the
* password to access to a keystore.
*/
- public static final int LIMIT_KEYSTORE_PASSWORD_PROMPT = 7;
+ private static final int LIMIT_KEYSTORE_PASSWORD_PROMPT = 7;
private final BackendTypeHelper backendTypeHelper = new BackendTypeHelper();
@@ -1816,7 +1798,7 @@
* the list that will be updated with the nicknames found in the key
* store.
*/
- public static void checkCertificateInKeystore(SecurityOptions.CertificateType type, String path, String pwd,
+ private static void checkCertificateInKeystore(SecurityOptions.CertificateType type, String path, String pwd,
Collection<String> certNicknames, Collection<LocalizableMessage> errorMessages, Collection<String> nicknameList)
{
boolean errorWithPath = false;
@@ -1973,7 +1955,6 @@
private SecurityOptions createSecurityOptionsPrompting(SecurityOptions.CertificateType type, boolean enableSSL,
boolean enableStartTLS, int ldapsPort) throws UserDataException, ClientException
{
- SecurityOptions securityOptions;
String path;
Collection<String> certNicknames = argParser.certNicknameArg.getValues();
String pwd = argParser.getKeyStorePassword();
@@ -2128,7 +2109,7 @@
* to a problem with the key store path and <CODE>false</CODE>
* otherwise.
*/
- public static boolean containsKeyStorePathErrorMessage(Collection<LocalizableMessage> msgs)
+ private static boolean containsKeyStorePathErrorMessage(Collection<LocalizableMessage> msgs)
{
for (final LocalizableMessage msg : msgs)
{
@@ -2159,7 +2140,7 @@
* to a problem with the key store password and <CODE>false</CODE>
* otherwise.
*/
- public static boolean containsKeyStorePasswordErrorMessage(Collection<LocalizableMessage> msgs)
+ private static boolean containsKeyStorePasswordErrorMessage(Collection<LocalizableMessage> msgs)
{
for (final LocalizableMessage msg : msgs)
{
@@ -2189,20 +2170,17 @@
* to a problem with the certificate nickname and <CODE>false</CODE>
* otherwise.
*/
- public static boolean containsCertNicknameErrorMessage(
- Collection<LocalizableMessage> msgs)
+ private static boolean containsCertNicknameErrorMessage(Collection<LocalizableMessage> msgs)
{
- boolean found = false;
for (final LocalizableMessage msg : msgs)
{
if (StaticUtils.hasDescriptor(msg, ERR_INSTALLDS_CERTNICKNAME_NOT_FOUND) ||
StaticUtils.hasDescriptor(msg, ERR_INSTALLDS_MUST_PROVIDE_CERTNICKNAME))
{
- found = true;
- break;
+ return true;
}
}
- return found;
+ return false;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTask.java
index 6beee57..b3fca8e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTask.java
@@ -11,45 +11,15 @@
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyright [year] [name of copyright owner]".
*
- * Copyright 2013-2015 ForgeRock AS.
+ * Copyright 2013-2016 ForgeRock AS.
*/
-
package org.opends.server.tools.upgrade;
import com.forgerock.opendj.cli.ClientException;
-/**
- * An upgrade task.
- */
-public interface UpgradeTask
+/** An upgrade task. */
+interface UpgradeTask
{
-
- /**
- * Defines the different types of upgrade tasks.
- */
- public enum TaskType {
- /**
- * Defines a standard task.
- */
- NORMAL,
- /**
- * Defines a task which require a standard user interaction.
- */
- NEED_USER_INTERACTION,
- /**
- * Defines a critical task which require an imperative user interaction.
- */
- MANDATORY_USER_INTERACTION,
- /**
- * Defines a task which take a long time to complete.
- */
- TAKE_LONG_TIME_TO_COMPLETE,
- /**
- * Defines a task which cannot be reverted once started.
- */
- CANNOT_BE_REVERTED
- }
-
/**
* Performs any preparation work required before performing the upgrade task, including
* interacting with the user where needed (e.g. in order to ask for confirmation), and throw a
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/LockType.java b/opendj-server-legacy/src/main/java/org/opends/server/types/LockType.java
deleted file mode 100644
index 4154105..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/LockType.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015-2016 ForgeRock AS.
- */
-package org.opends.server.types;
-
-
-
-/**
- * This enumeration defines a set of lock types that can be used when
- * requesting that a lock be obtained for an entry or some other
- * object.
- */
-@org.opends.server.types.PublicAPI(
- stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
- mayInstantiate=false,
- mayExtend=false,
- mayInvoke=true)
-public enum LockType
-{
- /** The lock type that indicates that a read lock should be obtained for the associated object. */
- READ("Read"),
-
-
-
- /** The lock type that indicates that a write lock should be obtained for the associated object. */
- WRITE("Write"),
-
-
-
- /** The lock type that indicates that no lock should be obtained for the associated object. */
- NONE("None");
-
-
-
- /** The human-readable name for this lock type. */
- private String name;
-
-
-
- /**
- * Creates a new lock type element with the provided name.
- *
- * @param name The name of the lock type element to create.
- */
- private LockType(String name)
- {
- this.name = name;
- }
-
-
-
- /**
- * Retrieves the name of this lock type element.
- *
- * @return The name of this lock type element.
- */
- public String getName()
- {
- return name;
- }
-
-
-
- /**
- * Retrieves a string representation of this lock type element.
- *
- * @return A string representation of this lock type element.
- */
- @Override
- public String toString()
- {
- return name;
- }
-}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SmallMap.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SmallMap.java
deleted file mode 100644
index 3ab3398..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SmallMap.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2014-2015 ForgeRock AS.
- */
-package org.opends.server.types;
-
-import java.util.*;
-
-/**
- * A small map of values. This map implementation is optimized to use as little
- * memory as possible in the case where there zero or one elements. In addition,
- * any normalization of entries is delayed until the second entry is added
- * (normalization may be triggered by invoking {@link Object#hashCode()} or
- * {@link Object#equals(Object)}.
- * <p>
- * Null keys are not supported by this map.
- *
- * @param <K>
- * the type of keys maintained by this map
- * @param <V>
- * the type of mapped values
- */
-public class SmallMap<K, V> extends AbstractMap<K, V>
-{
-
- /** The map of entries if there are more than one. */
- private LinkedHashMap<K, V> entries;
-
- /** The first key of the Map. */
- private K firstKey;
- /** The first value of the Map. */
- private V firstValue;
-
-
- /** Creates a new small map which is initially empty. */
- public SmallMap()
- {
- // No implementation required.
- }
-
- private void rejectIfNull(Object key)
- {
- if (key == null)
- {
- throw new NullPointerException("null keys are not allowed");
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public V get(Object key)
- {
- rejectIfNull(key);
- if (entries != null)
- { // >= 2 entries case
- return entries.get(key);
- }
- // 0 and 1 case
- if (firstKey != null && firstKey.equals(key))
- {
- return firstValue;
- }
- return null;
- }
-
- /** {@inheritDoc} */
- @Override
- public V put(K key, V value)
- {
- rejectIfNull(key);
- if (entries != null)
- { // >= 2 entries case
- return entries.put(key, value);
- }
- if (firstKey == null)
- { // 0 entries case
- firstKey = key;
- firstValue = value;
- return null;
- }
- // 1 entry case
- if (firstKey.equals(key))
- { // replace value
- V oldValue = firstValue;
- firstValue = value;
- return oldValue;
- }
- // overflow to the underlying map
- entries = new LinkedHashMap<>(2);
- entries.put(firstKey, firstValue);
- firstKey = null;
- firstValue = null;
- return entries.put(key, value);
- }
-
- /** {@inheritDoc} */
- @Override
- public void putAll(Map<? extends K, ? extends V> m)
- {
- for (Entry<? extends K, ? extends V> entry : m.entrySet())
- {
- put(entry.getKey(), entry.getValue());
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public V remove(Object key)
- {
- if (entries != null)
- {
- // Note: if there is one or zero values left we could stop using the map.
- // However, lets assume that if the map was multi-valued before
- // then it may become multi-valued again.
- return entries.remove(key);
- }
-
- if (firstKey != null && firstKey.equals(key))
- {
- V oldV = firstValue;
- firstKey = null;
- firstValue = null;
- return oldV;
- }
- return null;
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean containsKey(Object key)
- {
- rejectIfNull(key);
- if (entries != null)
- {
- return entries.containsKey(key);
- }
- return firstKey != null && firstKey.equals(key);
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean containsValue(Object value)
- {
- if (entries != null)
- {
- return entries.containsValue(value);
- }
- if (firstKey == null)
- {
- return false;
- }
- if (firstValue == null)
- {
- return value == null;
- }
- return firstValue.equals(value);
- }
-
- /** {@inheritDoc} */
- @Override
- public void clear()
- {
- firstKey = null;
- firstValue = null;
- entries = null;
- }
-
- /** {@inheritDoc} */
- @Override
- public int size()
- {
- if (entries != null)
- {
- return entries.size();
- }
- return firstKey != null ? 1 : 0;
- }
-
- /** {@inheritDoc} */
- @Override
- public Set<Entry<K, V>> entrySet()
- {
- if (entries != null)
- {
- return entries.entrySet();
- }
- if (firstKey == null)
- {
- return Collections.emptySet();
- }
-
- return new AbstractSet<Entry<K, V>>()
- {
-
- @Override
- public Iterator<Entry<K, V>> iterator()
- {
- return new Iterator<Entry<K, V>>()
- {
-
- private boolean isFirst = true;
-
- @Override
- public boolean hasNext()
- {
- return isFirst;
- }
-
- @Override
- public Entry<K, V> next()
- {
- if (!isFirst)
- {
- throw new NoSuchElementException();
- }
- isFirst = false;
- return new SimpleEntry<>(firstKey, firstValue);
- }
-
- @Override
- public void remove()
- {
- firstKey = null;
- firstValue = null;
- }
- };
- }
-
- @Override
- public int size()
- {
- return 1;
- }
- };
- }
-
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/ModifyOnceNewConfigFrameworkIsUsed.java b/opendj-server-legacy/src/main/java/org/opends/server/util/ModifyOnceNewConfigFrameworkIsUsed.java
deleted file mode 100644
index 9a7e036..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/ModifyOnceNewConfigFrameworkIsUsed.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2015 ForgeRock AS.
- */
-package org.opends.server.util;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Temporary annotation to remind that annotated code should be modified once
- * the new configuration framework is used in place of legacy one.
- * <p>
- * Failing to modify the code would lead to errors.
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface ModifyOnceNewConfigFrameworkIsUsed
-{
- /** Optional comment on modification. */
- String value() default "";
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/ModifyOnceSDKSchemaIsUsed.java b/opendj-server-legacy/src/main/java/org/opends/server/util/ModifyOnceSDKSchemaIsUsed.java
deleted file mode 100644
index a2069c9..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/ModifyOnceSDKSchemaIsUsed.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2015 ForgeRock AS.
- */
-package org.opends.server.util;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Temporary annotation to remind that annotated code could be modified once the
- * SDK schema is used in place of legacy server schema.
- */
-@Retention(RetentionPolicy.SOURCE)
-public @interface ModifyOnceSDKSchemaIsUsed
-{
- /** Optional comment on modification. */
- String value() default "";
-}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/SizeLimitInputStream.java b/opendj-server-legacy/src/main/java/org/opends/server/util/SizeLimitInputStream.java
deleted file mode 100644
index 17a449d..0000000
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/SizeLimitInputStream.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2015-2016 ForgeRock AS.
- */
-package org.opends.server.util;
-
-import java.io.InputStream;
-import java.io.IOException;
-
-/** An implementation of input stream that enforces an read size limit. */
-public class SizeLimitInputStream extends InputStream
-{
- private int bytesRead;
- private int markBytesRead;
- private int readLimit;
- private InputStream parentStream;
-
- /**
- * Creates a new a new size limit input stream.
- *
- * @param parentStream
- * The parent stream.
- * @param readLimit
- * The size limit.
- */
- public SizeLimitInputStream(InputStream parentStream, int readLimit)
- {
- this.parentStream = parentStream;
- this.readLimit = readLimit;
- }
-
- @Override
- public int available() throws IOException
- {
- int streamAvail = parentStream.available();
- int limitedAvail = readLimit - bytesRead;
- return limitedAvail < streamAvail ? limitedAvail : streamAvail;
- }
-
- @Override
- public synchronized void mark(int readlimit)
- {
- parentStream.mark(readlimit);
- markBytesRead = bytesRead;
- }
-
- @Override
- public int read() throws IOException
- {
- if(bytesRead >= readLimit)
- {
- return -1;
- }
-
- int b = parentStream.read();
- if (b != -1)
- {
- ++bytesRead;
- }
- return b;
- }
-
- @Override
- public int read(byte b[], int off, int len) throws IOException
- {
- if(off < 0 || len < 0 || off+len > b.length)
- {
- throw new IndexOutOfBoundsException();
- }
-
- if(len == 0)
- {
- return 0;
- }
-
- if(bytesRead >= readLimit)
- {
- return -1;
- }
-
- if(bytesRead + len > readLimit)
- {
- len = readLimit - bytesRead;
- }
-
- int readLen = parentStream.read(b, off, len);
- if(readLen > 0)
- {
- bytesRead += readLen;
- }
- return readLen;
- }
-
- @Override
- public synchronized void reset() throws IOException
- {
- parentStream.reset();
- bytesRead = markBytesRead;
- }
-
- @Override
- public long skip(long n) throws IOException
- {
- if(bytesRead + n > readLimit)
- {
- n = readLimit - bytesRead;
- }
-
- bytesRead += n;
- return parentStream.skip(n);
- }
-
- @Override
- public boolean markSupported() {
- return parentStream.markSupported();
- }
-
- @Override
- public void close() throws IOException {
- parentStream.close();
- }
-
- /**
- * Retrieves the number of bytes read from this stream.
- *
- * @return The number of bytes read from this stream.
- */
- public int getBytesRead()
- {
- return bytesRead;
- }
-
- /**
- * Retrieves the size limit of this stream.
- *
- * @return The size limit of this stream.
- */
- public int getSizeLimit()
- {
- return readLimit;
- }
-}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
index 905917e..54a222a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
@@ -24,6 +24,7 @@
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.core.DirectoryServer;
@@ -36,7 +37,6 @@
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.opends.server.types.Attributes;
-import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.Modification;
@@ -1093,8 +1093,7 @@
if (fks.iterator().hasNext())
{
FakeOperation fk = fks.iterator().next();
- assertEquals(new FakeOperationComparator().compare(fk, fk), 0);
- assertTrue(new FakeOperationComparator().compare(null, fk) < 0);
+ assertEquals(fk.getCSN().compareTo(fk.getCSN()), 0);
ReplicationMsg generatedMsg = fk.generateMessage();
if (generatedMsg instanceof LDAPUpdateMsg)
{
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/SmallMapTest.java b/opendj-server-legacy/src/test/java/org/opends/server/types/SmallMapTest.java
deleted file mode 100644
index c72a926..0000000
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/SmallMapTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * The contents of this file are subject to the terms of the Common Development and
- * Distribution License (the License). You may not use this file except in compliance with the
- * License.
- *
- * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
- * specific language governing permission and limitations under the License.
- *
- * When distributing Covered Software, include this CDDL Header Notice in each file and include
- * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
- * Header, with the fields enclosed by brackets [] replaced by your own identifying
- * information: "Portions Copyright [year] [name of copyright owner]".
- *
- * Copyright 2014-2015 ForgeRock AS.
- */
-package org.opends.server.types;
-
-import java.util.*;
-import java.util.Map.Entry;
-
-import org.opends.server.DirectoryServerTestCase;
-import org.testng.annotations.Test;
-
-import static org.assertj.core.api.Assertions.*;
-import static org.testng.Assert.*;
-
-@SuppressWarnings("javadoc")
-public class SmallMapTest extends DirectoryServerTestCase
-{
-
- @Test
- public void testPutAndSize() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- assertEquals(map.size(), 0);
- assertEquals(map.put(1, "one"), null);
- assertEquals(map.size(), 1);
- assertEquals(map.put(1, "ONE"), "one");
- assertEquals(map.size(), 1);
- assertEquals(map.put(2, "two"), null);
- assertEquals(map.size(), 2);
- assertEquals(map.put(3, "three"), null);
- assertEquals(map.size(), 3);
- }
-
- @Test(dependsOnMethods = { "testPutAndSize" })
- public void testGet() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- assertEquals(map.get(1), null);
- assertEquals(map.get(2), null);
- map.put(1, "one");
- assertEquals(map.get(1), "one");
- assertEquals(map.get(2), null);
- map.put(1, "ONE");
- assertEquals(map.get(1), "ONE");
- assertEquals(map.get(2), null);
- map.put(2, "two");
- assertEquals(map.get(1), "ONE");
- assertEquals(map.get(2), "two");
- }
-
- @Test(dependsOnMethods = { "testPutAndSize" })
- public void testPutAll() throws Exception
- {
- final SmallMap<Integer, String> map = new SmallMap<>();
- final HashMap<Integer, String> hashMap = new HashMap<>();
- map.putAll(hashMap);
- assertEquals(map.size(), 0);
- hashMap.put(1, "one");
- map.putAll(hashMap);
- assertEquals(map.size(), 1);
- assertEquals(map.get(1), "one");
- }
-
- @Test(dependsOnMethods = { "testPutAndSize" })
- public void testRemove() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- assertEquals(map.size(), 0);
- assertEquals(map.remove(2), null);
- assertEquals(map.remove(1), null);
-
- map.put(1, "one");
- assertEquals(map.size(), 1);
- assertEquals(map.remove(2), null);
- assertEquals(map.remove(1), "one");
- assertEquals(map.size(), 0);
-
- map.put(1, "one");
- map.put(2, "two");
- assertEquals(map.size(), 2);
- assertEquals(map.remove(1), "one");
- assertEquals(map.size(), 1);
- }
-
- @Test(dependsOnMethods = { "testPutAndSize" })
- public void testContains() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- assertDoesNotContain(map, entry(2, "two"));
-
- map.put(1, null);
- assertContains(map, entry(1, (String) null));
- assertDoesNotContain(map, entry(2, "two"));
-
- map.put(1, "one");
- assertContains(map, entry(1, "one"));
- assertDoesNotContain(map, entry(2, "two"));
-
- map.put(2, "two");
- assertContains(map, entry(1, "one"));
- assertContains(map, entry(2, "two"));
- assertDoesNotContain(map, entry(3, "three"));
- }
-
- @Test(dependsOnMethods = { "testPutAndSize" })
- public void testClear() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- map.clear();
- assertEquals(map.size(), 0);
-
- map.put(1, "one");
- map.clear();
- assertEquals(map.size(), 0);
-
- map.put(1, "one");
- map.put(2, "two");
- map.clear();
- assertEquals(map.size(), 0);
- }
-
- @Test(dependsOnMethods = { "testPutAndSize" })
- public void testEntrySetSize() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- assertEquals(map.entrySet().size(), 0);
-
- map.put(1, "one");
- assertEquals(map.entrySet().size(), 1);
-
- map.put(1, "one");
- map.put(2, "two");
- assertEquals(map.entrySet().size(), 2);
- }
-
- @SuppressWarnings("unchecked")
- @Test(dependsOnMethods = { "testEntrySetSize" })
- public void testEntrySetIterator() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- assertThat(map.entrySet().iterator()).isEmpty();
-
- map.put(1, "one");
- assertThat(map.entrySet().iterator()).containsExactly(
- entry(1, "one"));
-
- map.put(1, "one");
- map.put(2, "two");
- assertThat(map.entrySet().iterator()).containsExactly(
- entry(1, "one"), entry(2, "two"));
- }
-
- @Test(dependsOnMethods = { "testEntrySetIterator" })
- public void testEntrySetIteratorNextRemove() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- map.put(1, "one");
- Iterator<Entry<Integer, String>> iter = map.entrySet().iterator();
- assertTrue(iter.hasNext());
- assertNotNull(iter.next());
- iter.remove();
- assertFalse(iter.hasNext());
-
- assertTrue(map.isEmpty());
- }
-
- @Test(dependsOnMethods = { "testEntrySetIterator" },
- expectedExceptions = { NoSuchElementException.class })
- public void testEntrySetIteratorNextThrowsNoSuchElementException() throws Exception
- {
- SmallMap<Integer, String> map = new SmallMap<>();
- map.put(1, "one");
- Iterator<Entry<Integer, String>> iter = map.entrySet().iterator();
- assertTrue(iter.hasNext());
- iter.next();
- assertFalse(iter.hasNext());
- iter.next(); // throw an exception
- }
-
- private <K, V> Entry<K, V> entry(K key, V value)
- {
- return new AbstractMap.SimpleImmutableEntry<>(key, value);
- }
-
- private void assertContains(SmallMap<Integer, String> map,
- Entry<Integer, String> entry)
- {
- assertContains(map, entry, true);
- }
-
- private void assertDoesNotContain(SmallMap<Integer, String> map,
- Entry<Integer, String> entry)
- {
- assertContains(map, entry, false);
- }
-
- private void assertContains(SmallMap<Integer, String> map,
- Entry<Integer, String> entry, boolean expected)
- {
- assertEquals(map.containsKey(entry.getKey()), expected);
- assertEquals(map.containsValue(entry.getValue()), expected);
- }
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testGetRejectsNull() throws Exception
- {
- new SmallMap<Integer, String>().get(null);
- }
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testContainsKeyRejectsNull() throws Exception
- {
- new SmallMap<Integer, String>().containsKey(null);
- }
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testPutRejectsNull() throws Exception
- {
- new SmallMap<Integer, String>().put(null, null);
- }
-
- @Test(expectedExceptions = { NullPointerException.class })
- public void testPutAllRejectsNull() throws Exception
- {
- final HashMap<Integer, String> map = new HashMap<>();
- map.put(null, null);
- new SmallMap<Integer, String>().putAll(map);
- }
-}
--
Gitblit v1.10.0