tds/src/main/java/thredds/core/CatalogManager.java
private Object makeDynamicCatalog(String path, URI baseURI) throws IOException {
    boolean isLatest = path.endsWith("/latest.xml");

    // strip off the filename
    int pos = path.lastIndexOf("/");
    String workPath = (pos >= 0) ? path.substring(0, pos) : path;
    String filename = (pos > 0) ? path.substring(pos + 1) : path;

    // now look through the data roots for a maximal match
    DataRootManager.DataRootMatch match = dataRootManager.findDataRootMatch(workPath);
    if (match == null)
      return null;

    // Feature Collection
    if (match.dataRoot.getFeatureCollection() != null) {
      InvDatasetFeatureCollection fc = featureCollectionCache.get(match.dataRoot.getFeatureCollection());

      if (isLatest)
        return fc.makeLatest(match.remaining, path, baseURI);
      else
        return fc.makeCatalog(match.remaining, path, baseURI);
    }

    // DatasetScan
    DatasetScan dscan = match.dataRoot.getDatasetScan();
    if (dscan != null) {
      if (log.isDebugEnabled()) log.debug("makeDynamicCatalog(): Calling DatasetScan.makeCatalogForDirectory( " + baseURI + ", " + path + ").");
      CatalogBuilder cat;

      if (isLatest)
        cat = dscan.makeCatalogForLatest(workPath, baseURI);
      else
        cat = dscan.makeCatalogForDirectory(workPath, baseURI);

      if (null == cat)
        log.error("makeDynamicCatalog(): DatasetScan.makeCatalogForDirectory failed = " + workPath);

      return cat;
    }

    // CatalogScan
    CatalogScan catScan = match.dataRoot.getCatalogScan();
    if (catScan != null) {
      if (!filename.equalsIgnoreCase(CatalogScan.CATSCAN)) { // its an actual catalog
        return catScan.getCatalog(tdsContext.getThreddsDirectory(), match.remaining, filename, ccc);
      }

      if (log.isDebugEnabled()) log.debug("makeDynamicCatalog(): Calling CatalogScan.makeCatalogForDirectory( " + baseURI + ", " + path + ").");
      CatalogBuilder cat = catScan.makeCatalogFromDirectory(tdsContext.getThreddsDirectory(), match.remaining, baseURI);

      if (null == cat)
        log.error("makeDynamicCatalog(): CatalogScan.makeCatalogForDirectory failed = " + workPath);

      return cat;
    }

    log.warn("makeDynamicCatalog() failed for =" + workPath + " request path= " + path);
    return null;
  }
private Object makeDynamicCatalog(String path, URI baseURI) throws IOException {
    boolean isLatest = path.endsWith("/latest.xml");

    // strip off the filename
    int pos = path.lastIndexOf("/");
    String workPath = (pos >= 0) ? path.substring(0, pos) : path;
    String filename = (pos > 0) ? path.substring(pos + 1) : path;

    // now look through the data roots for a maximal match
    DataRootManager.DataRootMatch match = dataRootManager.findDataRootMatch(workPath);
    if (match == null)
      return null;

    // Feature Collection
    if (match.dataRoot.getFeatureCollection() != null) {
      InvDatasetFeatureCollection fc = featureCollectionCache.get(match.dataRoot.getFeatureCollection());

      if (isLatest)
        return fc.makeLatest(match.remaining, path, baseURI);
      else
        return fc.makeCatalog(match.remaining, path, baseURI);
    }

    // DatasetScan
    DatasetScan dscan = match.dataRoot.getDatasetScan();
    if (dscan != null) {
      if (log.isDebugEnabled()) log.debug("makeDynamicCatalog(): Calling DatasetScan.makeCatalogForDirectory( " + baseURI + ", " + path + ").");
      CatalogBuilder cat;

      if (isLatest)
        cat = dscan.makeCatalogForLatest(workPath, baseURI);
      else
        cat = dscan.makeCatalogForDirectory(workPath, baseURI);

      if (null == cat)
        log.error("makeDynamicCatalog(): DatasetScan.makeCatalogForDirectory failed = " + workPath);

      return cat;
    }

    // CatalogScan
    CatalogScan catScan = match.dataRoot.getCatalogScan();
    if (catScan != null) {
      if (!filename.equalsIgnoreCase(CatalogScan.CATSCAN)) { // its an actual catalog
        return catScan.getCatalog(tdsContext.getThreddsDirectory(), match.remaining, filename, ccc);
      }

      if (log.isDebugEnabled()) log.debug("makeDynamicCatalog(): Calling CatalogScan.makeCatalogForDirectory( " + baseURI + ", " + path + ").");
      CatalogBuilder cat = catScan.makeCatalogFromDirectory(tdsContext.getThreddsDirectory(), match.remaining, baseURI);

      if (null == cat)
        log.error("makeDynamicCatalog(): CatalogScan.makeCatalogForDirectory failed = " + workPath);

      return cat;
    }

    log.warn("makeDynamicCatalog() failed for =" + workPath + " request path= " + path);
    return null;
  }
private Object makeDynamicCatalog ( String path , URI baseURI ) throws IOException { boolean isLatest = path . endsWith ( "/latest.xml" ) ; // strip off the filename int pos = path . lastIndexOf ( "/" ) ; String workPath = ( pos >= 0 ) ? path . substring ( 0 , pos ) : path ; String filename = ( pos > 0 ) ? path . substring ( pos + 1 ) : path ; // now look through the data roots for a maximal match DataRootManager . DataRootMatch match = dataRootManager . findDataRootMatch ( workPath ) ; if ( match == null ) return null ; // Feature Collection if ( match . dataRoot . getFeatureCollection ( ) != null ) { InvDatasetFeatureCollection fc = featureCollectionCache . get ( match . dataRoot . getFeatureCollection ( ) ) ; if ( isLatest ) return fc . makeLatest ( match . remaining , path , baseURI ) ; else return fc . makeCatalog ( match . remaining , path , baseURI ) ; } // DatasetScan DatasetScan dscan = match . dataRoot . getDatasetScan ( ) ; if ( dscan != null ) { if ( log . isDebugEnabled ( ) ) log . debug ( "makeDynamicCatalog(): Calling DatasetScan.makeCatalogForDirectory( " + baseURI + ", " + path + ")." ) ; CatalogBuilder cat ; if ( isLatest ) cat = dscan . makeCatalogForLatest ( workPath , baseURI ) ; else cat = dscan . makeCatalogForDirectory ( workPath , baseURI ) ; if ( null == cat ) log . error ( "makeDynamicCatalog(): DatasetScan.makeCatalogForDirectory failed = " + workPath ) ; return cat ; } // CatalogScan CatalogScan catScan = match . dataRoot . getCatalogScan ( ) ; if ( catScan != null ) { if ( ! filename . equalsIgnoreCase ( CatalogScan . CATSCAN ) ) { // its an actual catalog return catScan . getCatalog ( tdsContext . getThreddsDirectory ( ) , match . remaining , filename , ccc ) ; } if ( log . isDebugEnabled ( ) ) log . debug ( "makeDynamicCatalog(): Calling CatalogScan.makeCatalogForDirectory( " + baseURI + ", " + path + ")." ) ; CatalogBuilder cat = catScan . makeCatalogFromDirectory ( tdsContext . getThreddsDirectory ( ) , match . remaining , baseURI ) ; if ( null == cat ) log . error ( "makeDynamicCatalog(): CatalogScan.makeCatalogForDirectory failed = " + workPath ) ; return cat ; } log . warn ( "makeDynamicCatalog() failed for =" + workPath + " request path= " + path ) ; return null ; }
barfola on the return type
barfola on the return type