Loading data-access/servlet/src/main/java/common/output/MCutResult.java +11 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,16 @@ class MCutResult cutFile.delete(); } } } void deleteResJson() { if(resJsonPathname != null) { File resJson = new File(resJsonPathname); resJson.delete(); } } public void deleteCutFiles() Loading @@ -41,6 +51,7 @@ class MCutResult } public String fileName; public String resJsonPathname; public long fileSize; Cut[] cutResArr; } Loading data-access/servlet/src/main/java/mcutout/VlkbCli.java +1 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,7 @@ class VlkbCli implements Vlkb MCutResult mCutResult = new MCutResult(); mCutResult.cutResArr = cutArr; mCutResult.fileName = tgzFileName; mCutResult.resJsonPathname = respJsonPathname; mCutResult.fileSize = Files.size(output); return mCutResult; Loading data-access/servlet/src/main/java/mcutout/webapi/UWSMCutoutWork.java +33 −66 Original line number Diff line number Diff line Loading @@ -66,8 +66,6 @@ public class UWSMCutoutWork extends JobThread long startTime_msec = System.currentTimeMillis(); boolean showDuration = true; /* UWS -> SODA (JDL in POST body is part of SODA REC) */ UploadFile jsonFile = (UploadFile)job.getAdditionalParameterValue("mcutout"); InputStreamReader isr = new InputStreamReader(jsonFile.open()); Loading @@ -80,45 +78,27 @@ public class UWSMCutoutWork extends JobThread } String reqJsonString = jsonStringBuffer.toString(); /* SODA -> Implementation */ MCutResult mresult = vlkb.doMCutout(reqJsonString); /* Implement -> SODA */ final String contentType = "application/gzip";// FIXME force stream output logger.logThread(LogLevel.INFO, this, "Prepare Result", " job:requestUrl: " + job.getUrl().getRequestURL(), null); if(contentType.equals("text/xml") || contentType.equals("application/xml")) { logger.logThread(LogLevel.INFO, this, "Prepare Result", "content type:" + contentType, null); Result result = createResult("Report"); result.setMimeType("text/xml"); OutputStream respOutputStream = getResultOutput(result); final String RESPONSE_ENCODING = "utf-8"; // publish Report PrintWriter writer = new PrintWriter(new OutputStreamWriter(respOutputStream, RESPONSE_ENCODING)); Result resultRes = new Result("Report", "none", null, false); resultRes.setMimeType("application/json"); OutputStream respResOutputStream = getResultOutput(resultRes); String accessUrl = convertLocalPathnameToRemoteUrl(mresult.fileName, settings.fitsPaths.cutouts(), settings.fitsPaths.cutoutsUrl()); String absResPathname = mresult.resJsonPathname; File downloadResFile = new File(absResPathname); FileInputStream fileResInput = new FileInputStream(downloadResFile); XmlSerializer.serializeToLegacyCutResult(writer, RESPONSE_ENCODING, mresult, accessUrl, //id, pos, band, time, pol, pixels, countNullValues, showDuration, startTime_msec); fileResInput.transferTo(respResOutputStream); publishResult(resultRes); writer.close(); downloadResFile.delete(); /* SODA -> UWS */ publishResult(result); } else if(contentType.equals("application/gzip") || contentType.equals("application/x-tar+gzip")) { logger.logThread(LogLevel.INFO, this, "Prepare Result", "content type:" + contentType + " job:requestUrl: " + job.getUrl().getRequestURL(), null); // publish mcutout.tar.gz final String id = "mcutout.tar.gz"; Result result = new Result(id, "none", null, false); Loading @@ -130,16 +110,15 @@ public class UWSMCutoutWork extends JobThread FileInputStream fileInput = new FileInputStream(downloadFile); fileInput.transferTo(respOutputStream); publishResult(result); downloadFile.delete(); // delete cut-files (were published/copied to uws-file store) mresult.deleteResJson(); mresult.deleteCutFiles(); publishResult(result); } else { throw new AssertionError("Unsupported contentType for output: " + contentType); } /* FIXME here was uws-check is-job-Interrupted */ } Loading @@ -150,16 +129,4 @@ public class UWSMCutoutWork extends JobThread } } private String convertLocalPathnameToRemoteUrl(String localPathname, String FITScutpath, String FITSRemoteUrlCutouts) { //LOGGER.fine("trace " + localPathname); String fileName = localPathname.replaceAll(FITScutpath + "/", ""); //LOGGER.finer("local filename: " + fileName); String remotefname = FITSRemoteUrlCutouts + "/" + fileName; //LOGGER.finer("remote url : " + remotefname); return remotefname; } } Loading
data-access/servlet/src/main/java/common/output/MCutResult.java +11 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,16 @@ class MCutResult cutFile.delete(); } } } void deleteResJson() { if(resJsonPathname != null) { File resJson = new File(resJsonPathname); resJson.delete(); } } public void deleteCutFiles() Loading @@ -41,6 +51,7 @@ class MCutResult } public String fileName; public String resJsonPathname; public long fileSize; Cut[] cutResArr; } Loading
data-access/servlet/src/main/java/mcutout/VlkbCli.java +1 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,7 @@ class VlkbCli implements Vlkb MCutResult mCutResult = new MCutResult(); mCutResult.cutResArr = cutArr; mCutResult.fileName = tgzFileName; mCutResult.resJsonPathname = respJsonPathname; mCutResult.fileSize = Files.size(output); return mCutResult; Loading
data-access/servlet/src/main/java/mcutout/webapi/UWSMCutoutWork.java +33 −66 Original line number Diff line number Diff line Loading @@ -66,8 +66,6 @@ public class UWSMCutoutWork extends JobThread long startTime_msec = System.currentTimeMillis(); boolean showDuration = true; /* UWS -> SODA (JDL in POST body is part of SODA REC) */ UploadFile jsonFile = (UploadFile)job.getAdditionalParameterValue("mcutout"); InputStreamReader isr = new InputStreamReader(jsonFile.open()); Loading @@ -80,45 +78,27 @@ public class UWSMCutoutWork extends JobThread } String reqJsonString = jsonStringBuffer.toString(); /* SODA -> Implementation */ MCutResult mresult = vlkb.doMCutout(reqJsonString); /* Implement -> SODA */ final String contentType = "application/gzip";// FIXME force stream output logger.logThread(LogLevel.INFO, this, "Prepare Result", " job:requestUrl: " + job.getUrl().getRequestURL(), null); if(contentType.equals("text/xml") || contentType.equals("application/xml")) { logger.logThread(LogLevel.INFO, this, "Prepare Result", "content type:" + contentType, null); Result result = createResult("Report"); result.setMimeType("text/xml"); OutputStream respOutputStream = getResultOutput(result); final String RESPONSE_ENCODING = "utf-8"; // publish Report PrintWriter writer = new PrintWriter(new OutputStreamWriter(respOutputStream, RESPONSE_ENCODING)); Result resultRes = new Result("Report", "none", null, false); resultRes.setMimeType("application/json"); OutputStream respResOutputStream = getResultOutput(resultRes); String accessUrl = convertLocalPathnameToRemoteUrl(mresult.fileName, settings.fitsPaths.cutouts(), settings.fitsPaths.cutoutsUrl()); String absResPathname = mresult.resJsonPathname; File downloadResFile = new File(absResPathname); FileInputStream fileResInput = new FileInputStream(downloadResFile); XmlSerializer.serializeToLegacyCutResult(writer, RESPONSE_ENCODING, mresult, accessUrl, //id, pos, band, time, pol, pixels, countNullValues, showDuration, startTime_msec); fileResInput.transferTo(respResOutputStream); publishResult(resultRes); writer.close(); downloadResFile.delete(); /* SODA -> UWS */ publishResult(result); } else if(contentType.equals("application/gzip") || contentType.equals("application/x-tar+gzip")) { logger.logThread(LogLevel.INFO, this, "Prepare Result", "content type:" + contentType + " job:requestUrl: " + job.getUrl().getRequestURL(), null); // publish mcutout.tar.gz final String id = "mcutout.tar.gz"; Result result = new Result(id, "none", null, false); Loading @@ -130,16 +110,15 @@ public class UWSMCutoutWork extends JobThread FileInputStream fileInput = new FileInputStream(downloadFile); fileInput.transferTo(respOutputStream); publishResult(result); downloadFile.delete(); // delete cut-files (were published/copied to uws-file store) mresult.deleteResJson(); mresult.deleteCutFiles(); publishResult(result); } else { throw new AssertionError("Unsupported contentType for output: " + contentType); } /* FIXME here was uws-check is-job-Interrupted */ } Loading @@ -150,16 +129,4 @@ public class UWSMCutoutWork extends JobThread } } private String convertLocalPathnameToRemoteUrl(String localPathname, String FITScutpath, String FITSRemoteUrlCutouts) { //LOGGER.fine("trace " + localPathname); String fileName = localPathname.replaceAll(FITScutpath + "/", ""); //LOGGER.finer("local filename: " + fileName); String remotefname = FITSRemoteUrlCutouts + "/" + fileName; //LOGGER.finer("remote url : " + remotefname); return remotefname; } }