Commit 07b21f45 authored by Robert Butora's avatar Robert Butora
Browse files

appends service descriptor to VOTable (replaces file_/cutout_/merge_url...

appends service descriptor to VOTable (replaces file_/cutout_/merge_url columns) also removes subsurveyId (from request used only in legacy)
parent eb6bce48
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -64,6 +64,12 @@ class Subsurvey

      try
      {
         // FIXME parser not robust:
         // * eats space-character also within the field:  ,  hu ha ,  --> "huha" not "hu ha"
         // * double quote used inside string not escaped: ,"blabla 25\" res",
         // * last record (line) is missing if that line is not closed with EOL
         // * UTF-8 or US-ASACII ?
         // * else ? how to validate/verify correctness

         CSVReaderHeaderAware csvReader = new CSVReaderHeaderAware(new FileReader(csvFilename));

+1 −1
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class Dataset
   }


   public Dataset(List<Dataset> datasetList, SubsurveyId subsurveyId, String mergeUrlRoot, String mergeQueryString)
   public Dataset(List<Dataset> datasetList, /*SubsurveyId subsurveyId,*/ String mergeUrlRoot, String mergeQueryString)
   {
      this.subsurvey_id = datasetList.get(0).subsurvey_id; // mergeabiity condition is more then 1 element in list
      this.overlapCode  = 5; // 5: exact match --> legacy used 0 here FIXME 5 will not be correct on edges of Subsurvey coverage
+5 −5
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ class SearchOutputData


   public static SearchOutputData  marshall(Dataset[] datasetArr,
         SubsurveyId subsurveyId, Subsurvey[] dbSubsurveys,
         /*SubsurveyId subsurveyId,*/ Subsurvey[] dbSubsurveys,
         String mergeUrlRoot, String mergeQueryString)
   {
      SearchOutputData sod = new SearchOutputData();
@@ -22,13 +22,13 @@ class SearchOutputData
      sod.versionString = "Search (pgSphere) version " + Version.asString;
      sod.datacubeCount = datasetArr.length;

      sod.subsurveyArr = groupBySubsurveys(datasetArr, subsurveyId, dbSubsurveys, mergeUrlRoot, mergeQueryString);
      sod.subsurveyArr = groupBySubsurveys(datasetArr, /*subsurveyId,*/ dbSubsurveys, mergeUrlRoot, mergeQueryString);
      return sod;
   }

   // assumes datasetArr is already ordered by subsurveys
   private static Subsurvey[] groupBySubsurveys(Dataset[] datasetArr,
         SubsurveyId subsurveyId, Subsurvey[] dbSubsurveys,
         /*SubsurveyId subsurveyId,*/ Subsurvey[] dbSubsurveys,
         String mergeUrlRoot, String mergeQueryString)
   {
      List<Subsurvey> subsurveyList = new ArrayList<Subsurvey>();
@@ -45,7 +45,7 @@ class SearchOutputData
            {
               if( false )//Dataset.areDatasetsMergeable(datasetList) )
               {
                  Dataset mergedDataset = new Dataset(datasetList, subsurveyId, mergeUrlRoot, mergeQueryString);
                  Dataset mergedDataset = new Dataset(datasetList, /*subsurveyId,*/ mergeUrlRoot, mergeQueryString);
                  datasetList.add(mergedDataset);
               }

@@ -64,7 +64,7 @@ class SearchOutputData

         if( false )//Dataset.areDatasetsMergeable(datasetList) )
         {
            Dataset mergedDataset = new Dataset(datasetList, subsurveyId, mergeUrlRoot, mergeQueryString);
            Dataset mergedDataset = new Dataset(datasetList, /*subsurveyId,*/ mergeUrlRoot, mergeQueryString);
            datasetList.add(mergedDataset);
         }

+12 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ final class XmlSerializer
   public static void serializeToVoTable(
         PrintWriter writer, String charEncoding,
         SearchOutputData searchOutputData,
         String cutoutUrl, String mergeUrl,
         boolean showDuration, long startTime_msec) throws IOException
   {
      StarTable dstable = makeSearchResultsTable( searchOutputData.subsurveyArr );
@@ -39,12 +40,22 @@ final class XmlSerializer

      out.write("<?xml-stylesheet type='text/xsl' href='VOTable2XHTML.xsl'?>");
      out.write( "<VOTABLE version='1.1'>" );
      out.write( "<RESOURCE>" );
      out.write( "<RESOURCE type=\"results\">" );
      out.write( "<DESCRIPTION> " + searchOutputData.versionString + " </DESCRIPTION>" );

      VOSerializer.makeSerializer( DataFormat.TABLEDATA, dstable ).writeInlineTableElement( out );

      out.write( "</RESOURCE>" );

      out.write( "<RESOURCE type=\"meta\" utype=\"adhoc:service\" name=\"CutoutService\" >" );
      out.write( "<DESCRIPTION> VLKB cutout service </DESCRIPTION>");
      out.write( "<PARAM name=\"standardID\" datatype=\"char\" arraysize=\"*\" value=\"ivo://ivoa.net/std/SODA#sync-1.0\" />");
      out.write( "<PARAM name=\"accessURL\" datatype=\"char\" arraysize=\"*\" value=\"" + cutoutUrl +  "\" />");
      out.write( "<GROUP name=\"inputParams\">");
      out.write( "<PARAM name=\"ID\" datatype=\"char\" arraysize=\"*\" value=\"\" ref=\"primaryID\" />"); // FIXME results table obs_publisher_did FIELD must have attrib: ID="primaryID"
      out.write( "</GROUP>");
      out.write( "</RESOURCE>" );

      out.write( "</VOTABLE>" );
      out.flush();
   }
+5 −3
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ public class FormatResponseFilter implements Filter

         // VLKB: reconstruct cutout/merge queryStrings and overlap code
         Map<String, String[]> params = request.getParameterMap();
         SubsurveyId subsurveyId = new SubsurveyId(params);
         SubsurveyId subsurveyId = new SubsurveyId(params); // for legacy-only Input
         Pos  pos  = Pos.parsePos(params, DEFAULT_SKY_SYSTEM);
         Band band = Band.parseBand(params, DEFAULT_SPEC_SYSTEM);
         String queryStringBase = toQueryString(pos, band);
@@ -117,7 +117,7 @@ public class FormatResponseFilter implements Filter
               queryStringBase);

         SearchOutputData searchOutputData = SearchOutputData.marshall(datasetArr,
               subsurveyId,
               /*subsurveyId,*/
               dbSubsurveyArr,
               settings.serviceUrls.mergeUrl(),
               queryStringBase);
@@ -159,7 +159,9 @@ public class FormatResponseFilter implements Filter
                     searchOutputData,showDuration,startTime_msec);
            else
               XmlSerializer.serializeToVoTable(responseWriter, RESPONSE_ENCODING,
                     searchOutputData,showDuration,startTime_msec);
                     searchOutputData,
                     settings.serviceUrls.cutoutUrl(),settings.serviceUrls.mergeUrl(),
                     showDuration,startTime_msec);

         }
         else