Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Commit

Permalink
Point Collection FeatureCollections update working
Browse files Browse the repository at this point in the history
Fixed #378

The update function would update the local state of the available date/time range
of the dataset in the catalog, but this was not being properly checked in the
request validation. Note that this essentially doubles the check of the date/time
range.
  • Loading branch information
lesserwhirls committed Feb 8, 2016
1 parent 3e10f07 commit 5cea2af
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tds/src/main/java/thredds/server/ncss/params/NcssParamsBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import thredds.server.ncss.validation.TimeParamsConstraint;
import thredds.server.ncss.validation.VarParamConstraint;
import ucar.nc2.ft.FeatureDataset;
import ucar.nc2.ft.point.collection.UpdateableCollection;
import ucar.nc2.time.Calendar;
import ucar.nc2.time.CalendarDate;
import ucar.nc2.time.CalendarDateFormatter;
Expand All @@ -49,6 +50,7 @@
import ucar.unidata.geoloc.LatLonPointImpl;
import ucar.unidata.geoloc.LatLonRect;

import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
import java.util.Formatter;
Expand All @@ -65,6 +67,8 @@
@NcssRequestConstraint
public class NcssParamsBean {

private org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger("featureCollectionScan");

private String accept;

@VarParamConstraint
Expand Down Expand Up @@ -405,6 +409,24 @@ public boolean isValidGridRequest() {

public boolean intersectsTime(FeatureDataset fd, Formatter errs) throws ParseException {
CalendarDateRange have = fd.getCalendarDateRange();
try {
//
// if this is an updatable collection, check for a new CalendarDateRange (i.e. new
// data available).
// The issue is that fd does not get updated with thredds.catalog.InvDatasetFcPoint
//
// This allows requests to be fulfilled, even if the correct CalendarDateRange is
// not available in the catalog. Ideally these should be synced.
//
UpdateableCollection uc = (UpdateableCollection) fd;
have = uc.update();
} catch (IOException ioe) {
fd.getLocation();
log.error("NCSS I/O Error for location %s", fd.getLocation());
log.error(ioe.getLocalizedMessage());
} catch (ClassCastException cce) {
// not an updateable collection...just keep going.
}
if (have == null) return true;
Calendar dataCal = have.getStart().getCalendar(); // use the same calendar as the dataset

Expand Down

0 comments on commit 5cea2af

Please sign in to comment.