001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2008-2009 Sun Microsystems, Inc.
015 * Portions Copyright 2014-2016 ForgeRock AS.
016 */
017package org.opends.guitools.controlpanel.task;
018
019import static org.opends.messages.AdminToolMessages.*;
020import static org.opends.messages.ConfigMessages.*;
021
022import java.util.ArrayList;
023import java.util.Collection;
024import java.util.HashMap;
025import java.util.HashSet;
026import java.util.LinkedList;
027import java.util.List;
028import java.util.Map;
029import java.util.Set;
030import java.util.SortedSet;
031import java.util.TreeSet;
032import java.util.concurrent.atomic.AtomicReference;
033
034import javax.naming.ldap.InitialLdapContext;
035import javax.swing.SwingUtilities;
036
037import org.forgerock.i18n.LocalizableMessage;
038import org.forgerock.opendj.config.server.ConfigException;
039import org.opends.guitools.controlpanel.datamodel.BackendDescriptor;
040import org.opends.guitools.controlpanel.datamodel.BaseDNDescriptor;
041import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
042import org.opends.guitools.controlpanel.ui.ColorAndFontConstants;
043import org.opends.guitools.controlpanel.ui.ProgressDialog;
044import org.opends.guitools.controlpanel.util.ConfigReader;
045import org.opends.guitools.controlpanel.util.Utilities;
046import org.opends.server.admin.client.ManagementContext;
047import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor;
048import org.opends.server.admin.client.ldap.LDAPManagementContext;
049import org.opends.server.admin.server.ServerManagementContext;
050import org.opends.server.admin.std.client.PluggableBackendCfgClient;
051import org.opends.server.admin.std.client.ReplicationDomainCfgClient;
052import org.opends.server.admin.std.client.ReplicationSynchronizationProviderCfgClient;
053import org.opends.server.admin.std.client.RootCfgClient;
054import org.opends.server.admin.std.server.ReplicationDomainCfg;
055import org.opends.server.admin.std.server.ReplicationSynchronizationProviderCfg;
056import org.opends.server.admin.std.server.RootCfg;
057import org.opends.server.config.ConfigConstants;
058import org.opends.server.config.ConfigEntry;
059import org.opends.server.config.DNConfigAttribute;
060import org.opends.server.core.DirectoryServer;
061import org.forgerock.opendj.ldap.DN;
062import org.opends.server.types.OpenDsException;
063
064/** The task used to delete a set of base DNs or backends. */
065public class DeleteBaseDNAndBackendTask extends Task
066{
067  private Set<String> backendSet;
068  private Map<String, Set<BaseDNDescriptor>> baseDNsToDelete = new HashMap<>();
069  private ArrayList<BackendDescriptor> backendsToDelete = new ArrayList<>();
070
071  /**
072   * Constructor of the task.
073   * @param info the control panel information.
074   * @param dlg the progress dialog where the task progress will be displayed.
075   * @param backendsToDelete the backends to delete.
076   * @param baseDNsToDelete the base DNs to delete.
077   */
078  public DeleteBaseDNAndBackendTask(ControlPanelInfo info, ProgressDialog dlg,
079      Collection<BackendDescriptor> backendsToDelete,
080      Collection<BaseDNDescriptor> baseDNsToDelete)
081  {
082    super(info, dlg);
083    backendSet = new HashSet<>();
084    for (BackendDescriptor backend : backendsToDelete)
085    {
086      backendSet.add(backend.getBackendID());
087    }
088    for (BaseDNDescriptor baseDN : baseDNsToDelete)
089    {
090      backendSet.add(baseDN.getBackend().getBackendID());
091    }
092    for (BaseDNDescriptor baseDN : baseDNsToDelete)
093    {
094      String backendID = baseDN.getBackend().getBackendID();
095      Set<BaseDNDescriptor> set = this.baseDNsToDelete.get(backendID);
096      if (set == null)
097      {
098        set = new HashSet<>();
099        this.baseDNsToDelete.put(backendID, set);
100      }
101      set.add(baseDN);
102    }
103    ArrayList<String> indirectBackendsToDelete = new ArrayList<>();
104    for (Set<BaseDNDescriptor> set : this.baseDNsToDelete.values())
105    {
106      BackendDescriptor backend = set.iterator().next().getBackend();
107      if (set.size() == backend.getBaseDns().size())
108      {
109        // All of the suffixes must be deleted.
110        indirectBackendsToDelete.add(backend.getBackendID());
111        this.backendsToDelete.add(backend);
112      }
113    }
114    for (String backendID : indirectBackendsToDelete)
115    {
116      this.baseDNsToDelete.remove(backendID);
117    }
118    this.backendsToDelete.addAll(backendsToDelete);
119  }
120
121  @Override
122  public Type getType()
123  {
124    return !baseDNsToDelete.isEmpty() ? Type.DELETE_BASEDN : Type.DELETE_BACKEND;
125  }
126
127  @Override
128  public Set<String> getBackends()
129  {
130    return backendSet;
131  }
132
133  @Override
134  public LocalizableMessage getTaskDescription()
135  {
136    StringBuilder sb = new StringBuilder();
137
138    if (!baseDNsToDelete.isEmpty())
139    {
140      ArrayList<String> dns = new ArrayList<>();
141      for (Set<BaseDNDescriptor> set : baseDNsToDelete.values())
142      {
143        for (BaseDNDescriptor baseDN : set)
144        {
145          dns.add(baseDN.getDn().toString());
146        }
147      }
148      if (dns.size() == 1)
149      {
150        String dn = dns.iterator().next();
151        sb.append(INFO_CTRL_PANEL_DELETE_BASE_DN_DESCRIPTION.get(dn));
152      }
153      else
154      {
155        ArrayList<String> quotedDns = new ArrayList<>();
156        for (String dn : dns)
157        {
158          quotedDns.add("'"+dn+"'");
159        }
160        sb.append(INFO_CTRL_PANEL_DELETE_BASE_DNS_DESCRIPTION.get(
161        Utilities.getStringFromCollection(quotedDns, ", ")));
162      }
163    }
164
165    if (!backendsToDelete.isEmpty())
166    {
167      if (sb.length() > 0)
168      {
169        sb.append("  ");
170      }
171      if (backendsToDelete.size() == 1)
172      {
173        sb.append(INFO_CTRL_PANEL_DELETE_BACKEND_DESCRIPTION.get(
174            backendsToDelete.iterator().next().getBackendID()));
175      }
176      else
177      {
178        ArrayList<String> ids = new ArrayList<>();
179        for (BackendDescriptor backend : backendsToDelete)
180        {
181          ids.add(backend.getBackendID());
182        }
183        sb.append(INFO_CTRL_PANEL_DELETE_BACKENDS_DESCRIPTION.get(
184        Utilities.getStringFromCollection(ids, ", ")));
185      }
186    }
187    return LocalizableMessage.raw(sb.toString());
188  }
189
190  @Override
191  public boolean canLaunch(Task taskToBeLaunched,
192      Collection<LocalizableMessage> incompatibilityReasons)
193  {
194    boolean canLaunch = true;
195    if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
196    {
197      // All the operations are incompatible if they apply to this
198      // backend for safety.  This is a short operation so the limitation
199      // has not a lot of impact.
200      Set<String> backends = new TreeSet<>(taskToBeLaunched.getBackends());
201      backends.retainAll(getBackends());
202      if (!backends.isEmpty())
203      {
204        incompatibilityReasons.add(
205            getIncompatibilityMessage(this, taskToBeLaunched));
206        canLaunch = false;
207      }
208    }
209    return canLaunch;
210  }
211
212  /**
213   * Update the configuration in the server.
214   * @throws OpenDsException if an error occurs.
215   */
216  private void updateConfiguration() throws OpenDsException, ConfigException
217  {
218    boolean configHandlerUpdated = false;
219    final int totalNumber = baseDNsToDelete.size() + backendsToDelete.size();
220    int numberDeleted = 0;
221    try
222    {
223      if (!isServerRunning())
224      {
225        configHandlerUpdated = true;
226        getInfo().stopPooling();
227        if (getInfo().mustDeregisterConfig())
228        {
229          DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config"));
230        }
231        DirectoryServer.getInstance().initializeConfiguration(
232            org.opends.server.extensions.ConfigFileHandler.class.getName(),
233            ConfigReader.configFile);
234        getInfo().setMustDeregisterConfig(true);
235      }
236      boolean isFirst = true;
237      for (final Set<BaseDNDescriptor> baseDNs : baseDNsToDelete.values())
238      {
239        if (!isFirst)
240        {
241          SwingUtilities.invokeLater(new Runnable()
242          {
243            @Override
244            public void run()
245            {
246              getProgressDialog().appendProgressHtml("<br><br>");
247            }
248          });
249        }
250        isFirst = false;
251
252        for (BaseDNDescriptor baseDN : baseDNs)
253        {
254          disableReplicationIfRequired(baseDN);
255        }
256
257        if (isServerRunning())
258        {
259          SwingUtilities.invokeLater(new Runnable()
260          {
261            @Override
262            public void run()
263            {
264              List<String> args =
265                getObfuscatedCommandLineArguments(
266                    getDSConfigCommandLineArguments(baseDNs));
267              args.removeAll(getConfigCommandLineArguments());
268              printEquivalentCommandLine(getConfigCommandLinePath(), args,
269                  INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_BASE_DN.get());
270            }
271          });
272        }
273        SwingUtilities.invokeLater(new Runnable()
274        {
275          @Override
276          public void run()
277          {
278            if (baseDNs.size() == 1)
279            {
280              String dn = baseDNs.iterator().next().getDn().toString();
281              getProgressDialog().appendProgressHtml(
282                  Utilities.getProgressWithPoints(
283                      INFO_CTRL_PANEL_DELETING_BASE_DN.get(dn),
284                      ColorAndFontConstants.progressFont));
285            }
286            else
287            {
288              ArrayList<String> dns = new ArrayList<>();
289              for (BaseDNDescriptor baseDN : baseDNs)
290              {
291                dns.add("'" + baseDN.getDn() + "'");
292              }
293              getProgressDialog().appendProgressHtml(
294                  Utilities.getProgressWithPoints(
295                      INFO_CTRL_PANEL_DELETING_BASE_DNS.get(
296                      Utilities.getStringFromCollection(dns, ", ")),
297                      ColorAndFontConstants.progressFont));
298            }
299          }
300        });
301        if (isServerRunning())
302        {
303          deleteBaseDNs(getInfo().getDirContext(), baseDNs);
304        }
305        else
306        {
307          deleteBaseDNs(baseDNs);
308        }
309        numberDeleted ++;
310        final int fNumberDeleted = numberDeleted;
311        SwingUtilities.invokeLater(new Runnable()
312        {
313          @Override
314          public void run()
315          {
316            getProgressDialog().getProgressBar().setIndeterminate(false);
317            getProgressDialog().getProgressBar().setValue(
318                (fNumberDeleted * 100) / totalNumber);
319            getProgressDialog().appendProgressHtml(
320                Utilities.getProgressDone(ColorAndFontConstants.progressFont));
321          }
322        });
323      }
324      for (final BackendDescriptor backend : backendsToDelete)
325      {
326        if (!isFirst)
327        {
328          SwingUtilities.invokeLater(new Runnable()
329          {
330            @Override
331            public void run()
332            {
333              getProgressDialog().appendProgressHtml("<br><br>");
334            }
335          });
336        }
337        for (BaseDNDescriptor baseDN : backend.getBaseDns())
338        {
339          disableReplicationIfRequired(baseDN);
340        }
341        isFirst = false;
342        if (isServerRunning())
343        {
344          SwingUtilities.invokeLater(new Runnable()
345          {
346            @Override
347            public void run()
348            {
349              List<String> args =
350                getObfuscatedCommandLineArguments(
351                    getDSConfigCommandLineArguments(backend));
352              args.removeAll(getConfigCommandLineArguments());
353              printEquivalentCommandLine(getConfigCommandLinePath(), args,
354                  INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_BACKEND.get());
355            }
356          });
357        }
358        SwingUtilities.invokeLater(new Runnable()
359        {
360          @Override
361          public void run()
362          {
363            getProgressDialog().appendProgressHtml(
364                  Utilities.getProgressWithPoints(
365                      INFO_CTRL_PANEL_DELETING_BACKEND.get(
366                          backend.getBackendID()),
367                      ColorAndFontConstants.progressFont));
368          }
369        });
370        if (isServerRunning())
371        {
372          deleteBackend(getInfo().getDirContext(), backend);
373        }
374        else
375        {
376          deleteBackend(backend);
377        }
378        numberDeleted ++;
379        final int fNumberDeleted = numberDeleted;
380        SwingUtilities.invokeLater(new Runnable()
381        {
382          @Override
383          public void run()
384          {
385            getProgressDialog().getProgressBar().setIndeterminate(false);
386            getProgressDialog().getProgressBar().setValue(
387                (fNumberDeleted * 100) / totalNumber);
388            getProgressDialog().appendProgressHtml(
389                Utilities.getProgressDone(ColorAndFontConstants.progressFont));
390          }
391        });
392      }
393    }
394    finally
395    {
396      if (configHandlerUpdated)
397      {
398        DirectoryServer.getInstance().initializeConfiguration(
399            ConfigReader.configClassName, ConfigReader.configFile);
400        getInfo().startPooling();
401      }
402    }
403  }
404
405  /**
406   * Deletes a set of base DNs.  The code assumes that the server is not running
407   * and that the configuration file can be edited.
408   * @param baseDNs the list of base DNs.
409   * @throws OpenDsException if an error occurs.
410   */
411  private void deleteBaseDNs(Set<BaseDNDescriptor> baseDNs)
412  throws OpenDsException, ConfigException
413  {
414    BackendDescriptor backend = baseDNs.iterator().next().getBackend();
415
416    SortedSet<DN> oldBaseDNs = new TreeSet<>();
417    for (BaseDNDescriptor baseDN : backend.getBaseDns())
418    {
419      oldBaseDNs.add(baseDN.getDn());
420    }
421    LinkedList<DN> newBaseDNs = new LinkedList<>(oldBaseDNs);
422    ArrayList<DN> dnsToRemove = new ArrayList<>();
423    for (BaseDNDescriptor baseDN : baseDNs)
424    {
425      dnsToRemove.add(baseDN.getDn());
426    }
427    newBaseDNs.removeAll(dnsToRemove);
428
429    String backendName = backend.getBackendID();
430    DN dn = DN.valueOf("ds-cfg-backend-id" + "=" + backendName + ",cn=Backends,cn=config");
431    ConfigEntry configEntry = DirectoryServer.getConfigHandler().getConfigEntry(dn);
432
433    DNConfigAttribute baseDNAttr =
434      new DNConfigAttribute(
435          ConfigConstants.ATTR_BACKEND_BASE_DN,
436          INFO_CONFIG_BACKEND_ATTR_DESCRIPTION_BASE_DNS.get(),
437          true, true, false, newBaseDNs);
438    configEntry.putConfigAttribute(baseDNAttr);
439    DirectoryServer.getConfigHandler().writeUpdatedConfig();
440  }
441
442  /**
443   * Deletes a set of base DNs.  The code assumes that the server is running
444   * and that the provided connection is active.
445   * @param baseDNs the list of base DNs.
446   * @param ctx the connection to the server.
447   * @throws OpenDsException if an error occurs.
448   */
449  private void deleteBaseDNs(InitialLdapContext ctx,
450      Set<BaseDNDescriptor> baseDNs) throws OpenDsException
451  {
452    ManagementContext mCtx = LDAPManagementContext.createFromContext(
453        JNDIDirContextAdaptor.adapt(ctx));
454    RootCfgClient root = mCtx.getRootConfiguration();
455    PluggableBackendCfgClient backend =
456      (PluggableBackendCfgClient)root.getBackend(
457          baseDNs.iterator().next().getBackend().getBackendID());
458    SortedSet<DN> oldBaseDNs = backend.getBaseDN();
459    SortedSet<DN> newBaseDNs = new TreeSet<>(oldBaseDNs);
460    ArrayList<DN> dnsToRemove = new ArrayList<>();
461    for (BaseDNDescriptor baseDN : baseDNs)
462    {
463      dnsToRemove.add(baseDN.getDn());
464    }
465    newBaseDNs.removeAll(dnsToRemove);
466    backend.setBaseDN(newBaseDNs);
467    backend.commit();
468  }
469
470  /**
471   * Deletes a backend.  The code assumes that the server is not running
472   * and that the configuration file can be edited.
473   * @param backend the backend to be deleted.
474   * @throws OpenDsException if an error occurs.
475   */
476  private void deleteBackend(BackendDescriptor backend) throws OpenDsException, ConfigException
477  {
478    DN dn = DN.valueOf("ds-cfg-backend-id" + "=" + backend.getBackendID() + ",cn=Backends,cn=config");
479    Utilities.deleteConfigSubtree(DirectoryServer.getConfigHandler(), dn);
480  }
481
482  /**
483   * Deletes a backend.  The code assumes that the server is running
484   * and that the provided connection is active.
485   * @param backend the backend to be deleted.
486   * @param ctx the connection to the server.
487   * @throws OpenDsException if an error occurs.
488   */
489  private void deleteBackend(InitialLdapContext ctx,
490      BackendDescriptor backend) throws OpenDsException
491  {
492    ManagementContext mCtx = LDAPManagementContext.createFromContext(
493        JNDIDirContextAdaptor.adapt(ctx));
494    RootCfgClient root = mCtx.getRootConfiguration();
495    root.removeBackend(backend.getBackendID());
496    root.commit();
497  }
498
499  @Override
500  protected String getCommandLinePath()
501  {
502    return null;
503  }
504
505  @Override
506  protected ArrayList<String> getCommandLineArguments()
507  {
508    return new ArrayList<>();
509  }
510
511  /**
512   * Returns the path of the command line to be used.
513   *
514   * @return the path of the command line to be used
515   */
516  private String getConfigCommandLinePath()
517  {
518    if (isServerRunning())
519    {
520      return getCommandLinePath("dsconfig");
521    }
522    return null;
523  }
524
525  @Override
526  public void runTask()
527  {
528    state = State.RUNNING;
529    lastException = null;
530
531    try
532    {
533      updateConfiguration();
534      state = State.FINISHED_SUCCESSFULLY;
535    }
536    catch (Throwable t)
537    {
538      lastException = t;
539      state = State.FINISHED_WITH_ERROR;
540    }
541  }
542
543  /**
544   * Return the dsconfig arguments required to delete a set of base DNs.
545   * @param baseDNs the base DNs to be deleted.
546   * @return the dsconfig arguments required to delete a set of base DNs.
547   */
548  private ArrayList<String> getDSConfigCommandLineArguments(
549      Set<BaseDNDescriptor> baseDNs)
550  {
551    ArrayList<String> args = new ArrayList<>();
552    if (isServerRunning())
553    {
554      args.add("set-backend-prop");
555      args.add("--backend-name");
556      args.add(baseDNs.iterator().next().getBackend().getBackendID());
557      args.add("--remove");
558      for (BaseDNDescriptor baseDN : baseDNs)
559      {
560        args.add("base-dn:" + baseDN.getDn());
561      }
562      args.addAll(getConnectionCommandLineArguments());
563      args.add("--no-prompt");
564    }
565    return args;
566  }
567
568  /**
569   * Return the dsconfig arguments required to delete a backend.
570   * @param backend the backend to be deleted.
571   * @return the dsconfig arguments required to delete a backend.
572   */
573  private ArrayList<String> getDSConfigCommandLineArguments(
574      BackendDescriptor backend)
575  {
576    ArrayList<String> args = new ArrayList<>();
577    args.add("delete-backend");
578    args.add("--backend-name");
579    args.add(backend.getBackendID());
580
581    args.addAll(getConnectionCommandLineArguments());
582    args.add("--no-prompt");
583    return args;
584  }
585
586  /**
587   * Disables replication if required: if the deleted base DN is replicated,
588   * update the replication configuration to remove any reference to it.
589   * @param baseDN the base DN that is going to be removed.
590   * @throws OpenDsException if an error occurs.
591   */
592  private void disableReplicationIfRequired(final BaseDNDescriptor baseDN)
593  throws OpenDsException, ConfigException
594  {
595    if (baseDN.getType() == BaseDNDescriptor.Type.REPLICATED)
596    {
597      final AtomicReference<String> domainName = new AtomicReference<>();
598
599      try
600      {
601        if (isServerRunning())
602        {
603          InitialLdapContext ctx = getInfo().getDirContext();
604          ManagementContext mCtx = LDAPManagementContext.createFromContext(
605              JNDIDirContextAdaptor.adapt(ctx));
606          RootCfgClient root = mCtx.getRootConfiguration();
607          ReplicationSynchronizationProviderCfgClient sync = null;
608          try
609          {
610            sync = (ReplicationSynchronizationProviderCfgClient)
611            root.getSynchronizationProvider("Multimaster Synchronization");
612          }
613          catch (OpenDsException oe)
614          {
615            // Ignore this one
616          }
617          if (sync != null)
618          {
619            String[] domains = sync.listReplicationDomains();
620            if (domains != null)
621            {
622              for (String dName : domains)
623              {
624                ReplicationDomainCfgClient domain = sync.getReplicationDomain(dName);
625                if (baseDN.getDn().equals(domain.getBaseDN()))
626                {
627                  domainName.set(dName);
628                  sync.removeReplicationDomain(dName);
629                  sync.commit();
630                  break;
631                }
632              }
633            }
634          }
635        }
636        else
637        {
638          RootCfg root =
639            ServerManagementContext.getInstance().getRootConfiguration();
640          ReplicationSynchronizationProviderCfg sync = null;
641          try
642          {
643            sync = (ReplicationSynchronizationProviderCfg)
644            root.getSynchronizationProvider("Multimaster Synchronization");
645          }
646          catch (ConfigException oe)
647          {
648            // Ignore this one
649          }
650          if (sync != null)
651          {
652            String[] domains = sync.listReplicationDomains();
653            if (domains != null)
654            {
655              for (String dName : domains)
656              {
657                ReplicationDomainCfg domain = sync.getReplicationDomain(dName);
658                DN dn = domain.getBaseDN();
659                if (dn.equals(baseDN.getDn()))
660                {
661                  domainName.set(dName);
662                  DN entryDN = domain.dn();
663                  Utilities.deleteConfigSubtree(
664                      DirectoryServer.getConfigHandler(), entryDN);
665                  break;
666                }
667              }
668            }
669          }
670        }
671      }
672      finally
673      {
674        // This is not super clean, but this way we calculate the domain name only once.
675        if (isServerRunning() && domainName.get() != null)
676        {
677          SwingUtilities.invokeLater(new Runnable()
678          {
679            @Override
680            public void run()
681            {
682              List<String> args =
683                getObfuscatedCommandLineArguments(
684                    getCommandLineArgumentsToDisableReplication(domainName.get()));
685              args.removeAll(getConfigCommandLineArguments());
686              args.add(getNoPropertiesFileArgument());
687              printEquivalentCommandLine(getConfigCommandLinePath(), args,
688                  INFO_CTRL_PANEL_EQUIVALENT_CMD_TO_DELETE_DOMAIN.get(baseDN.getDn()));
689              }
690          });
691        }
692        SwingUtilities.invokeLater(new Runnable()
693        {
694          @Override
695          public void run()
696          {
697            getProgressDialog().appendProgressHtml(
698                Utilities.getProgressWithPoints(
699                    INFO_CTRL_PANEL_DELETING_DOMAIN.get(baseDN.getDn()),
700                    ColorAndFontConstants.progressFont));
701          }
702        });
703      }
704      SwingUtilities.invokeLater(new Runnable()
705      {
706        @Override
707        public void run()
708        {
709          getProgressDialog().appendProgressHtml(
710              Utilities.getProgressDone(ColorAndFontConstants.progressFont)+
711              "<br>");
712        }
713      });
714    }
715  }
716
717  /**
718   * Return the dsconfig arguments required to delete a replication domain.
719   * @param domainName the name of the domain to be deleted.
720   * @return the dsconfig arguments required to delete a replication domain.
721   */
722  private ArrayList<String> getCommandLineArgumentsToDisableReplication(
723      String domainName)
724  {
725    ArrayList<String> args = new ArrayList<>();
726    args.add("delete-replication-domain");
727    args.add("--provider-name");
728    args.add("Multimaster Synchronization");
729    args.add("--domain-name");
730    args.add(domainName);
731    args.addAll(getConnectionCommandLineArguments());
732    args.add("--no-prompt");
733    return args;
734  }
735}
736