Commit 6669a90f authored by Robert Butora's avatar Robert Butora
Browse files

separates search from formatting (Format filter parses own params as needed by...

separates search from formatting (Format filter parses own params as needed by VLKB-legacy extension)
parent 993462d9
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ class Dataset
   }


   String queryString;// was in Inputs
   String subsurvey_id;
   int overlapCodeSky;
   int overlapCodeVel;
@@ -70,7 +69,7 @@ class Dataset
      this.access = new Access();
      this.access.accessFileUrl   = null;
      this.access.accessCutoutUrl = null;
      this.access.accessMosaicUrl = mergeUrlRoot + "?pubdid=" + publisherDid + "&" + coord.toVoQueryString();///*inputs.*/queryString;
      this.access.accessMosaicUrl = mergeUrlRoot + "?pubdid=" + publisherDid + "&" + coord.toVoQueryString();

      this.vertices_deg = mergeVertices(datasetList, /*inputs.*/coord);
   }
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ public final class XmlSerializer

      BufferedWriter out = new BufferedWriter( writer );

      out.write("<?xml-stylesheet type='text/xsl' href='VOTable2XHTML.xsl'?>");
      //out.write("<?xml-stylesheet type='text/xsl' href='VOTable2XHTML.xsl'?>");
      //out.write("<?xml-stylesheet type='text/xsl' href='http://www.ivoa.net/internal/IVOA/VOTableSoftware/VOTable2XHTML.xsl'?>");
      out.write( "<VOTABLE version='1.1'>\n" );
      out.write( "<RESOURCE>\n" );
+1 −1
Original line number Diff line number Diff line
@@ -215,7 +215,7 @@ public class DbPSearch

      theQuery += " ORDER BY obs_collection";

      LOGGER.info(theQuery);
      //LOGGER.info(theQuery);

      List<FormatResponseFilter.ObsCore> obsCoreList = new ArrayList<>();

+2 −2
Original line number Diff line number Diff line
@@ -122,8 +122,8 @@ public class VlkbServletFile
	{
		StringBuffer requestURL = request.getRequestURL();
	
   	System.out.println(className + " vlkb req from: " + request.getRemoteAddr()
                               + " doGet: " + requestURL.toString());
   	//System.out.println(className + " vlkb req from: " + request.getRemoteAddr()
      //                         + " doGet: " + requestURL.toString());

		PrintWriter writer = response.getWriter();
		response.setContentType("text/xml");
+14 −13
Original line number Diff line number Diff line
@@ -25,9 +25,6 @@ class FormatResponseWrapper extends HttpServletResponseWrapper
   AuthPolicy auth;

   String[] pubdidArr;
   Coord coord;
   SubsurveyId subsurveyId;
   String queryString; 



@@ -80,6 +77,12 @@ public class FormatResponseFilter implements Filter
      LOGGER.info("trace");
      LOGGER.info("REQUEST START =============================================================================================");
 
      Map<String, String[]> params = request.getParameterMap();
      for(String keys : params.keySet()) LOGGER.info("Params: " + keys);
      Coord       coord           = new Coord(params);
      SubsurveyId subsurveyId     = new SubsurveyId(params);
      // FIXME add invalid param excpetions 

      FormatResponseWrapper responseWrapper = new FormatResponseWrapper((HttpServletResponse) response);

      chain.doFilter(request, responseWrapper);
@@ -94,15 +97,14 @@ public class FormatResponseFilter implements Filter

         Dataset[] datasetArr = getOutputData(
               responseWrapper.getPubdidArr(),
               responseWrapper.coord, // VLKB: calc ovelrap-code in Spectrum
               responseWrapper.queryString,
               coord,// VLKB: calc ovelrap-code in Spectrum
               settings.serviceUrls.cutoutUrl());

         SearchOutputData searchOutputData = SearchOutputData.marshall(
               datasetArr,
               responseWrapper.auth,
               responseWrapper.coord, // VLKB: calc Vertices
               responseWrapper.subsurveyId,
               coord, // VLKB: calc Vertices
               subsurveyId,
               settings.serviceUrls.mergeUrl(),
               dbSubsurveyArr);

@@ -118,7 +120,7 @@ public class FormatResponseFilter implements Filter
         }
         else if(respFormat.equals("application/x-votable+xml"))
         {
            response.setContentType("application/xml");//respFormat);
            response.setContentType("application/xml");
            boolean showDuration = false;
            XmlSerializer.serializeToVoTable(responseWriter, RESPONSE_ENCODING, searchOutputData,showDuration,startTime_msec);
         }
@@ -189,7 +191,7 @@ public class FormatResponseFilter implements Filter



   private Dataset[] getOutputData(String[] pubdidArr, Coord coord, String queryString, String fitsRemotePath)
   private Dataset[] getOutputData(String[] pubdidArr, Coord coord, String fitsRemotePath)
   {
      LOGGER.info("trace");

@@ -201,14 +203,14 @@ public class FormatResponseFilter implements Filter

      FormatResponseFilter.ObsCore[] obsCoreArr = dbps.queryOutputData(pubdidArr, coord);

      return convert(obsCoreArr, coord, queryString, fitsRemotePath);
      return convert(obsCoreArr, coord, fitsRemotePath);
   }





   private Dataset[] convert(FormatResponseFilter.ObsCore[] obsCoreArr, Coord coord, String queryString, String fitsRemotePath)
   private Dataset[] convert(FormatResponseFilter.ObsCore[] obsCoreArr, Coord coord, String fitsRemotePath)
   {
      List<Dataset> datasetList  = new ArrayList<Dataset>();

@@ -218,7 +220,6 @@ public class FormatResponseFilter implements Filter

         dataset.obsCore = obsCore;

         dataset.queryString = queryString;
         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);
@@ -227,7 +228,7 @@ public class FormatResponseFilter implements Filter
         dataset.publisherDid   = obsCore.obs_publisher_did;

         dataset.access.accessFileUrl   = obsCore.access_url;
         dataset.access.accessCutoutUrl = fitsRemotePath + "?ID=" + dataset.publisherDid + "&"+queryString;//coord.toVoQueryString();
         dataset.access.accessCutoutUrl = fitsRemotePath + "?ID=" + dataset.publisherDid + "&" + coord.toVoQueryString();
         //dataset.access.accessCutoutUrl = fitsRemotePath + "?pubdid=" + dataset.publisherDid + "&amp;" + queryString;
         dataset.access.accessMosaicUrl  = null;

Loading