tds/src/main/java/thredds/featurecollection/InvDatasetFeatureCollection.java
protected CatalogBuilder makeCatalogFiles(URI catURI, State localState, List<String> filenames, boolean addLatest) throws IOException {
    Catalog parentCatalog = parent.getParentCatalog();

    CatalogBuilder result = new CatalogBuilder();
    result.setName(makeFullName(parent));
    result.setVersion(parentCatalog.getVersion());
    result.setBaseURI(catURI);
    result.addService(orgService);

    DatasetBuilder top = new DatasetBuilder(null);
    top.transferInheritedMetadata(parent); // make all inherited metadata local
    top.setName(FILES);

    // add Variables, GeospatialCoverage, TimeCoverage
    ThreddsMetadata tmi = top.getInheritableMetadata();
    tmi.set(Dataset.TimeCoverage, null);      // LOOK
    if (localState.coverage != null) {
      tmi.set(Dataset.GeospatialCoverage, localState.coverage);
    }
    tmi.set(Dataset.ServiceName, orgService.getName());
    result.addDataset(top);

    if (addLatest) {
      DatasetBuilder latest = new DatasetBuilder(top);
      latest.setName(getLatestFileName());
      latest.put(Dataset.UrlPath, LATEST_DATASET_CATALOG);
      latest.put(Dataset.Id, LATEST_DATASET_CATALOG);
      latest.put(Dataset.ServiceName, latestService.getName());
      latest.addServiceToCatalog(latestService);
      top.addDataset(latest);
    }

    // sort copy of files
    List<String> sortedFilenames = new ArrayList<>(filenames);
    Collections.sort(sortedFilenames, String.CASE_INSENSITIVE_ORDER);

    // if not increasing (i.e. we WANT newest file listed first), reverse sort
    if (!this.config.getSortFilesAscending()) {
      Collections.reverse(sortedFilenames);
    }

    for (String f : sortedFilenames) {
      if (!f.startsWith(topDirectory))
        logger.warn("File {} doesnt start with topDir {}", f, topDirectory);

      DatasetBuilder ds = new DatasetBuilder(top);

      String fname = f.substring(topDirectory.length() + 1);
      ds.setName(fname);

      String lpath = this.configPath + "/" + FILES + "/" + fname;
      // String lpath = getPath() + "/" + FILES + "/" + fname;
      ds.put(Dataset.UrlPath, lpath);
      ds.put(Dataset.Id, lpath);
      ds.put(Dataset.VariableMapLinkURI, new ThreddsMetadata.UriResolved(makeMetadataLink(lpath, VARIABLES), catURI));

      File file = new File(f);
      ds.put(Dataset.DataSize, file.length());
      top.addDataset(ds);
    }

    return result;
  }
protected CatalogBuilder makeCatalogFiles(URI catURI, State localState, List<String> filenames, boolean addLatest) throws IOException {
    Catalog parentCatalog = parent.getParentCatalog();

    CatalogBuilder result = new CatalogBuilder();
    result.setName(makeFullName(parent));
    result.setVersion(parentCatalog.getVersion());
    result.setBaseURI(catURI);
    result.addService(orgService);

    DatasetBuilder top = new DatasetBuilder(null);
    top.transferInheritedMetadata(parent); // make all inherited metadata local
    top.setName(FILES);

    // add Variables, GeospatialCoverage, TimeCoverage
    ThreddsMetadata tmi = top.getInheritableMetadata();
    tmi.set(Dataset.TimeCoverage, null);      // LOOK
    if (localState.coverage != null) {
      tmi.set(Dataset.GeospatialCoverage, localState.coverage);
    }
    tmi.set(Dataset.ServiceName, orgService.getName());
    result.addDataset(top);

    if (addLatest) {
      DatasetBuilder latest = new DatasetBuilder(top);
      latest.setName(getLatestFileName());
      latest.put(Dataset.UrlPath, LATEST_DATASET_CATALOG);
      latest.put(Dataset.Id, LATEST_DATASET_CATALOG);
      latest.put(Dataset.ServiceName, latestService.getName());
      latest.addServiceToCatalog(latestService);
      top.addDataset(latest);
    }

    // sort copy of files
    List<String> sortedFilenames = new ArrayList<>(filenames);
    Collections.sort(sortedFilenames, String.CASE_INSENSITIVE_ORDER);

    // if not increasing (i.e. we WANT newest file listed first), reverse sort
    if (!this.config.getSortFilesAscending()) {
      Collections.reverse(sortedFilenames);
    }

    for (String f : sortedFilenames) {
      if (!f.startsWith(topDirectory))
        logger.warn("File {} doesnt start with topDir {}", f, topDirectory);

      DatasetBuilder ds = new DatasetBuilder(top);

      String fname = f.substring(topDirectory.length() + 1);
      ds.setName(fname);

      String lpath = this.configPath + "/" + FILES + "/" + fname;
      // String lpath = getPath() + "/" + FILES + "/" + fname;
      ds.put(Dataset.UrlPath, lpath);
      ds.put(Dataset.Id, lpath);
      ds.put(Dataset.VariableMapLinkURI, new ThreddsMetadata.UriResolved(makeMetadataLink(lpath, VARIABLES), catURI));

      File file = new File(f);
      ds.put(Dataset.DataSize, file.length());
      top.addDataset(ds);
    }

    return result;
  }
