diff --git a/data-discovery/src/main/java/search/DbObstap.java b/data-discovery/src/main/java/search/DbObstap.java index d6851d4173a16bf0706403df103c5fad3147a5e5..ca9e40a20bf0fcb4e893c6296d3c8e53b3da52ad 100644 --- a/data-discovery/src/main/java/search/DbObstap.java +++ b/data-discovery/src/main/java/search/DbObstap.java @@ -33,7 +33,7 @@ public class DbObstap } - static class ObsCore + static class Obstap { String dataproduct_type; Integer calib_level; @@ -201,7 +201,7 @@ public class DbObstap - public ObsCore[] queryOutputData(String[] pubdidArr, Pos pos, Band band) + public Obstap[] queryOutputData(String[] pubdidArr, Pos pos, Band band) throws Exception { LOGGER.fine("trace"); @@ -220,7 +220,7 @@ public class DbObstap //LOGGER.fine(theQuery); - List<ObsCore> obsCoreList = new ArrayList<>(); + List<Obstap> obstapList = new ArrayList<>(); LOGGER.fine("Connecting to: " + dbConnArgs.uri() + " with optional user/pwd: " + dbConnArgs.userName() +" / "+ dbConnArgs.password() ); @@ -231,71 +231,71 @@ public class DbObstap { while (res.next()) { - ObsCore obsCore = new ObsCore(); + Obstap obstap = new Obstap(); - obsCore.dataproduct_type = this.getString(res,"dataproduct_type"); - obsCore.calib_level = this.getInt(res,"calib_level"); - obsCore.obs_collection = this.getString(res,"obs_collection"); - obsCore.obs_title = this.getString(res,"obs_title"); - obsCore.obs_id = this.getString(res,"obs_id"); - obsCore.obs_publisher_did = this.getString(res,"obs_publisher_did"); + obstap.dataproduct_type = this.getString(res,"dataproduct_type"); + obstap.calib_level = this.getInt(res,"calib_level"); + obstap.obs_collection = this.getString(res,"obs_collection"); + obstap.obs_title = this.getString(res,"obs_title"); + obstap.obs_id = this.getString(res,"obs_id"); + obstap.obs_publisher_did = this.getString(res,"obs_publisher_did"); - obsCore.bib_reference = this.getString(res,"bib_reference"); - obsCore.data_rights = this.getString(res,"data_rights"); + obstap.bib_reference = this.getString(res,"bib_reference"); + obstap.data_rights = this.getString(res,"data_rights"); - obsCore.access_url = this.getString(res,"access_url"); - obsCore.access_format = this.getString(res,"access_format"); - obsCore.access_estsize = this.getLong(res,"access_estsize"); + obstap.access_url = this.getString(res,"access_url"); + obstap.access_format = this.getString(res,"access_format"); + obstap.access_estsize = this.getLong(res,"access_estsize"); - obsCore.target_name = this.getString(res,"target_name"); + obstap.target_name = this.getString(res,"target_name"); - obsCore.s_ra = this.getDouble(res,"s_ra"); - obsCore.s_dec = this.getDouble(res,"s_dec"); - obsCore.s_fov = this.getDouble(res,"s_fov"); - obsCore.s_region = this.getString(res,"s_region"); - obsCore.s_xel1 = this.getLong(res,"s_xel1"); - obsCore.s_xel2 = this.getLong(res,"s_xel2"); - obsCore.s_resolution = this.getDouble(res,"s_resolution"); + obstap.s_ra = this.getDouble(res,"s_ra"); + obstap.s_dec = this.getDouble(res,"s_dec"); + obstap.s_fov = this.getDouble(res,"s_fov"); + obstap.s_region = this.getString(res,"s_region"); + obstap.s_xel1 = this.getLong(res,"s_xel1"); + obstap.s_xel2 = this.getLong(res,"s_xel2"); + obstap.s_resolution = this.getDouble(res,"s_resolution"); - obsCore.t_min = this.getDouble(res,"t_min"); - obsCore.t_max = this.getDouble(res,"t_max"); - obsCore.t_exptime = this.getDouble(res,"t_exptime"); - obsCore.t_resolution = this.getDouble(res,"t_resolution"); - obsCore.t_xel = this.getLong(res,"t_xel"); + obstap.t_min = this.getDouble(res,"t_min"); + obstap.t_max = this.getDouble(res,"t_max"); + obstap.t_exptime = this.getDouble(res,"t_exptime"); + obstap.t_resolution = this.getDouble(res,"t_resolution"); + obstap.t_xel = this.getLong(res,"t_xel"); - obsCore.em_min = this.getDouble(res,"em_min"); boolean em_min_valid = !res.wasNull(); - obsCore.em_max = this.getDouble(res,"em_max"); boolean em_max_valid = !res.wasNull(); - obsCore.em_valid = em_min_valid && em_max_valid;; - obsCore.em_res_power = this.getDouble(res,"em_res_power"); - obsCore.em_xel = this.getLong(res,"em_xel"); + obstap.em_min = this.getDouble(res,"em_min"); boolean em_min_valid = !res.wasNull(); + obstap.em_max = this.getDouble(res,"em_max"); boolean em_max_valid = !res.wasNull(); + obstap.em_valid = em_min_valid && em_max_valid;; + obstap.em_res_power = this.getDouble(res,"em_res_power"); + obstap.em_xel = this.getLong(res,"em_xel"); - obsCore.o_ucd = this.getString(res,"o_ucd"); + obstap.o_ucd = this.getString(res,"o_ucd"); - obsCore.pol_states = this.getString(res,"pol_states"); - obsCore.pol_xel = this.getLong(res ,"pol_xel"); + obstap.pol_states = this.getString(res,"pol_states"); + obstap.pol_xel = this.getLong(res ,"pol_xel"); - obsCore.facility_name = this.getString(res,"facility_name"); - obsCore.instrument_name = this.getString(res,"instrument_name"); + obstap.facility_name = this.getString(res,"facility_name"); + obstap.instrument_name = this.getString(res,"instrument_name"); // VLKB extension - obsCore.s_region_galactic = this.getString(res,"s_region_galactic"); - obsCore.vel_min = this.getDouble(res,"vel_min"); //boolean em_min_valid = !res.wasNull(); - obsCore.vel_max = this.getDouble(res,"vel_max"); //boolean em_max_valid = !res.wasNull(); + obstap.s_region_galactic = this.getString(res,"s_region_galactic"); + obstap.vel_min = this.getDouble(res,"vel_min"); //boolean em_min_valid = !res.wasNull(); + obstap.vel_max = this.getDouble(res,"vel_max"); //boolean em_max_valid = !res.wasNull(); boolean inputInsideDb = res.getBoolean("inputInsideDb"); boolean dbInsideInput = res.getBoolean("dbInsideInput"); - obsCore.overlapCodeSky = convertToOverlapCodeSky(inputInsideDb, dbInsideInput); + obstap.overlapCodeSky = convertToOverlapCodeSky(inputInsideDb, dbInsideInput); - obsCore.overlapCodeVel = convertToOverlapCodeVel(band,obsCore.em_valid,obsCore.em_min,obsCore.em_max); + obstap.overlapCodeVel = convertToOverlapCodeVel(band,obstap.em_valid,obstap.em_min,obstap.em_max); - obsCore.overlapCode = convertToOverlapCode(obsCore.overlapCodeSky, obsCore.overlapCodeVel); + obstap.overlapCode = convertToOverlapCode(obstap.overlapCodeSky, obstap.overlapCodeVel); - obsCoreList.add(obsCore); + obstapList.add(obstap); } - LOGGER.fine("From DB collected # of ObsCore : " + obsCoreList.size()); + LOGGER.fine("From DB collected # of Obstap : " + obstapList.size()); } catch (SQLException se) { @@ -304,7 +304,7 @@ public class DbObstap throw new Exception(se.toString()); } - ObsCore[] cubes = obsCoreList.toArray(new ObsCore[0]); + Obstap[] cubes = obstapList.toArray(new Obstap[0]); return cubes; } diff --git a/data-discovery/src/main/java/webapi/SearchServlet.java b/data-discovery/src/main/java/webapi/SearchServlet.java index 537dee8b5c32023dff8de9e53f73603334d77490..f02e40ce430d3350f99947bb23f78c3763198996 100644 --- a/data-discovery/src/main/java/webapi/SearchServlet.java +++ b/data-discovery/src/main/java/webapi/SearchServlet.java @@ -76,7 +76,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet if((qArgs.maxrec != null) && (qArgs.maxrec < 0)) throw new IllegalArgumentException("MAXREC must not be negative: " + qArgs.maxrec); - /* query Obscore table */ + /* query Obstap table */ DbObstap dbObstap; synchronized(DbObstap.class) diff --git a/data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java b/data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java index be53ad94f160923d252a369f43dda2c91353d01d..ec6b89a3c8378344258c955f4ee2ea887a065bc7 100644 --- a/data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java +++ b/data-discovery/src/main/java/webapi/formatfilter/FormatResponseFilter.java @@ -64,7 +64,7 @@ public class FormatResponseFilter implements Filter Pos pos = Pos.parsePos(params, DEFAULT_SKY_SYSTEM); Band band = Band.parseBand(params, DEFAULT_SPEC_SYSTEM); - DbObstap.ObsCore[] obsCoreArr = queryObsCore(responseWrapper.getDbConnArgs(), pubdidArr, pos, band); + DbObstap.Obstap[] obstapArr = queryObstap(responseWrapper.getDbConnArgs(), pubdidArr, pos, band); String respFormat; String respFormatReq[] = params.get("RESPONSEFORMAT"); @@ -86,7 +86,7 @@ public class FormatResponseFilter implements Filter boolean showDuration = false; XmlSerializer.serializeToVoTable(responseWriter, RESPONSE_ENCODING, - obsCoreArr, + obstapArr, settings.serviceUrls.cutoutUrl(), showDuration,startTime_msec); } @@ -150,7 +150,7 @@ public class FormatResponseFilter implements Filter } - private DbObstap.ObsCore[] queryObsCore(DbConnArgs dbConnArgs, String[] pubdidArr, Pos pos, Band band) + private DbObstap.Obstap[] queryObstap(DbConnArgs dbConnArgs, String[] pubdidArr, Pos pos, Band band) throws Exception { diff --git a/data-discovery/src/main/java/webapi/formatfilter/ObscoreExt.java b/data-discovery/src/main/java/webapi/formatfilter/ObstapExt.java similarity index 72% rename from data-discovery/src/main/java/webapi/formatfilter/ObscoreExt.java rename to data-discovery/src/main/java/webapi/formatfilter/ObstapExt.java index e847b5f3985d82d29cad3a48d52636e538e93fd8..ce20fccf79bbb346e930c6e2c3c7e9b820d48ccc 100644 --- a/data-discovery/src/main/java/webapi/formatfilter/ObscoreExt.java +++ b/data-discovery/src/main/java/webapi/formatfilter/ObstapExt.java @@ -3,7 +3,7 @@ import uk.ac.starlink.table.*;// ColumnInfo needed import uk.ac.starlink.votable.*; -class ObscoreExt +class ObstapExt { static private ColumnInfo genPubDidColInfo() { @@ -29,7 +29,7 @@ class ObscoreExt - public static final ColumnInfo[] OBSCORE_COLINFO = + public static final ColumnInfo[] OBSTAP_COLINFO = { new ColumnInfo( "dataproduct_type", String.class, "Dataproduct Type (image|cube)" ), @@ -75,52 +75,52 @@ class ObscoreExt new ColumnInfo( "instrument_name", String.class, "Instrument" ), }; - public static Object[] obscoreRow( DbObstap.ObsCore obsCore ) + public static Object[] obstapRow( DbObstap.Obstap obstap ) { return new Object[] { - obsCore.dataproduct_type, - obsCore.calib_level, - obsCore.obs_collection, - obsCore.obs_title, - obsCore.obs_id, - obsCore.obs_publisher_did, - obsCore.bib_reference, - obsCore.data_rights, - - obsCore.access_url, - obsCore.access_format, - obsCore.access_estsize, - - obsCore.target_name, - - obsCore.s_ra, - obsCore.s_dec, - obsCore.s_fov, - - obsCore.s_region, - obsCore.s_xel1, - obsCore.s_xel2, - obsCore.s_resolution, - - obsCore.t_min, - obsCore.t_max, - obsCore.t_exptime, - obsCore.t_resolution, - obsCore.t_xel, - - obsCore.em_min, - obsCore.em_max, - obsCore.em_res_power, - obsCore.em_xel, - - obsCore.o_ucd, - - obsCore.pol_states, - obsCore.pol_xel, - - obsCore.facility_name, - obsCore.instrument_name, + obstap.dataproduct_type, + obstap.calib_level, + obstap.obs_collection, + obstap.obs_title, + obstap.obs_id, + obstap.obs_publisher_did, + obstap.bib_reference, + obstap.data_rights, + + obstap.access_url, + obstap.access_format, + obstap.access_estsize, + + obstap.target_name, + + obstap.s_ra, + obstap.s_dec, + obstap.s_fov, + + obstap.s_region, + obstap.s_xel1, + obstap.s_xel2, + obstap.s_resolution, + + obstap.t_min, + obstap.t_max, + obstap.t_exptime, + obstap.t_resolution, + obstap.t_xel, + + obstap.em_min, + obstap.em_max, + obstap.em_res_power, + obstap.em_xel, + + obstap.o_ucd, + + obstap.pol_states, + obstap.pol_xel, + + obstap.facility_name, + obstap.instrument_name, }; } @@ -138,28 +138,28 @@ class ObscoreExt new ColumnInfo( "vel_max", Double.class, "Velocity max" ), }; - public static Object[] vlkbRow( DbObstap.ObsCore obsCore ) + public static Object[] vlkbRow( DbObstap.Obstap obstap ) { return new Object[] { - obsCore.overlapCode, - obsCore.overlapCodeSky, - obsCore.overlapCodeVel, + obstap.overlapCode, + obstap.overlapCodeSky, + obstap.overlapCodeVel, - obsCore.s_region_galactic, + obstap.s_region_galactic, - obsCore.vel_min, - obsCore.vel_max, + obstap.vel_min, + obstap.vel_max, }; } - public static final ColumnInfo[] OBSCORE_VLKB_COLINFO = concat(OBSCORE_COLINFO, VLKB_COLINFO); + public static final ColumnInfo[] OBSTAP_VLKB_COLINFO = concat(OBSTAP_COLINFO, VLKB_COLINFO); - public static Object[] obscoreVlkbRow( DbObstap.ObsCore obsCore ) + public static Object[] obstapVlkbRow( DbObstap.Obstap obstap ) { - return concat(obscoreRow(obsCore),vlkbRow(obsCore)); + return concat(obstapRow(obstap),vlkbRow(obstap)); } diff --git a/data-discovery/src/main/java/webapi/formatfilter/XmlSerializer.java b/data-discovery/src/main/java/webapi/formatfilter/XmlSerializer.java index e54e8771cf1607d33ca3bdc7eab4d4b47f547e02..2dbf9545e4a85c63b13ab882879b894886b14bad 100644 --- a/data-discovery/src/main/java/webapi/formatfilter/XmlSerializer.java +++ b/data-discovery/src/main/java/webapi/formatfilter/XmlSerializer.java @@ -22,16 +22,15 @@ final class XmlSerializer public static void serializeToVoTable( PrintWriter writer, String charEncoding, - DbObstap.ObsCore[] obsCoreArr, + DbObstap.Obstap[] obstapArr, String cutoutUrl, boolean showDuration, long startTime_msec) throws IOException { - //StarTable dstable = makeSearchResultsTable( obsCoreArr ); - /*RowList*/StarTable dstable = new RowListStarTable( ObscoreExt.OBSCORE_VLKB_COLINFO ); + StarTable dstable = new RowListStarTable( ObstapExt.OBSTAP_VLKB_COLINFO ); dstable.setParameter(new DescribedValue( new DefaultValueInfo("datacubeCount", Integer.class, "Count of all datacubes from VLKB-search" ), - obsCoreArr.length ) ); + obstapArr.length ) ); BufferedWriter out = new BufferedWriter( writer );