Loading data-access/servlet/src/main/java/cutout/webapi/ServletCutout.java +21 −2 Original line number Diff line number Diff line Loading @@ -164,8 +164,27 @@ public class ServletCutout extends HttpServlet String cutAbsPathname = settings.fitsPaths.cutouts() + "/" + generateSubimgPathname(resolver.relPathname(), resolver.hdunum()); return vlkb.doFile(resolver.relPathname(), resolver.hdunum(), pos, band, time, pol, pixels, countNullValues, extraCards, cutAbsPathname); vlkb.doFile(resolver.relPathname(), resolver.hdunum(), pos, band, time, pol, pixels, cutAbsPathname); // VLKB specific: null-value-count and extra-cards CutResult cutResult = new CutResult(); cutResult.fileName = cutAbsPathname; cutResult.fileSize = Files.size(Paths.get(cutAbsPathname)); if(countNullValues) { cutResult.nullValueCount = vlkb.doCountNullValues(cutAbsPathname, 1); } if(extraCards == null || (extraCards.length < 1)) { LOGGER.finer("Adding extraCards to cut-file implemented only in VlkbAmql"); } cutResult.pixels = null; return cutResult; } Loading data-access/servlet/src/main/java/mcutout/VlkbCli.java +21 −11 Original line number Diff line number Diff line Loading @@ -87,21 +87,32 @@ class VlkbCli implements Vlkb return new CutResult(); } public CutResult doFile(String relPathname, int hdunum, public CutResult doFileAmqp(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues, FitsCard[] extraCards, String cutAbsPathname) throws IOException, InterruptedException { LOGGER.fine("trace: " + pos.toString() ); LOGGER.finer("Using doStream() to local file : " + cutAbsPathname); LOGGER.fine("trace doFileAmqp by CLI is NOT IMPLEMENTED (only by AMQP)"); return new CutResult(); } public void doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, /*boolean countNullValues, FitsCard[] extraCards,*/ String cutAbsPathname) throws IOException, InterruptedException { LOGGER.fine("trace: " + cutAbsPathname ); try(OutputStream fileOutputStream = new FileOutputStream(new File(cutAbsPathname))) { soda.doStream(relPathname, hdunum, pos, band, time, pol, pixels, fileOutputStream); } /* CutResult cutResult = new CutResult(); cutResult.fileName = cutAbsPathname; Loading @@ -117,7 +128,7 @@ class VlkbCli implements Vlkb cutResult.pixels = null; return cutResult; } */ } public MCutResult doMCutout(String jdlJson, String workDir) Loading Loading @@ -194,10 +205,9 @@ class VlkbCli implements Vlkb String cutAbsPathname = workDir + "/" + generateSubimgPathname(ix, relPathname, hdunum, MAX_FILENAME_LEN); CutResult cutResult = doFile(relPathname, hdunum, pos, band, time, pol, pixels, countNullValues, extraCards, cutAbsPathname); doFile(relPathname, hdunum, pos, band, time, pol, pixels, cutAbsPathname); cut.content = cutResult.fileName; cut.content = cutAbsPathname; cut.contentType = MCutResult.Cut.ContentType.FILENAME; } catch(MultiValuedParamNotSupported ex) Loading Loading @@ -325,7 +335,7 @@ class VlkbCli implements Vlkb } private NullValueCount doCountNullValues(String absPathname, int hdunum) public NullValueCount doCountNullValues(String absPathname, int hdunum) throws IOException, InterruptedException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Loading data-access/servlet/src/main/java/vlkb/Vlkb.java +15 −5 Original line number Diff line number Diff line Loading @@ -13,20 +13,30 @@ import vo.parameter.*; public interface Vlkb { public CutResult doFile(String relPathname, int hdunum, public void doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues, FitsCard[] extraCards, String cutAbsPathname) throws IOException, InterruptedException; public MCutResult doMCutout(String jdlJson, String workDir) throws IOException, InterruptedException; public CutResult doMerge(String[] idArr, Coord coord, boolean countNullValues) throws FileNotFoundException, IOException; // misc NullValueCount doCountNullValues(String absPathname, int hdunum) throws IOException, InterruptedException; // deprecated - used only in VlkbAmqp public CutResult doFileAmqp(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues, FitsCard[] extraCards, String cutAbsPathname) throws IOException, InterruptedException; } data-access/servlet/src/main/java/vlkb/VlkbAmqp.java +366 −352 Original line number Diff line number Diff line Loading @@ -64,6 +64,12 @@ class VlkbAmqp implements Vlkb } public NullValueCount doCountNullValues(String absPathname, int hdunum) throws IOException, InterruptedException { LOGGER.fine("trace: not implemented; TB deprecated"); return new NullValueCount(); } public CutResult doMerge(String[] idArr, Coord coord, boolean countNullValues) Loading @@ -76,8 +82,16 @@ class VlkbAmqp implements Vlkb /////////////////////////////////////////////////////////////////////////////////// public void doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, /*boolean countNullValues, FitsCard[] extraCards,*/ String dummyCutAbsPathname) throws IOException, InterruptedException { ;// only placehoder for compatibility with Vlkb.java interface, //Amqp support is deprecated } public CutResult doFile(String relPathname, int hdunum, public CutResult doFileAmqp(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues, FitsCard[] extraCards, String dummyCutAbsPathname) throws IOException, InterruptedException Loading Loading @@ -133,7 +147,7 @@ class VlkbAmqp implements Vlkb final String DEFAULT_TIME_SYSTEM = "MJD_UTC"; // FIXME take from confif file CutResult cutResult = doFile(relPathname, hdunum, pos, band, time, pol, pixels, CutResult cutResult = doFileAmqp(relPathname, hdunum, pos, band, time, pol, pixels, countNullValues, extraCards, null); return cutResult; Loading Loading
data-access/servlet/src/main/java/cutout/webapi/ServletCutout.java +21 −2 Original line number Diff line number Diff line Loading @@ -164,8 +164,27 @@ public class ServletCutout extends HttpServlet String cutAbsPathname = settings.fitsPaths.cutouts() + "/" + generateSubimgPathname(resolver.relPathname(), resolver.hdunum()); return vlkb.doFile(resolver.relPathname(), resolver.hdunum(), pos, band, time, pol, pixels, countNullValues, extraCards, cutAbsPathname); vlkb.doFile(resolver.relPathname(), resolver.hdunum(), pos, band, time, pol, pixels, cutAbsPathname); // VLKB specific: null-value-count and extra-cards CutResult cutResult = new CutResult(); cutResult.fileName = cutAbsPathname; cutResult.fileSize = Files.size(Paths.get(cutAbsPathname)); if(countNullValues) { cutResult.nullValueCount = vlkb.doCountNullValues(cutAbsPathname, 1); } if(extraCards == null || (extraCards.length < 1)) { LOGGER.finer("Adding extraCards to cut-file implemented only in VlkbAmql"); } cutResult.pixels = null; return cutResult; } Loading
data-access/servlet/src/main/java/mcutout/VlkbCli.java +21 −11 Original line number Diff line number Diff line Loading @@ -87,21 +87,32 @@ class VlkbCli implements Vlkb return new CutResult(); } public CutResult doFile(String relPathname, int hdunum, public CutResult doFileAmqp(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues, FitsCard[] extraCards, String cutAbsPathname) throws IOException, InterruptedException { LOGGER.fine("trace: " + pos.toString() ); LOGGER.finer("Using doStream() to local file : " + cutAbsPathname); LOGGER.fine("trace doFileAmqp by CLI is NOT IMPLEMENTED (only by AMQP)"); return new CutResult(); } public void doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, /*boolean countNullValues, FitsCard[] extraCards,*/ String cutAbsPathname) throws IOException, InterruptedException { LOGGER.fine("trace: " + cutAbsPathname ); try(OutputStream fileOutputStream = new FileOutputStream(new File(cutAbsPathname))) { soda.doStream(relPathname, hdunum, pos, band, time, pol, pixels, fileOutputStream); } /* CutResult cutResult = new CutResult(); cutResult.fileName = cutAbsPathname; Loading @@ -117,7 +128,7 @@ class VlkbCli implements Vlkb cutResult.pixels = null; return cutResult; } */ } public MCutResult doMCutout(String jdlJson, String workDir) Loading Loading @@ -194,10 +205,9 @@ class VlkbCli implements Vlkb String cutAbsPathname = workDir + "/" + generateSubimgPathname(ix, relPathname, hdunum, MAX_FILENAME_LEN); CutResult cutResult = doFile(relPathname, hdunum, pos, band, time, pol, pixels, countNullValues, extraCards, cutAbsPathname); doFile(relPathname, hdunum, pos, band, time, pol, pixels, cutAbsPathname); cut.content = cutResult.fileName; cut.content = cutAbsPathname; cut.contentType = MCutResult.Cut.ContentType.FILENAME; } catch(MultiValuedParamNotSupported ex) Loading Loading @@ -325,7 +335,7 @@ class VlkbCli implements Vlkb } private NullValueCount doCountNullValues(String absPathname, int hdunum) public NullValueCount doCountNullValues(String absPathname, int hdunum) throws IOException, InterruptedException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); Loading
data-access/servlet/src/main/java/vlkb/Vlkb.java +15 −5 Original line number Diff line number Diff line Loading @@ -13,20 +13,30 @@ import vo.parameter.*; public interface Vlkb { public CutResult doFile(String relPathname, int hdunum, public void doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues, FitsCard[] extraCards, String cutAbsPathname) throws IOException, InterruptedException; public MCutResult doMCutout(String jdlJson, String workDir) throws IOException, InterruptedException; public CutResult doMerge(String[] idArr, Coord coord, boolean countNullValues) throws FileNotFoundException, IOException; // misc NullValueCount doCountNullValues(String absPathname, int hdunum) throws IOException, InterruptedException; // deprecated - used only in VlkbAmqp public CutResult doFileAmqp(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues, FitsCard[] extraCards, String cutAbsPathname) throws IOException, InterruptedException; }
data-access/servlet/src/main/java/vlkb/VlkbAmqp.java +366 −352 Original line number Diff line number Diff line Loading @@ -64,6 +64,12 @@ class VlkbAmqp implements Vlkb } public NullValueCount doCountNullValues(String absPathname, int hdunum) throws IOException, InterruptedException { LOGGER.fine("trace: not implemented; TB deprecated"); return new NullValueCount(); } public CutResult doMerge(String[] idArr, Coord coord, boolean countNullValues) Loading @@ -76,8 +82,16 @@ class VlkbAmqp implements Vlkb /////////////////////////////////////////////////////////////////////////////////// public void doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, /*boolean countNullValues, FitsCard[] extraCards,*/ String dummyCutAbsPathname) throws IOException, InterruptedException { ;// only placehoder for compatibility with Vlkb.java interface, //Amqp support is deprecated } public CutResult doFile(String relPathname, int hdunum, public CutResult doFileAmqp(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, String pixels, boolean countNullValues, FitsCard[] extraCards, String dummyCutAbsPathname) throws IOException, InterruptedException Loading Loading @@ -133,7 +147,7 @@ class VlkbAmqp implements Vlkb final String DEFAULT_TIME_SYSTEM = "MJD_UTC"; // FIXME take from confif file CutResult cutResult = doFile(relPathname, hdunum, pos, band, time, pol, pixels, CutResult cutResult = doFileAmqp(relPathname, hdunum, pos, band, time, pol, pixels, countNullValues, extraCards, null); return cutResult; Loading