public void crawlDirectDatasets ( 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 ; } 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 ; } } // get datasets with data access ("leaves") List < InvDataset > dlist = ds . getDatasets ( ) ; List < InvDataset > leaves = new ArrayList < InvDataset > ( ) ; for ( InvDataset dds : dlist ) { if ( dds . hasAccess ( ) ) leaves . add ( dds ) ; } if ( leaves . size ( ) > 0 ) { if ( type == Type . first_direct ) { InvDataset dds = leaves . get ( 0 ) ; listen . getDataset ( dds , context ) ; } else if ( type == Type . random_direct ) { listen . getDataset ( chooseRandom ( leaves ) , context ) ; } else if ( type == Type . random_direct_middle ) { listen . getDataset ( chooseRandomNotFirstOrLast ( leaves ) , context ) ; } else { // do all of them for ( InvDataset dds : leaves ) { listen . getDataset ( dds , context ) ; if ( ( task != null ) && task . isCancel ( ) ) break ; } } } // recurse for ( InvDataset dds : dlist ) { if ( dds . hasNestedDatasets ( ) ) crawlDirectDatasets ( dds , task , out , context , release ) ; if ( ( task != null ) && task . isCancel ( ) ) break ; } /* if (out != null) { int took = (int) (System.currentTimeMillis() - start); out.println(" ** " + ds.getName() + " took " + took + " msecs\n"); } */ if ( ds instanceof InvCatalogRef && release ) { InvCatalogRef catref = ( InvCatalogRef ) ds ; catref . release ( ) ; } }
Crawl this dataset recursively . Only send back direct datasets