From 480ae8c839acaf1840f463c579f76d964ef5a178 Mon Sep 17 00:00:00 2001 From: Robert Butora <robert.butora@gmail.com> Date: Thu, 28 Mar 2024 09:09:56 -0400 Subject: [PATCH] modifies API recognition: VLKB-legacy only if 'l'&'b' params present in query string and synchronizes it with cutout/merge URL generation (VLKB-legacy or VO-Siav2) --- .../config/formatresponsefilter.properties | 4 +-- .../src/main/java/vlkb/common/Coord.java | 28 +++++++++++++------ .../vlkb/webapi/FormatResponseFilter.java | 4 +-- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/data-discovery/config/formatresponsefilter.properties b/data-discovery/config/formatresponsefilter.properties index f36192b..a4a55a2 100644 --- a/data-discovery/config/formatresponsefilter.properties +++ b/data-discovery/config/formatresponsefilter.properties @@ -1,6 +1,6 @@ -response_format=application/x-votable+xml -# response_format=application/x-vlkb+xml +#response_format=application/x-votable+xml +response_format=application/x-vlkb+xml # used to retrieve extraCards to add to FITS_header (VLKB-only) surveys_metadata_abs_pathname=/srv/vlkb/surveys/survey_populate.csv diff --git a/data-discovery/src/main/java/vlkb/common/Coord.java b/data-discovery/src/main/java/vlkb/common/Coord.java index 2e2db1f..7384304 100644 --- a/data-discovery/src/main/java/vlkb/common/Coord.java +++ b/data-discovery/src/main/java/vlkb/common/Coord.java @@ -23,16 +23,19 @@ class Coord double vel_up; double vel_low; - // constructors + private boolean API_VLKB_legacy = false; + Coord(Map<String, String[]> params) { - String id = getFirstValue(params, "ID"); - String pubdid = getFirstValue(params, "pubdid"); + String api_l = getFirstValue(params, "l"); + String api_b = getFirstValue(params, "b"); - if(id != null) - parseSoda(params); - else + API_VLKB_legacy = ((api_l != null) && (api_b != null)); + + if(API_VLKB_legacy) parseVlkb(params); + else + parseSoda(params); LOGGER.info("Parse result: " + toQueryString()); } @@ -157,7 +160,7 @@ class Coord throw new IllegalArgumentException("parameter " + key + " has no value."); } - +/* Coord(String lon, String lat, String radius, String velLow, String velUp) { try @@ -218,7 +221,7 @@ class Coord this.shape = "RECT"; this.vel_valid = false; } - +*/ void setSkySystem(String skySystem) { this.skySystem = skySystem; } void setSpecSystem(String velType) { this.vel_type = velType; } @@ -278,10 +281,17 @@ class Coord } + String toQueryString() + { + if(API_VLKB_legacy) + return toVlkbLegacyQueryString(); + else + return toVoQueryString(); + } // FIXME separate keywords into dictionary key-string (LON->"l" LAT->"b" SKYSYSTEM->"skysystem") // to be part of api/QueryStringParams.java - String toQueryString() + String toVlkbLegacyQueryString() { StringBuilder sb = new StringBuilder(); diff --git a/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java b/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java index c470f1e..1cbdf4f 100644 --- a/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java +++ b/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java @@ -104,13 +104,13 @@ public class FormatResponseFilter implements Filter Dataset[] datasetArr = convert(obsCoreArr, coord, // VLKB: calc overlap-code for velocity settings.serviceUrls.cutoutUrl(), - coord.toVoQueryString()); + coord.toQueryString()); SearchOutputData searchOutputData = SearchOutputData.marshall(datasetArr, subsurveyId, dbSubsurveyArr, settings.serviceUrls.mergeUrl(), - coord.toVoQueryString()); + coord.toQueryString()); final String respFormat = settings.serviceUrls.responseFormat(); LOGGER.info("responseFormat: " + respFormat); -- GitLab