Commit ff7d5402 authored by Robert Butora's avatar Robert Butora
Browse files

cosmetic (removes unused DataLink and commented code)

parent fe836fde
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -97,15 +97,12 @@ public class ServletMCutout extends javax.servlet.http.HttpServlet
         OutputStream respOutputStream = response.getOutputStream();

         MCutResult result = datasets.doMCutout(reqJsonString);
       //  DataLink dlk = new DataLink(mCutRes);

         final String contentType = "text/xml"; // FIXME
         final String respEncoding = "utf-8"; // FIXME
         if(contentType.equals("text/xml") || contentType.equals("application/xml"))
         {
            //LOGGER.info("writing xml");
            PrintWriter writer = new PrintWriter(new OutputStreamWriter(respOutputStream, respEncoding));
         // XmlSerializer.serializeToLegacyCutResults(writer, respEncoding, dlk, showDuration, startTime_msec);


            String accessUrl = convertLocalPathnameToRemoteUrl(result.fileName,
+0 −3
Original line number Diff line number Diff line
@@ -84,14 +84,11 @@ public class UWSMCutoutWork extends JobThread
            /* SODA -> Implementation */

            MCutResult mresult = datasets.doMCutout(reqJsonString);
        //DataLink dlk = new DataLink(mCutResults);

            /* Implement -> SODA */

            PrintWriter writer = new PrintWriter(new OutputStreamWriter(respOutputStream, RESPONSE_ENCODING));

        //XmlSerializer.serializeToLegacyCutResults(writer, RESPONSE_ENCODING, dlk, showDuration, startTime_msec);

            String accessUrl = convertLocalPathnameToRemoteUrl(mresult.fileName,
                  settings.fitsPaths.cutouts(),
                  settings.fitsPaths.cutoutsUrl());
+0 −133
Original line number Diff line number Diff line

import java.util.logging.Logger;
import java.util.List;
import java.util.ArrayList;

import vo.parameter.*;

class DataLink
{
   private static final Logger LOGGER = Logger.getLogger("DataLink");

   /* DataLink fields */

   String id;
   String accessUrl;   // MX
   String serviceDef;
   String errorMessage;
   String description;  // X
   String semantics;
   String contentType;
   long  contentLength;  // MX

   /* legacy-VLKB fields */

   Inputs inputs;
   String versionString;
   String cut;
   String absCutPathname; // ServeltCutout uses
   int datacubeCount;
   NullValueCount nullVals;
   MCutResult.Cut[] mcutResultArr;


   public DataLink()
   {
      this.nullVals = new NullValueCount();
      this.versionString = Version.asString;
      this.inputs = null;
      this.datacubeCount = 1;
   }


   // used in ServeltCutout
   public DataLink(Settings settings, CutResult cutResult,
         String id, Pos pos, Band band, Time time, Pol pol, boolean countNullValues)
   {
      this.id            = id;
      this.accessUrl     = convertLocalPathnameToRemoteUrl(cutResult.fileName,
            settings.fitsPaths.cutouts(), settings.fitsPaths.cutoutsUrl());
      this.serviceDef    = null;
      this.errorMessage  = null;
      this.description   = "A cutout from " + id;
      // + " by parameters "
      // + pos.toString() + " " + band.toString() + " " + time.toString() + " " + pol.toString();
      this.semantics     = "http://www.ivoa.net/rdf/datalink/core#proc#cutout";
      this.contentType   = "application/fits";
      this.contentLength = cutResult.fileSize;

      // VLKB-extension to DataLink:
      Coord coord = new Coord(pos, band, time, pol, null);
      LOGGER.info(coord.toString());

      this.inputs         = new Inputs(id, coord, countNullValues);
      this.versionString  = Version.asString;
      this.cut            = null;
      this.absCutPathname = cutResult.fileName;
      this.datacubeCount  = 1;
      this.nullVals = ((cutResult.nullValueCount.percent < 0) || (cutResult.nullValueCount.totalCount < 1)) ?
         null : cutResult.nullValueCount;
      this.mcutResultArr  = null;
   }

   // FIXME fake, only to compile MCutout and Merge
   public DataLink(CutResult cutResult)
   {
      this.nullVals = new NullValueCount();

      this.id            = "_PIXEL_BOUNDS"; 
      this.accessUrl     = cutResult.fileName; // FIXME fileName ->> remoteUrl
      this.serviceDef    = null;
      this.errorMessage  = null;
      this.description   = "cutout_from ID";
      this.semantics     = "FIXME find in IVOA docs...";
      this.contentType   = "application/fits"; 
      this.contentLength = cutResult.fileSize;

      // VLKB-extension to DataLink:
      this.inputs         = null;
      this.versionString  = Version.asString;
      this.cut            = null;
      this.absCutPathname = cutResult.fileName;
      this.datacubeCount  = 1;
      this.nullVals       = cutResult.nullValueCount;
      this.mcutResultArr  = null;
   }


   // used in MCutout
   public DataLink(MCutResult cutResult)
   {
      this.nullVals = new NullValueCount();

      this.id            = "_PIXEL_BOUNDS"; 
      this.accessUrl     = cutResult.fileName; // FIXME fileName ->> remoteUrl
      this.serviceDef    = null;
      this.errorMessage  = null;
      this.description   = "cutout_from ID";
      this.semantics     = "FIXME find in IVOA docs...";
      this.contentType   = "application/fits"; 
      this.contentLength = cutResult.fileSize;

      // VLKB-extension to DataLink:
      this.inputs         = null;
      this.versionString  = Version.asString;
      this.cut            = null;
      this.absCutPathname = cutResult.fileName;
      this.datacubeCount  = 1;
      this.nullVals       = null;
      this.mcutResultArr  = cutResult.cutResArr;
   }


   public String convertLocalPathnameToRemoteUrl(String localPathname, String FITScutpath, String FITSRemoteUrlCutouts)
   {
      String fileName = localPathname.replaceAll(FITScutpath + "/", "");
      LOGGER.info("local filename: " + fileName);
      String remotefname = FITSRemoteUrlCutouts + "/" + fileName;
      LOGGER.info("remote url    : " + remotefname);
      return remotefname;
   }

}
+0 −32
Original line number Diff line number Diff line
@@ -10,38 +10,6 @@ public final class XmlSerializer

   private XmlSerializer() {} // disables instatiation


/*   public static void serializeToLegacyCutResults(PrintWriter writer, String charEncoding, DataLink dataLink,
         boolean showDuration, long startTime_msec)
   {
      LOGGER.info("trace");

      writer.println("<?xml version=\"1.0\" encoding=\"" + charEncoding + "\" standalone=\"yes\"?>");
      writer.println("<results>");
      writer.println("<description> " + dataLink.description + " </description>");
      serialize(writer, dataLink.inputs);

      if(dataLink.cut != null)
         writer.println("<CUT> " + dataLink.cut + " </CUT>");
      if(dataLink.accessUrl != null) 
      {
         writer.println("<URL> " + dataLink.accessUrl + " </URL>");
         writer.println("<cutoutSize> " + dataLink.contentLength + " </cutoutSize>");
      }
      if(dataLink.nullVals != null)
         writer.println(serialize(dataLink.nullVals ));
 
      writer.println("<msg> " + dataLink.versionString + " </msg>");
 
      writer.println("<DatacubeCount> " + dataLink.datacubeCount + " </DatacubeCount>");

      if(showDuration)
         writer.println("<duration unit=\"msec\">"+(System.currentTimeMillis() - startTime_msec)+"</duration>");

      writer.println("</results>");
  }
*/

  public static void serializeToLegacyCutResult(PrintWriter writer, String charEncoding,
        CutResult cutResult, String accessUrl,
        String id, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues,