protected InvDatasetScan readDatasetScan(InvCatalogImpl catalog, InvDatasetImpl parent, Element dsElem, URI base) {
    InvDatasetScan datasetScan;

    if (dsElem.getAttributeValue("dirLocation") == null) {
      if (dsElem.getAttributeValue("location") == null) {
        logger.error("readDatasetScan(): datasetScan has neither a \"location\" nor a \"dirLocation\" attribute.");
        datasetScan = null;
      } else {
        return readDatasetScanNew(catalog, parent, dsElem, base);
      }
    } else {
      String name = dsElem.getAttributeValue("name");
      factory.appendWarning("**Warning: Dataset " + name + " using old form of DatasetScan (dirLocation instead of location)\n");

      String path = dsElem.getAttributeValue("path");

      String scanDir = expandAliasForPath(dsElem.getAttributeValue("dirLocation"));
      String filter = dsElem.getAttributeValue("filter");
      String addDatasetSizeString = dsElem.getAttributeValue("addDatasetSize");
      String addLatest = dsElem.getAttributeValue("addLatest");
      String sortOrderIncreasingString = dsElem.getAttributeValue("sortOrderIncreasing");
      boolean sortOrderIncreasing = false;
      if (sortOrderIncreasingString != null)
        if (sortOrderIncreasingString.equalsIgnoreCase("true"))
          sortOrderIncreasing = true;
      boolean addDatasetSize = true;
      if (addDatasetSizeString != null)
        if (addDatasetSizeString.equalsIgnoreCase("false"))
          addDatasetSize = false;

      if (path != null) {
        if (path.charAt(0) == '/') path = path.substring(1);
        int last = path.length() - 1;
        if (path.charAt(last) == '/') path = path.substring(0, last);
      }

      if (scanDir != null) {
        int last = scanDir.length() - 1;
        if (scanDir.charAt(last) != '/') scanDir = scanDir + '/';
      }

      Element atcElem = dsElem.getChild("addTimeCoverage", defNS);
      String dsNameMatchPattern = null;
      String startTimeSubstitutionPattern = null;
      String duration = null;
      if (atcElem != null) {
        dsNameMatchPattern = atcElem.getAttributeValue("datasetNameMatchPattern");
        startTimeSubstitutionPattern = atcElem.getAttributeValue("startTimeSubstitutionPattern");
        duration = atcElem.getAttributeValue("duration");
      }

      try {
        datasetScan = new InvDatasetScan(catalog, parent, name, path, scanDir, filter, addDatasetSize, addLatest, sortOrderIncreasing,
                dsNameMatchPattern, startTimeSubstitutionPattern, duration);
        readDatasetInfo(catalog, datasetScan, dsElem, base);
        if (InvCatalogFactory.debugXML) System.out.println(" Dataset added: " + datasetScan.dump());

      } catch (Exception e) {
        logger.error("Reading DatasetScan", e);
        datasetScan = null;
      }
    }

    return datasetScan;
  }
protected InvDatasetScan readDatasetScan ( InvCatalogImpl catalog , InvDatasetImpl parent , Element dsElem , URI base ) { InvDatasetScan datasetScan ; if ( dsElem . getAttributeValue ( "dirLocation" ) == null ) { if ( dsElem . getAttributeValue ( "location" ) == null ) { logger . error ( "readDatasetScan(): datasetScan has neither a \"location\" nor a \"dirLocation\" attribute." ) ; datasetScan = null ; } else { return readDatasetScanNew ( catalog , parent , dsElem , base ) ; } } else { String name = dsElem . getAttributeValue ( "name" ) ; factory . appendWarning ( "**Warning: Dataset " + name + " using old form of DatasetScan (dirLocation instead of location)\n" ) ; String path = dsElem . getAttributeValue ( "path" ) ; String scanDir = expandAliasForPath ( dsElem . getAttributeValue ( "dirLocation" ) ) ; String filter = dsElem . getAttributeValue ( "filter" ) ; String addDatasetSizeString = dsElem . getAttributeValue ( "addDatasetSize" ) ; String addLatest = dsElem . getAttributeValue ( "addLatest" ) ; String sortOrderIncreasingString = dsElem . getAttributeValue ( "sortOrderIncreasing" ) ; boolean sortOrderIncreasing = false ; if ( sortOrderIncreasingString != null ) if ( sortOrderIncreasingString . equalsIgnoreCase ( "true" ) ) sortOrderIncreasing = true ; boolean addDatasetSize = true ; if ( addDatasetSizeString != null ) if ( addDatasetSizeString . equalsIgnoreCase ( "false" ) ) addDatasetSize = false ; if ( path != null ) { if ( path . charAt ( 0 ) == '/' ) path = path . substring ( 1 ) ; int last = path . length ( ) - 1 ; if ( path . charAt ( last ) == '/' ) path = path . substring ( 0 , last ) ; } if ( scanDir != null ) { int last = scanDir . length ( ) - 1 ; if ( scanDir . charAt ( last ) != '/' ) scanDir = scanDir + '/' ; } Element atcElem = dsElem . getChild ( "addTimeCoverage" , defNS ) ; String dsNameMatchPattern = null ; String startTimeSubstitutionPattern = null ; String duration = null ; if ( atcElem != null ) { dsNameMatchPattern = atcElem . getAttributeValue ( "datasetNameMatchPattern" ) ; startTimeSubstitutionPattern = atcElem . getAttributeValue ( "startTimeSubstitutionPattern" ) ; duration = atcElem . getAttributeValue ( "duration" ) ; } try { datasetScan = new InvDatasetScan ( catalog , parent , name , path , scanDir , filter , addDatasetSize , addLatest , sortOrderIncreasing , dsNameMatchPattern , startTimeSubstitutionPattern , duration ) ; readDatasetInfo ( catalog , datasetScan , dsElem , base ) ; if ( InvCatalogFactory . debugXML ) System . out . println ( " Dataset added: " + datasetScan . dump ( ) ) ; } catch ( Exception e ) { logger . error ( "Reading DatasetScan" , e ) ; datasetScan = null ; } } return datasetScan ; }
read a dataset scan element