tdcommon/src/main/java/thredds/server/catalog/writer/ThreddsMetadataExtractor.java
public ThreddsMetadata extract(Dataset threddsDataset) throws IOException {
    ThreddsMetadata metadata = new ThreddsMetadata();
    Map<String, Object> flds = metadata.getFlds();

    try ( DataFactory.Result result = new DataFactory().openFeatureDataset(threddsDataset, null)) {
      if (result.fatalError) {
        logger.warn(" openFeatureDataset failed, errs=%s%n", result.errLog);
        return null;
      }

      if (result.featureType.isCoverageFeatureType()) {
        GridDataset gridDataset = (GridDataset) result.featureDataset; // LOOK wrong
        flds.put(Dataset.GeospatialCoverage, extractGeospatial(gridDataset));

        CalendarDateRange tc = extractCalendarDateRange(gridDataset);
        if (tc != null)
          flds.put(Dataset.TimeCoverage, tc);

        ThreddsMetadata.VariableGroup vars = extractVariables(threddsDataset.getDataFormatName(), gridDataset);
        if (vars != null)
          flds.put(Dataset.VariableGroups, vars);

      } else if (result.featureType.isPointFeatureType()) {
        PointDatasetImpl pobsDataset = (PointDatasetImpl) result.featureDataset;
        LatLonRect llbb = pobsDataset.getBoundingBox();
        if (null != llbb)
          flds.put(Dataset.GeospatialCoverage, new ThreddsMetadata.GeospatialCoverage(llbb, null, 0.0, 0.0));

        CalendarDateRange tc = extractCalendarDateRange(pobsDataset);
        if (tc != null)
          flds.put(Dataset.TimeCoverage, tc);

        ThreddsMetadata.VariableGroup vars = extractVariables(pobsDataset);
        if (vars != null)
          flds.put(Dataset.VariableGroups, vars);
      }

    } catch (IOException ioe) {
      logger.error("Error opening dataset " + threddsDataset.getName(), ioe);
    }

    return metadata;
  }
public ThreddsMetadata extract(Dataset threddsDataset) throws IOException {
    ThreddsMetadata metadata = new ThreddsMetadata();
    Map<String, Object> flds = metadata.getFlds();

    try ( DataFactory.Result result = new DataFactory().openFeatureDataset(threddsDataset, null)) {
      if (result.fatalError) {
        logger.warn(" openFeatureDataset failed, errs=%s%n", result.errLog);
        return null;
      }

      if (result.featureType.isCoverageFeatureType()) {
        GridDataset gridDataset = (GridDataset) result.featureDataset; // LOOK wrong
        flds.put(Dataset.GeospatialCoverage, extractGeospatial(gridDataset));

        CalendarDateRange tc = extractCalendarDateRange(gridDataset);
        if (tc != null)
          flds.put(Dataset.TimeCoverage, tc);

        ThreddsMetadata.VariableGroup vars = extractVariables(threddsDataset.getDataFormatName(), gridDataset);
        if (vars != null)
          flds.put(Dataset.VariableGroups, vars);

      } else if (result.featureType.isPointFeatureType()) {
        PointDatasetImpl pobsDataset = (PointDatasetImpl) result.featureDataset;
        LatLonRect llbb = pobsDataset.getBoundingBox();
        if (null != llbb)
          flds.put(Dataset.GeospatialCoverage, new ThreddsMetadata.GeospatialCoverage(llbb, null, 0.0, 0.0));

        CalendarDateRange tc = extractCalendarDateRange(pobsDataset);
        if (tc != null)
          flds.put(Dataset.TimeCoverage, tc);

        ThreddsMetadata.VariableGroup vars = extractVariables(pobsDataset);
        if (vars != null)
          flds.put(Dataset.VariableGroups, vars);
      }

    } catch (IOException ioe) {
      logger.error("Error opening dataset " + threddsDataset.getName(), ioe);
    }

    return metadata;
  }
public ThreddsMetadata extract ( Dataset threddsDataset ) throws IOException { ThreddsMetadata metadata = new ThreddsMetadata ( ) ; Map < String , Object > flds = metadata . getFlds ( ) ; try ( DataFactory . Result result = new DataFactory ( ) . openFeatureDataset ( threddsDataset , null ) ) { if ( result . fatalError ) { logger . warn ( " openFeatureDataset failed, errs=%s%n" , result . errLog ) ; return null ; } if ( result . featureType . isCoverageFeatureType ( ) ) { GridDataset gridDataset = ( GridDataset ) result . featureDataset ; // LOOK wrong flds . put ( Dataset . GeospatialCoverage , extractGeospatial ( gridDataset ) ) ; CalendarDateRange tc = extractCalendarDateRange ( gridDataset ) ; if ( tc != null ) flds . put ( Dataset . TimeCoverage , tc ) ; ThreddsMetadata . VariableGroup vars = extractVariables ( threddsDataset . getDataFormatName ( ) , gridDataset ) ; if ( vars != null ) flds . put ( Dataset . VariableGroups , vars ) ; } else if ( result . featureType . isPointFeatureType ( ) ) { PointDatasetImpl pobsDataset = ( PointDatasetImpl ) result . featureDataset ; LatLonRect llbb = pobsDataset . getBoundingBox ( ) ; if ( null != llbb ) flds . put ( Dataset . GeospatialCoverage , new ThreddsMetadata . GeospatialCoverage ( llbb , null , 0.0 , 0.0 ) ) ; CalendarDateRange tc = extractCalendarDateRange ( pobsDataset ) ; if ( tc != null ) flds . put ( Dataset . TimeCoverage , tc ) ; ThreddsMetadata . VariableGroup vars = extractVariables ( pobsDataset ) ; if ( vars != null ) flds . put ( Dataset . VariableGroups , vars ) ; } } catch ( IOException ioe ) { logger . error ( "Error opening dataset " + threddsDataset . getName ( ) , ioe ) ; } return metadata ; }
extract info from underlying feature dataset
@param threddsDataset  call DataFactory().openFeatureDataset() to open it
@return results in ThreddsMetadata object
@throws IOException
extract info from underlying feature dataset