protected CatalogBuilder makeCatalogFiles ( URI catURI , State localState , List < String > filenames , boolean addLatest ) throws IOException { Catalog parentCatalog = parent . getParentCatalog ( ) ; CatalogBuilder result = new CatalogBuilder ( ) ; result . setName ( makeFullName ( parent ) ) ; result . setVersion ( parentCatalog . getVersion ( ) ) ; result . setBaseURI ( catURI ) ; result . addService ( orgService ) ; DatasetBuilder top = new DatasetBuilder ( null ) ; top . transferInheritedMetadata ( parent ) ; // make all inherited metadata local top . setName ( FILES ) ; // add Variables, GeospatialCoverage, TimeCoverage ThreddsMetadata tmi = top . getInheritableMetadata ( ) ; tmi . set ( Dataset . TimeCoverage , null ) ; // LOOK if ( localState . coverage != null ) { tmi . set ( Dataset . GeospatialCoverage , localState . coverage ) ; } tmi . set ( Dataset . ServiceName , orgService . getName ( ) ) ; result . addDataset ( top ) ; if ( addLatest ) { DatasetBuilder latest = new DatasetBuilder ( top ) ; latest . setName ( getLatestFileName ( ) ) ; latest . put ( Dataset . UrlPath , LATEST_DATASET_CATALOG ) ; latest . put ( Dataset . Id , LATEST_DATASET_CATALOG ) ; latest . put ( Dataset . ServiceName , latestService . getName ( ) ) ; latest . addServiceToCatalog ( latestService ) ; top . addDataset ( latest ) ; } // sort copy of files List < String > sortedFilenames = new ArrayList <> ( filenames ) ; Collections . sort ( sortedFilenames , String . CASE_INSENSITIVE_ORDER ) ; // if not increasing (i.e. we WANT newest file listed first), reverse sort if ( ! this . config . getSortFilesAscending ( ) ) { Collections . reverse ( sortedFilenames ) ; } for ( String f : sortedFilenames ) { if ( ! f . startsWith ( topDirectory ) ) logger . warn ( "File {} doesnt start with topDir {}" , f , topDirectory ) ; DatasetBuilder ds = new DatasetBuilder ( top ) ; String fname = f . substring ( topDirectory . length ( ) + 1 ) ; ds . setName ( fname ) ; String lpath = this . configPath + "/" + FILES + "/" + fname ; // String lpath = getPath() + "/" + FILES + "/" + fname; ds . put ( Dataset . UrlPath , lpath ) ; ds . put ( Dataset . Id , lpath ) ; ds . put ( Dataset . VariableMapLinkURI , new ThreddsMetadata . UriResolved ( makeMetadataLink ( lpath , VARIABLES ) , catURI ) ) ; File file = new File ( f ) ; ds . put ( Dataset . DataSize , file . length ( ) ) ; top . addDataset ( ds ) ; } return result ; }
this catalog lists the individual files comprising the collection.
this catalog lists the individual files comprising the collection .