public void remove()

in modules/core/src/main/java/org/apache/fluo/core/client/FluoAdminImpl.java [236:279]


  public void remove() {
    if (applicationRunning()) {
      throw new FluoException("Error - The Fluo '" + config.getApplicationName() + "' application"
          + " is already running and must be stopped before removing. Aborted remove.");
    }
    if (!config.hasRequiredAdminProps()) {
      throw new IllegalArgumentException("Admin configuration is missing required properties");
    }
    Preconditions.checkArgument(
        !ZookeeperUtil.parseRoot(config.getInstanceZookeepers()).equals("/"),
        "The Zookeeper connection string (set by 'fluo.connection.zookeepers') "
            + " must have a chroot suffix.");

    if (OracleServerUtils.oracleExists(getAppCurator())) {
      throw new FluoException("Must stop the oracle server to remove an application");
    }

    try (AccumuloClient client = AccumuloUtil.getClient(config)) {
      boolean tableExists = client.tableOperations().exists(config.getAccumuloTable());
      // With preconditions met, it's now OK to delete table & zookeeper root (if they exist)
      if (tableExists) {
        logger.info("The Accumulo table '{}' will be dropped", config.getAccumuloTable());
        try {
          client.tableOperations().delete(config.getAccumuloTable());
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }
    }

    try {
      if (rootCurator.checkExists().forPath(appRootDir) != null) {
        logger.info("Clearing Fluo '{}' application in Zookeeper at {}",
            config.getApplicationName(), config.getAppZookeepers());
        rootCurator.delete().deletingChildrenIfNeeded().forPath(appRootDir);
      }
    } catch (KeeperException.NoNodeException nne) {
      // it's ok if node doesn't exist
    } catch (Exception e) {
      logger.error("An error occurred deleting Zookeeper root of [" + config.getAppZookeepers()
          + "], error=[" + e.getMessage() + "]");
      throw new RuntimeException(e);
    }
  }