diff --git a/data-access/servlet/src/main/java/cutout/DatasetsCli.java b/data-access/servlet/src/main/java/cutout/DatasetsCli.java index 84bdf055f18eb9b0a58e08b67f8d000cbf8074ba..a3eba9023b32cd892e095be7e4a206bfcf48f06d 100644 --- a/data-access/servlet/src/main/java/cutout/DatasetsCli.java +++ b/data-access/servlet/src/main/java/cutout/DatasetsCli.java @@ -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; diff --git a/data-access/servlet/src/main/java/cutout/Cutout.java b/data-access/servlet/src/main/java/cutout/Soda.java similarity index 95% rename from data-access/servlet/src/main/java/cutout/Cutout.java rename to data-access/servlet/src/main/java/cutout/Soda.java index 1ab96adbab510e1e1f57ebe6f91996317ac9bab4..fa104720dbaf71e2dce994f9a108b87fdcd2ed68 100644 --- a/data-access/servlet/src/main/java/cutout/Cutout.java +++ b/data-access/servlet/src/main/java/cutout/Soda.java @@ -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, diff --git a/data-access/servlet/src/main/java/cutout/CutoutImpl.java b/data-access/servlet/src/main/java/cutout/SodaImpl.java similarity index 95% rename from data-access/servlet/src/main/java/cutout/CutoutImpl.java rename to data-access/servlet/src/main/java/cutout/SodaImpl.java index 3660f16dea3f74189ed07427ac7936c0ab6991c0..3eeba263ce7dc4bddaa3ec8689c1877fa7e25375 100644 --- a/data-access/servlet/src/main/java/cutout/CutoutImpl.java +++ b/data-access/servlet/src/main/java/cutout/SodaImpl.java @@ -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) { diff --git a/data-access/servlet/src/main/java/webapi/ServletCutout.java b/data-access/servlet/src/main/java/webapi/ServletCutout.java index ca49a16a6767987aa2b09648e9a69bdbdbb0d12a..b0567ce4a24368f19142236eeddb63fdfad6100b 100644 --- a/data-access/servlet/src/main/java/webapi/ServletCutout.java +++ b/data-access/servlet/src/main/java/webapi/ServletCutout.java @@ -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); }