Commit 4dad4b9a authored by Robert Butora's avatar Robert Butora
Browse files

creates DataLink-constructor to convert cutout results in ServeltCutout

parent 1f80727a
Loading
Loading
Loading
Loading
+2 −26
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet
         rsl.resolve(id);
         relPathname = rsl.relPathname();
         hdunum      = rsl.hdunum();
         String subsurveyId = rsl.obsCollection(); //this implementation assumes ObsCore::obs_collection holds ssID
         String subsurveyId = rsl.obsCollection();
         FitsCard[] extraCards = null;
         if(subsurveyId != null)
         {
@@ -173,31 +173,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet

      CutResult cutResult = cutout.doFile(relPathname, hdunum, pos, band, time, pol, pixels, false, null);

      DataLink dlk = new DataLink();

      dlk.id            = id;
      dlk.accessUrl     = dlk.convertLocalPathnameToRemoteUrl(cutResult.filename,
            settings.fitsPaths.cutouts(), settings.fitsPaths.cutoutsUrl());
      dlk.serviceDef    = null;
      dlk.errorMessage  = null;
      dlk.description   = "A cutout from " + id;// + " by parameters "
                                                // + pos.toString() + " " + band.toString() + " " + time.toString() + " " + pol.toString();
      dlk.semantics     = "http://www.ivoa.net/rdf/datalink/core#proc#cutout";
      dlk.contentType   = "application/fits";
      dlk.contentLength = cutResult.filesize;

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

      dlk.inputs         = new Inputs(id, coord, countNullValues);
      dlk.versionString  = Version.asString;
      dlk.cut            = null;
      dlk.absCutPathname = cutResult.filename;
      dlk.datacubeCount  = 1;
      dlk.nullVals       = ((cutResult.nullValueCount.percent < 0) || (cutResult.nullValueCount.totalCount < 1)) ?
         null : cutResult.nullValueCount;
      dlk.mcutResultArr  = null;
      DataLink dlk = new DataLink(settings, cutResult, id, pos, band, time, pol, countNullValues);

      return dlk;
   }
+33 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ import java.util.logging.Logger;
import java.util.List;
import java.util.ArrayList;

import vo.parameter.*;

class DataLink
{
@@ -38,6 +39,37 @@ class DataLink
      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.system.toString(), pos, band.system.toString(), band, time, pol);
      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)
   {
@@ -63,6 +95,7 @@ class DataLink
   }


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