From 9b23e8325caf1c548dbf07fccb0a31d29e5d1cca Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 12 Sep 2007 23:21:22 +0000
Subject: [PATCH] Fix for issues: 1335: define, document, review CLI to register a server in a synch 1336: CLI implementation to register a server in a synchronization 1878: provide a CLI to initialize a replication topology from a gi 2201: ads-trustore missing when not configuring replication with t 2250: Setup and dsreplication utilities should configure schema sy
---
opends/src/guitools/org/opends/guitools/replicationcli/EnableReplicationUserData.java | 21 ++++
opends/resource/bin/dsreplication | 38 +++++++
opends/src/messages/messages/quicksetup.properties | 5
opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java | 92 +++++++++++++++---
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java | 2
opends/src/quicksetup/org/opends/quicksetup/Constants.java | 6 +
opends/resource/bin/dsreplication.bat | 32 ++++++
opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliArgumentParser.java | 21 ++++
opends/src/messages/messages/admin_tool.properties | 10 +
opends/src/ads/org/opends/admin/ads/ServerDescriptor.java | 13 ++
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 4
opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java | 6 +
12 files changed, 222 insertions(+), 28 deletions(-)
diff --git a/opends/resource/bin/dsreplication b/opends/resource/bin/dsreplication
new file mode 100644
index 0000000..280bfcb
--- /dev/null
+++ b/opends/resource/bin/dsreplication
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License, Version 1.0 only
+# (the "License"). You may not use this file except in compliance
+# with the License.
+#
+# You can obtain a copy of the license at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE
+# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at
+# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+# add the following below this CDDL HEADER, with the fields enclosed
+# by brackets "[]" replaced with your own identifying information:
+# Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+#
+# Portions Copyright 2007 Sun Microsystems, Inc.
+
+
+# This script may be used to perform some replication specific operations.
+OPENDS_INVOKE_CLASS="org.opends.guitools.replicationcli.ReplicationCliMain"
+export OPENDS_INVOKE_CLASS
+
+SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=dsreplication"
+export SCRIPT_NAME_ARG
+
+SCRIPT_DIR=`dirname "${0}"`
+"${SCRIPT_DIR}/../lib/_client-script.sh" "${@}"
+
diff --git a/opends/resource/bin/dsreplication.bat b/opends/resource/bin/dsreplication.bat
new file mode 100644
index 0000000..1e2aa0c
--- /dev/null
+++ b/opends/resource/bin/dsreplication.bat
@@ -0,0 +1,32 @@
+
+@echo off
+rem CDDL HEADER START
+rem
+rem The contents of this file are subject to the terms of the
+rem Common Development and Distribution License, Version 1.0 only
+rem (the "License"). You may not use this file except in compliance
+rem with the License.
+rem
+rem You can obtain a copy of the license at
+rem trunk/opends/resource/legal-notices/OpenDS.LICENSE
+rem or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+rem See the License for the specific language governing permissions
+rem and limitations under the License.
+rem
+rem When distributing Covered Code, include this CDDL HEADER in each
+rem file and include the License file at
+rem trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+rem add the following below this CDDL HEADER, with the fields enclosed
+rem by brackets "[]" replaced with your own identifying information:
+rem Portions Copyright [yyyy] [name of copyright owner]
+rem
+rem CDDL HEADER END
+rem
+rem
+rem Portions Copyright 2007 Sun Microsystems, Inc.
+
+setlocal
+
+set OPENDS_INVOKE_CLASS="org.opends.guitools.replicationcli.ReplicationCliMain"
+set SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=dsreplication"
+for %%i in (%~sf0) do call "%%~dPsi\..\lib\_client-script.bat" %*
diff --git a/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java b/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
index ca818f4..d9aadca 100644
--- a/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
+++ b/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
@@ -651,7 +651,7 @@
String id = getFirstValue(sr, "ds-cfg-backend-id");
- if (!isConfigBackend(id))
+ if (!isConfigBackend(id) || isSchemaBackend(id))
{
Set<String> baseDns = getValues(sr, "ds-cfg-backend-base-dn");
@@ -1002,6 +1002,17 @@
}
/**
+ * An convenience method to know if the provided ID corresponds to the schema
+ * backend or not.
+ * @param id the backend ID to analyze
+ * @return <CODE>true</CODE> if the the id corresponds to the schema backend
+ * and <CODE>false</CODE> otherwise.
+ */
+ private static boolean isSchemaBackend(String id)
+ {
+ return "schema".equalsIgnoreCase(id);
+ }
+ /**
* Returns <CODE>true</CODE> if the the provided strings represent the same
* DN and <CODE>false</CODE> otherwise.
* @param dn1 the first dn to compare.
diff --git a/opends/src/guitools/org/opends/guitools/replicationcli/EnableReplicationUserData.java b/opends/src/guitools/org/opends/guitools/replicationcli/EnableReplicationUserData.java
index e17ca87..a15aa92 100644
--- a/opends/src/guitools/org/opends/guitools/replicationcli/EnableReplicationUserData.java
+++ b/opends/src/guitools/org/opends/guitools/replicationcli/EnableReplicationUserData.java
@@ -49,6 +49,7 @@
private boolean useStartTLS2;
private boolean useSSL2;
private int replicationPort2;
+ private boolean replicateSchema = true;
/**
* Returns the host name of the first server.
@@ -322,4 +323,24 @@
{
this.replicationPort2 = replicationPort2;
}
+
+ /**
+ * Returns <CODE>true</CODE> if the user asked to replicate schema and <CODE>
+ * false</CODE> otherwise.
+ * @return <CODE>true</CODE> if the user asked to replicate schema and <CODE>
+ * false</CODE> otherwise.
+ */
+ public boolean replicateSchema()
+ {
+ return replicateSchema;
+ }
+
+ /**
+ * Sets whether to replicate schema or not.
+ * @param replicateSchema whether to replicate schema or not.
+ */
+ public void setReplicateSchema(boolean replicateSchema)
+ {
+ this.replicateSchema = replicateSchema;
+ }
}
diff --git a/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliArgumentParser.java b/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliArgumentParser.java
index 6133171..4c72ac0 100644
--- a/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliArgumentParser.java
+++ b/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliArgumentParser.java
@@ -148,6 +148,11 @@
private BooleanArgument skipPortCheckArg;
/**
+ * The 'noSchemaReplication' argument to not replicate schema.
+ */
+ private BooleanArgument noSchemaReplicationArg;
+
+ /**
* The 'hostName' argument for the source server.
*/
private StringArgument hostNameSourceArg = null;
@@ -489,6 +494,10 @@
"skipportcheck", 'S', "skipPortCheck",
INFO_DESCRIPTION_ENABLE_REPLICATION_SKIPPORT.get());
+ noSchemaReplicationArg = new BooleanArgument(
+ "noschemareplication", null, "noSchemaReplication",
+ INFO_DESCRIPTION_ENABLE_REPLICATION_NO_SCHEMA_REPLICATION.get());
+
enableReplicationSubCmd = new SubCommand(this,
ENABLE_REPLICATION_SUBCMD_NAME,
INFO_DESCRIPTION_SUBCMD_ENABLE_REPLICATION.get());
@@ -498,7 +507,7 @@
bindPasswordFile1Arg, useStartTLS1Arg, useSSL1Arg, replicationPort1Arg,
hostName2Arg, port2Arg, bindDn2Arg, bindPassword2Arg,
bindPasswordFile2Arg, useStartTLS2Arg, useSSL2Arg, replicationPort2Arg,
- skipPortCheckArg
+ skipPortCheckArg, noSchemaReplicationArg
};
for (int i=0; i<argsToAdd.length; i++)
{
@@ -1046,6 +1055,16 @@
}
/**
+ * Returns whether the user asked to not replicate the schema between servers.
+ * @return <CODE>true</CODE> the user asked to not replicate schema and <CODE>
+ * false</CODE> otherwise.
+ */
+ public boolean noSchemaReplication()
+ {
+ return noSchemaReplicationArg.isPresent();
+ }
+
+ /**
* Returns the host name explicitly provided in the disable replication
* subcommand.
* @return the host name explicitly provided in the disable replication
diff --git a/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java b/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
index 4e80d6e..2bd1daa 100644
--- a/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
+++ b/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
@@ -913,6 +913,9 @@
{
}
}
+
+ uData.setReplicateSchema(!argParser.noSchemaReplication());
+
return !cancelled;
}
@@ -1078,12 +1081,16 @@
{
// Ask for confirmation to disable.
boolean disableADS = false;
+ boolean disableSchema = false;
for (String dn : uData.getBaseDNs())
{
if (Utils.areDnsEqual(ADSContext.getAdministrationSuffixDN(), dn))
{
disableADS = true;
- break;
+ }
+ else if (Utils.areDnsEqual(Constants.SCHEMA_DN, dn))
+ {
+ disableSchema = true;
}
}
if (disableADS)
@@ -1092,7 +1099,12 @@
cancelled = !confirm(INFO_REPLICATION_CONFIRM_DISABLE_ADS.get(
ADSContext.getAdministrationSuffixDN()));
}
- else
+ if (disableSchema)
+ {
+ printLineBreak();
+ cancelled = !confirm(INFO_REPLICATION_CONFIRM_DISABLE_SCHEMA.get());
+ }
+ if (!disableSchema && !disableADS)
{
printLineBreak();
cancelled = !confirm(INFO_REPLICATION_CONFIRM_DISABLE_GENERIC.get());
@@ -1541,7 +1553,10 @@
uData.setBindDn2(bindDn);
uData.setPwd2(pwd2);
}
- uData.setReplicationPort1(replicationPort1);
+ int replicationPort2 = getValue(argParser.getReplicationPort2(),
+ argParser.getDefaultReplicationPort2());
+ uData.setReplicationPort2(replicationPort2);
+ uData.setReplicateSchema(!argParser.noSchemaReplication());
}
/**
@@ -1717,17 +1732,23 @@
}
}
/* Check the exceptions and see if we throw them or not. */
+ boolean notGlobalAdministratorError = false;
for (TopologyCacheException e : exceptions)
{
+ if (notGlobalAdministratorError)
+ {
+ break;
+ }
switch (e.getType())
{
case NOT_GLOBAL_ADMINISTRATOR:
- printLineBreak();
- printErrorMessage(INFO_NOT_GLOBAL_ADMINISTRATOR_PROVIDED.get());
+ notGlobalAdministratorError = true;
boolean connected = false;
String adminUid = uData.getAdminUid();
String adminPwd = uData.getAdminPwd();
+
+ boolean errorDisplayed = false;
while (!connected)
{
if ((!triedWithUserProvidedAdmin) && (adminPwd == null))
@@ -1739,6 +1760,13 @@
}
if (adminPwd == null)
{
+ if (!errorDisplayed)
+ {
+ printLineBreak();
+ printErrorMessage(
+ INFO_NOT_GLOBAL_ADMINISTRATOR_PROVIDED.get());
+ errorDisplayed = true;
+ }
adminUid = askForAdministratorUID(
argParser.getDefaultAdministratorUID());
adminPwd = askForAdministratorPwd();
@@ -2496,9 +2524,17 @@
while (suffixes.isEmpty())
{
- if ((availableSuffixes.size() == 1) &&
- Utils.areDnsEqual(availableSuffixes.first(),
- ADSContext.getAdministrationSuffixDN()))
+ boolean noSchemaOrAds = false;
+ for (String s: availableSuffixes)
+ {
+ if (!Utils.areDnsEqual(s, ADSContext.getAdministrationSuffixDN()) &&
+ !Utils.areDnsEqual(s, Constants.SCHEMA_DN) &&
+ !Utils.areDnsEqual(s, Constants.REPLICATION_CHANGES_DN))
+ {
+ noSchemaOrAds = true;
+ }
+ }
+ if (!noSchemaOrAds)
{
// In interactive mode we do not propose to manage the
// administration suffix.
@@ -2514,7 +2550,7 @@
for (String dn : availableSuffixes)
{
if (!Utils.areDnsEqual(ADSContext.getAdministrationSuffixDN(),
- dn))
+ dn) && !Utils.areDnsEqual(Constants.SCHEMA_DN, dn))
{
if (confirm(INFO_REPLICATION_ENABLE_SUFFIX_PROMPT.get(dn)))
{
@@ -2643,9 +2679,17 @@
{
while (suffixes.isEmpty())
{
- if ((availableSuffixes.size() == 1) &&
- Utils.areDnsEqual(availableSuffixes.first(),
- ADSContext.getAdministrationSuffixDN()))
+ boolean noSchemaOrAds = false;
+ for (String s: availableSuffixes)
+ {
+ if (!Utils.areDnsEqual(s, ADSContext.getAdministrationSuffixDN()) &&
+ !Utils.areDnsEqual(s, Constants.SCHEMA_DN) &&
+ !Utils.areDnsEqual(s, Constants.REPLICATION_CHANGES_DN))
+ {
+ noSchemaOrAds = true;
+ }
+ }
+ if (!noSchemaOrAds)
{
// In interactive mode we do not propose to manage the
// administration suffix.
@@ -2661,7 +2705,7 @@
for (String dn : availableSuffixes)
{
if (!Utils.areDnsEqual(ADSContext.getAdministrationSuffixDN(),
- dn))
+ dn) && !Utils.areDnsEqual(Constants.SCHEMA_DN, dn))
{
if (confirm(INFO_REPLICATION_DISABLE_SUFFIX_PROMPT.get(dn)))
{
@@ -2731,9 +2775,17 @@
{
while (suffixes.isEmpty())
{
- if ((availableSuffixes.size() == 1) &&
- Utils.areDnsEqual(availableSuffixes.first(),
- ADSContext.getAdministrationSuffixDN()))
+ boolean noSchemaOrAds = false;
+ for (String s: availableSuffixes)
+ {
+ if (!Utils.areDnsEqual(s, ADSContext.getAdministrationSuffixDN()) &&
+ !Utils.areDnsEqual(s, Constants.SCHEMA_DN) &&
+ !Utils.areDnsEqual(s, Constants.REPLICATION_CHANGES_DN))
+ {
+ noSchemaOrAds = true;
+ }
+ }
+ if (!noSchemaOrAds)
{
// In interactive mode we do not propose to manage the
// administration suffix.
@@ -2750,7 +2802,7 @@
for (String dn : availableSuffixes)
{
if (!Utils.areDnsEqual(ADSContext.getAdministrationSuffixDN(),
- dn))
+ dn) && !Utils.areDnsEqual(Constants.SCHEMA_DN, dn))
{
if (confirm(INFO_REPLICATION_INITIALIZE_SUFFIX_PROMPT.get(dn)))
{
@@ -2959,6 +3011,12 @@
}
}
+ if (uData.replicateSchema())
+ {
+ baseDNs = uData.getBaseDNs();
+ baseDNs.add("cn=schema");
+ uData.setBaseDNs(baseDNs);
+ }
TopologyCache cache1 = null;
TopologyCache cache2 = null;
try
diff --git a/opends/src/messages/messages/admin_tool.properties b/opends/src/messages/messages/admin_tool.properties
index 2545c1a..a94afe6 100644
--- a/opends/src/messages/messages/admin_tool.properties
+++ b/opends/src/messages/messages/admin_tool.properties
@@ -338,10 +338,9 @@
INFO_SUMMARY_UNINSTALL_NOT_STARTED=Starting Uninstallation...
INFO_UNDEFINED_PROTOCOL_LABEL=-Unknown-
SEVERE_ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED=%n%nThe graphical Uninstall \
- launch failed.%n%nLaunching command line Uninstall...
+ launch failed.
SEVERE_ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS=%n%nThe graphical \
- Uninstall launch failed. Check file %s for more details.%n%nLaunching \
- command line Uninstall...
+ Uninstall launch failed. Check file %s for more details.
INFO_UNINSTALL_LAUNCHER_LAUNCHING_CLI=Launching command line uninstall...
INFO_UNINSTALL_LAUNCHER_LAUNCHING_GUI=Launching graphical uninstall...
INFO_UNINSTALL_LAUNCHER_USAGE_DESCRIPTION=This utility may be used to \
@@ -418,6 +417,8 @@
specified the global administrator will be used to bind
INFO_DESCRIPTION_ENABLE_REPLICATION_SKIPPORT=Skip the check to determine \
whether the specified replication ports are usable
+INFO_DESCRIPTION_ENABLE_REPLICATION_NO_SCHEMA_REPLICATION=Do not replicate the \
+ schema between the servers.
INFO_DESCRIPTION_ENABLE_REPLICATION_BINDPASSWORD2=Specifies the password \
to use to bind to the second server whose contents will be replicated. If no \
bind DN was specified for the first server the password of the global \
@@ -613,6 +614,9 @@
base DN %s. This base DN is used by the replication mechanism and by some \
administrative tools and it is not recommended to configure it directly. Do \
you want to continue?
+INFO_REPLICATION_CONFIRM_DISABLE_SCHEMA=You chose to disable replication of \
+ the schema. Disabling schema replication is only recommended in specific \
+ scenarios. Do you want to continue?
INFO_REPLICATION_CONFIRM_DISABLE_GENERIC=Disabling replication will make the \
data under the selected base DNs not to be synchronized with other servers \
any more. Do you want to continue?
diff --git a/opends/src/messages/messages/quicksetup.properties b/opends/src/messages/messages/quicksetup.properties
index cca56d7..24688d1 100644
--- a/opends/src/messages/messages/quicksetup.properties
+++ b/opends/src/messages/messages/quicksetup.properties
@@ -837,10 +837,9 @@
INFO_SERVER_SETTINGS_PANEL_TITLE=Server Settings
INFO_SERVER_SETTINGS_STEP=Server Settings
INFO_SETUP_LAUNCHER_GUI_LAUNCHED_FAILED=%n%nThe graphical Setup launch \
- failed.%n%nLaunching command line Setup...
+ failed.
INFO_SETUP_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS=%n%nThe graphical Setup \
- launch failed. Check file %s for more details.%n%nLaunching command line \
- Setup...
+ launch failed. Check file %s for more details.
INFO_SETUP_LAUNCHER_LAUNCHING_GUI=Launching graphical setup...
INFO_SETUP_LAUNCHER_USAGE_DESCRIPTION=This utility may be used to setup the \
Directory Server.
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Constants.java b/opends/src/quicksetup/org/opends/quicksetup/Constants.java
index 32fd051..9602fe1 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Constants.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Constants.java
@@ -82,6 +82,12 @@
HTML_LIST_ITEM_CLOSE
};
+ /** DN of the schema object. */
+ public static final String SCHEMA_DN = "cn=schema";
+
+ /** DN of the replication changes base DN. */
+ public static final String REPLICATION_CHANGES_DN = "dc=replicationChanges";
+
/** The cli java system property. */
public static final String CLI_JAVA_PROPERTY = "org.opends.quicksetup.cli";
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 02f1dfd..b0c1bef 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -1411,6 +1411,8 @@
}
dns.add(ADSContext.getAdministrationSuffixDN());
replicationServers.put(ADSContext.getAdministrationSuffixDN(), adsServers);
+ dns.add(Constants.SCHEMA_DN);
+ replicationServers.put(Constants.SCHEMA_DN, adsServers);
InitialLdapContext ctx = null;
try
@@ -1491,7 +1493,7 @@
dns.add(replica.getSuffix().getDN());
}
dns.add(ADSContext.getAdministrationSuffixDN());
-
+ dns.add(Constants.SCHEMA_DN);
ctx = getRemoteConnection(server, getTrustManager());
ConfiguredReplication repl =
helper.configureReplication(ctx, dns, replicationServers,
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
index 788ed46..d15f679 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java
@@ -57,6 +57,7 @@
import org.opends.admin.ads.SuffixDescriptor;
import org.opends.quicksetup.ButtonName;
+import org.opends.quicksetup.Constants;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.event.ButtonEvent;
import org.opends.quicksetup.installer.AuthenticationData;
@@ -281,7 +282,10 @@
for (SuffixDescriptor suffix : array)
{
if (!Utils.areDnsEqual(suffix.getDN(),
- ADSContext.getAdministrationSuffixDN()))
+ ADSContext.getAdministrationSuffixDN()) &&
+ !Utils.areDnsEqual(suffix.getDN(), Constants.SCHEMA_DN) &&
+ !Utils.areDnsEqual(suffix.getDN(),
+ Constants.REPLICATION_CHANGES_DN))
{
orderedSuffixes.add(suffix);
}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 10845d3..fb7fc88 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -320,7 +320,7 @@
{
boolean isConfigurationDn = false;
String[] configDns =
- { "cn=config", "cn=schema" };
+ { "cn=config", Constants.SCHEMA_DN };
for (int i = 0; i < configDns.length && !isConfigurationDn; i++)
{
isConfigurationDn = areDnsEqual(dn, configDns[i]);
--
Gitblit v1.10.0