legacy/src/main/java/thredds/catalog/dl/DIFWriter.java
public void writeDatasetEntries( InvCatalogImpl cat, String fileDir, StringBuilder mess) {
    this.fileDir = fileDir;
    this.messBuffer = mess;

    File dir = new File(fileDir);
    if (!dir.exists()) {
      boolean ret = dir.mkdirs();
      assert ret;
    }

    CatalogCrawler.Listener listener = new CatalogCrawler.Listener() {
      public void getDataset(InvDataset ds, Object context) {
        doOneDataset(ds);
      }
      public boolean getCatalogRef(InvCatalogRef dd, Object context) { return true; }
      
    };

    ByteArrayOutputStream bis = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter( new OutputStreamWriter(bis, CDM.utf8Charset));
    CatalogCrawler crawler = new CatalogCrawler( CatalogCrawler.USE_ALL, true, listener);
    crawler.crawl(cat, null, pw, null);
    mess.append("\n*********************\n");
    mess.append(new String(bis.toByteArray(), CDM.utf8Charset));
  }
public void writeDatasetEntries( InvCatalogImpl cat, String fileDir, StringBuilder mess) {
    this.fileDir = fileDir;
    this.messBuffer = mess;

    File dir = new File(fileDir);
    if (!dir.exists()) {
      boolean ret = dir.mkdirs();
      assert ret;
    }

    CatalogCrawler.Listener listener = new CatalogCrawler.Listener() {
      public void getDataset(InvDataset ds, Object context) {
        doOneDataset(ds);
      }
      public boolean getCatalogRef(InvCatalogRef dd, Object context) { return true; }
      
    };

    ByteArrayOutputStream bis = new ByteArrayOutputStream();
    PrintWriter pw = new PrintWriter( new OutputStreamWriter(bis, CDM.utf8Charset));
    CatalogCrawler crawler = new CatalogCrawler( CatalogCrawler.USE_ALL, true, listener);
    crawler.crawl(cat, null, pw, null);
    mess.append("\n*********************\n");
    mess.append(new String(bis.toByteArray(), CDM.utf8Charset));
  }
public void writeDatasetEntries ( InvCatalogImpl cat , String fileDir , StringBuilder mess ) { this . fileDir = fileDir ; this . messBuffer = mess ; File dir = new File ( fileDir ) ; if ( ! dir . exists ( ) ) { boolean ret = dir . mkdirs ( ) ; assert ret ; } CatalogCrawler . Listener listener = new CatalogCrawler . Listener ( ) { public void getDataset ( InvDataset ds , Object context ) { doOneDataset ( ds ) ; } public boolean getCatalogRef ( InvCatalogRef dd , Object context ) { return true ; } } ; ByteArrayOutputStream bis = new ByteArrayOutputStream ( ) ; PrintWriter pw = new PrintWriter ( new OutputStreamWriter ( bis , CDM . utf8Charset ) ) ; CatalogCrawler crawler = new CatalogCrawler ( CatalogCrawler . USE_ALL , true , listener ) ; crawler . crawl ( cat , null , pw , null ) ; mess . append ( "\n*********************\n" ) ; mess . append ( new String ( bis . toByteArray ( ) , CDM . utf8Charset ) ) ; }
Write all harvestable datasets to DIF records that have at least the minimum metadata.
Call isDatasetUseable() to find out.

@param cat harvest the datasets starting from here
@param fileDir write records to this directory. The dataset id is used as the filename, appending "dif.xml"
@param mess status messages are appended here
Write all harvestable datasets to DIF records that have at least the minimum metadata . Call isDatasetUseable () to find out .