mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
13.21.2007 9b23e8325caf1c548dbf07fccb0a31d29e5d1cca
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


Extra: do not show dc=replicationchanges suffix in the replication panel of the setup, nor propose it to replicate.
fix some bugs related to duplicate error messages displayed in dsreplication interactive mode.

2 files added
10 files modified
250 ■■■■ changed files
opends/resource/bin/dsreplication 38 ●●●●● patch | view | raw | blame | history
opends/resource/bin/dsreplication.bat 32 ●●●●● patch | view | raw | blame | history
opends/src/ads/org/opends/admin/ads/ServerDescriptor.java 13 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/replicationcli/EnableReplicationUserData.java 21 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliArgumentParser.java 21 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java 92 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/admin_tool.properties 10 ●●●● patch | view | raw | blame | history
opends/src/messages/messages/quicksetup.properties 5 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Constants.java 6 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java 4 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/ui/SuffixesToReplicatePanel.java 6 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java 2 ●●● patch | view | raw | blame | history
opends/resource/bin/dsreplication
New file
@@ -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" "${@}"
opends/resource/bin/dsreplication.bat
New file
@@ -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" %*
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.
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;
  }
}
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
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
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?
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.
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";
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,
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);
        }
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]);