tds/src/main/java/thredds/core/CatalogManager.java
public Catalog getCatalog(String path, URI baseURI) throws IOException {
    if (path == null)
      return null;

    String workPath = path;
    if (workPath.startsWith("/"))
      workPath = workPath.substring(1);

    // Check if its a CatalogBuilder or ConfigCatalog
    Object dyno = makeDynamicCatalog(workPath, baseURI);
    if (dyno != null) {
      CatalogBuilder catBuilder;
      if (dyno instanceof CatalogBuilder) {
        catBuilder = (CatalogBuilder) dyno;
      } else {
        ConfigCatalog configCatalog = (ConfigCatalog) dyno;
        catBuilder = configCatalog.makeCatalogBuilder();     // turn it back into mutable object
      }
      addGlobalServices(catBuilder);
      return catBuilder.makeCatalog();
    }

    // check cache and read if needed
    ConfigCatalog configCatalog = ccc.get(workPath);
    if (configCatalog == null) return null;
    CatalogBuilder catBuilder = configCatalog.makeCatalogBuilder();
    addGlobalServices(catBuilder);
    return catBuilder.makeCatalog();
  }
public Catalog getCatalog(String path, URI baseURI) throws IOException {
    if (path == null)
      return null;

    String workPath = path;
    if (workPath.startsWith("/"))
      workPath = workPath.substring(1);

    // Check if its a CatalogBuilder or ConfigCatalog
    Object dyno = makeDynamicCatalog(workPath, baseURI);
    if (dyno != null) {
      CatalogBuilder catBuilder;
      if (dyno instanceof CatalogBuilder) {
        catBuilder = (CatalogBuilder) dyno;
      } else {
        ConfigCatalog configCatalog = (ConfigCatalog) dyno;
        catBuilder = configCatalog.makeCatalogBuilder();     // turn it back into mutable object
      }
      addGlobalServices(catBuilder);
      return catBuilder.makeCatalog();
    }

    // check cache and read if needed
    ConfigCatalog configCatalog = ccc.get(workPath);
    if (configCatalog == null) return null;
    CatalogBuilder catBuilder = configCatalog.makeCatalogBuilder();
    addGlobalServices(catBuilder);
    return catBuilder.makeCatalog();
  }
If a catalog exists and is allowed (not filtered out) for the given path, return
the catalog as an Catalog. Otherwise, return null.
<p>
The validity of the returned catalog is not guaranteed. Use Catalog.check() to
check that the catalog is valid.

@param path    the path for the requested catalog.
@param baseURI the base URI for the catalog, used to resolve relative URLs.
@return the requested Catalog, or null if catalog does not exist or is not allowed.