tdcommon/src/main/java/thredds/server/catalog/DataRootPathMatcher.java
public void extractDataRoots(String catalogRelPath, List<Dataset> dsList, boolean checkDups, Map<String, String> idMap) {

    for (Dataset dataset : dsList) {
      if (dataset instanceof DatasetScan) {
        DatasetScan ds = (DatasetScan) dataset;
        addRoot(ds, catalogRelPath, checkDups);

      } else if (dataset instanceof FeatureCollectionRef) {
        FeatureCollectionRef fc = (FeatureCollectionRef) dataset;
        addRoot(fc, catalogRelPath, checkDups);

        if (idMap != null) {
          String catWithSameFc = idMap.get(fc.getCollectionName());
          if (catWithSameFc != null)
            logCatalogInit.warn("*** ERROR: Duplicate featureCollection name {} in catalogs '{}' and '{}'", fc.getCollectionName(), catalogRelPath, catWithSameFc);
          else
            idMap.put(fc.getCollectionName(), catalogRelPath);
        }

      } else if (dataset instanceof CatalogScan) {
        CatalogScan catScan = (CatalogScan) dataset;
        addRoot(catScan, catalogRelPath, checkDups);
      }

      if (!(dataset instanceof CatalogRef)) {
        // recurse
        extractDataRoots(catalogRelPath, dataset.getDatasetsLocal(), checkDups, idMap);
      }
    }
  }
public void extractDataRoots(String catalogRelPath, List<Dataset> dsList, boolean checkDups, Map<String, String> idMap) {

    for (Dataset dataset : dsList) {
      if (dataset instanceof DatasetScan) {
        DatasetScan ds = (DatasetScan) dataset;
        addRoot(ds, catalogRelPath, checkDups);

      } else if (dataset instanceof FeatureCollectionRef) {
        FeatureCollectionRef fc = (FeatureCollectionRef) dataset;
        addRoot(fc, catalogRelPath, checkDups);

        if (idMap != null) {
          String catWithSameFc = idMap.get(fc.getCollectionName());
          if (catWithSameFc != null)
            logCatalogInit.warn("*** ERROR: Duplicate featureCollection name {} in catalogs '{}' and '{}'", fc.getCollectionName(), catalogRelPath, catWithSameFc);
          else
            idMap.put(fc.getCollectionName(), catalogRelPath);
        }

      } else if (dataset instanceof CatalogScan) {
        CatalogScan catScan = (CatalogScan) dataset;
        addRoot(catScan, catalogRelPath, checkDups);
      }

      if (!(dataset instanceof CatalogRef)) {
        // recurse
        extractDataRoots(catalogRelPath, dataset.getDatasetsLocal(), checkDups, idMap);
      }
    }
  }
Finds datasetScan, datasetFmrc
Look for duplicate Ids (give message).
Dont follow catRefs.

@param dsList the list of Dataset