@Override
  public void prepareAMAndConfigForLaunch(
      SliderFileSystem fileSystem,
      Configuration serviceConf,
      AbstractLauncher launcher,
      AggregateConf instanceDescription,
      Path snapshotConfDirPath,
      Path generatedConfDirPath,
      Configuration clientConfExtras,
      String libdir,
      Path tempPath,
      boolean miniClusterTestRun)
      throws IOException, SliderException {
    // load in the template site config
    log.debug("Loading template configuration from {}", snapshotConfDirPath);
    Configuration siteConf =
        ConfigHelper.loadTemplateConfiguration(
            serviceConf,
            snapshotConfDirPath,
            AccumuloKeys.SITE_XML,
            AccumuloKeys.SITE_XML_RESOURCE);

    Map<String, LocalResource> providerResources;
    providerResources =
        fileSystem.submitDirectory(generatedConfDirPath, SliderKeys.PROPAGATED_CONF_DIR_NAME);

    ProviderUtils.addProviderJar(
        providerResources,
        this,
        "slider-accumulo-provider.jar",
        fileSystem,
        tempPath,
        libdir,
        miniClusterTestRun);

    addAccumuloDependencyJars(providerResources, fileSystem, libdir, tempPath);
    launcher.addLocalResources(providerResources);

    // construct the cluster configuration values

    ConfTreeOperations appconf = instanceDescription.getAppConfOperations();

    Map<String, String> clusterConfMap = buildSiteConfFromInstance(instanceDescription);

    // merge them
    ConfigHelper.addConfigMap(siteConf, clusterConfMap.entrySet(), "Accumulo Provider");

    // now, if there is an extra client conf, merge it in too
    if (clientConfExtras != null) {
      ConfigHelper.mergeConfigurations(siteConf, clientConfExtras, "Slider Client");
    }

    if (log.isDebugEnabled()) {
      log.debug("Merged Configuration");
      ConfigHelper.dumpConf(siteConf);
    }

    Path sitePath =
        ConfigHelper.saveConfig(serviceConf, siteConf, generatedConfDirPath, AccumuloKeys.SITE_XML);

    log.debug("Saving the config to {}", sitePath);
    launcher.submitDirectory(generatedConfDirPath, SliderKeys.PROPAGATED_CONF_DIR_NAME);
  }