From 6d1ebe16f8bfd23ef5de615dc7fab6468f7ef3f8 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 24 Dec 2014 15:01:44 +0000
Subject: [PATCH] Code cleanup
---
opendj3-server-dev/src/server/org/opends/server/replication/plugin/MultimasterReplication.java | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/plugin/MultimasterReplication.java b/opendj3-server-dev/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
index f9d34fa..c43111b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -26,6 +26,11 @@
*/
package org.opends.server.replication.plugin;
+import static org.opends.messages.ReplicationMessages.*;
+import static org.opends.server.replication.plugin.ReplicationRepairRequestControl.*;
+import static org.opends.server.util.ServerConstants.*;
+import static org.opends.server.util.StaticUtils.*;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -77,11 +82,6 @@
import org.opends.server.types.operation.PreOperationModifyDNOperation;
import org.opends.server.types.operation.PreOperationModifyOperation;
-import static org.opends.messages.ReplicationMessages.*;
-import static org.opends.server.replication.plugin.ReplicationRepairRequestControl.*;
-import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.StaticUtils.*;
-
/**
* This class is used to load the Replication code inside the JVM
* and to trigger initialization of the replication.
@@ -126,7 +126,7 @@
private static int replayThreadNumber = 10;
/**
- * enum that symbolizes the state of the multimaster replication.
+ * Enum that symbolizes the state of the multimaster replication.
*/
private static enum State
{
@@ -375,6 +375,7 @@
public ConfigChangeResult applyConfigurationAdd(
ReplicationDomainCfg configuration)
{
+ ConfigChangeResult ccr = new ConfigChangeResult();
try
{
LDAPReplicationDomain rd = createNewDomain(configuration);
@@ -385,13 +386,13 @@
rd.shutdown();
}
}
- return new ConfigChangeResult(ResultCode.SUCCESS, false);
} catch (ConfigException e)
{
// we should never get to this point because the configEntry has
// already been validated in isConfigurationAddAcceptable()
- return new ConfigChangeResult(ResultCode.CONSTRAINT_VIOLATION, false);
+ ccr.setResultCode(ResultCode.CONSTRAINT_VIOLATION);
}
+ return ccr;
}
/** {@inheritDoc} */
@@ -753,7 +754,7 @@
{
deleteDomain(configuration.getBaseDN());
- return new ConfigChangeResult(ResultCode.SUCCESS, false);
+ return new ConfigChangeResult();
}
/** {@inheritDoc} */
@@ -815,7 +816,7 @@
connectionTimeoutMS = (int) Math.min(configuration.getConnectionTimeout(),
Integer.MAX_VALUE);
- return new ConfigChangeResult(ResultCode.SUCCESS, false);
+ return new ConfigChangeResult();
}
/** {@inheritDoc} */
@@ -896,14 +897,20 @@
}
}
// if state is STOPPING, then we need to return from this method
+ final LDAPReplicationDomain domain = getDomain(baseDN);
+ return domain != null && domain.isECLEnabled();
+ }
+
+ private static LDAPReplicationDomain getDomain(DN baseDN)
+ {
for (LDAPReplicationDomain domain : domains.values())
{
- if (domain.isECLEnabled() && domain.getBaseDN().equals(baseDN))
+ if (domain.getBaseDN().equals(baseDN))
{
- return true;
+ return domain;
}
}
- return false;
+ return null;
}
/**
--
Gitblit v1.10.0