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

renames Cutout CutoutImpl -> Soda SodaImpl

parent 30e19f82
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -43,13 +43,13 @@ class DatasetsCli implements Datasets

   private Settings    settings   = null;
   private Subsurvey[] subsurveys = null;
   private Cutout      cutout     = null;
   private Soda        soda       = null;

   public DatasetsCli()
   {
      LOGGER.info("trace DatasetsCli()");
      this.settings = Settings.getInstance();
      cutout = new CutoutImpl(settings, subsurveys);
      soda = new SodaImpl(settings, subsurveys);
   }


@@ -57,7 +57,7 @@ class DatasetsCli implements Datasets
   {
      LOGGER.info("trace DatasetsCli(settings)");
      this.settings = settings;
      this.cutout = new CutoutImpl(settings, subsurveys);
      this.soda = new SodaImpl(settings, subsurveys);
   }


@@ -66,7 +66,7 @@ class DatasetsCli implements Datasets
      LOGGER.info("trace DatasetsCli(settings, subsurveys)");
      this.settings = settings;
      this.subsurveys = subsurveys;
      this.cutout = new CutoutImpl(settings, subsurveys);
      this.soda = new SodaImpl(settings, subsurveys);
   }


@@ -150,7 +150,7 @@ class DatasetsCli implements Datasets

         OutputStream fileOutputStream = new FileOutputStream( new File(absSubimgPathname) );

         cutout.doStream(relPathname, hdunum, pos, band, time, pol, pixels, fileOutputStream);
         soda.doStream(relPathname, hdunum, pos, band, time, pol, pixels, fileOutputStream);

         // engine returns absPathname see common/cutout.cpp::do_cutout_file()
         cutResult.fileName = absSubimgPathname;
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ import java.time.Instant;//Timestamp in cut-filename

import vo.parameter.*;

public interface Cutout
public interface Soda
{

   public void doStream(String relPathname, int hdunum,
+52 −52
Original line number Diff line number Diff line
@@ -28,81 +28,37 @@ import java.io.ByteArrayOutputStream; // for SODA direct streaming doSubimgStrea

import vo.parameter.*;

class CutoutImpl implements Cutout
class SodaImpl implements Soda
{
   static final Logger LOGGER = Logger.getLogger("CutoutImpl");
   static final Logger LOGGER = Logger.getLogger("SodaImpl");

   private Settings    settings   = null;
   private Subsurvey[] subsurveys = null;


   public CutoutImpl()
   public SodaImpl()
   {
      LOGGER.info("trace CutoutImpl()");
      LOGGER.info("trace SodaImpl()");
      this.settings = Settings.getInstance();
      this.subsurveys = null;
   }


   public CutoutImpl(Settings settings)
   public SodaImpl(Settings settings)
   {
      LOGGER.info("trace CutoutImpl(settings)");
      LOGGER.info("trace SodaImpl(settings)");
      this.settings = settings;
      this.subsurveys = null;
   }

   public CutoutImpl(Settings settings, Subsurvey[] subsurveys)
   public SodaImpl(Settings settings, Subsurvey[] subsurveys)
   {
      LOGGER.info("trace CutoutImpl(settings)");
      LOGGER.info("trace SodaImpl(settings)");
      this.settings = settings;
      this.subsurveys = subsurveys;
   }


   private String genRegionForVlkbOverlapCmd(Pos pos, Band band)
   {
      String region = "";

      if(pos != null)
      {
         String skySystem = pos.system.name();

         if(pos.shape.equals("CIRCLE"))
         {
            double l = pos.circle.lon;
            double b = pos.circle.lat;
            double r = pos.circle.radius;
            region = region + "skysystem=" + skySystem + "&l=" + String.valueOf(l) + "&b=" + String.valueOf(b)
               + "&r=" + String.valueOf(r);
         }
         else if(pos.shape.equals("RANGE"))
         {
            double l =  (pos.range.lon1 + pos.range.lon2)/2.0;
            double b =  (pos.range.lat1 + pos.range.lat2)/2.0;
            double dl = (pos.range.lon2 - pos.range.lon1);
            double db = (pos.range.lat2 - pos.range.lat1);
            region = region + "skysystem=" + skySystem + "&l=" + String.valueOf(l) + "&b=" + String.valueOf(b)
               + "&dl=" + String.valueOf(dl) + "&db=" + String.valueOf(db);
         }
         else 
         {
            LOGGER.info("FIXME here Exception: POLYGON not supported or pos.shape invalid: " + pos.shape);
         }

      }

      if(band != null)
      {
         String specSystem = band.system.name();
         double vl = band.getMin();
         double vu = band.getMax();

         region =region + "specsystem=" + specSystem + "&vl=" + String.valueOf(vl) + "&vu=" + String.valueOf(vu);
      }

      return region;
   }

   public void doStream(String relPathname, int hdunum,
         Pos pos, Band band, Time time, Pol pol, String pixels,
         OutputStream outputStream)  throws IOException, InterruptedException
@@ -204,6 +160,50 @@ class CutoutImpl implements Cutout
   }


   private String genRegionForVlkbOverlapCmd(Pos pos, Band band)
   {
      String region = "";

      if(pos != null)
      {
         String skySystem = pos.system.name();

         if(pos.shape.equals("CIRCLE"))
         {
            double l = pos.circle.lon;
            double b = pos.circle.lat;
            double r = pos.circle.radius;
            region = region + "skysystem=" + skySystem + "&l=" + String.valueOf(l) + "&b=" + String.valueOf(b)
               + "&r=" + String.valueOf(r);
         }
         else if(pos.shape.equals("RANGE"))
         {
            double l =  (pos.range.lon1 + pos.range.lon2)/2.0;
            double b =  (pos.range.lat1 + pos.range.lat2)/2.0;
            double dl = (pos.range.lon2 - pos.range.lon1);
            double db = (pos.range.lat2 - pos.range.lat1);
            region = region + "skysystem=" + skySystem + "&l=" + String.valueOf(l) + "&b=" + String.valueOf(b)
               + "&dl=" + String.valueOf(dl) + "&db=" + String.valueOf(db);
         }
         else 
         {
            LOGGER.info("FIXME here Exception: POLYGON not supported or pos.shape invalid: " + pos.shape);
         }

      }

      if(band != null)
      {
         String specSystem = band.system.name();
         double vl = band.getMin();
         double vu = band.getMax();

         region =region + "specsystem=" + specSystem + "&vl=" + String.valueOf(vl) + "&vu=" + String.valueOf(vu);
      }

      return region;
   }


   private String replaceWithGrid(String wcsBounds, Pos pos, Band band, Time time, Pol pol)
   {
+2 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet

   private Subsurvey[] subsurveys = null;

   protected Cutout cutout     = new CutoutImpl(settings, subsurveys);
   protected Soda soda     = new SodaImpl(settings, subsurveys);
   protected Datasets datasets = ( settings.amqpConn.isHostnameEmpty() ? new DatasetsCli(settings): new DatasetsAmqp(settings) );

   public void init() throws ServletException
@@ -126,7 +126,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet
      Resolver rsl = new ResolverFromId();
      rsl.resolve(id);

      cutout.doStream(rsl.relPathname(), rsl.hdunum(), pos, band, time, pol, pixels, respOutputStream);
      soda.doStream(rsl.relPathname(), rsl.hdunum(), pos, band, time, pol, pixels, respOutputStream);
   }