From 8cdc460410cbf823ab0fede5d27856331aa3c1cf Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 18 Apr 2016 15:59:21 +0000
Subject: [PATCH] Added generic types
---
opendj-server-legacy/src/main/java/org/opends/server/api/ImportTaskListener.java | 16 ---
opendj-server-legacy/src/main/java/org/opends/server/api/RestoreTaskListener.java | 15 ---
opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java | 17 ++--
opendj-server-legacy/src/test/java/org/opends/server/api/TestTaskListener.java | 71 +++++------------
opendj-server-legacy/src/main/java/org/opends/server/api/ExportTaskListener.java | 16 ---
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java | 67 +++-------------
opendj-server-legacy/src/main/java/org/opends/server/api/BackupTaskListener.java | 15 ---
7 files changed, 53 insertions(+), 164 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/BackupTaskListener.java b/opendj-server-legacy/src/main/java/org/opends/server/api/BackupTaskListener.java
index cb1d577..adb98db 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/BackupTaskListener.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/BackupTaskListener.java
@@ -12,16 +12,12 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
package org.opends.server.api;
-
-
import org.opends.server.types.BackupConfig;
-
-
/**
* This interface defines a set of methods that may be used to notify
* various Directory Server components whenever a backend backup task
@@ -47,10 +43,7 @@
* @param config Configuration information about the backup to be
* performed.
*/
- void processBackupBegin(Backend backend,
- BackupConfig config);
-
-
+ void processBackupBegin(Backend<?> backend, BackupConfig config);
/**
* Performs any processing that might be necessary after the server
@@ -64,7 +57,5 @@
* @param successful Indicates whether the backup operation
* completed successfully.
*/
- void processBackupEnd(Backend backend, BackupConfig config,
- boolean successful);
+ void processBackupEnd(Backend<?> backend, BackupConfig config, boolean successful);
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/ExportTaskListener.java b/opendj-server-legacy/src/main/java/org/opends/server/api/ExportTaskListener.java
index c72701a..7a387dd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/ExportTaskListener.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/ExportTaskListener.java
@@ -12,16 +12,12 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
package org.opends.server.api;
-
-
import org.opends.server.types.LDIFExportConfig;
-
-
/**
* This interface defines a set of methods that may be used to notify
* various Directory Server components whenever an LDIF export task is
@@ -47,10 +43,7 @@
* @param config Configuration information about the LDIF export
* to be performed.
*/
- void processExportBegin(Backend backend,
- LDIFExportConfig config);
-
-
+ void processExportBegin(Backend<?> backend, LDIFExportConfig config);
/**
* Performs any processing that might be necessary after the server
@@ -64,8 +57,5 @@
* @param successful Indicates whether the export operation
* completed successfully.
*/
- void processExportEnd(Backend backend,
- LDIFExportConfig config,
- boolean successful);
+ void processExportEnd(Backend<?> backend, LDIFExportConfig config, boolean successful);
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/ImportTaskListener.java b/opendj-server-legacy/src/main/java/org/opends/server/api/ImportTaskListener.java
index 239e48e..74d7eae 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/ImportTaskListener.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/ImportTaskListener.java
@@ -12,16 +12,12 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
package org.opends.server.api;
-
-
import org.opends.server.types.LDIFImportConfig;
-
-
/**
* This interface defines a set of methods that may be used to notify
* various Directory Server components whenever an LDIF import task is
@@ -46,10 +42,7 @@
* @param config Configuration information about the LDIF import
* to be performed.
*/
- void processImportBegin(Backend backend,
- LDIFImportConfig config);
-
-
+ void processImportBegin(Backend<?> backend, LDIFImportConfig config);
/**
* Performs any processing that might be necessary after the server
@@ -63,8 +56,5 @@
* @param successful Indicates whether the import operation
* completed successfully.
*/
- void processImportEnd(Backend backend,
- LDIFImportConfig config,
- boolean successful);
+ void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful);
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/RestoreTaskListener.java b/opendj-server-legacy/src/main/java/org/opends/server/api/RestoreTaskListener.java
index 79bfa4c..3352f78 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/RestoreTaskListener.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/RestoreTaskListener.java
@@ -12,16 +12,12 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
package org.opends.server.api;
-
-
import org.opends.server.types.RestoreConfig;
-
-
/**
* This interface defines a set of methods that may be used to notify
* various Directory Server components whenever a backend restore task
@@ -46,10 +42,7 @@
* @param config Configuration information about the restore to
* be performed.
*/
- void processRestoreBegin(Backend backend,
- RestoreConfig config);
-
-
+ void processRestoreBegin(Backend<?> backend, RestoreConfig config);
/**
* Performs any processing that might be necessary after the server
@@ -63,7 +56,5 @@
* @param successful Indicates whether the restore operation
* completed successfully.
*/
- void processRestoreEnd(Backend backend, RestoreConfig config,
- boolean successful);
+ void processRestoreEnd(Backend<?> backend, RestoreConfig config, boolean successful);
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
index 79b2f4f..37d4be1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -59,7 +59,6 @@
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.SubEntry;
import org.opends.server.util.SchemaUtils;
-import org.opends.server.util.SchemaUtils.PasswordType;
/**
* This class implements a Directory Server plugin that performs various
@@ -222,7 +221,7 @@
}
@Override
- public void processImportBegin(Backend backend, LDIFImportConfig config)
+ public void processImportBegin(Backend<?> backend, LDIFImportConfig config)
{
// Find the set of attribute types with the auth password and user password
// syntax defined in the schema.
@@ -230,14 +229,15 @@
HashSet<AttributeType> userPWTypes = new HashSet<>();
for (AttributeType t : DirectoryServer.getAttributeTypes())
{
- final PasswordType passwordType = SchemaUtils.checkPasswordType(t);
- if (passwordType.equals(PasswordType.AUTH_PASSWORD))
+ switch (SchemaUtils.checkPasswordType(t))
{
+ case AUTH_PASSWORD:
authPWTypes.add(t);
- }
- else if (passwordType.equals(PasswordType.USER_PASSWORD))
- {
+ break;
+
+ case USER_PASSWORD:
userPWTypes.add(t);
+ break;
}
}
@@ -269,8 +269,7 @@
}
@Override
- public void processImportEnd(Backend backend, LDIFImportConfig config,
- boolean successful)
+ public void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful)
{
// No implementation is required.
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java
index 64f4b46..1c7c053 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -37,10 +37,11 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
-import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.config.server.ConfigurationAddListener;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.config.server.ConfigurationDeleteListener;
+import org.forgerock.opendj.ldap.DN;
+import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.server.config.server.ReplicationDomainCfg;
import org.forgerock.opendj.server.config.server.ReplicationSynchronizationProviderCfg;
import org.opends.server.api.Backend;
@@ -53,7 +54,6 @@
import org.opends.server.replication.service.DSRSShutdownSync;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.Control;
-import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.LDIFExportConfig;
@@ -91,7 +91,6 @@
BackupTaskListener, RestoreTaskListener, ImportTaskListener,
ExportTaskListener
{
-
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
private ReplicationServerListener replicationServerListener;
@@ -105,7 +104,7 @@
private static int replayThreadNumber = 10;
/** Enum that symbolizes the state of the multimaster replication. */
- private static enum State
+ private enum State
{
STARTING, RUNNING, STOPPING
}
@@ -165,7 +164,6 @@
}
}
-
LDAPReplicationDomain domain = null;
DN temp = dn;
while (domain == null && temp != null)
@@ -251,7 +249,6 @@
}
}
- /** {@inheritDoc} */
@Override
public void initializeSynchronizationProvider(
ReplicationSynchronizationProviderCfg cfg) throws ConfigException
@@ -300,9 +297,7 @@
return value == null ? Platform.computeNumberOfThreads(16, 2.0f) : value;
}
- /**
- * Create the threads that will wait for incoming update messages.
- */
+ /** Create the threads that will wait for incoming update messages. */
private static synchronized void createReplayThreads()
{
replayThreads.clear();
@@ -316,9 +311,7 @@
}
}
- /**
- * Stop the threads that are waiting for incoming update messages.
- */
+ /** Stop the threads that are waiting for incoming update messages. */
private static synchronized void stopReplayThreads()
{
// stop the replay threads
@@ -341,7 +334,6 @@
replayThreads.clear();
}
- /** {@inheritDoc} */
@Override
public boolean isConfigurationAddAcceptable(
ReplicationDomainCfg configuration, List<LocalizableMessage> unacceptableReasons)
@@ -350,7 +342,6 @@
configuration, unacceptableReasons);
}
- /** {@inheritDoc} */
@Override
public ConfigChangeResult applyConfigurationAdd(
ReplicationDomainCfg configuration)
@@ -375,7 +366,6 @@
return ccr;
}
- /** {@inheritDoc} */
@Override
public void doPostOperation(PostOperationAddOperation addOperation)
{
@@ -383,8 +373,6 @@
genericPostOperation(addOperation, dn);
}
-
- /** {@inheritDoc} */
@Override
public void doPostOperation(PostOperationDeleteOperation deleteOperation)
{
@@ -392,7 +380,6 @@
genericPostOperation(deleteOperation, dn);
}
- /** {@inheritDoc} */
@Override
public void doPostOperation(PostOperationModifyDNOperation modifyDNOperation)
{
@@ -400,7 +387,6 @@
genericPostOperation(modifyDNOperation, dn);
}
- /** {@inheritDoc} */
@Override
public void doPostOperation(PostOperationModifyOperation modifyOperation)
{
@@ -408,7 +394,6 @@
genericPostOperation(modifyOperation, dn);
}
- /** {@inheritDoc} */
@Override
public SynchronizationProviderResult handleConflictResolution(
PreOperationModifyOperation modifyOperation)
@@ -421,7 +406,6 @@
return new SynchronizationProviderResult.ContinueProcessing();
}
- /** {@inheritDoc} */
@Override
public SynchronizationProviderResult handleConflictResolution(
PreOperationAddOperation addOperation) throws DirectoryException
@@ -434,7 +418,6 @@
return new SynchronizationProviderResult.ContinueProcessing();
}
- /** {@inheritDoc} */
@Override
public SynchronizationProviderResult handleConflictResolution(
PreOperationDeleteOperation deleteOperation) throws DirectoryException
@@ -447,7 +430,6 @@
return new SynchronizationProviderResult.ContinueProcessing();
}
- /** {@inheritDoc} */
@Override
public SynchronizationProviderResult handleConflictResolution(
PreOperationModifyDNOperation modifyDNOperation) throws DirectoryException
@@ -460,7 +442,6 @@
return new SynchronizationProviderResult.ContinueProcessing();
}
- /** {@inheritDoc} */
@Override
public SynchronizationProviderResult
doPreOperation(PreOperationModifyOperation modifyOperation)
@@ -498,7 +479,6 @@
return new SynchronizationProviderResult.ContinueProcessing();
}
- /** {@inheritDoc} */
@Override
public SynchronizationProviderResult doPreOperation(
PreOperationDeleteOperation deleteOperation) throws DirectoryException
@@ -506,7 +486,6 @@
return new SynchronizationProviderResult.ContinueProcessing();
}
- /** {@inheritDoc} */
@Override
public SynchronizationProviderResult doPreOperation(
PreOperationModifyDNOperation modifyDNOperation)
@@ -541,7 +520,6 @@
return new SynchronizationProviderResult.ContinueProcessing();
}
- /** {@inheritDoc} */
@Override
public SynchronizationProviderResult doPreOperation(
PreOperationAddOperation addOperation)
@@ -566,7 +544,6 @@
return new SynchronizationProviderResult.ContinueProcessing();
}
- /** {@inheritDoc} */
@Override
public void finalizeSynchronizationProvider()
{
@@ -599,7 +576,6 @@
*
* @param modifications The list of modifications that was
* applied to the schema.
- *
*/
@Override
public void processSchemaChange(List<Modification> modifications)
@@ -611,9 +587,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void processBackupBegin(Backend backend, BackupConfig config)
+ public void processBackupBegin(Backend<?> backend, BackupConfig config)
{
for (DN dn : backend.getBaseDNs())
{
@@ -625,10 +600,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void processBackupEnd(Backend backend, BackupConfig config,
- boolean successful)
+ public void processBackupEnd(Backend<?> backend, BackupConfig config, boolean successful)
{
for (DN dn : backend.getBaseDNs())
{
@@ -640,9 +613,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void processRestoreBegin(Backend backend, RestoreConfig config)
+ public void processRestoreBegin(Backend<?> backend, RestoreConfig config)
{
for (DN dn : backend.getBaseDNs())
{
@@ -654,10 +626,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void processRestoreEnd(Backend backend, RestoreConfig config,
- boolean successful)
+ public void processRestoreEnd(Backend<?> backend, RestoreConfig config, boolean successful)
{
for (DN dn : backend.getBaseDNs())
{
@@ -669,9 +639,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void processImportBegin(Backend backend, LDIFImportConfig config)
+ public void processImportBegin(Backend<?> backend, LDIFImportConfig config)
{
for (DN dn : backend.getBaseDNs())
{
@@ -683,10 +652,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void processImportEnd(Backend backend, LDIFImportConfig config,
- boolean successful)
+ public void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful)
{
for (DN dn : backend.getBaseDNs())
{
@@ -698,9 +665,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void processExportBegin(Backend backend, LDIFExportConfig config)
+ public void processExportBegin(Backend<?> backend, LDIFExportConfig config)
{
for (DN dn : backend.getBaseDNs())
{
@@ -712,10 +678,8 @@
}
}
- /** {@inheritDoc} */
@Override
- public void processExportEnd(Backend backend, LDIFExportConfig config,
- boolean successful)
+ public void processExportEnd(Backend<?> backend, LDIFExportConfig config, boolean successful)
{
for (DN dn : backend.getBaseDNs())
{
@@ -737,7 +701,6 @@
return new ConfigChangeResult();
}
- /** {@inheritDoc} */
@Override
public boolean isConfigurationDeleteAcceptable(
ReplicationDomainCfg configuration, List<LocalizableMessage> unacceptableReasons)
@@ -769,7 +732,6 @@
return replicationServerListener;
}
- /** {@inheritDoc} */
@Override
public boolean isConfigurationChangeAcceptable(
ReplicationSynchronizationProviderCfg configuration,
@@ -781,7 +743,6 @@
@Override
public ConfigChangeResult applyConfigurationChange(ReplicationSynchronizationProviderCfg configuration)
{
-
// Stop threads then restart new number of threads
stopReplayThreads();
replayThreadNumber = getNumberOfReplayThreadsOrDefault(configuration);
@@ -796,7 +757,6 @@
return new ConfigChangeResult();
}
- /** {@inheritDoc} */
@Override
public void completeSynchronizationProvider()
{
@@ -911,5 +871,4 @@
{
return connectionTimeoutMS;
}
-
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/api/TestTaskListener.java b/opendj-server-legacy/src/test/java/org/opends/server/api/TestTaskListener.java
index 4b5f49c..aebbe85 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/api/TestTaskListener.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/api/TestTaskListener.java
@@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2015 ForgeRock AS.
+ * Portions Copyright 2015-2016 ForgeRock AS.
*/
package org.opends.server.api;
@@ -20,12 +20,10 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.BackupConfig;
-import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.LDIFExportConfig;
+import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.RestoreConfig;
-
-
/**
* This class provides a very simple implementation of an import, export,
* backup, and restore task listener. It will simply increment a counter each
@@ -45,11 +43,7 @@
public static final AtomicInteger restoreBeginCount = new AtomicInteger(0);
public static final AtomicInteger restoreEndCount = new AtomicInteger(0);
-
-
- /**
- * Registers the task listeners with the Directory Server.
- */
+ /** Registers the task listeners with the Directory Server. */
public static void registerListeners()
{
DirectoryServer.registerBackupTaskListener(instance);
@@ -58,11 +52,7 @@
DirectoryServer.registerImportTaskListener(instance);
}
-
-
- /**
- * Deregisters the task listeners with the Directory Server.
- */
+ /** Deregisters the task listeners with the Directory Server. */
public static void deregisterListeners()
{
DirectoryServer.deregisterBackupTaskListener(instance);
@@ -71,72 +61,51 @@
DirectoryServer.deregisterImportTaskListener(instance);
}
-
-
- /** {@inheritDoc} */
- public void processBackupBegin(Backend backend, BackupConfig config)
+ @Override
+ public void processBackupBegin(Backend<?> backend, BackupConfig config)
{
backupBeginCount.incrementAndGet();
}
-
-
- /** {@inheritDoc} */
- public void processBackupEnd(Backend backend, BackupConfig config,
- boolean successful)
+ @Override
+ public void processBackupEnd(Backend<?> backend, BackupConfig config, boolean successful)
{
backupEndCount.incrementAndGet();
}
-
-
- /** {@inheritDoc} */
- public void processRestoreBegin(Backend backend, RestoreConfig config)
+ @Override
+ public void processRestoreBegin(Backend<?> backend, RestoreConfig config)
{
restoreBeginCount.incrementAndGet();
}
-
-
- /** {@inheritDoc} */
- public void processRestoreEnd(Backend backend, RestoreConfig config,
- boolean successful)
+ @Override
+ public void processRestoreEnd(Backend<?> backend, RestoreConfig config, boolean successful)
{
restoreEndCount.incrementAndGet();
}
-
-
- /** {@inheritDoc} */
- public void processExportBegin(Backend backend, LDIFExportConfig config)
+ @Override
+ public void processExportBegin(Backend<?> backend, LDIFExportConfig config)
{
exportBeginCount.incrementAndGet();
}
-
-
- /** {@inheritDoc} */
- public void processExportEnd(Backend backend, LDIFExportConfig config,
- boolean successful)
+ @Override
+ public void processExportEnd(Backend<?> backend, LDIFExportConfig config, boolean successful)
{
exportEndCount.incrementAndGet();
}
-
-
- /** {@inheritDoc} */
- public void processImportBegin(Backend backend, LDIFImportConfig config)
+ @Override
+ public void processImportBegin(Backend<?> backend, LDIFImportConfig config)
{
importBeginCount.incrementAndGet();
}
-
-
- /** {@inheritDoc} */
- public void processImportEnd(Backend backend, LDIFImportConfig config,
- boolean successful)
+ @Override
+ public void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful)
{
importEndCount.incrementAndGet();
}
}
-
--
Gitblit v1.10.0