diff --git a/data-discovery/src/main/java/vlkb/common/Coord.java b/data-discovery/src/main/java/vlkb/common/Coord.java index 1dc0cafc08bf8d7b7943552227b5d9292ed6c727..38286699dbf3e6e17c0b336f7a9ca6fd85b4d060 100644 --- a/data-discovery/src/main/java/vlkb/common/Coord.java +++ b/data-discovery/src/main/java/vlkb/common/Coord.java @@ -2,13 +2,15 @@ import java.util.logging.Logger; import java.util.Map; import java.io.PrintWriter; +import vo.parameter.*; + class Coord { private static final Logger LOGGER = Logger.getLogger(Coord.class.getName()); - String skySystem; // FIXME make enum +// String skySystem; // FIXME make enum - // center + /*/ center double lon; double lat; @@ -21,10 +23,22 @@ class Coord public boolean vel_valid; String vel_type; // FIXME make enum double vel_up; - double vel_low; + double vel_low;*/ - private boolean API_VLKB_legacy = false; +// Begin .................................. + +// String specSystem; // FIXME enum VELO_LSRK | WAVE_Barycentric | NONE + + Pos pos; + Band band; + Time time; + Pol pol; +// End .................................... + + + private boolean API_VLKB_legacy = false; +/* Coord(Map<String, String[]> params) { String api_l = getFirstValue(params, "l"); @@ -39,8 +53,8 @@ class Coord LOGGER.info("Parse result: " + toQueryString()); } - - +*/ +/* protected void parseSoda(Map<String, String[]> params) { LOGGER.info("trace"); @@ -72,12 +86,12 @@ class Coord if(specSystem == null) specSystem = "2"; // 2=WAVE BARY if( (vel != null) && (vel.length >= 2) ) { - this.vel_type = specSystem; // FIXME add sanity checks / use enum + this.specSystem = specSystem; // FIXME add sanity checks / use enum if((vel[0] != null) && (vel[1] != null)) { - this.vel_low = Double.parseDouble(vel[0]); - this.vel_up = Double.parseDouble(vel[1]); + this.band.wavelength[0] = Double.parseDouble(vel[0]); + this.band.wavelength[1] = Double.parseDouble(vel[1]); this.vel_valid = true; } else @@ -92,8 +106,8 @@ class Coord throw new IllegalArgumentException("Request with incorrect parameters: " + illArg.getMessage()); } } - - +*/ +/* protected void parseVlkb(Map<String, String[]> params) { LOGGER.info("trace"); @@ -144,12 +158,12 @@ class Coord vel_type = cvtype; } } +*/ - - void setSkySystem(String skySystem) { this.skySystem = skySystem; } - void setSpecSystem(String velType) { this.vel_type = velType; } - +// void setSkySystem(String skySystem) { this.skySystem = skySystem; } +// void setSpecSystem(String velType) { this.vel_type = velType; } +/* void setVelocity(double vel_low, double vel_up, String vel_type) { this.vel_type = vel_type; @@ -157,7 +171,7 @@ class Coord this.vel_up = vel_up; this.vel_valid = true; } - +*/ @@ -166,47 +180,47 @@ class Coord String toQueryString() { - if(API_VLKB_legacy) - return toVlkbLegacyQueryString(); - else + //if(API_VLKB_legacy) + // return toVlkbLegacyQueryString(); + //else return toVoQueryString(); } - +/* String toVlkbLegacyQueryString() { LOGGER.info("trace"); StringBuilder sb = new StringBuilder(); - sb.append("skysystem=" + skySystem); - sb.append("&l=" + lon ); - sb.append("&b=" + lat ); + sb.append("skysystem=" + pos.skySystem); + sb.append("&l=" + pos.circle.lon ); + sb.append("&b=" + pos.circle.lat ); switch(shape) { - case "CIRCLE" : sb.append("&r=" + radius ); + case "CIRCLE" : sb.append("&r=" + pos.circle.radius ); break; case "RECT" : - sb.append("&dl=" + dlon ); - sb.append("&db=" + dlat ); +// sb.append("&dl=" + dlon ); +// sb.append("&db=" + dlat ); break; default: LOGGER.info("Coord::toVlkbLegacyQueryString: unknown shape: " + shape); } - if(vel_valid) + /* if(vel_valid) { sb.append("&vl=" + vel_low); sb.append("&vu=" + vel_up ); sb.append("&specsystem=" + vel_type ); } - +* / sb.append("&pubdid="); // FIXME id-value will be added in FormatResponseFilter return sb.toString(); } - +*/ String toVoQueryString() { @@ -214,35 +228,34 @@ class Coord StringBuilder sb = new StringBuilder(); - sb.append("skysystem=" + skySystem); + sb.append("skysystem=" + pos.system); - switch(shape) + switch(pos.shape) { case "CIRCLE" : - sb.append("&POS=CIRCLE " + lon + " " + lat + " " + + radius ); + sb.append("&POS=CIRCLE " + pos.circle.lon + " " + pos.circle.lat + " " + pos.circle.radius); break; case "RECT" : - if(vel_valid) + if(band != null) sb.append("&POS=RANGE=" - + " " + (lon - dlon) + " " + (lon + dlon) - + " " + (lat - dlat) + " " + (lat + dlat) - + " " + vel_low + " " + vel_up ); - - else + + " " + pos.range.lon1 + " " + pos.range.lon2 + + " " + pos.range.lat1 + " " + pos.range.lat2 + + " " + band.wavelength[0] + " " + band.wavelength[1]); + else sb.append("&POS=RANGE=" - + " " + (lon - dlon) + " " + (lon + dlon) - + " " + (lat - dlat) + " " + (lat + dlat) ); + + " " + pos.range.lon1 + " " + pos.range.lon2 + + " " + pos.range.lat1 + " " + pos.range.lat2); break; default: - LOGGER.info("Coord::toVoQueryString: unknown shape: " + shape); + LOGGER.info("Coord::toVoQueryString: unknown shape: " + pos.shape); } - if(vel_valid) + if(band != null) { - sb.append("&BAND= " + vel_low + " " + vel_up); - sb.append("&specsystem=" + vel_type ); + sb.append("&BAND= " + band.wavelength[0] + " " + band.wavelength[1]); + sb.append("&specsystem=" + band.system ); } sb.append("&ID="); // FIXME id-value will be added in FormatResponseFilter @@ -258,17 +271,17 @@ class Coord public String toString() { - String area = null; - switch(shape) + String area = "";//null; + /*switch(shape) { - case "CIRCLE" : area = String.valueOf(radius); break; + case "CIRCLE" : area = String.valueOf(pos.circle.radius); break; case "RECT" : area = dlon + ", " + dlat; break; default: // FIXME leave with exception area = "err: " + shape; } - + */ String resourceSearchArea - = "(P; area) = (" + lon + ", " + lat + "; " + area + ") [deg]"; + = "(P; area) = (" + pos.circle.lon + ", " + pos.circle.lat + "; " + area + ") [deg]"; return resourceSearchArea; } @@ -277,25 +290,27 @@ class Coord void toXML(PrintWriter writer) { // center is mandatory -> create no Coord if center not valid - writer.println("<SkySystem>"+skySystem+"</SkySystem>"); - writer.println("<l>"+lon+"</l>"); - writer.println("<b>"+lat+"</b>"); - - switch(shape) + writer.println("<SkySystem>"+pos.system+"</SkySystem>"); + switch(pos.shape) { - case "CIRCLE" : writer.println("<r>"+String.valueOf(radius)+"</r>"); break; + case "CIRCLE" : + writer.println("<l>"+pos.circle.lon+"</l>"); + writer.println("<b>"+pos.circle.lat+"</b>"); + writer.println("<r>"+String.valueOf(pos.circle.radius)+"</r>"); break; case "RECT" : - writer.println("<dl>"+String.valueOf(dlon)+"</dl>"); - writer.println("<db>"+String.valueOf(dlat)+"</db>"); - break; + writer.println("<l>" + (pos.range.lon1 + pos.range.lon2)/2.0 + "</l>"); + writer.println("<b>" + (pos.range.lat1 + pos.range.lat2)/2.0 + "</b>"); + writer.println("<dl>" + (pos.range.lon2 - pos.range.lon1) + "</dl>"); + writer.println("<db>" + (pos.range.lat2 - pos.range.lat1) + "</db>"); + break; default: - writer.println("<shape> unknown shape: "+ shape +" </shape>"); + writer.println("<shape> unknown shape: " + pos.shape + " </shape>"); } - if(vel_valid) + if(band != null) { - writer.println("<vl>" + String.valueOf(vel_low) +"</vl>"); - writer.println("<vu>" + String.valueOf(vel_up) +"</vu>"); - writer.println("<vtype>"+ vel_type +"</vtype>"); + writer.println("<vl>" + String.valueOf(band.wavelength[0]) +"</vl>"); + writer.println("<vu>" + String.valueOf(band.wavelength[1]) +"</vu>"); + writer.println("<vtype>"+ band.system +"</vtype>"); } } diff --git a/data-discovery/src/main/java/vlkb/output/Dataset.java b/data-discovery/src/main/java/vlkb/output/Dataset.java index f94ec448a429cf4da220eb5ff3aa8f250bfb88c2..f2ca86e5cf1e29c59a81c3d389aec716b540d3a3 100644 --- a/data-discovery/src/main/java/vlkb/output/Dataset.java +++ b/data-discovery/src/main/java/vlkb/output/Dataset.java @@ -104,23 +104,23 @@ class Dataset } /* - private Vertices mergeVertices(List<Dataset> datasetList, Coord coord) +// private Vertices mergeVertices(List<Dataset> datasetList, Coord coord) { // FIXME for now simply return input defined rectangle vertices // which is not correct on edges of survey coverage - double ll=coord.lon, bb=coord.lat; +// double ll=coord.lon, bb=coord.lat; double dll=0, dbb=0; // FIXME why compilers errors (not warning): need to be inited ? - switch(coord.shape) +// switch(coord.shape) { case "CIRCLE" : - dll = coord.radius; - dbb = coord.radius; +// dll = coord.radius; +// dbb = coord.radius; break; case "RECT" : - dll = coord.dlon; - dbb = coord.dlat; + // dll = coord.dlon; + // dbb = coord.dlat; break; default: // FIXME internnal error diff --git a/data-discovery/src/main/java/vlkb/output/XmlSerializer.java b/data-discovery/src/main/java/vlkb/output/XmlSerializer.java index aa039c1abed41ac803f188603a9dd6aa2a2a4350..eea0ac48514f7f84c1d318e4a2e48276a234688f 100644 --- a/data-discovery/src/main/java/vlkb/output/XmlSerializer.java +++ b/data-discovery/src/main/java/vlkb/output/XmlSerializer.java @@ -167,25 +167,33 @@ final class XmlSerializer private static String serialize(Coord coord) { StringBuilder xml = new StringBuilder(); - xml.append("<SkySystem>"+coord.skySystem+"</SkySystem>"); - xml.append("<l>"+coord.lon+"</l>"); - xml.append("<b>"+coord.lat+"</b>"); - switch(coord.shape) + if(coord.pos != null) { - case "CIRCLE" : xml.append("<r>"+String.valueOf(coord.radius)+"</r>"); break; - case "RECT" : - xml.append("<dl>"+String.valueOf(coord.dlon)+"</dl>"); - xml.append("<db>"+String.valueOf(coord.dlat)+"</db>"); - break; - default: - xml.append("<shape> unknown shape: "+ coord.shape +" </shape>"); + xml.append("<SkySystem>"+coord.pos.system+"</SkySystem>"); + switch(coord.pos.shape) + { + case "CIRCLE" : + xml.append("<l>"+coord.pos.circle.lon+"</l>"); + xml.append("<b>"+coord.pos.circle.lat+"</b>"); + xml.append("<r>"+String.valueOf(coord.pos.circle.radius)+"</r>"); break; + case "RECT" : + xml.append("<l>"+(coord.pos.range.lon1+ coord.pos.range.lon2)/2.0 + "</l>"); + xml.append("<b>"+(coord.pos.range.lat1+ coord.pos.range.lat2)/2.0 + "</b>"); + xml.append("<dl>"+String.valueOf(coord.pos.range.lon2 - coord.pos.range.lon1)+"</dl>"); + xml.append("<db>"+String.valueOf(coord.pos.range.lat2 - coord.pos.range.lat1)+"</db>"); + break; + default: + xml.append("<shape> unknown shape: "+ coord.pos.shape +" </shape>"); + } } - if(coord.vel_valid) + + if(coord.band != null) { - xml.append("<vl>" + String.valueOf(coord.vel_low) +"</vl>"); - xml.append("<vu>" + String.valueOf(coord.vel_up) +"</vu>"); - xml.append("<vtype>"+ coord.vel_type +"</vtype>"); + xml.append("<vl>" + String.valueOf(coord.band.wavelength[0]) +"</vl>"); + xml.append("<vu>" + String.valueOf(coord.band.wavelength[1]) +"</vu>"); + xml.append("<vtype>"+ coord.band.system +"</vtype>"); } + return xml.toString(); } diff --git a/data-discovery/src/main/java/vlkb/search/DbPSearch.java b/data-discovery/src/main/java/vlkb/search/DbPSearch.java index 9de69b69758eb579136de58cb9f927ffd00c79cf..435523130d4a7c9cb6f5ae7812564727f8144782 100644 --- a/data-discovery/src/main/java/vlkb/search/DbPSearch.java +++ b/data-discovery/src/main/java/vlkb/search/DbPSearch.java @@ -19,6 +19,7 @@ import java.util.ArrayList; import java.lang.ClassNotFoundException; +import vo.parameter.*; public class DbPSearch { @@ -34,56 +35,60 @@ public class DbPSearch public String[] queryOverlapingPubdid(Coord coord, SubsurveyId subsurveyId) { - LOGGER.info("trace"); - - double lon = coord.lon; - double lat = coord.lat; - double radius = coord.radius; - double dlon = coord.dlon; - double dlat = coord.dlat; - - boolean vel_valid = coord.vel_valid; - String vel_type = coord.vel_type; - double vel_low = coord.vel_low; - double vel_up = coord.vel_up; - - String inputRegion = null; - - if(coord.shape.equals("CIRCLE")) - { - inputRegion = "scircle '<(" + Double.toString(lon) + "d," + Double.toString(lat) + "d)," - + Double.toString(radius) + "d>'"; - } - else if( coord.shape.equals("RECT") ) - { - /*Vert vert[] = toVertices(lon, lat, dlon, dlat); - - inputRegion = "spoly '{" - + "(" + Double.toString(vert[0].lon) + "d," + Double.toString(vert[0].lat) + "d)," - + "(" + Double.toString(vert[1].lon) + "d," + Double.toString(vert[1].lat) + "d)," - + "(" + Double.toString(vert[2].lon) + "d," + Double.toString(vert[2].lat) + "d)," - + "(" + Double.toString(vert[3].lon) + "d," + Double.toString(vert[3].lat) + "d)" - + "}'"; - */ - - /* South-West and North-East corners of a box */ - String sw_lon = Double.toString(lon - dlon/2.0); - String sw_lat = Double.toString(lat - dlat/2.0); - String ne_lon = Double.toString(lon + dlon/2.0); - String ne_lat = Double.toString(lat + dlat/2.0); - - inputRegion = "sbox '( ("+ sw_lon + "d, " + sw_lat + "d), (" + ne_lon +"d, " + ne_lat + "d) )'"; - } - else - { - throw new IllegalArgumentException("Coord::shape was: " + coord.shape + " but valid is CIRCLE or RECT"); - } + LOGGER.info("trace"); +// String skySystem = coord.skySystem; + String shape = coord.pos.shape; + + double lon; + double lat; + double radius; + double dlon; + double dlat; + + String inputRegion = null; + + if(shape.equals("CIRCLE")) + { + lon = coord.pos.circle.lon; + lat = coord.pos.circle.lat; + radius = coord.pos.circle.radius; + inputRegion = "scircle '<(" + Double.toString(lon) + "d," + Double.toString(lat) + "d)," + + Double.toString(radius) + "d>'"; + } + else if (shape.equals("RECT")) + { + lon = (coord.pos.range.lon1 + coord.pos.range.lon2)/2.0; + lat = (coord.pos.range.lat1 + coord.pos.range.lat2)/2.0; + dlon = (coord.pos.range.lon2 - coord.pos.range.lon1)/2.0; + dlat = (coord.pos.range.lat2 - coord.pos.range.lat1)/2.0; + + /* South-West and North-East corners of a box */ + String sw_lon = Double.toString(lon - dlon/2.0); + String sw_lat = Double.toString(lat - dlat/2.0); + String ne_lon = Double.toString(lon + dlon/2.0); + String ne_lat = Double.toString(lat + dlat/2.0); + + inputRegion = "sbox '( ("+ sw_lon + "d, " + sw_lat + "d), (" + ne_lon +"d, " + ne_lat + "d) )'"; + } + else + { // FIXME how to deal with Polygon ? -> use enclose-RECT -> RANGE + /* lon = coord.lon; + lat = coord.lat; + radius = coord.radius; + dlon = coord.dlon; + dlat = coord.dlat;*/ + + throw new IllegalArgumentException("Coord::shape was: " + shape + " but valid is CIRCLE or RECT"); + } + + boolean vel_valid = (coord.band != null) && (coord.band.system != Band.System.NONE);//coord.vel_valid; +// String vel_type = coord.vel_type; String theQuery; - if(coord.skySystem.equals("GALACTIC")) + if(coord.pos.system == Pos.System.GALACTIC) { - theQuery ="SELECT obs_publisher_did FROM obscore WHERE (" + inputRegion + " && polygon_region_galactic)"; + theQuery ="SELECT obs_publisher_did FROM obscore WHERE ("+inputRegion+" && polygon_region_galactic)"; } else { @@ -92,10 +97,12 @@ public class DbPSearch if(vel_valid) { - String vel_no_overlap = "((em_min > " + Double.toString(vel_up) + ") OR (em_max < " + Double.toString(vel_low) + "))"; + String vel_no_overlap + = "((em_min > " + Double.toString(coord.band.wavelength[1]) + + ") OR (em_max < " + Double.toString(coord.band.wavelength[0]) + "))"; theQuery += " AND ( (NOT " + vel_no_overlap + ") OR (em_min is null) OR (em_max is null))"; - /* NOTE '... OR (em_min is null)' statement causes to include 2D-continuum datasets if they overlap in sky + /* NOTE '... OR (em_min is null)' statement causes to include 2D datasets if they overlap in sky * It is the legacy-search behaviour - however is that useful ? */ } @@ -162,35 +169,32 @@ public class DbPSearch public FormatResponseFilter.ObsCore[] queryOutputData(String[] pubdidArr, Coord coord/*, SubsurveyId subsurveyId*/) { LOGGER.info(""); - double lon = coord.lon; - double lat = coord.lat; - double radius = coord.radius; - double dlon = coord.dlon; - double dlat = coord.dlat; - boolean vel_valid = coord.vel_valid; - String vel_type = coord.vel_type; - double vel_low = coord.vel_low; - double vel_up = coord.vel_up; + String skySystem = coord.pos.system.toString(); + String shape = coord.pos.shape; + + double lon; + double lat; + double radius; + double dlon; + double dlat; String inputRegion = null; - if(coord.shape.equals("CIRCLE")) + if(shape.equals("CIRCLE")) { + lon = coord.pos.circle.lon; + lat = coord.pos.circle.lat; + radius = coord.pos.circle.radius; inputRegion = "scircle '<(" + Double.toString(lon) + "d," + Double.toString(lat) + "d)," + Double.toString(radius) + "d>'"; } - else if( coord.shape.equals("RECT") ) + else if (shape.equals("RECT")) { - /*Vert vert[] = toVertices(lon, lat, dlon, dlat); - - inputRegion = "spoly '{" - + "(" + Double.toString(vert[0].lon) + "d," + Double.toString(vert[0].lat) + "d)," - + "(" + Double.toString(vert[1].lon) + "d," + Double.toString(vert[1].lat) + "d)," - + "(" + Double.toString(vert[2].lon) + "d," + Double.toString(vert[2].lat) + "d)," - + "(" + Double.toString(vert[3].lon) + "d," + Double.toString(vert[3].lat) + "d)" - + "}'"; - */ + lon = (coord.pos.range.lon1 + coord.pos.range.lon2)/2.0; + lat = (coord.pos.range.lat1 + coord.pos.range.lat2)/2.0; + dlon = (coord.pos.range.lon2 - coord.pos.range.lon1)/2.0; + dlat = (coord.pos.range.lat2 - coord.pos.range.lat1)/2.0; /* South-West and North-East corners of a box */ String sw_lon = Double.toString(lon - dlon/2.0); @@ -201,16 +205,77 @@ public class DbPSearch inputRegion = "sbox '( ("+ sw_lon + "d, " + sw_lat + "d), (" + ne_lon +"d, " + ne_lat + "d) )'"; } else - { - throw new IllegalArgumentException("Coord::shape was: " + coord.shape + " but valid is CIRCLE or RECT"); + { // FIXME how to deal with Polygon ? -> use enclose-RECT -> RANGE + /* lon = coord.lon; + lat = coord.lat; + radius = coord.radius; + dlon = coord.dlon; + dlat = coord.dlat;*/ + + throw new IllegalArgumentException("Coord::shape was: " + shape + " but valid is CIRCLE or RECT"); } + boolean vel_valid = (coord.band != null) && (coord.band.system != Band.System.NONE);//coord.vel_valid; + // String vel_type = coord.vel_type; + // double vel_low = coord.band.wavelength[0];//vel_low; + // double vel_up = coord.band.wavelength[1];//vel_up; + + + /* + double lon = coord.lon; + double lat = coord.lat; + double radius = coord.radius; + double dlon = coord.dlon; + double dlat = coord.dlat; + + boolean vel_valid = coord.vel_valid; + String vel_type = coord.vel_type; + double vel_low = coord.vel_low; + double vel_up = coord.vel_up; + + String inputRegion = null; + + if(coord.shape.equals("CIRCLE")) + { + inputRegion = "scircle '<(" + Double.toString(lon) + "d," + Double.toString(lat) + "d)," + + Double.toString(radius) + "d>'"; + } + else if( coord.shape.equals("RECT") ) + { + /*Vert vert[] = toVertices(lon, lat, dlon, dlat); + + inputRegion = "spoly '{" + + "(" + Double.toString(vert[0].lon) + "d," + Double.toString(vert[0].lat) + "d)," + + "(" + Double.toString(vert[1].lon) + "d," + Double.toString(vert[1].lat) + "d)," + + "(" + Double.toString(vert[2].lon) + "d," + Double.toString(vert[2].lat) + "d)," + + "(" + Double.toString(vert[3].lon) + "d," + Double.toString(vert[3].lat) + "d)" + + "}'"; + */ + + /* South-West and North-East corners of a box * / + String sw_lon = Double.toString(lon - dlon/2.0); + String sw_lat = Double.toString(lat - dlat/2.0); + String ne_lon = Double.toString(lon + dlon/2.0); + String ne_lat = Double.toString(lat + dlat/2.0); + + inputRegion = "sbox '( ("+ sw_lon + "d, " + sw_lat + "d), (" + ne_lon +"d, " + ne_lat + "d) )'"; + } + else + { + throw new IllegalArgumentException("Coord::shape was: " + coord.shape + " but valid is CIRCLE or RECT"); + } + */ + + + + + String commaSepPubdids = String.join("\',\'", pubdidArr); //String theQuery ="SELECT dataproduct_type,obs_publisher_did,obs_collection,polygon_region_galactic,access_url,em_min,em_max," String theQuery; - if(coord.skySystem.equals("GALACTIC")) + if(coord.pos.system == Pos.System.GALACTIC) { theQuery ="SELECT *," + inputRegion + " <@ polygon_region_galactic AS inputInsideDb, " diff --git a/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java b/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java index c6b48993b532cdb6a28ce10e1a223d7e691a7c68..2b9e01157161683c52eeae89089ef018ec13f0fa 100644 --- a/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java +++ b/data-discovery/src/main/java/vlkb/webapi/FormatResponseFilter.java @@ -19,6 +19,7 @@ import javax.servlet.http.HttpServletResponseWrapper; import java.nio.charset.Charset; +import vo.parameter.*; class FormatResponseWrapper extends HttpServletResponseWrapper { @@ -95,10 +96,17 @@ public class FormatResponseFilter implements Filter PrintWriter responseWriter = ((HttpServletResponse)response).getWriter(); Map<String, String[]> params = request.getParameterMap(); - Coord coord = new Coord(params); +// Coord coord = new Coord(params); SubsurveyId subsurveyId = new SubsurveyId(params); // FIXME add invalid param excpetions -> params already parsed in servlet + Coord coord = new Coord(); + coord.pos = Pos.parsePos(params); + coord.pos.setSystem(Pos.System.ICRS); + coord.band = Band.parseBand(params); + coord.time = Time.parseTime(params); + coord.pol = Pol.parsePol(params); + ObsCore[] obsCoreArr = queryObsCore(pubdidArr, coord); // VLKB: calc overlap-code for sky @@ -254,7 +262,7 @@ public class FormatResponseFilter implements Filter dataset.subsurvey_id = obsCore.obs_collection; dataset.overlapCodeSky = convertToOverlapCodeSky(obsCore.inputInsideDb, obsCore.dbInsideInput); - dataset.overlapCodeVel = convertToOverlapCodeVel(coord, obsCore.em_valid, obsCore.em_min, obsCore.em_max); + dataset.overlapCodeVel = convertToOverlapCodeVel(coord,obsCore.em_valid,obsCore.em_min,obsCore.em_max); dataset.overlapCode = convertToOverlapCode(dataset.overlapCodeSky, dataset.overlapCodeVel); dataset.dataType = obsCore.dataproduct_type; dataset.publisherDid = obsCore.obs_publisher_did; @@ -283,18 +291,18 @@ public class FormatResponseFilter implements Filter private int convertToOverlapCodeVel(Coord coord, boolean v_valid, double v_min, double v_max) { - if(coord.vel_valid && v_valid) + if((coord.band != null) && v_valid) { - if(coord.vel_type.equals("1")) + if(coord.band.system == Band.System.VELO_LSRK) { // FIXME assert coord: vel_min <= vel_max // FIXME assert cube: v_min <= v_max - boolean dbInInp = (coord.vel_low <= v_min) && (v_min <= coord.vel_up) - && (coord.vel_low <= v_max) && (v_max <= coord.vel_up); + boolean dbInInp = (coord.band.wavelength[0] <= v_min) && (v_min <= coord.band.wavelength[1]) + && (coord.band.wavelength[0] <= v_max) && (v_max <= coord.band.wavelength[1]); - boolean inpInDb = (v_min <= coord.vel_low) && (coord.vel_low <= v_max) - && (v_min <= coord.vel_up ) && (coord.vel_up <= v_max); + boolean inpInDb = (v_min <= coord.band.wavelength[0]) && (coord.band.wavelength[0] <= v_max) + && (v_min <= coord.band.wavelength[1] ) && (coord.band.wavelength[1] <= v_max); return convertToOverlapCodeSky(inpInDb, dbInInp); diff --git a/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java b/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java index f66ca87ebcec21fc0cfa4d07e3fdadc33958dbac..8bda8da1d27022a176125dc9ed998bceae7f2c26 100644 --- a/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java +++ b/data-discovery/src/main/java/vlkb/webapi/SearchServlet.java @@ -17,6 +17,7 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import vo.parameter.*; public class SearchServlet extends javax.servlet.http.HttpServlet { @@ -56,8 +57,19 @@ public class SearchServlet extends javax.servlet.http.HttpServlet try { Map<String, String[]> params = request.getParameterMap(); - Coord coord = new Coord(params); - SubsurveyId subsurveyId = new SubsurveyId(params); + + // VLKB-legacy init + //Coord coord = new Coord(params); + SubsurveyId subsurveyId = new SubsurveyId(params); + +// FIXME check this! String id = SingleStringParam.parseSingleStringParam(params, "ID"); + + // new based on vlkb-volib + Coord coord = new Coord(); + coord.pos = Pos.parsePos(params); + coord.band = Band.parseBand(params); + coord.time = Time.parseTime(params); + coord.pol = Pol.parsePol(params); /* query Obscore table */ diff --git a/java-libs/lib/vlkb-volib-0.9-SNAPSHOT.jar b/java-libs/lib/vlkb-volib-0.9-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..94a329a806bb4c43df0d25c3d36896d6b28ccce4 Binary files /dev/null and b/java-libs/lib/vlkb-volib-0.9-SNAPSHOT.jar differ