Loading data-access/servlet/src/main/java/common/vo/NullValueCount.java +7 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,13 @@ class NullValueCount double percent; long nullCount; long totalCount; NullValueCount() { percent = 0.0; nullCount = 0; totalCount = 0; } } data-access/servlet/src/main/java/datasets/Cutout.java +3 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ public interface Cutout public CutResult doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, boolean countNullValues, FitsCard[] extraCards); boolean countNullValues, FitsCard[] extraCards) throws IOException, InterruptedException; ; } data-access/servlet/src/main/java/datasets/CutoutImpl.java +39 −14 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ import java.io.PrintWriter; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.nio.file.StandardOpenOption; import java.nio.file.Files; Loading Loading @@ -184,11 +185,32 @@ class CutoutImpl implements Cutout public CutResult doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, boolean countNullValues, FitsCard[] extraCards) throws IOException, InterruptedException { LOGGER.info("trace: " + pos.toString() ); String absSubimgPathname = settings.fitsPaths.cutouts() + "/" + generateSubimgPathname(relPathname, hdunum); CutResult cutResult = new CutResult(); if(settings.amqpConn.isHostnameEmpty()) { String absSubimgPathname = settings.fitsPaths.cutouts() + "/" + generateSubimgPathname(relPathname, hdunum); OutputStream fileOutputStream = new FileOutputStream( new File(absSubimgPathname) ); doStream(relPathname, hdunum, pos, band, time, pol, fileOutputStream); // engine returns absPathname see common/cutout.cpp::do_cutout_file() cutResult.filename = absSubimgPathname; cutResult.filesize = Files.size(Paths.get(absSubimgPathname)); if(countNullValues) { LOGGER.info("NullValuesCount not implemented when used with Cutout::doStream()"); } } else { JsonEncoder jReq = new JsonEncoder(); jReq.add(relPathname, hdunum); jReq.add(pos); Loading @@ -200,7 +222,10 @@ class CutoutImpl implements Cutout String outJson = doRpc( jReq.toString() ); return JsonDecoder.responseFromCutoutJson( outJson ); cutResult = JsonDecoder.responseFromCutoutJson( outJson ); } return cutResult; } Loading data-access/servlet/src/main/java/webapi/ServletCutout.java +2 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet protected void doCutoutFileStream(String id, Pos pos, Band band, Time time, Pol pol, OutputStream respOutputStream) throws IOException throws IOException, InterruptedException { LOGGER.info("trace" + pos); Loading @@ -137,6 +137,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet protected DataLink doCutoutFile(String id, Pos pos, Band band, Time time, Pol pol, boolean countNullValues, String respFormat) throws IOException, InterruptedException { LOGGER.info("trace"); Loading data-access/servlet/src/main/java/webapi/Settings.java +5 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,11 @@ class Settings public int portNumber() { return portNum; } public String routingKey() { return routingKey; } public boolean isHostnameEmpty() { return ( (hostName == null) || hostName.trim().isEmpty() ); } public String toString() { return hostName + " " + String.valueOf(portNum) + " " + routingKey; Loading Loading
data-access/servlet/src/main/java/common/vo/NullValueCount.java +7 −0 Original line number Diff line number Diff line Loading @@ -6,6 +6,13 @@ class NullValueCount double percent; long nullCount; long totalCount; NullValueCount() { percent = 0.0; nullCount = 0; totalCount = 0; } }
data-access/servlet/src/main/java/datasets/Cutout.java +3 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ public interface Cutout public CutResult doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, boolean countNullValues, FitsCard[] extraCards); boolean countNullValues, FitsCard[] extraCards) throws IOException, InterruptedException; ; }
data-access/servlet/src/main/java/datasets/CutoutImpl.java +39 −14 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ import java.io.PrintWriter; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.nio.file.StandardOpenOption; import java.nio.file.Files; Loading Loading @@ -184,11 +185,32 @@ class CutoutImpl implements Cutout public CutResult doFile(String relPathname, int hdunum, Pos pos, Band band, Time time, Pol pol, boolean countNullValues, FitsCard[] extraCards) throws IOException, InterruptedException { LOGGER.info("trace: " + pos.toString() ); String absSubimgPathname = settings.fitsPaths.cutouts() + "/" + generateSubimgPathname(relPathname, hdunum); CutResult cutResult = new CutResult(); if(settings.amqpConn.isHostnameEmpty()) { String absSubimgPathname = settings.fitsPaths.cutouts() + "/" + generateSubimgPathname(relPathname, hdunum); OutputStream fileOutputStream = new FileOutputStream( new File(absSubimgPathname) ); doStream(relPathname, hdunum, pos, band, time, pol, fileOutputStream); // engine returns absPathname see common/cutout.cpp::do_cutout_file() cutResult.filename = absSubimgPathname; cutResult.filesize = Files.size(Paths.get(absSubimgPathname)); if(countNullValues) { LOGGER.info("NullValuesCount not implemented when used with Cutout::doStream()"); } } else { JsonEncoder jReq = new JsonEncoder(); jReq.add(relPathname, hdunum); jReq.add(pos); Loading @@ -200,7 +222,10 @@ class CutoutImpl implements Cutout String outJson = doRpc( jReq.toString() ); return JsonDecoder.responseFromCutoutJson( outJson ); cutResult = JsonDecoder.responseFromCutoutJson( outJson ); } return cutResult; } Loading
data-access/servlet/src/main/java/webapi/ServletCutout.java +2 −1 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet protected void doCutoutFileStream(String id, Pos pos, Band band, Time time, Pol pol, OutputStream respOutputStream) throws IOException throws IOException, InterruptedException { LOGGER.info("trace" + pos); Loading @@ -137,6 +137,7 @@ public class ServletCutout extends javax.servlet.http.HttpServlet protected DataLink doCutoutFile(String id, Pos pos, Band band, Time time, Pol pol, boolean countNullValues, String respFormat) throws IOException, InterruptedException { LOGGER.info("trace"); Loading
data-access/servlet/src/main/java/webapi/Settings.java +5 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,11 @@ class Settings public int portNumber() { return portNum; } public String routingKey() { return routingKey; } public boolean isHostnameEmpty() { return ( (hostName == null) || hostName.trim().isEmpty() ); } public String toString() { return hostName + " " + String.valueOf(portNum) + " " + routingKey; Loading