diff --git a/data-access/servlet/src/main/java/common/Subsurvey.java b/data-access/servlet/src/main/java/common/Subsurvey.java index 0ffe4d8ccfa11166a285823dc786d5f5b3a30d43..38c8379cc7633bab928b6452fef8c72045964e69 100644 --- a/data-access/servlet/src/main/java/common/Subsurvey.java +++ b/data-access/servlet/src/main/java/common/Subsurvey.java @@ -60,6 +60,25 @@ class Subsurvey throw new AssertionError(subsurvey_id + " not found in surveys table"); } + static public Subsurvey findSubsurveyByStoragePath(Subsurvey[] dbSubsurveys, String storagePath) + { + LOGGER.info("trace storagePath: " + storagePath); + + for(Subsurvey curr : dbSubsurveys) + { + //curr.storage_path.strip("/"); + //storagePath.strip("/"); + + if(curr.storage_path.equals(storagePath)) + { + return curr; + } + } + + throw new AssertionError(storagePath + " storage-path not found in surveys table"); + } + + @@ -74,6 +93,17 @@ class Subsurvey return keyRecords; } + static public FitsCard[] subsurveysFindCardsByStoragePath(Subsurvey[] subsurveys, String storagePath) + { + if(subsurveys == null) return null; + + Subsurvey subsurvey = Subsurvey.findSubsurveyByStoragePath(subsurveys, storagePath); + + FitsCard[] keyRecords = FitsCard.convertToFitsCard(subsurvey.rf, subsurvey.vel_unit); + + return keyRecords; + } + diff --git a/data-access/servlet/src/main/java/webapi/ServletCutout.java b/data-access/servlet/src/main/java/webapi/ServletCutout.java index 8747ce90367fa280545d976523187b93ad037158..f0784e625bee9ff89ba4a8065e6f9fe1e66d3b5f 100644 --- a/data-access/servlet/src/main/java/webapi/ServletCutout.java +++ b/data-access/servlet/src/main/java/webapi/ServletCutout.java @@ -129,7 +129,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet protected CutResult doCutoutFile(String id, Pos pos, Band band, Time time, Pol pol, String pixels, - boolean countNullValues, String respFormat) + boolean countNullValues) throws IOException, InterruptedException { LOGGER.info("trace"); @@ -137,6 +137,8 @@ public class ServletCutout extends javax.servlet.http.HttpServlet String relPathname; int hdunum; + FitsCard[] extraCards = null; + String dbUri = settings.dbConn.uri(); if(settings.dbConn.isDbUriEmpty()) @@ -145,6 +147,16 @@ public class ServletCutout extends javax.servlet.http.HttpServlet rsl.resolve(id); relPathname = rsl.relPathname(); hdunum = rsl.hdunum(); + + /* FIXME needs also match on filename - some subsurveys have the same storage-path, + * and file-filter distiguishes frequences + * OR + * ivoid must include obs-collection + + Path path = Paths.get(rsl.relPathname()); + String storagePath = path.getParent().toString(); + extraCards = Subsurvey.subsurveysFindCardsByStoragePath(subsurveys, storagePath); + */ } else { @@ -153,7 +165,6 @@ public class ServletCutout extends javax.servlet.http.HttpServlet relPathname = rsl.relPathname(); hdunum = rsl.hdunum(); String subsurveyId = rsl.obsCollection(); - FitsCard[] extraCards = null; if(subsurveyId != null) { extraCards = Subsurvey.subsurveysFindCards(subsurveys, subsurveyId); @@ -162,16 +173,12 @@ public class ServletCutout extends javax.servlet.http.HttpServlet { LOGGER.info("Resolver with Obscore returns subsurveyId null: no extraCards loaded."); } - // FIXME use of extraCards not implemented } final String DEFAULT_TIME_SYSTEM = "MJD_UTC"; // FIXME take from confif file - //if(pos != null) pos.setSystem(DEFAULT_SKY_SYSTEM); - //if(band != null) band.setSystem(DEFAULT_SPEC_SYSTEM); - //if(time != null) time.setSystem(DEFAULT_TIME_SYSTEM); - - CutResult cutResult = cutout.doFile(relPathname, hdunum, pos, band, time, pol, pixels, false, null); + CutResult cutResult = cutout.doFile(relPathname, hdunum, pos, band, time, pol, pixels, + countNullValues, extraCards); return cutResult; } @@ -283,8 +290,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet boolean countNullValues = vlkbReq_getNullValues(request); response.setContentType(respFormat); - CutResult cutResult = doCutoutFile(id, pos, band, time, pol, pixels, countNullValues, - respFormat); + CutResult cutResult = doCutoutFile(id, pos, band, time, pol, pixels, countNullValues);// FIXME wh? , respFormat); /* FIXME errors from engine not checked - cut-file might not have been created */ @@ -300,7 +306,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet id, pos, band, time, pol, pixels, countNullValues, showDuration, startTime_msec); - writer.close(); /* must close to force flush to complete the xml */ + writer.close(); /* must close to force flush to complete the xml */ } else {