@SuppressWarnings({"MethodLength", "unchecked"})
  private <T extends RESTResponse> T handleRequest(
      Route route, Map<String, String> vars, Object body) {
    // update HMS catalog route counter metric
    final String metricName = hmsCatalogMetricCount(route.name());
    Counter counter = Metrics.getOrCreateCounter(metricName);
    if (counter != null) {
      counter.inc();
    }
    switch (route) {
      case TOKENS:
        return (T) tokens(body);

      case CONFIG:
        return (T) config();

      case LIST_NAMESPACES:
        return (T) listNamespaces(vars);

      case CREATE_NAMESPACE:
        return (T) createNamespace(body);

      case LOAD_NAMESPACE:
        return (T) loadNamespace(vars);

      case DROP_NAMESPACE:
        return (T) dropNamespace(vars);

      case UPDATE_NAMESPACE:
        return (T) updateNamespace(vars, body);

      case LIST_TABLES:
        return (T) listTables(vars);

      case CREATE_TABLE:
        return (T) createTable(vars, body);

      case DROP_TABLE:
        return (T) dropTable(vars);

      case LOAD_TABLE:
        return (T) loadTable(vars);

      case REGISTER_TABLE:
        return (T) registerTable(vars, body);

      case UPDATE_TABLE:
        return (T) updateTable(vars, body);

      case RENAME_TABLE:
        return (T) renameTable(body);

      case REPORT_METRICS:
        return (T) reportMetrics(body);

      case COMMIT_TRANSACTION:
        return (T) commitTransaction(body);
        
      case LIST_VIEWS:
        return (T) listViews(vars);

      case CREATE_VIEW:
          return (T) createView(vars, body);

      case LOAD_VIEW:
        return (T) loadView(vars);

      case UPDATE_VIEW:
        return (T) updateView(vars, body);
        
      case RENAME_VIEW:
        return (T) renameView(vars);
        
      case DROP_VIEW:
        return (T) dropView(vars);

      default:
    }
    return null;
  }
This is a very simplistic approach that only validates the requirements for each table and does
not do any other conflict detection. Therefore, it does not guarantee true transactional
atomicity, which is left to the implementation details of a REST server.
standalone-metastore/metastore-rest-catalog/src/main/java/org/apache/iceberg/rest/HMSCatalogAdapter.java