From 5363b9d3da9faf53b3e135dae0a68e4f70b99c5f Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 19 Feb 2009 17:40:39 +0000
Subject: [PATCH] Fix for issue 3812 (dsreplication should complain if wrong repl port given for existent replication server)

---
 opendj-sdk/opends/src/messages/messages/tools.properties                                             |    8 +++++++-
 opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java           |   26 ++++++++++++++++++++++++++
 opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java |    2 +-
 opendj-sdk/opends/src/messages/messages/admin_tool.properties                                        |    2 +-
 4 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/src/messages/messages/admin_tool.properties b/opendj-sdk/opends/src/messages/messages/admin_tool.properties
index b8cd987..b23c021 100644
--- a/opendj-sdk/opends/src/messages/messages/admin_tool.properties
+++ b/opendj-sdk/opends/src/messages/messages/admin_tool.properties
@@ -2390,7 +2390,7 @@
 INFO_CTRL_PANEL_AVAILABLE_CPUS=Available CPUs
 INFO_CTRL_PANEL_SYSTEM_NAME=System Name
 INFO_CTRL_PANEL_OPERATING_SYSTEM=Operating System
-INFO_CTRL_PANEL_FREE_USED_MEMORY=Free Used Memory
+INFO_CTRL_PANEL_FREE_USED_MEMORY=Free Memory in JVM
 INFO_CTRL_PANEL_MAX_MEMORY=Max Memory
 INFO_CTRL_PANEL_USED_MEMORY=Used Memory
 INFO_CTRL_PANEL_CLASS_PATH=Class Path
diff --git a/opendj-sdk/opends/src/messages/messages/tools.properties b/opendj-sdk/opends/src/messages/messages/tools.properties
index c9b252a..c760617 100644
--- a/opendj-sdk/opends/src/messages/messages/tools.properties
+++ b/opendj-sdk/opends/src/messages/messages/tools.properties
@@ -20,7 +20,7 @@
 #
 # CDDL HEADER END
 #
-#      Copyright 2006-2008 Sun Microsystems, Inc.
+#      Copyright 2006-2009 Sun Microsystems, Inc.
 
 
 
@@ -2446,3 +2446,9 @@
 INFO_UNCONFIGURE_USAGE_DESCRIPTION_1656=This utility unsets the instance location
 INFO_DESCRIPTION_CHECK_OPTIONS_1657=Checks options are valid
 
+MILD_WARN_FIRST_REPLICATION_SERVER_ALREADY_CONFIGURED_1658=The first server is \
+ already configured with replication port '%d'.  The provided replication \
+ server port '%d' has been ignored.
+MILD_WARN_SECOND_REPLICATION_SERVER_ALREADY_CONFIGURED_1659=The second server \
+ is already configured with replication port '%d'.  The provided replication \
+ server port '%d' has been ignored.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
index cd7abac..f21b7f2 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
@@ -137,7 +137,7 @@
   /**
    * The 'replicationPort' argument for the second server.
    */
-  private IntegerArgument replicationPort2Arg = null;
+  IntegerArgument replicationPort2Arg = null;
 
   /**
    * The 'secureReplication' argument for the second server.
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index 37be70f..abeb70a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -4871,6 +4871,19 @@
             ConnectionUtils.getHostPort(ctx1)),
             ERROR_CONFIGURING_REPLICATIONSERVER, ode);
       }
+      if (argParser.replicationPort1Arg.isPresent())
+      {
+        // Inform the user that the provided value will be ignored
+        if (uData.getReplicationPort1() !=
+          server1.getReplicationServerPort())
+        {
+          LOG.log(Level.WARNING, "Ignoring provided replication port for "+
+              "first server (already configured with port "+
+              server1.getReplicationServerPort()+")");
+          println(WARN_FIRST_REPLICATION_SERVER_ALREADY_CONFIGURED.get(
+              server1.getReplicationServerPort(), uData.getReplicationPort1()));
+        }
+      }
     }
     alreadyConfiguredReplicationServers.add(server1.getId());
     if (!server2.isReplicationServer())
@@ -4902,6 +4915,19 @@
             ConnectionUtils.getHostPort(ctx1)),
             ERROR_CONFIGURING_REPLICATIONSERVER, ode);
       }
+      if (argParser.replicationPort2Arg.isPresent())
+      {
+        // Inform the user that the provided value will be ignored
+        if (uData.getReplicationPort2() !=
+          server2.getReplicationServerPort())
+        {
+          LOG.log(Level.WARNING, "Ignoring provided replication port for "+
+              "second server (already configured with port "+
+              server2.getReplicationServerPort()+")");
+          println(WARN_SECOND_REPLICATION_SERVER_ALREADY_CONFIGURED.get(
+              server2.getReplicationServerPort(), uData.getReplicationPort2()));
+        }
+      }
     }
     alreadyConfiguredReplicationServers.add(server2.getId());
 

--
Gitblit v1.10.0