Skip to content
Snippets Groups Projects
Commit ef84e619 authored by Robert Butora's avatar Robert Butora
Browse files

mcutout: separates out VLKB-specific funcs (null-value-count & extra-cards) from doFile()

parent 8ccd3c26
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
......@@ -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 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: " + pos.toString() );
LOGGER.finer("Using doStream() to local file : " + cutAbsPathname);
LOGGER.fine("trace: " + cutAbsPathname );
try(OutputStream fileOutputStream = new FileOutputStream(new File(cutAbsPathname)))
{
soda.doStream(relPathname, hdunum, pos, band, time, pol, pixels,fileOutputStream);
soda.doStream(relPathname, hdunum, pos, band, time, pol, pixels, fileOutputStream);
}
/*
CutResult cutResult = new CutResult();
cutResult.fileName = cutAbsPathname;
......@@ -117,7 +128,7 @@ class VlkbCli implements Vlkb
cutResult.pixels = null;
return cutResult;
}
*/ }
public MCutResult doMCutout(String jdlJson, String workDir)
......@@ -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)
......@@ -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();
......
......@@ -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)
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;
}
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment