legacy/src/main/java/thredds/cataloggen/config/DodsDirDatasetSource.java
protected List expandThisLevel( InvDataset dataset, String prefixUrlPath )
  {
    // @todo Switch to return type of InvDataset (???) so can return error messages about datasets removed from list.
    if ( dataset == null) throw new NullPointerException( "Given dataset cannot be null.");
    if ( ! isCollection( dataset)) throw new IllegalArgumentException( "Dataset \"" + dataset.getName() + "\" is not a collection dataset.");

    List dsList = new ArrayList();

    // Get list of possible datasets from current URL.
    List possibleDsList = null;
    try
    {
      possibleDsList = urlExtractor.extract( dataset.getName());
    }
    catch (java.io.IOException e)
    {
      log.warn(  "expandThisLevel(): IOException while extracting dataset info from given OPeNDAP directory <" + dataset.getName() + ">, return empty list: " + e.getMessage());
      return( dsList);
    }

    // Handle each link in the current access path.
    String curDsUrlString = null;
    URI curDsUri = null;
    InvDataset curDs = null;
    for ( Iterator it = possibleDsList.iterator(); it.hasNext() ; ) // @todo curDsUrlString = (String) it.next())
    {
      curDsUrlString = (String) it.next();

      // Skip datasets that aren't OPeNDAP datasets (".html") or collection datasets ("/").
      if ( (! curDsUrlString.endsWith( ".html")) && (! curDsUrlString.endsWith( "/")))
      {
        log.warn(  "expandThisLevel(): Dataset isn't an OPeNDAP dataset or collection dataset, skip <" + dataset.getName() + ">.");
        continue;
      }

      // Remove ".html" extension.
      if ( curDsUrlString.endsWith( ".html"))
      {
        curDsUrlString = curDsUrlString.substring( 0, curDsUrlString.length() - 5);
      }

      // Avoid links back down the path hierarchy (i.e., parent directory links).
      if ( ! curDsUrlString.startsWith( this.accessPointHeaderUri.toString()))
      {
        log.debug( "expandThisLevel(): current path <" + curDsUrlString + "> not child of given" +
                " location <" + this.accessPointHeaderUri.toString() + ">, skip.");
        continue;
      }

      // Get URI from URL string.
      try
      {
        curDsUri = new URI( curDsUrlString);
      }
      catch ( URISyntaxException e )
      {
        log.error( "expandThisLevel(): Skipping dataset  <" + curDsUrlString + "> due to URISyntaxException: " + e.getMessage());
        continue;
      }
      log.debug( "expandThisLevel(): handle dataset (" + curDsUrlString + ")");

      try
      {
        curDs = new DodsDirInvDataset( null, curDsUri);
      }
      catch ( IOException e )
      {
        log.warn( "expandThisLevel(): skipping dataset <" + curDsUri.toString() + ">, not under accessPointHeader: " + e.getMessage());
        continue;
      }

      dsList.add( curDs);
    } // END - loop through files in current directory

    return( dsList);
  }
protected List expandThisLevel( InvDataset dataset, String prefixUrlPath )
  {
    // @todo Switch to return type of InvDataset (???) so can return error messages about datasets removed from list.
    if ( dataset == null) throw new NullPointerException( "Given dataset cannot be null.");
    if ( ! isCollection( dataset)) throw new IllegalArgumentException( "Dataset \"" + dataset.getName() + "\" is not a collection dataset.");

    List dsList = new ArrayList();

    // Get list of possible datasets from current URL.
    List possibleDsList = null;
    try
    {
      possibleDsList = urlExtractor.extract( dataset.getName());
    }
    catch (java.io.IOException e)
    {
      log.warn(  "expandThisLevel(): IOException while extracting dataset info from given OPeNDAP directory <" + dataset.getName() + ">, return empty list: " + e.getMessage());
      return( dsList);
    }

    // Handle each link in the current access path.
    String curDsUrlString = null;
    URI curDsUri = null;
    InvDataset curDs = null;
    for ( Iterator it = possibleDsList.iterator(); it.hasNext() ; ) // @todo curDsUrlString = (String) it.next())
    {
      curDsUrlString = (String) it.next();

      // Skip datasets that aren't OPeNDAP datasets (".html") or collection datasets ("/").
      if ( (! curDsUrlString.endsWith( ".html")) && (! curDsUrlString.endsWith( "/")))
      {
        log.warn(  "expandThisLevel(): Dataset isn't an OPeNDAP dataset or collection dataset, skip <" + dataset.getName() + ">.");
        continue;
      }

      // Remove ".html" extension.
      if ( curDsUrlString.endsWith( ".html"))
      {
        curDsUrlString = curDsUrlString.substring( 0, curDsUrlString.length() - 5);
      }

      // Avoid links back down the path hierarchy (i.e., parent directory links).
      if ( ! curDsUrlString.startsWith( this.accessPointHeaderUri.toString()))
      {
        log.debug( "expandThisLevel(): current path <" + curDsUrlString + "> not child of given" +
                " location <" + this.accessPointHeaderUri.toString() + ">, skip.");
        continue;
      }

      // Get URI from URL string.
      try
      {
        curDsUri = new URI( curDsUrlString);
      }
      catch ( URISyntaxException e )
      {
        log.error( "expandThisLevel(): Skipping dataset  <" + curDsUrlString + "> due to URISyntaxException: " + e.getMessage());
        continue;
      }
      log.debug( "expandThisLevel(): handle dataset (" + curDsUrlString + ")");

      try
      {
        curDs = new DodsDirInvDataset( null, curDsUri);
      }
      catch ( IOException e )
      {
        log.warn( "expandThisLevel(): skipping dataset <" + curDsUri.toString() + ">, not under accessPointHeader: " + e.getMessage());
        continue;
      }

      dsList.add( curDs);
    } // END - loop through files in current directory

    return( dsList);
  }
protected List expandThisLevel ( InvDataset dataset , String prefixUrlPath ) { // @todo Switch to return type of InvDataset (???) so can return error messages about datasets removed from list. if ( dataset == null ) throw new NullPointerException ( "Given dataset cannot be null." ) ; if ( ! isCollection ( dataset ) ) throw new IllegalArgumentException ( "Dataset \"" + dataset . getName ( ) + "\" is not a collection dataset." ) ; List dsList = new ArrayList ( ) ; // Get list of possible datasets from current URL. List possibleDsList = null ; try { possibleDsList = urlExtractor . extract ( dataset . getName ( ) ) ; } catch ( java . io . IOException e ) { log . warn ( "expandThisLevel(): IOException while extracting dataset info from given OPeNDAP directory <" + dataset . getName ( ) + ">, return empty list: " + e . getMessage ( ) ) ; return ( dsList ) ; } // Handle each link in the current access path. String curDsUrlString = null ; URI curDsUri = null ; InvDataset curDs = null ; for ( Iterator it = possibleDsList . iterator ( ) ; it . hasNext ( ) ; ) // @todo curDsUrlString = (String) it.next()) { curDsUrlString = ( String ) it . next ( ) ; // Skip datasets that aren't OPeNDAP datasets (".html") or collection datasets ("/"). if ( ( ! curDsUrlString . endsWith ( ".html" ) ) && ( ! curDsUrlString . endsWith ( "/" ) ) ) { log . warn ( "expandThisLevel(): Dataset isn't an OPeNDAP dataset or collection dataset, skip <" + dataset . getName ( ) + ">." ) ; continue ; } // Remove ".html" extension. if ( curDsUrlString . endsWith ( ".html" ) ) { curDsUrlString = curDsUrlString . substring ( 0 , curDsUrlString . length ( ) - 5 ) ; } // Avoid links back down the path hierarchy (i.e., parent directory links). if ( ! curDsUrlString . startsWith ( this . accessPointHeaderUri . toString ( ) ) ) { log . debug ( "expandThisLevel(): current path <" + curDsUrlString + "> not child of given" + " location <" + this . accessPointHeaderUri . toString ( ) + ">, skip." ) ; continue ; } // Get URI from URL string. try { curDsUri = new URI ( curDsUrlString ) ; } catch ( URISyntaxException e ) { log . error ( "expandThisLevel(): Skipping dataset  <" + curDsUrlString + "> due to URISyntaxException: " + e . getMessage ( ) ) ; continue ; } log . debug ( "expandThisLevel(): handle dataset (" + curDsUrlString + ")" ) ; try { curDs = new DodsDirInvDataset ( null , curDsUri ) ; } catch ( IOException e ) { log . warn ( "expandThisLevel(): skipping dataset <" + curDsUri . toString ( ) + ">, not under accessPointHeader: " + e . getMessage ( ) ) ; continue ; } dsList . add ( curDs ) ; } // END - loop through files in current directory return ( dsList ) ; }
Return a list of the InvDatasets contained in the given collection dataset
on this DatasetSource.

@param dataset - the collection dataset to be expanded.
@return A list of the InvDatasets contained in the given collection dataset.
@throws IllegalArgumentException when given dataset is not a collection dataset.
@throws NullPointerException if given dataset is null.
@throws ClassCastException if the given InvDataset is not a DodsDirInvDataset.
Return a list of the InvDatasets contained in the given collection dataset on this DatasetSource .