legacy/src/main/java/thredds/catalog/crawl/CatalogCrawler.java
public int crawl(String catUrl, CancelTask task, PrintWriter out, Object context) {
    InvCatalogFactory catFactory = InvCatalogFactory.getDefaultFactory(true);
    InvCatalogImpl cat = catFactory.readXML(catUrl);
    StringBuilder buff = new StringBuilder();
    boolean isValid = cat.check(buff, false);

    if (out != null) {
      out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid");
      out.println(" validation output=\n" + buff);
    }
    if (isValid)
      return crawl(cat, task, out, context);
    return 0;
  }
public int crawl(String catUrl, CancelTask task, PrintWriter out, Object context) {
    InvCatalogFactory catFactory = InvCatalogFactory.getDefaultFactory(true);
    InvCatalogImpl cat = catFactory.readXML(catUrl);
    StringBuilder buff = new StringBuilder();
    boolean isValid = cat.check(buff, false);

    if (out != null) {
      out.println("catalog <" + cat.getName() + "> " + (isValid ? "is" : "is not") + " valid");
      out.println(" validation output=\n" + buff);
    }
    if (isValid)
      return crawl(cat, task, out, context);
    return 0;
  }
public int crawl ( String catUrl , CancelTask task , PrintWriter out , Object context ) { InvCatalogFactory catFactory = InvCatalogFactory . getDefaultFactory ( true ) ; InvCatalogImpl cat = catFactory . readXML ( catUrl ) ; StringBuilder buff = new StringBuilder ( ) ; boolean isValid = cat . check ( buff , false ) ; if ( out != null ) { out . println ( "catalog <" + cat . getName ( ) + "> " + ( isValid ? "is" : "is not" ) + " valid" ) ; out . println ( " validation output=\n" + buff ) ; } if ( isValid ) return crawl ( cat , task , out , context ) ; return 0 ; }
Open a catalog and crawl (depth first) all the datasets in it.
Close catalogs and release their resources as you.

@param catUrl url of catalog to open
@param task   user can cancel the task (may be null)
@param out    send status messages to here (may be null)
@param context caller can pass this object in (used for thread safety)
@return number of catalog references opened and crawled
Open a catalog and crawl ( depth first ) all the datasets in it . Close catalogs and release their resources as you .