legacy/src/main/java/thredds/catalog/crawl/CatalogCrawler.java
public void crawlDataset(InvDataset ds, CancelTask task, PrintWriter out, Object context, boolean release) {
    boolean isCatRef = (ds instanceof InvCatalogRef);
    if (filter != null && filter.skipAll(ds)) {
      if (isCatRef && release) ((InvCatalogRef) ds).release();
      return;
    }

    boolean isDataScan = ds.findProperty("DatasetScan") != null;

    if (isCatRef) {
      InvCatalogRef catref = (InvCatalogRef) ds;
      if (out != null)
        out.println(" **CATREF " + catref.getURI() + " (" + ds.getName() + ") ");
      countCatrefs++;

      if (!listen.getCatalogRef( catref, context)) {
        if (release) catref.release();
        return;
      }
    }

    if (!isCatRef || isDataScan)
      listen.getDataset(ds, context);

    // recurse - depth first
      List<InvDataset> dlist = ds.getDatasets();
      if (isCatRef) {
        InvCatalogRef catref = (InvCatalogRef) ds;
        if (!isDataScan) {
          listen.getDataset(catref.getProxyDataset(), context); // wait till a catref is read, so all metadata is there !
        }
      }

      for (InvDataset dds : dlist) {
        crawlDataset(dds, task, out, context, release);
        if ((task != null) && task.isCancel())
          break;
      }

    if (isCatRef && release) {
      InvCatalogRef catref = (InvCatalogRef) ds;
      catref.release();
    }

  }
public void crawlDataset(InvDataset ds, CancelTask task, PrintWriter out, Object context, boolean release) {
    boolean isCatRef = (ds instanceof InvCatalogRef);
    if (filter != null && filter.skipAll(ds)) {
      if (isCatRef && release) ((InvCatalogRef) ds).release();
      return;
    }

    boolean isDataScan = ds.findProperty("DatasetScan") != null;

    if (isCatRef) {
      InvCatalogRef catref = (InvCatalogRef) ds;
      if (out != null)
        out.println(" **CATREF " + catref.getURI() + " (" + ds.getName() + ") ");
      countCatrefs++;

      if (!listen.getCatalogRef( catref, context)) {
        if (release) catref.release();
        return;
      }
    }

    if (!isCatRef || isDataScan)
      listen.getDataset(ds, context);

    // recurse - depth first
      List<InvDataset> dlist = ds.getDatasets();
      if (isCatRef) {
        InvCatalogRef catref = (InvCatalogRef) ds;
        if (!isDataScan) {
          listen.getDataset(catref.getProxyDataset(), context); // wait till a catref is read, so all metadata is there !
        }
      }

      for (InvDataset dds : dlist) {
        crawlDataset(dds, task, out, context, release);
        if ((task != null) && task.isCancel())
          break;
      }

    if (isCatRef && release) {
      InvCatalogRef catref = (InvCatalogRef) ds;
      catref.release();
    }

  }
public void crawlDataset ( InvDataset ds , CancelTask task , PrintWriter out , Object context , boolean release ) { boolean isCatRef = ( ds instanceof InvCatalogRef ) ; if ( filter != null && filter . skipAll ( ds ) ) { if ( isCatRef && release ) ( ( InvCatalogRef ) ds ) . release ( ) ; return ; } boolean isDataScan = ds . findProperty ( "DatasetScan" ) != null ; if ( isCatRef ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; if ( out != null ) out . println ( " **CATREF " + catref . getURI ( ) + " (" + ds . getName ( ) + ") " ) ; countCatrefs ++ ; if ( ! listen . getCatalogRef ( catref , context ) ) { if ( release ) catref . release ( ) ; return ; } } if ( ! isCatRef || isDataScan ) listen . getDataset ( ds , context ) ; // recurse - depth first List < InvDataset > dlist = ds . getDatasets ( ) ; if ( isCatRef ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; if ( ! isDataScan ) { listen . getDataset ( catref . getProxyDataset ( ) , context ) ; // wait till a catref is read, so all metadata is there ! } } for ( InvDataset dds : dlist ) { crawlDataset ( dds , task , out , context , release ) ; if ( ( task != null ) && task . isCancel ( ) ) break ; } if ( isCatRef && release ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; catref . release ( ) ; } }
Crawl this dataset recursively, return all datasets

@param ds   the dataset
@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)
Crawl this dataset recursively return all datasets