Commit 8913fab4 authored by Robert Butora's avatar Robert Butora
Browse files

renames ObsCore -> Obstap

parent 8a9f2fe7
Loading
Loading
Loading
Loading
+47 −47
Original line number Original line Diff line number Diff line
@@ -33,7 +33,7 @@ public class DbObstap
   }
   }




   static class ObsCore
   static class Obstap
   {
   {
      String dataproduct_type;
      String dataproduct_type;
      Integer calib_level;
      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
      throws Exception
   {
   {
      LOGGER.fine("trace");
      LOGGER.fine("trace");
@@ -220,7 +220,7 @@ public class DbObstap


      //LOGGER.fine(theQuery);
      //LOGGER.fine(theQuery);


      List<ObsCore> obsCoreList = new ArrayList<>();
      List<Obstap> obstapList = new ArrayList<>();


      LOGGER.fine("Connecting to: " + dbConnArgs.uri()
      LOGGER.fine("Connecting to: " + dbConnArgs.uri()
            + " with optional user/pwd: " + dbConnArgs.userName() +" / "+ dbConnArgs.password() );
            + " with optional user/pwd: " + dbConnArgs.userName() +" / "+ dbConnArgs.password() );
@@ -231,71 +231,71 @@ public class DbObstap
      {
      {
         while (res.next())
         while (res.next())
         {
         {
            ObsCore obsCore = new ObsCore();
            Obstap obstap = new Obstap();


            obsCore.dataproduct_type  = this.getString(res,"dataproduct_type");
            obstap.dataproduct_type  = this.getString(res,"dataproduct_type");
            obsCore.calib_level       = this.getInt(res,"calib_level");
            obstap.calib_level       = this.getInt(res,"calib_level");
            obsCore.obs_collection    = this.getString(res,"obs_collection");
            obstap.obs_collection    = this.getString(res,"obs_collection");
            obsCore.obs_title         = this.getString(res,"obs_title");
            obstap.obs_title         = this.getString(res,"obs_title");
            obsCore.obs_id            = this.getString(res,"obs_id");
            obstap.obs_id            = this.getString(res,"obs_id");
            obsCore.obs_publisher_did = this.getString(res,"obs_publisher_did");
            obstap.obs_publisher_did = this.getString(res,"obs_publisher_did");


            obsCore.bib_reference = this.getString(res,"bib_reference");
            obstap.bib_reference = this.getString(res,"bib_reference");
            obsCore.data_rights   = this.getString(res,"data_rights");
            obstap.data_rights   = this.getString(res,"data_rights");


            obsCore.access_url     = this.getString(res,"access_url");
            obstap.access_url     = this.getString(res,"access_url");
            obsCore.access_format  = this.getString(res,"access_format");
            obstap.access_format  = this.getString(res,"access_format");
            obsCore.access_estsize = this.getLong(res,"access_estsize");
            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");
            obstap.s_ra         = this.getDouble(res,"s_ra");
            obsCore.s_dec        = this.getDouble(res,"s_dec");
            obstap.s_dec        = this.getDouble(res,"s_dec");
            obsCore.s_fov        = this.getDouble(res,"s_fov");
            obstap.s_fov        = this.getDouble(res,"s_fov");
            obsCore.s_region     = this.getString(res,"s_region");
            obstap.s_region     = this.getString(res,"s_region");
            obsCore.s_xel1       = this.getLong(res,"s_xel1");
            obstap.s_xel1       = this.getLong(res,"s_xel1");
            obsCore.s_xel2       = this.getLong(res,"s_xel2");
            obstap.s_xel2       = this.getLong(res,"s_xel2");
            obsCore.s_resolution = this.getDouble(res,"s_resolution");
            obstap.s_resolution = this.getDouble(res,"s_resolution");


            obsCore.t_min         = this.getDouble(res,"t_min");
            obstap.t_min         = this.getDouble(res,"t_min");
            obsCore.t_max         = this.getDouble(res,"t_max");
            obstap.t_max         = this.getDouble(res,"t_max");
            obsCore.t_exptime     = this.getDouble(res,"t_exptime");
            obstap.t_exptime     = this.getDouble(res,"t_exptime");
            obsCore.t_resolution  = this.getDouble(res,"t_resolution");
            obstap.t_resolution  = this.getDouble(res,"t_resolution");
            obsCore.t_xel         = this.getLong(res,"t_xel");
            obstap.t_xel         = this.getLong(res,"t_xel");


            obsCore.em_min       = this.getDouble(res,"em_min"); boolean em_min_valid = !res.wasNull();
            obstap.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();
            obstap.em_max       = this.getDouble(res,"em_max"); boolean em_max_valid = !res.wasNull();
            obsCore.em_valid     = em_min_valid && em_max_valid;;
            obstap.em_valid     = em_min_valid && em_max_valid;;
            obsCore.em_res_power = this.getDouble(res,"em_res_power");
            obstap.em_res_power = this.getDouble(res,"em_res_power");
            obsCore.em_xel       = this.getLong(res,"em_xel");
            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");
            obstap.pol_states = this.getString(res,"pol_states");
            obsCore.pol_xel    = this.getLong(res ,"pol_xel");
            obstap.pol_xel    = this.getLong(res ,"pol_xel");


            obsCore.facility_name = this.getString(res,"facility_name");
            obstap.facility_name = this.getString(res,"facility_name");
            obsCore.instrument_name = this.getString(res,"instrument_name");
            obstap.instrument_name = this.getString(res,"instrument_name");


            // VLKB extension
            // VLKB extension


            obsCore.s_region_galactic = this.getString(res,"s_region_galactic");
            obstap.s_region_galactic = this.getString(res,"s_region_galactic");
            obsCore.vel_min           = this.getDouble(res,"vel_min"); //boolean em_min_valid = !res.wasNull();
            obstap.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.vel_max           = this.getDouble(res,"vel_max"); //boolean em_max_valid = !res.wasNull();


            boolean inputInsideDb = res.getBoolean("inputInsideDb");
            boolean inputInsideDb = res.getBoolean("inputInsideDb");
            boolean dbInsideInput = res.getBoolean("dbInsideInput");
            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)
      catch (SQLException se)
      {
      {
@@ -304,7 +304,7 @@ public class DbObstap
         throw new Exception(se.toString());
         throw new Exception(se.toString());
      }
      }


      ObsCore[] cubes = obsCoreList.toArray(new ObsCore[0]);
      Obstap[] cubes = obstapList.toArray(new Obstap[0]);


      return cubes;
      return cubes;
   }
   }
+1 −1
Original line number Original line Diff line number Diff line
@@ -76,7 +76,7 @@ public class SearchServlet extends javax.servlet.http.HttpServlet
         if((qArgs.maxrec != null) && (qArgs.maxrec < 0))
         if((qArgs.maxrec != null) && (qArgs.maxrec < 0))
            throw new IllegalArgumentException("MAXREC must not be negative: " + qArgs.maxrec);
            throw new IllegalArgumentException("MAXREC must not be negative: " + qArgs.maxrec);


         /* query Obscore table */
         /* query Obstap table */


         DbObstap dbObstap;
         DbObstap dbObstap;
         synchronized(DbObstap.class)
         synchronized(DbObstap.class)
+3 −3
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ public class FormatResponseFilter implements Filter
            Pos  pos  = Pos.parsePos(params, DEFAULT_SKY_SYSTEM);
            Pos  pos  = Pos.parsePos(params, DEFAULT_SKY_SYSTEM);
            Band band = Band.parseBand(params, DEFAULT_SPEC_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 respFormat;
            String respFormatReq[] = params.get("RESPONSEFORMAT");
            String respFormatReq[] = params.get("RESPONSEFORMAT");
@@ -86,7 +86,7 @@ public class FormatResponseFilter implements Filter
               boolean showDuration = false;
               boolean showDuration = false;


               XmlSerializer.serializeToVoTable(responseWriter, RESPONSE_ENCODING,
               XmlSerializer.serializeToVoTable(responseWriter, RESPONSE_ENCODING,
                     obsCoreArr,
                     obstapArr,
                     settings.serviceUrls.cutoutUrl(),
                     settings.serviceUrls.cutoutUrl(),
                     showDuration,startTime_msec);
                     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
         throws Exception
      {
      {


+55 −55
Original line number Original line Diff line number Diff line
@@ -3,7 +3,7 @@
import uk.ac.starlink.table.*;// ColumnInfo needed
import uk.ac.starlink.table.*;// ColumnInfo needed
import uk.ac.starlink.votable.*;
import uk.ac.starlink.votable.*;


class ObscoreExt
class ObstapExt
{
{
   static private ColumnInfo genPubDidColInfo()
   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)" ),
      new ColumnInfo( "dataproduct_type",  String.class,  "Dataproduct Type (image|cube)" ),
@@ -75,52 +75,52 @@ class ObscoreExt
      new ColumnInfo( "instrument_name", String.class, "Instrument" ),
      new ColumnInfo( "instrument_name", String.class, "Instrument" ),
   };
   };


   public static Object[] obscoreRow( DbObstap.ObsCore obsCore )
   public static Object[] obstapRow( DbObstap.Obstap obstap )
   {
   {
      return new Object[]
      return new Object[]
      {
      {
         obsCore.dataproduct_type,
         obstap.dataproduct_type,
            obsCore.calib_level,
            obstap.calib_level,
            obsCore.obs_collection,
            obstap.obs_collection,
            obsCore.obs_title,
            obstap.obs_title,
            obsCore.obs_id,
            obstap.obs_id,
            obsCore.obs_publisher_did,
            obstap.obs_publisher_did,
            obsCore.bib_reference,
            obstap.bib_reference,
            obsCore.data_rights,
            obstap.data_rights,


            obsCore.access_url,
            obstap.access_url,
            obsCore.access_format,
            obstap.access_format,
            obsCore.access_estsize,
            obstap.access_estsize,


            obsCore.target_name,
            obstap.target_name,


            obsCore.s_ra,
            obstap.s_ra,
            obsCore.s_dec,
            obstap.s_dec,
            obsCore.s_fov,
            obstap.s_fov,


            obsCore.s_region,
            obstap.s_region,
            obsCore.s_xel1,
            obstap.s_xel1,
            obsCore.s_xel2,
            obstap.s_xel2,
            obsCore.s_resolution,
            obstap.s_resolution,


            obsCore.t_min,
            obstap.t_min,
            obsCore.t_max,
            obstap.t_max,
            obsCore.t_exptime,
            obstap.t_exptime,
            obsCore.t_resolution,
            obstap.t_resolution,
            obsCore.t_xel,
            obstap.t_xel,


            obsCore.em_min,
            obstap.em_min,
            obsCore.em_max,
            obstap.em_max,
            obsCore.em_res_power,
            obstap.em_res_power,
            obsCore.em_xel,
            obstap.em_xel,


            obsCore.o_ucd,
            obstap.o_ucd,


            obsCore.pol_states,
            obstap.pol_states,
            obsCore.pol_xel,
            obstap.pol_xel,


            obsCore.facility_name,
            obstap.facility_name,
            obsCore.instrument_name,
            obstap.instrument_name,
      };
      };
   }
   }


@@ -138,28 +138,28 @@ class ObscoreExt
      new ColumnInfo( "vel_max",    Double.class, "Velocity max" ),
      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[]
      return new Object[]
      {
      {
         obsCore.overlapCode,
         obstap.overlapCode,
            obsCore.overlapCodeSky,
            obstap.overlapCodeSky,
            obsCore.overlapCodeVel,
            obstap.overlapCodeVel,


            obsCore.s_region_galactic,
            obstap.s_region_galactic,


            obsCore.vel_min,
            obstap.vel_min,
            obsCore.vel_max,
            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));
   }
   }




+3 −4
Original line number Original line Diff line number Diff line
@@ -22,16 +22,15 @@ final class XmlSerializer


   public static void serializeToVoTable(
   public static void serializeToVoTable(
         PrintWriter writer, String charEncoding,
         PrintWriter writer, String charEncoding,
         DbObstap.ObsCore[] obsCoreArr,
         DbObstap.Obstap[] obstapArr,
         String cutoutUrl,
         String cutoutUrl,
         boolean showDuration, long startTime_msec) throws IOException
         boolean showDuration, long startTime_msec) throws IOException
   {
   {
      //StarTable dstable = makeSearchResultsTable( obsCoreArr );
      StarTable dstable = new RowListStarTable( ObstapExt.OBSTAP_VLKB_COLINFO );
      /*RowList*/StarTable dstable = new RowListStarTable( ObscoreExt.OBSCORE_VLKB_COLINFO );


      dstable.setParameter(new DescribedValue(
      dstable.setParameter(new DescribedValue(
               new DefaultValueInfo("datacubeCount", Integer.class, "Count of all datacubes from VLKB-search" ),
               new DefaultValueInfo("datacubeCount", Integer.class, "Count of all datacubes from VLKB-search" ),
               obsCoreArr.length ) );
               obstapArr.length ) );


      BufferedWriter out = new BufferedWriter( writer );
      BufferedWriter out = new BufferedWriter( writer );